Fixed Server transfer stuff. Portal send works!

This commit is contained in:
Jonathan Williams 2014-12-24 14:35:34 -05:00
parent eb5a7b4276
commit 81e423fa4f
5 changed files with 20 additions and 18 deletions

View File

@ -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)

View File

@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
public class TransferHandler implements CommandCallback
{
public void run(ServerCommand command)
{
if (command instanceof TransferCommand)

View File

@ -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<? extends ServerCommand> 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
// TODO: Run synchronously?
CommandCallback callback = _commandTypes.get(commandType).getCallback();
serverCommand.run(); // Run server command without callback
if (callback != null)
{
callback.run(serverCommand); // Run callback
}
if (callback != null)
{
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<? extends ServerCommand> commandType, CommandCallback callback)
public void registerCommandType(String commandName, Class<? extends ServerCommand> 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<? extends ServerCommand> commandType)
public void registerCommandType(String commandName, Class<? extends ServerCommand> commandType)
{
registerCommandType(commandType, null);
registerCommandType(commandName, commandType, null);
}
/**

View File

@ -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());

View File

@ -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);
}
}