Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a debugging message to troubleshoot some recent NPEs - Possible issu... #2

Merged
merged 1 commit into from
Apr 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public void receivePluginMessage( PluginMessageEvent event ) throws IOException,
if ( task.equals( "DeleteHome" ) ) {
HomesManager.deleteHome(in.readUTF(), in.readUTF() );
} else if ( task.equals( "SendPlayerHome" ) ) { //SendOtherPlayerHome sendPlayerToOtherHome
HomesManager.sendPlayerToHome( PlayerManager.getPlayer(in.readUTF() ), in.readUTF() );
HomesManager.sendPlayerToHome( PlayerManager.getPlayer(in.readUTF(), true), in.readUTF() );
} else if ( task.equals( "SendOtherPlayerHome" ) ) {
HomesManager.sendPlayerToOtherHome( PlayerManager.getPlayer(in.readUTF() ), in.readUTF(), in.readUTF() );
HomesManager.sendPlayerToOtherHome( PlayerManager.getPlayer(in.readUTF(), true), in.readUTF(), in.readUTF() );
} else if ( task.equals( "SetPlayersHome" ) ) {
String player = in.readUTF();
GSPlayer gsPlayer = PlayerManager.getPlayer(player);
GSPlayer gsPlayer = PlayerManager.getPlayer(player, true);

if (gsPlayer == null) {
gsPlayer = DatabaseManager.players.loadPlayer(player);
Expand All @@ -69,9 +69,9 @@ public void receivePluginMessage( PluginMessageEvent event ) throws IOException,

HomesManager.createNewHome(gsPlayer, in.readInt(), in.readInt(), in.readUTF(), new Location(((Server) event.getSender()).getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()));
} else if ( task.equals( "GetHomesList" ) ) {
HomesManager.listPlayersHomes( PlayerManager.getPlayer( in.readUTF() ) );
HomesManager.listPlayersHomes( PlayerManager.getPlayer(in.readUTF(), true) );
} else if ( task.equals( "GetOtherHomesList" ) ) {
HomesManager.listOtherPlayersHomes( PlayerManager.getPlayer( in.readUTF() ), in.readUTF() );
HomesManager.listOtherPlayersHomes( PlayerManager.getPlayer(in.readUTF(), true), in.readUTF() );
} else if ( task.equals( "SendVersion" ) ) {
LoggingManager.log( in.readUTF() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public void receivePluginMessage(PluginMessageEvent event) throws IOException, S
String task = in.readUTF();
Server s = (Server) event.getSender();
if (task.equals("TeleportPlayer")) {
PortalManager.teleportPlayer(PlayerManager.getPlayer(in.readUTF()), in.readUTF(), in.readUTF(), in.readBoolean());
PortalManager.teleportPlayer(PlayerManager.getPlayer(in.readUTF(), true), in.readUTF(), in.readUTF(), in.readBoolean());
} else if (task.equals("ListPortals")) {
PortalManager.listPortals(PlayerManager.getPlayer(in.readUTF()));
PortalManager.listPortals(PlayerManager.getPlayer(in.readUTF(), true));
} else if (task.equals("DeletePortal")) {
PortalManager.deletePortal(PlayerManager.getPlayer(in.readUTF()), in.readUTF());
PortalManager.deletePortal(PlayerManager.getPlayer(in.readUTF(), true), in.readUTF());
} else if (task.equals("SetPortal")) {
GSPlayer sender = PlayerManager.getPlayer(in.readUTF());
GSPlayer sender = PlayerManager.getPlayer(in.readUTF(), true);
boolean selection = in.readBoolean();
if (!selection) {
PlayerManager.sendMessageToTarget(sender, ConfigManager.messages.NO_SELECTION_MADE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class SpawnListener implements Listener {
public void sendPlayerToHub(final PostLoginEvent e) throws SQLException {
if (ConfigManager.spawn.ForceAllPlayersToProxySpawn && !SpawnManager.newPlayers.contains(e.getPlayer())) {
if (SpawnManager.doesProxySpawnExist()) {
SpawnManager.sendPlayerToProxySpawn(PlayerManager.getPlayer(e.getPlayer().getName()));
SpawnManager.sendPlayerToProxySpawn(PlayerManager.getPlayer(e.getPlayer().getName(), true));
} else {
geSuit.instance.getLogger().warning("Wanted to use ForceAllPlayersToProxySpawn without a Proxy Spawn set");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ public void receivePluginMessage(PluginMessageEvent event) throws IOException, S
Server s = (Server) event.getSender();

if (task.equals("SendToProxySpawn")) {
SpawnManager.sendPlayerToProxySpawn(PlayerManager.getPlayer(in.readUTF()));
SpawnManager.sendPlayerToProxySpawn(PlayerManager.getPlayer(in.readUTF(), true));
} else if (task.equals("GetSpawns")) {
SpawnManager.sendSpawns(s);
} else if (task.equals("SetServerSpawn")) {
SpawnManager.setServerSpawn(PlayerManager.getPlayer(in.readUTF()), new Location(s.getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()), in.readBoolean());
SpawnManager.setServerSpawn(PlayerManager.getPlayer(in.readUTF(), true), new Location(s.getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()), in.readBoolean());
} else if (task.equals("SetWorldSpawn")) {
SpawnManager.setWorldSpawn(PlayerManager.getPlayer(in.readUTF()), new Location(s.getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()), in.readBoolean());
SpawnManager.setWorldSpawn(PlayerManager.getPlayer(in.readUTF(), true), new Location(s.getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()), in.readBoolean());
} else if (task.equals("SetNewPlayerSpawn")) {
SpawnManager.setNewPlayerSpawn(PlayerManager.getPlayer(in.readUTF()), new Location(s.getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()));
SpawnManager.setNewPlayerSpawn(PlayerManager.getPlayer(in.readUTF(), true), new Location(s.getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()));
} else if (task.equals("SetProxySpawn")) {
SpawnManager.setProxySpawn(PlayerManager.getPlayer(in.readUTF()), new Location(s.getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()));
SpawnManager.setProxySpawn(PlayerManager.getPlayer(in.readUTF(), true), new Location(s.getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()));
} else if (task.equals("SendVersion")) {
LoggingManager.log(in.readUTF());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public class TeleportsListener implements Listener {
@EventHandler(priority=(byte)255)
public void serverChange(ServerConnectEvent e) {
if (!e.isCancelled() && e.getPlayer().getServer() != null)
LeavingServer.execute(PlayerManager.getPlayer(e.getPlayer().getName()));
LeavingServer.execute(PlayerManager.getPlayer(e.getPlayer().getName(), true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ public void receivePluginMessage(PluginMessageEvent event) throws IOException, S
String task = in.readUTF();

if (task.equals("TpAccept")) {
TeleportManager.acceptTeleportRequest(PlayerManager.getPlayer(in.readUTF()));
TeleportManager.acceptTeleportRequest(PlayerManager.getPlayer(in.readUTF(), true));
return;
}

if (task.equals("TeleportToLocation")) {
GSPlayer player = PlayerManager.getPlayer(in.readUTF());
GSPlayer player = PlayerManager.getPlayer(in.readUTF(), true);
String server = in.readUTF();
TeleportToLocation.execute(player, new Location((!server.equals("")) ? server : ((Server) event.getSender()).getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble()));
return;
}

if (task.equals("PlayersTeleportBackLocation")) {
GSPlayer player = PlayerManager.getPlayer(in.readUTF());
GSPlayer player = PlayerManager.getPlayer(in.readUTF(), true);
if (player != null) {
TeleportManager.setPlayersTeleportBackLocation(player, new Location(((Server) event.getSender()).getInfo(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()));
}
return;
}

if (task.equals("PlayersDeathBackLocation")) {
TeleportManager.setPlayersDeathBackLocation(PlayerManager.getPlayer(in.readUTF()), new Location(((Server) event.getSender()).getInfo(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()));
TeleportManager.setPlayersDeathBackLocation(PlayerManager.getPlayer(in.readUTF(), true), new Location(((Server) event.getSender()).getInfo(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()));
return;
}

Expand All @@ -80,7 +80,7 @@ public void receivePluginMessage(PluginMessageEvent event) throws IOException, S
}

if (task.equals("TpDeny")) {
TeleportManager.denyTeleportRequest(PlayerManager.getPlayer(in.readUTF()));
TeleportManager.denyTeleportRequest(PlayerManager.getPlayer(in.readUTF(), true));
return;
}

Expand All @@ -90,12 +90,12 @@ public void receivePluginMessage(PluginMessageEvent event) throws IOException, S
}

if (task.equals("SendPlayerBack")) {
TeleportManager.sendPlayerToLastBack(PlayerManager.getPlayer(in.readUTF()), in.readBoolean(), in.readBoolean());
TeleportManager.sendPlayerToLastBack(PlayerManager.getPlayer(in.readUTF(), true), in.readBoolean(), in.readBoolean());
return;
}

if (task.equals("ToggleTeleports")) {
TeleportManager.togglePlayersTeleports(PlayerManager.getPlayer(in.readUTF()));
TeleportManager.togglePlayersTeleports(PlayerManager.getPlayer(in.readUTF(), true));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public void receivePluginMessage(PluginMessageEvent event) throws IOException, S
}

if (task.equals("SetWarp")) {
WarpsManager.setWarp(PlayerManager.getPlayer(in.readUTF()), in.readUTF(), new Location(((Server) event.getSender()).getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()), in.readBoolean(), in.readBoolean());
WarpsManager.setWarp(PlayerManager.getPlayer(in.readUTF(), true), in.readUTF(), new Location(((Server) event.getSender()).getInfo().getName(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readFloat(), in.readFloat()), in.readBoolean(), in.readBoolean());
return;
}

if (task.equals("DeleteWarp")) {
WarpsManager.deleteWarp(PlayerManager.getPlayer(in.readUTF()), in.readUTF());
WarpsManager.deleteWarp(PlayerManager.getPlayer(in.readUTF(), true), in.readUTF());
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.UUID;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;

import au.com.addstar.bc.BungeeChat;

Expand Down Expand Up @@ -377,6 +376,14 @@ public static GSPlayer getPlayer(String player) {
return onlinePlayers.get(player.toLowerCase());
}

public static GSPlayer getPlayer(String player, boolean ExpectOnline) {
GSPlayer p = getPlayer(player);
if ((p == null) && (ExpectOnline)) {
geSuit.instance.getLogger().warning("Unable to find player named \"" + player + "\" in onlinePlayers list!");
}
return p;
}

public static GSPlayer getPlayer(UUID id) {
return cachedPlayers.get(id);
}
Expand Down