From 81e423fa4ff1ed01882eca8df26392bee44ad129 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Wed, 24 Dec 2014 14:35:34 -0500 Subject: [PATCH] Fixed Server transfer stuff. Portal send works! --- .../src/mineplex/core/portal/Portal.java | 2 +- .../mineplex/core/portal/TransferHandler.java | 1 - .../serverdata/ServerCommandManager.java | 26 ++++++++----------- .../src/mineplex/staffServer/StaffServer.java | 1 + .../nautilus/game/arcade/ArcadeManager.java | 8 +++++- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java index 55e91c8f7..6512ac8d8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java @@ -44,7 +44,7 @@ public class Portal extends MiniPlugin Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord"); // Register the server command type for future use - ServerCommandManager.getInstance().registerCommandType(TransferCommand.class, new TransferHandler()); + ServerCommandManager.getInstance().registerCommandType("TransferCommand", TransferCommand.class, new TransferHandler()); } public void SendAllPlayers(String serverName) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/TransferHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/TransferHandler.java index 725f8ee15..1008579e9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/TransferHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/TransferHandler.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Player; public class TransferHandler implements CommandCallback { - public void run(ServerCommand command) { if (command instanceof TransferCommand) diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerCommandManager.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerCommandManager.java index ca1820e0c..be818030a 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerCommandManager.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerCommandManager.java @@ -35,7 +35,7 @@ public class ServerCommandManager initialize(); // Register default command types - registerCommandType(TransferCommand.class); + //registerCommandType("TransferCommand", TransferCommand.class); } /** @@ -117,16 +117,13 @@ public class ServerCommandManager Class commandClazz = _commandTypes.get(commandType).getCommandType(); ServerCommand serverCommand = Utility.deserialize(serializedCommand, commandClazz); - if (serverCommand.isTargetServer(_localServerName)) + // TODO: Run synchronously? + CommandCallback callback = _commandTypes.get(commandType).getCallback(); + serverCommand.run(); // Run server command without callback + + if (callback != null) { - // TODO: Run synchronously? - CommandCallback callback = _commandTypes.get(commandType).getCallback(); - serverCommand.run(); // Run server command without callback - - if (callback != null) - { - callback.run(serverCommand); // Run callback - } + callback.run(serverCommand); // Run callback } } } @@ -135,10 +132,8 @@ public class ServerCommandManager * Register a new type of {@link ServerCommand}. * @param commandType - the {@link ServerCommand} type to register. */ - public void registerCommandType(Class commandType, CommandCallback callback) + public void registerCommandType(String commandName, Class commandType, CommandCallback callback) { - String commandName = commandType.toString(); - if (_commandTypes.containsKey(commandName)) { // Log overwriting of command type? @@ -146,11 +141,12 @@ public class ServerCommandManager CommandType cmdType = new CommandType(commandType, callback); _commandTypes.put(commandName, cmdType); + System.out.println("Registered : " + commandName); } - public void registerCommandType(Class commandType) + public void registerCommandType(String commandName, Class commandType) { - registerCommandType(commandType, null); + registerCommandType(commandName, commandType, null); } /** diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index c9dcd8d79..a38b5af5e 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -71,6 +71,7 @@ public class StaffServer extends JavaPlugin Bukkit.getWorlds().get(0).setSpawnLocation(0, 102, 0); + ((CraftServer)getServer()).setWhitelist(true); ((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("dooskee").toString(), "dooskee").loadProfile()); ((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Morenaa").toString(), "Morenaa").loadProfile()); ((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Revolark").toString(), "Revolark").loadProfile()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 178701755..7be38e342 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -290,7 +290,13 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (GetHost() != null && !GetHost().isEmpty()) { - Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName()); + Bukkit.getScheduler().runTaskLater(plugin, new Runnable() + { + public void run() + { + Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName()); + } + }, 80L); } }