Do not use backreference, it's just a waste of mem for too small cpu saving

This commit is contained in:
Shevchik 2014-03-07 20:19:11 +04:00
parent bf540798d9
commit 15b3a5a4bd

View File

@ -17,7 +17,6 @@ public class PlayerSitData {
private HashMap<String, Entity> sit = new HashMap<String, Entity>(); private HashMap<String, Entity> sit = new HashMap<String, Entity>();
private HashMap<Block, String> sitblock = new HashMap<Block, String>(); private HashMap<Block, String> sitblock = new HashMap<Block, String>();
private HashMap<String, Block> sitblockbr = new HashMap<String, Block>();
private HashMap<String, Location> sitstopteleportloc = new HashMap<String, Location>(); private HashMap<String, Location> sitstopteleportloc = new HashMap<String, Location>();
private HashMap<String, Integer> sittask = new HashMap<String, Integer>(); private HashMap<String, Integer> sittask = new HashMap<String, Integer>();
@ -46,7 +45,6 @@ public class PlayerSitData {
arrow.setPassenger(player); arrow.setPassenger(player);
sit.put(player.getName(), arrow); sit.put(player.getName(), arrow);
sitblock.put(block, player.getName()); sitblock.put(block, player.getName());
sitblockbr.put(player.getName(), block);
startReSitTask(player); startReSitTask(player);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -125,8 +123,7 @@ public class PlayerSitData {
} else if (correctleaveposition) { } else if (correctleaveposition) {
player.teleport(tploc); player.teleport(tploc);
} }
sitblock.remove(sitblockbr.get(player.getName())); sitblock.values().remove(player.getName());
sitblockbr.remove(player.getName());
sitstopteleportloc.remove(player.getName()); sitstopteleportloc.remove(player.getName());
Bukkit.getScheduler().cancelTask(sittask.get(player.getName())); Bukkit.getScheduler().cancelTask(sittask.get(player.getName()));
sittask.remove(player.getName()); sittask.remove(player.getName());