|
|
@ -24,7 +24,7 @@ import java.net.UnknownHostException; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
|
|
|
|
|
|
|
|
@ -54,6 +54,9 @@ public class Mine extends AbstractGameObject { |
|
|
|
|
|
|
|
|
|
|
|
public int capSize; |
|
|
|
public int capSize; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HashMap<Guild,ArrayList<PlayerCharacter>> presentPlayers = new HashMap<>(); |
|
|
|
|
|
|
|
public Integer totalPLayers; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* ResultSet Constructor |
|
|
|
* ResultSet Constructor |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -587,5 +590,66 @@ public class Mine extends AbstractGameObject { |
|
|
|
} |
|
|
|
} |
|
|
|
return (int) totalModded; |
|
|
|
return (int) totalModded; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void onEnter() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HashSet<AbstractWorldObject> currentPlayers; |
|
|
|
|
|
|
|
HashSet<Integer> currentMemory; |
|
|
|
|
|
|
|
PlayerCharacter player; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Gather current list of players within the zone bounds
|
|
|
|
|
|
|
|
Building building = BuildingManager.getBuilding(this.buildingID); |
|
|
|
|
|
|
|
currentPlayers = WorldGrid.getObjectsInRangePartial(building.loc, Enum.CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER); |
|
|
|
|
|
|
|
this.totalPLayers = currentPlayers.size(); |
|
|
|
|
|
|
|
for (AbstractWorldObject playerObject : currentPlayers) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (playerObject == null) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
player = (PlayerCharacter) playerObject; |
|
|
|
|
|
|
|
Guild nation = player.getGuild().getNation(); |
|
|
|
|
|
|
|
if(this.presentPlayers.containsKey(nation)) { |
|
|
|
|
|
|
|
if (this.presentPlayers.get(nation).contains(player) == false) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this.presentPlayers.get(nation).add(player); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ArrayList<PlayerCharacter> present = new ArrayList<>(); |
|
|
|
|
|
|
|
present.add(player); |
|
|
|
|
|
|
|
this.presentPlayers.put(nation, present); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for(Guild guild : this.presentPlayers.keySet()) { |
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(player, "Guild: " + guild.getName() + " COUNT: " + presentPlayers.get(guild).size()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
onExit(); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
Logger.error(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void onExit() { |
|
|
|
|
|
|
|
HashSet<AbstractWorldObject> currentPlayers; |
|
|
|
|
|
|
|
PlayerCharacter player; |
|
|
|
|
|
|
|
Building building = BuildingManager.getBuilding(this.buildingID); |
|
|
|
|
|
|
|
currentPlayers = WorldGrid.getObjectsInRangePartial(building.loc, Enum.CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER); |
|
|
|
|
|
|
|
this.totalPLayers = currentPlayers.size(); |
|
|
|
|
|
|
|
for (AbstractWorldObject playerObject : currentPlayers) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (playerObject == null) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
player = (PlayerCharacter) playerObject; |
|
|
|
|
|
|
|
Guild nation = player.getGuild().getNation(); |
|
|
|
|
|
|
|
if(this.presentPlayers.containsKey(nation)) { |
|
|
|
|
|
|
|
if (this.presentPlayers.get(nation).contains(player) == false) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this.presentPlayers.get(nation).remove(player); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for(Guild guild : this.presentPlayers.keySet()) { |
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(player, "Guild: " + guild.getName() + " COUNT: " + presentPlayers.get(guild).size()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|