Added recording of food bar on player join
This commit is contained in:
Binary file not shown.
@@ -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()
|
||||||
@@ -621,6 +627,9 @@ public class Arena
|
|||||||
hero.setHealth(health * hero.getMaxHealth() / 20);
|
hero.setHealth(health * hero.getMaxHealth() / 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hungerMap.containsKey(p))
|
||||||
|
p.setFoodLevel(hungerMap.remove(p));
|
||||||
|
|
||||||
// Put out fire.
|
// Put out fire.
|
||||||
p.setFireTicks(0);
|
p.setFireTicks(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user