Fixed Server transfer stuff. Portal send works!
This commit is contained in:
parent
eb5a7b4276
commit
81e423fa4f
@ -44,7 +44,7 @@ public class Portal extends MiniPlugin
|
|||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
|
||||||
|
|
||||||
// Register the server command type for future use
|
// 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)
|
public void SendAllPlayers(String serverName)
|
||||||
|
@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class TransferHandler implements CommandCallback
|
public class TransferHandler implements CommandCallback
|
||||||
{
|
{
|
||||||
|
|
||||||
public void run(ServerCommand command)
|
public void run(ServerCommand command)
|
||||||
{
|
{
|
||||||
if (command instanceof TransferCommand)
|
if (command instanceof TransferCommand)
|
||||||
|
@ -35,7 +35,7 @@ public class ServerCommandManager
|
|||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
// Register default command types
|
// Register default command types
|
||||||
registerCommandType(TransferCommand.class);
|
//registerCommandType("TransferCommand", TransferCommand.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,8 +117,6 @@ public class ServerCommandManager
|
|||||||
Class<? extends ServerCommand> commandClazz = _commandTypes.get(commandType).getCommandType();
|
Class<? extends ServerCommand> commandClazz = _commandTypes.get(commandType).getCommandType();
|
||||||
ServerCommand serverCommand = Utility.deserialize(serializedCommand, commandClazz);
|
ServerCommand serverCommand = Utility.deserialize(serializedCommand, commandClazz);
|
||||||
|
|
||||||
if (serverCommand.isTargetServer(_localServerName))
|
|
||||||
{
|
|
||||||
// TODO: Run synchronously?
|
// TODO: Run synchronously?
|
||||||
CommandCallback callback = _commandTypes.get(commandType).getCallback();
|
CommandCallback callback = _commandTypes.get(commandType).getCallback();
|
||||||
serverCommand.run(); // Run server command without callback
|
serverCommand.run(); // Run server command without callback
|
||||||
@ -129,16 +127,13 @@ public class ServerCommandManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new type of {@link ServerCommand}.
|
* Register a new type of {@link ServerCommand}.
|
||||||
* @param commandType - the {@link ServerCommand} type to register.
|
* @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))
|
if (_commandTypes.containsKey(commandName))
|
||||||
{
|
{
|
||||||
// Log overwriting of command type?
|
// Log overwriting of command type?
|
||||||
@ -146,11 +141,12 @@ public class ServerCommandManager
|
|||||||
|
|
||||||
CommandType cmdType = new CommandType(commandType, callback);
|
CommandType cmdType = new CommandType(commandType, callback);
|
||||||
_commandTypes.put(commandName, cmdType);
|
_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,6 +71,7 @@ public class StaffServer extends JavaPlugin
|
|||||||
|
|
||||||
Bukkit.getWorlds().get(0).setSpawnLocation(0, 102, 0);
|
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("dooskee").toString(), "dooskee").loadProfile());
|
||||||
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Morenaa").toString(), "Morenaa").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());
|
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Revolark").toString(), "Revolark").loadProfile());
|
||||||
|
@ -289,9 +289,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
_eloManager = new EloManager(_plugin, clientManager);
|
_eloManager = new EloManager(_plugin, clientManager);
|
||||||
|
|
||||||
if (GetHost() != null && !GetHost().isEmpty())
|
if (GetHost() != null && !GetHost().isEmpty())
|
||||||
|
{
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
{
|
{
|
||||||
Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName());
|
Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName());
|
||||||
}
|
}
|
||||||
|
}, 80L);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user