players coutn towards mine cap for 3 minutes after leaving
This commit is contained in:
@@ -65,6 +65,7 @@ public class Mine extends AbstractGameObject {
|
|||||||
public boolean isStronghold = false;
|
public boolean isStronghold = false;
|
||||||
public ArrayList<Mob> strongholdMobs;
|
public ArrayList<Mob> strongholdMobs;
|
||||||
public HashMap<Integer,Integer> oldBuildings;
|
public HashMap<Integer,Integer> oldBuildings;
|
||||||
|
public HashMap<Integer, Long> mineAttendees = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultSet Constructor
|
* ResultSet Constructor
|
||||||
@@ -679,8 +680,15 @@ public class Mine extends AbstractGameObject {
|
|||||||
HashSet<AbstractWorldObject> currentPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, Enum.CityBoundsType.GRID.extents, MBServerStatics.MASK_PLAYER);
|
HashSet<AbstractWorldObject> currentPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, Enum.CityBoundsType.GRID.extents, MBServerStatics.MASK_PLAYER);
|
||||||
for(Integer id : currentMemory){
|
for(Integer id : currentMemory){
|
||||||
PlayerCharacter pc = PlayerCharacter.getPlayerCharacter(id);
|
PlayerCharacter pc = PlayerCharacter.getPlayerCharacter(id);
|
||||||
if(currentPlayers.contains(pc) == false){
|
if(!currentPlayers.contains(pc)){
|
||||||
toRemove.add(id);
|
if(this.mineAttendees.containsKey(id)){
|
||||||
|
long timeGone = System.currentTimeMillis() - this.mineAttendees.get(id).longValue();
|
||||||
|
if (timeGone > 180000L) { // 3 minutes
|
||||||
|
toRemove.add(id); // Mark for removal
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
this.mineAttendees.put(id,System.currentTimeMillis());
|
||||||
|
}
|
||||||
pc.ZergMultiplier = 1.0f;
|
pc.ZergMultiplier = 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -688,6 +696,9 @@ public class Mine extends AbstractGameObject {
|
|||||||
// Remove players from city memory
|
// Remove players from city memory
|
||||||
|
|
||||||
_playerMemory.removeAll(toRemove);
|
_playerMemory.removeAll(toRemove);
|
||||||
|
for(int id : toRemove){
|
||||||
|
this.mineAttendees.remove(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static Building getTower(Mine mine){
|
public static Building getTower(Mine mine){
|
||||||
Building tower = BuildingManager.getBuildingFromCache(mine.buildingID);
|
Building tower = BuildingManager.getBuildingFromCache(mine.buildingID);
|
||||||
|
|||||||
Reference in New Issue
Block a user