Added ability to add players to friends list

Fixed broadcasting per planet using galaxy wide broadcasting
Added ability to notify players galaxy-wide based on conditionals
Fixed tells being sent to players that are not zoned in, the sender will now receive the appropriate offline message
This commit is contained in:
Waverunner
2015-06-14 14:52:30 -04:00
parent d7ecd419ad
commit c682a64c0d
10 changed files with 292 additions and 62 deletions
+16 -4
View File
@@ -155,7 +155,17 @@ public class PlayerManager extends Manager {
}
}
}
public void notifyPlayersWithCondition(NotifyPlayersPacketIntent.ConditionalNotify conditional, Packet... packets) {
synchronized (players) {
for (Player player : players.values()) {
if (conditional.meetsCondition(player)) {
player.sendPacket(packets);
}
}
}
}
public Player getPlayerFromNetworkId(long networkId) {
synchronized (players) {
return players.get(networkId);
@@ -247,10 +257,12 @@ public class PlayerManager extends Manager {
}
private void onNotifyPlayersPacketIntent(NotifyPlayersPacketIntent nppi) {
if (nppi.getTerrain() != null)
if (nppi.getCondition() != null) {
notifyPlayersWithCondition(nppi.getCondition(), nppi.getPacket());
} else if (nppi.getTerrain() != null) {
notifyPlayersAtPlanet(nppi.getTerrain(), nppi.getPacket());
else
} else {
notifyPlayers(nppi.getPacket());
}
}
}