use of de.dytanic.cloudnetcore.network.components.MinecraftServer in project CloudNet by Dytanic.
the class CommandCmd method onExecuteCommand.
@Override
public void onExecuteCommand(CommandSender sender, String[] args) {
if (args.length > 1) {
for (Wrapper wrapper : CloudNet.getInstance().getWrappers().values()) {
for (MinecraftServer minecraftServer : wrapper.getServers().values()) {
if (minecraftServer.getServiceId().getServerId().equalsIgnoreCase(args[0])) {
StringBuilder stringBuilder = new StringBuilder();
for (short i = 1; i < args.length; i++) {
stringBuilder.append(args[i]).append(NetworkUtils.SPACE_STRING);
}
minecraftServer.getWrapper().writeServerCommand(stringBuilder.substring(0, stringBuilder.length() - 1), minecraftServer.getServerInfo());
sender.sendMessage("Sending command to " + minecraftServer.getServiceId().getServerId() + " with [\"" + stringBuilder.substring(0, stringBuilder.length() - 1) + "\"]");
return;
}
}
for (ProxyServer minecraftServer : wrapper.getProxys().values()) {
if (minecraftServer.getServiceId().getServerId().equalsIgnoreCase(args[0])) {
StringBuilder stringBuilder = new StringBuilder();
for (short i = 1; i < args.length; i++) {
stringBuilder.append(args[i]).append(NetworkUtils.SPACE_STRING);
}
minecraftServer.getWrapper().writeProxyCommand(stringBuilder.substring(0, stringBuilder.length() - 1), minecraftServer.getProxyInfo());
sender.sendMessage("Sending command to " + minecraftServer.getServiceId().getServerId() + " with [\"" + stringBuilder.substring(0, stringBuilder.length() - 1) + "\"]");
return;
}
}
}
} else {
sender.sendMessage("cmd <name> <command> | Executes a command, either from a proxy or game server");
}
}
use of de.dytanic.cloudnetcore.network.components.MinecraftServer in project CloudNet by Dytanic.
the class CommandInstallPlugin method onExecuteCommand.
@Override
public void onExecuteCommand(CommandSender sender, String[] args) {
switch(args.length) {
case 3:
MinecraftServer minecraftServer = CloudNet.getInstance().getServer(args[0]);
if (minecraftServer != null && minecraftServer.getChannel() != null) {
minecraftServer.sendCustomMessage("cloudnet_internal", "install_plugin", new Document("name", args[1]).append("url", args[2]));
sender.sendMessage("Plugin will install on " + args[0] + "...");
} else {
sender.sendMessage("Server doesn't exist");
}
break;
default:
sender.sendMessage("installplugin <server> <name> <url>");
break;
}
}
Aggregations