Added recording of food bar on player join

This commit is contained in:
Garbage Mule
2011-09-18 23:41:16 +02:00
parent dcff0915a5
commit 0badeaaf90
2 changed files with 9 additions and 0 deletions
BIN
View File
Binary file not shown.
+9
View File
@@ -106,6 +106,7 @@ public class Arena
protected List<String> classes = new LinkedList<String>(); protected List<String> classes = new LinkedList<String>();
protected Map<Player,Location> locations = new HashMap<Player,Location>(); protected Map<Player,Location> locations = new HashMap<Player,Location>();
protected Map<Player,Integer> healthMap = new HashMap<Player,Integer>(); protected Map<Player,Integer> healthMap = new HashMap<Player,Integer>();
protected Map<Player,Integer> hungerMap = new HashMap<Player,Integer>();
// Logging // Logging
protected ArenaLog log; protected ArenaLog log;
@@ -189,6 +190,7 @@ public class Arena
hero.setHealth(hero.getMaxHealth()); hero.setHealth(hero.getMaxHealth());
} }
p.setHealth(20); p.setHealth(20);
p.setFoodLevel(20);
assignClassPermissions(p); assignClassPermissions(p);
} }
@@ -323,6 +325,7 @@ public class Arena
hero.setHealth(hero.getMaxHealth()); hero.setHealth(hero.getMaxHealth());
} }
p.setHealth(20); p.setHealth(20);
p.setFoodLevel(20);
movePlayerToLobby(p); movePlayerToLobby(p);
// Notify listeners. // Notify listeners.
@@ -554,6 +557,9 @@ public class Arena
if (!healthMap.containsKey(p)) if (!healthMap.containsKey(p))
healthMap.put(p, p.getHealth()); healthMap.put(p, p.getHealth());
if (!hungerMap.containsKey(p))
hungerMap.put(p, p.getFoodLevel());
} }
public void storeContainerContents() public void storeContainerContents()
@@ -622,6 +628,9 @@ public class Arena
} }
} }
if (hungerMap.containsKey(p))
p.setFoodLevel(hungerMap.remove(p));
// Put out fire. // Put out fire.
p.setFireTicks(0); p.setFireTicks(0);