mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 10:15:52 +01:00
Add a placeholder for selecting the current server in commands
This commit is contained in:
parent
a5c5a532a0
commit
b7639ae3dc
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,6 +40,7 @@ crashlytics-build.properties
|
||||
/Artifacts/-Maven/
|
||||
/Artifacts/-History/
|
||||
/Artifacts/-Icon/
|
||||
/Artifacts/-Lite/
|
||||
/Artifacts/*.jar
|
||||
/Javadoc/
|
||||
/SubServers.Test/
|
||||
|
@ -88,6 +88,7 @@
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>process</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
@ -96,6 +97,7 @@
|
||||
<tasks>
|
||||
<mkdir dir="${project.build.directory}" />
|
||||
<copy file="${basedir}/../LICENSE" todir="${project.build.directory}/classes" />
|
||||
<mkdir dir="${basedir}/../Artifacts/-Lite" />
|
||||
<copy file="${basedir}/../Artifacts/SubServers.Client.jar" tofile="${project.build.directory}/classes/net/ME1312/SubServers/Bungee/Library/Files/client.jar" />
|
||||
<mkdir dir="${project.build.directory}/classes/net/ME1312/SubServers/Bungee/Library/Files/Templates" />
|
||||
<zip basedir="${basedir}/../SubServers.Creator/src" destfile="${project.build.directory}/classes/net/ME1312/SubServers/Bungee/Library/Files/Templates/forge.zip" includes="Forge/**" />
|
||||
@ -105,6 +107,20 @@
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>verify</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks> <!-- Dependency Stripped Jar for Testing -->
|
||||
<jar destfile="${basedir}/../Artifacts/-Lite/SubServers.Bungee.jar" manifest="src/META-INF/MANIFEST.MF">
|
||||
<zipfileset src="${basedir}/../Artifacts/SubServers.Bungee.jar" excludes="net/ME1312/Galaxi/** net/ME1312/SubData/**" />
|
||||
</jar>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -1,4 +1,4 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path: BungeeCord.jar Waterfall.jar
|
||||
Class-Path: GalaxiEngine.jar SubDataServer.jar BungeeCord.jar Waterfall.jar
|
||||
Main-Class: net.ME1312.SubServers.Bungee.Launch
|
||||
Implementation-Title: SubServers.Bungee
|
||||
|
@ -859,7 +859,6 @@ public final class SubCommand extends CommandX {
|
||||
}
|
||||
}
|
||||
} else if (args[0].equals("start") ||
|
||||
args[0].equals("restart") ||
|
||||
(!(sender instanceof ProxiedPlayer) && (
|
||||
args[0].equals("sudo") || args[0].equals("screen") ||
|
||||
args[0].equals("del") || args[0].equals("delete")
|
||||
@ -877,15 +876,18 @@ public final class SubCommand extends CommandX {
|
||||
} else {
|
||||
return new NamedContainer<>(null, Collections.emptyList());
|
||||
}
|
||||
} else if (args[0].equals("stop") ||
|
||||
} else if (args[0].equals("restart") ||
|
||||
args[0].equals("stop") ||
|
||||
args[0].equals("kill") || args[0].equals("terminate")) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (args.length == 2) {
|
||||
if (last.length() == 0) {
|
||||
list.add("*");
|
||||
if (sender instanceof ProxiedPlayer) list.add(".");
|
||||
if (!args[0].equals("restart")) list.add("*");
|
||||
for (SubServer server : plugin.api.getSubServers().values()) list.add(server.getName());
|
||||
} else {
|
||||
if ("*".startsWith(last)) list.add("*");
|
||||
if (sender instanceof ProxiedPlayer && ".".startsWith(last)) list.add(".");
|
||||
if (!args[0].equals("restart") && "*".startsWith(last)) list.add("*");
|
||||
for (SubServer server : plugin.api.getSubServers().values()) {
|
||||
if (server.getName().toLowerCase().startsWith(last)) list.add(last + server.getName().substring(last.length()));
|
||||
}
|
||||
@ -898,9 +900,11 @@ public final class SubCommand extends CommandX {
|
||||
if (args.length == 2) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (last.length() == 0) {
|
||||
if (sender instanceof ProxiedPlayer) list.add(".");
|
||||
list.add("*");
|
||||
for (SubServer server : plugin.api.getSubServers().values()) list.add(server.getName());
|
||||
} else {
|
||||
if (sender instanceof ProxiedPlayer && ".".startsWith(last)) list.add(".");
|
||||
if ("*".startsWith(last)) list.add("*");
|
||||
for (SubServer server : plugin.api.getSubServers().values()) {
|
||||
if (server.getName().toLowerCase().startsWith(last)) list.add(last + server.getName().substring(last.length()));
|
||||
|
@ -383,6 +383,7 @@ public final class SubCommand extends BukkitCommand {
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("restart")) {
|
||||
if (args.length > 1) {
|
||||
if (args[1].equals(".")) args[1] = plugin.api.getName();
|
||||
if ((sender.hasPermission("subservers.subserver.stop.*") || sender.hasPermission("subservers.subserver.stop." + args[1].toLowerCase())) && (sender.hasPermission("subservers.subserver.start.*") || sender.hasPermission("subservers.subserver.start." + args[1].toLowerCase()))) {
|
||||
Runnable starter = () -> ((SubDataClient) plugin.api.getSubDataNetwork()[0]).sendPacket(new PacketStartServer(null, args[1], data -> {
|
||||
switch (data.getInt(0x0001)) {
|
||||
@ -462,6 +463,7 @@ public final class SubCommand extends BukkitCommand {
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("stop")) {
|
||||
if (args.length > 1) {
|
||||
if (args[1].equals(".")) args[1] = plugin.api.getName();
|
||||
if (sender.hasPermission("subservers.subserver.stop.*") || sender.hasPermission("subservers.subserver.stop." + args[1].toLowerCase())) {
|
||||
((SubDataClient) plugin.api.getSubDataNetwork()[0]).sendPacket(new PacketStopServer((sender instanceof Player)?((Player) sender).getUniqueId():null, args[1], false, data -> {
|
||||
switch (data.getInt(0x0001)) {
|
||||
@ -488,6 +490,7 @@ public final class SubCommand extends BukkitCommand {
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("kill") || args[0].equalsIgnoreCase("terminate")) {
|
||||
if (args.length > 1) {
|
||||
if (args[1].equals(".")) args[1] = plugin.api.getName();
|
||||
if (sender.hasPermission("subservers.subserver.terminate.*") || sender.hasPermission("subservers.subserver.terminate." + args[1].toLowerCase())) {
|
||||
((SubDataClient) plugin.api.getSubDataNetwork()[0]).sendPacket(new PacketStopServer((sender instanceof Player)?((Player) sender).getUniqueId():null, args[1], true, data -> {
|
||||
switch (data.getInt(0x0001)) {
|
||||
@ -514,6 +517,7 @@ public final class SubCommand extends BukkitCommand {
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("cmd") || args[0].equalsIgnoreCase("command")) {
|
||||
if (args.length > 2) {
|
||||
if (args[1].equals(".")) args[1] = plugin.api.getName();
|
||||
if (sender.hasPermission("subservers.subserver.command.*") || sender.hasPermission("subservers.subserver.command." + args[1].toLowerCase())) {
|
||||
int i = 2;
|
||||
String str = args[2];
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.ME1312.SubServers.Client.Sponge;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||
import net.ME1312.SubData.Client.SubDataClient;
|
||||
import net.ME1312.SubServers.Client.Sponge.Graphic.UIRenderer;
|
||||
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||
@ -701,10 +702,11 @@ public final class SubCommand implements CommandExecutor {
|
||||
public final class RESTART implements CommandExecutor {
|
||||
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
|
||||
if (canRun(sender)) {
|
||||
Optional<String> subserver = args.getOne(Text.of("SubServer"));
|
||||
if (subserver.isPresent()) {
|
||||
if (sender.hasPermission("subservers.subserver.stop." + subserver.get().toLowerCase()) && sender.hasPermission("subservers.subserver.start." + subserver.get().toLowerCase())) {
|
||||
Runnable starter = () -> ((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStartServer(null, subserver.get(), data -> {
|
||||
Container<Optional<String>> subserver = new Container<>(args.getOne(Text.of("SubServer")));
|
||||
if (subserver.get().isPresent()) {
|
||||
if (subserver.get().get().equals(".")) subserver.set(Optional.of(plugin.api.getName()));
|
||||
if (sender.hasPermission("subservers.subserver.stop." + subserver.get().get().toLowerCase()) && sender.hasPermission("subservers.subserver.start." + subserver.get().get().toLowerCase())) {
|
||||
Runnable starter = () -> ((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStartServer(null, subserver.get().get(), data -> {
|
||||
switch (data.getInt(0x0001)) {
|
||||
case 3:
|
||||
case 4:
|
||||
@ -738,7 +740,7 @@ public final class SubCommand implements CommandExecutor {
|
||||
@Override
|
||||
public void run(ObjectMap<String> json) {
|
||||
try {
|
||||
if (listening.get()) if (!json.getString("server").equalsIgnoreCase(subserver.get())) {
|
||||
if (listening.get()) if (!json.getString("server").equalsIgnoreCase(subserver.get().get())) {
|
||||
PacketInExRunEvent.callback("SubStoppedEvent", this);
|
||||
} else {
|
||||
plugin.game.getScheduler().createTaskBuilder().execute(starter).delay(100, TimeUnit.MILLISECONDS).submit(plugin);
|
||||
@ -766,18 +768,18 @@ public final class SubCommand implements CommandExecutor {
|
||||
}
|
||||
};
|
||||
|
||||
if (SubAPI.getInstance().getName().equalsIgnoreCase(subserver.get())) {
|
||||
if (SubAPI.getInstance().getName().equalsIgnoreCase(subserver.get().get())) {
|
||||
listening.set(false);
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketRestartServer((sender instanceof Player)?((Player) sender).getUniqueId():null, subserver.get(), stopper));
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketRestartServer((sender instanceof Player)?((Player) sender).getUniqueId():null, subserver.get().get(), stopper));
|
||||
} else {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStopServer((sender instanceof Player)?((Player) sender).getUniqueId():null, subserver.get(), false, stopper));
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStopServer((sender instanceof Player)?((Player) sender).getUniqueId():null, subserver.get().get(), false, stopper));
|
||||
}
|
||||
return CommandResult.builder().successCount(1).build();
|
||||
} else if (!sender.hasPermission("subservers.subserver.stop." + subserver.get().toLowerCase())) {
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.stop." + subserver.get().toLowerCase())));
|
||||
} else if (!sender.hasPermission("subservers.subserver.stop." + subserver.get().get().toLowerCase())) {
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.stop." + subserver.get().get().toLowerCase())));
|
||||
return CommandResult.builder().successCount(0).build();
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.start." + subserver.get().toLowerCase())));
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.start." + subserver.get().get().toLowerCase())));
|
||||
return CommandResult.builder().successCount(0).build();
|
||||
}
|
||||
} else {
|
||||
@ -794,10 +796,11 @@ public final class SubCommand implements CommandExecutor {
|
||||
public final class STOP implements CommandExecutor {
|
||||
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
|
||||
if (canRun(sender)) {
|
||||
Optional<String> subserver = args.getOne(Text.of("SubServer"));
|
||||
if (subserver.isPresent()) {
|
||||
if (sender.hasPermission("subservers.subserver.stop." + subserver.get().toLowerCase())) {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStopServer((sender instanceof Player) ? ((Player) sender).getUniqueId():null, subserver.get(), false, data -> {
|
||||
Container<Optional<String>> subserver = new Container<>(args.getOne(Text.of("SubServer")));
|
||||
if (subserver.get().isPresent()) {
|
||||
if (subserver.get().get().equals(".")) subserver.set(Optional.of(plugin.api.getName()));
|
||||
if (sender.hasPermission("subservers.subserver.stop." + subserver.get().get().toLowerCase())) {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStopServer((sender instanceof Player) ? ((Player) sender).getUniqueId():null, subserver.get().get(), false, data -> {
|
||||
switch (data.getInt(0x0001)) {
|
||||
case 3:
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Stop.Unknown")));
|
||||
@ -816,7 +819,7 @@ public final class SubCommand implements CommandExecutor {
|
||||
}));
|
||||
return CommandResult.builder().successCount(1).build();
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.stop." + subserver.get().toLowerCase())));
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.stop." + subserver.get().get().toLowerCase())));
|
||||
return CommandResult.builder().successCount(0).build();
|
||||
}
|
||||
} else {
|
||||
@ -833,10 +836,11 @@ public final class SubCommand implements CommandExecutor {
|
||||
public final class TERMINATE implements CommandExecutor {
|
||||
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
|
||||
if (canRun(sender)) {
|
||||
Optional<String> subserver = args.getOne(Text.of("SubServer"));
|
||||
if (subserver.isPresent()) {
|
||||
if (sender.hasPermission("subservers.subserver.terminate." + subserver.get().toLowerCase())) {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStopServer((sender instanceof Player)?((Player) sender).getUniqueId():null, subserver.get(), true, data -> {
|
||||
Container<Optional<String>> subserver = new Container<>(args.getOne(Text.of("SubServer")));
|
||||
if (subserver.get().isPresent()) {
|
||||
if (subserver.get().get().equals(".")) subserver.set(Optional.of(plugin.api.getName()));
|
||||
if (sender.hasPermission("subservers.subserver.terminate." + subserver.get().get().toLowerCase())) {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStopServer((sender instanceof Player)?((Player) sender).getUniqueId():null, subserver.get().get(), true, data -> {
|
||||
switch (data.getInt(0x0001)) {
|
||||
case 3:
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Terminate.Unknown")));
|
||||
@ -855,7 +859,7 @@ public final class SubCommand implements CommandExecutor {
|
||||
}));
|
||||
return CommandResult.builder().successCount(1).build();
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.terminate." + subserver.get().toLowerCase())));
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.terminate." + subserver.get().get().toLowerCase())));
|
||||
return CommandResult.builder().successCount(0).build();
|
||||
}
|
||||
} else {
|
||||
@ -872,11 +876,12 @@ public final class SubCommand implements CommandExecutor {
|
||||
public final class COMMAND implements CommandExecutor {
|
||||
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
|
||||
if (canRun(sender)) {
|
||||
Optional<String> subserver = args.getOne(Text.of("SubServer"));
|
||||
Container<Optional<String>> subserver = new Container<>(args.getOne(Text.of("SubServer")));
|
||||
Optional<String> command = args.getOne(Text.of("Command"));
|
||||
if (subserver.isPresent() && command.isPresent()) {
|
||||
if (sender.hasPermission("subservers.subserver.command." + subserver.get().toLowerCase())) {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketCommandServer((sender instanceof Player)?((Player) sender).getUniqueId():null, subserver.get(), command.get(), data -> {
|
||||
if (subserver.get().isPresent() && command.isPresent()) {
|
||||
if (subserver.get().get().equals(".")) subserver.set(Optional.of(plugin.api.getName()));
|
||||
if (sender.hasPermission("subservers.subserver.command." + subserver.get().get().toLowerCase())) {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketCommandServer((sender instanceof Player)?((Player) sender).getUniqueId():null, subserver.get().get(), command.get(), data -> {
|
||||
switch (data.getInt(0x0001)) {
|
||||
case 3:
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Command.Unknown")));
|
||||
@ -895,7 +900,7 @@ public final class SubCommand implements CommandExecutor {
|
||||
}));
|
||||
return CommandResult.builder().successCount(1).build();
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.command." + subserver.get().toLowerCase())));
|
||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.subserver.command." + subserver.get().get().toLowerCase())));
|
||||
return CommandResult.builder().successCount(0).build();
|
||||
}
|
||||
} else {
|
||||
|
@ -66,6 +66,7 @@
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>process</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
@ -78,6 +79,20 @@
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>verify</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks> <!-- Dependency Stripped Jar for Testing -->
|
||||
<jar destfile="${basedir}/../Artifacts/-Lite/SubServers.Host.jar" manifest="src/META-INF/MANIFEST.MF">
|
||||
<zipfileset src="${basedir}/../Artifacts/SubServers.Host.jar" excludes="net/ME1312/Galaxi/** net/ME1312/SubData/**" />
|
||||
</jar>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -1,4 +1,4 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path: GalaxiEngine.jar
|
||||
Class-Path: GalaxiEngine.jar SubDataClient.jar
|
||||
Main-Class: net.ME1312.SubServers.Host.Launch
|
||||
Implementation-Title: SubServers.Host
|
||||
|
@ -88,6 +88,7 @@
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>process</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
@ -99,6 +100,20 @@
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>verify</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks> <!-- Dependency Stripped Jar for Testing -->
|
||||
<jar destfile="${basedir}/../Artifacts/-Lite/SubServers.Sync.jar" manifest="src/META-INF/MANIFEST.MF">
|
||||
<zipfileset src="${basedir}/../Artifacts/SubServers.Sync.jar" excludes="net/ME1312/Galaxi/** net/ME1312/SubData/**" />
|
||||
</jar>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -1,4 +1,4 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path: BungeeCord.jar Waterfall.jar
|
||||
Class-Path: GalaxiEngine.jar SubDataClient.jar BungeeCord.jar Waterfall.jar
|
||||
Main-Class: net.ME1312.SubServers.Sync.Launch
|
||||
Implementation-Title: SubServers.Sync
|
||||
|
@ -807,8 +807,7 @@ public final class SubCommand extends CommandX {
|
||||
} else {
|
||||
return new NamedContainer<>(null, Collections.emptyList());
|
||||
}
|
||||
} else if (args[0].equals("start") ||
|
||||
args[0].equals("restart")) {
|
||||
} else if (args[0].equals("start")) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (args.length == 2) {
|
||||
if (last.length() == 0) {
|
||||
@ -822,15 +821,18 @@ public final class SubCommand extends CommandX {
|
||||
} else {
|
||||
return new NamedContainer<>(null, Collections.emptyList());
|
||||
}
|
||||
} else if (args[0].equals("stop") ||
|
||||
} else if (args[0].equals("restart") ||
|
||||
args[0].equals("stop") ||
|
||||
args[0].equals("kill") || args[0].equals("terminate")) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (args.length == 2) {
|
||||
if (last.length() == 0) {
|
||||
list.add("*");
|
||||
if (sender instanceof ProxiedPlayer) list.add(".");
|
||||
if (!args[0].equals("restart")) list.add("*");
|
||||
for (ServerImpl server : plugin.servers.values()) if (server instanceof SubServerImpl) list.add(server.getName());
|
||||
} else {
|
||||
if ("*".startsWith(last)) list.add("*");
|
||||
if (sender instanceof ProxiedPlayer && ".".startsWith(last)) list.add(".");
|
||||
if (!args[0].equals("restart") && "*".startsWith(last)) list.add("*");
|
||||
for (ServerImpl server : plugin.servers.values()) {
|
||||
if (server instanceof SubServerImpl && server.getName().toLowerCase().startsWith(last)) list.add(last + server.getName().substring(last.length()));
|
||||
}
|
||||
@ -843,8 +845,12 @@ public final class SubCommand extends CommandX {
|
||||
if (args.length == 2) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (last.length() == 0) {
|
||||
if (sender instanceof ProxiedPlayer) list.add(".");
|
||||
list.add("*");
|
||||
for (ServerImpl server : plugin.servers.values()) if (server instanceof SubServerImpl) list.add(server.getName());
|
||||
} else {
|
||||
if (sender instanceof ProxiedPlayer && ".".startsWith(last)) list.add(".");
|
||||
if ("*".startsWith(last)) list.add("*");
|
||||
for (ServerImpl server : plugin.servers.values()) {
|
||||
if (server instanceof SubServerImpl && server.getName().toLowerCase().startsWith(last)) list.add(last + server.getName().substring(last.length()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user