diff --git a/src/main/java/net/cubespace/geSuit/listeners/HomesMessageListener.java b/src/main/java/net/cubespace/geSuit/listeners/HomesMessageListener.java index 4bcf7100..a8a382ff 100644 --- a/src/main/java/net/cubespace/geSuit/listeners/HomesMessageListener.java +++ b/src/main/java/net/cubespace/geSuit/listeners/HomesMessageListener.java @@ -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); @@ -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() ); } diff --git a/src/main/java/net/cubespace/geSuit/listeners/PortalsMessageListener.java b/src/main/java/net/cubespace/geSuit/listeners/PortalsMessageListener.java index 051dfba2..e6d51ca1 100644 --- a/src/main/java/net/cubespace/geSuit/listeners/PortalsMessageListener.java +++ b/src/main/java/net/cubespace/geSuit/listeners/PortalsMessageListener.java @@ -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); diff --git a/src/main/java/net/cubespace/geSuit/listeners/SpawnListener.java b/src/main/java/net/cubespace/geSuit/listeners/SpawnListener.java index 14066231..b1307010 100644 --- a/src/main/java/net/cubespace/geSuit/listeners/SpawnListener.java +++ b/src/main/java/net/cubespace/geSuit/listeners/SpawnListener.java @@ -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"); } diff --git a/src/main/java/net/cubespace/geSuit/listeners/SpawnMessageListener.java b/src/main/java/net/cubespace/geSuit/listeners/SpawnMessageListener.java index e9603701..d29f408d 100644 --- a/src/main/java/net/cubespace/geSuit/listeners/SpawnMessageListener.java +++ b/src/main/java/net/cubespace/geSuit/listeners/SpawnMessageListener.java @@ -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()); } diff --git a/src/main/java/net/cubespace/geSuit/listeners/TeleportsListener.java b/src/main/java/net/cubespace/geSuit/listeners/TeleportsListener.java index 12adb028..a57f293e 100644 --- a/src/main/java/net/cubespace/geSuit/listeners/TeleportsListener.java +++ b/src/main/java/net/cubespace/geSuit/listeners/TeleportsListener.java @@ -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)); } } diff --git a/src/main/java/net/cubespace/geSuit/listeners/TeleportsMessageListener.java b/src/main/java/net/cubespace/geSuit/listeners/TeleportsMessageListener.java index 07414bcd..d93b1f30 100644 --- a/src/main/java/net/cubespace/geSuit/listeners/TeleportsMessageListener.java +++ b/src/main/java/net/cubespace/geSuit/listeners/TeleportsMessageListener.java @@ -40,19 +40,19 @@ 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())); } @@ -60,7 +60,7 @@ public void receivePluginMessage(PluginMessageEvent event) throws IOException, S } 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; } @@ -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; } @@ -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; } diff --git a/src/main/java/net/cubespace/geSuit/listeners/WarpsMessageListener.java b/src/main/java/net/cubespace/geSuit/listeners/WarpsMessageListener.java index ac8a3b31..e3842529 100644 --- a/src/main/java/net/cubespace/geSuit/listeners/WarpsMessageListener.java +++ b/src/main/java/net/cubespace/geSuit/listeners/WarpsMessageListener.java @@ -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; } diff --git a/src/main/java/net/cubespace/geSuit/managers/PlayerManager.java b/src/main/java/net/cubespace/geSuit/managers/PlayerManager.java index d4486719..efa0f646 100644 --- a/src/main/java/net/cubespace/geSuit/managers/PlayerManager.java +++ b/src/main/java/net/cubespace/geSuit/managers/PlayerManager.java @@ -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; @@ -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); }