mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-25 11:46:50 +01:00
Add subservers.request
This commit is contained in:
parent
a9b0afb40a
commit
b188f0d4af
@ -794,7 +794,11 @@ public final class SubCommand extends BukkitCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (args.length > 0 && (args[0].equalsIgnoreCase("tp") || args[0].equalsIgnoreCase("teleport"))) {
|
} else if (args.length > 0 && (args[0].equalsIgnoreCase("tp") || args[0].equalsIgnoreCase("teleport"))) {
|
||||||
|
if (sender.hasPermission("subservers.request")) {
|
||||||
executeTeleport(sender, label, args);
|
executeTeleport(sender, label, args);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(plugin.api.getLang("SubServers", "Command.Generic.Invalid-Permission").replace("$str$", "subservers.request"));
|
||||||
|
}
|
||||||
} else if (sender.hasPermission("subservers.interface") && sender instanceof Player) {
|
} else if (sender.hasPermission("subservers.interface") && sender instanceof Player) {
|
||||||
plugin.gui.getRenderer((Player) sender).newUI();
|
plugin.gui.getRenderer((Player) sender).newUI();
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,46 +65,46 @@ public final class SubCommand implements CommandExecutor {
|
|||||||
return CommandSpec.builder()
|
return CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command"))
|
.description(Text.of("The SubServers Command"))
|
||||||
.executor(root)
|
.executor(root)
|
||||||
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("subcommand"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("subcommand"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Help"))
|
.description(Text.of("The SubServers Command - Help"))
|
||||||
.executor(new HELP())
|
.executor(new HELP())
|
||||||
.arguments(GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "help", "?")
|
.build(), "help", "?")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Version"))
|
.description(Text.of("The SubServers Command - Version"))
|
||||||
.executor(new VERSION())
|
.executor(new VERSION())
|
||||||
.arguments(GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "version", "ver")
|
.build(), "version", "ver")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - List"))
|
.description(Text.of("The SubServers Command - List"))
|
||||||
.executor(new LIST())
|
.executor(new LIST())
|
||||||
.arguments(GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "list")
|
.build(), "list")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Info"))
|
.description(Text.of("The SubServers Command - Info"))
|
||||||
.executor(new INFO())
|
.executor(new INFO())
|
||||||
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("Type"))), GenericArguments.optional(GenericArguments.string(Text.of("Name"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("Type"))), GenericArguments.optional(GenericArguments.string(Text.of("Name"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "info", "status")
|
.build(), "info", "status")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Start"))
|
.description(Text.of("The SubServers Command - Start"))
|
||||||
.executor(new START())
|
.executor(new START())
|
||||||
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "start")
|
.build(), "start")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Restart"))
|
.description(Text.of("The SubServers Command - Restart"))
|
||||||
.executor(new RESTART())
|
.executor(new RESTART())
|
||||||
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "restart")
|
.build(), "restart")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Stop"))
|
.description(Text.of("The SubServers Command - Stop"))
|
||||||
.executor(new STOP())
|
.executor(new STOP())
|
||||||
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "stop")
|
.build(), "stop")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Terminate"))
|
.description(Text.of("The SubServers Command - Terminate"))
|
||||||
.executor(new TERMINATE())
|
.executor(new TERMINATE())
|
||||||
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "kill", "terminate")
|
.build(), "kill", "terminate")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Command"))
|
.description(Text.of("The SubServers Command - Command"))
|
||||||
@ -114,22 +114,22 @@ public final class SubCommand implements CommandExecutor {
|
|||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Create"))
|
.description(Text.of("The SubServers Command - Create"))
|
||||||
.executor(new CREATE())
|
.executor(new CREATE())
|
||||||
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("Name"))), GenericArguments.optional(GenericArguments.string(Text.of("Host"))), GenericArguments.optional(GenericArguments.string(Text.of("Template"))), GenericArguments.optional(GenericArguments.string(Text.of("Version"))), GenericArguments.optional(GenericArguments.string(Text.of("Port"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("Name"))), GenericArguments.optional(GenericArguments.string(Text.of("Host"))), GenericArguments.optional(GenericArguments.string(Text.of("Template"))), GenericArguments.optional(GenericArguments.string(Text.of("Version"))), GenericArguments.optional(GenericArguments.string(Text.of("Port"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "create")
|
.build(), "create")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Update"))
|
.description(Text.of("The SubServers Command - Update"))
|
||||||
.executor(new UPDATE())
|
.executor(new UPDATE())
|
||||||
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.string(Text.of("Template"))), GenericArguments.optional(GenericArguments.string(Text.of("Version"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(new ListArgument(Text.of("Subservers"))), GenericArguments.optional(GenericArguments.string(Text.of("Template"))), GenericArguments.optional(GenericArguments.string(Text.of("Version"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "update", "upgrade")
|
.build(), "update", "upgrade")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Teleport"))
|
.description(Text.of("The SubServers Command - Teleport"))
|
||||||
.executor(new TELEPORT())
|
.executor(new TELEPORT())
|
||||||
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("Player"))), GenericArguments.optional(GenericArguments.string(Text.of("Server"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("extra"))))
|
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("Player"))), GenericArguments.optional(GenericArguments.string(Text.of("Server"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("..."))))
|
||||||
.build(), "tp", "teleport")
|
.build(), "tp", "teleport")
|
||||||
.child(CommandSpec.builder()
|
.child(CommandSpec.builder()
|
||||||
.description(Text.of("The SubServers Command - Open Menu"))
|
.description(Text.of("The SubServers Command - Open Menu"))
|
||||||
.executor(new OPEN())
|
.executor(new OPEN())
|
||||||
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("MenuID"))), GenericArguments.optional(GenericArguments.allOf(GenericArguments.string(Text.of("Args")))))
|
.arguments(GenericArguments.optional(GenericArguments.string(Text.of("Menu"))), GenericArguments.optional(GenericArguments.allOf(GenericArguments.string(Text.of("Args")))))
|
||||||
.build(), "open", "view")
|
.build(), "open", "view")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
@ -1136,7 +1136,7 @@ public final class SubCommand implements CommandExecutor {
|
|||||||
|
|
||||||
public final class TELEPORT implements CommandExecutor {
|
public final class TELEPORT implements CommandExecutor {
|
||||||
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
|
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
|
||||||
if (canRun(sender, true)) {
|
if (canRun(sender, true) && (sender.hasPermission("subservers.command") || sender.hasPermission("subservers.request"))) {
|
||||||
Optional<String> p = args.getOne(Text.of("Player"));
|
Optional<String> p = args.getOne(Text.of("Player"));
|
||||||
Optional<String> s = args.getOne(Text.of("Server"));
|
Optional<String> s = args.getOne(Text.of("Server"));
|
||||||
if (!s.isPresent()) {
|
if (!s.isPresent()) {
|
||||||
@ -1196,7 +1196,7 @@ public final class SubCommand implements CommandExecutor {
|
|||||||
return CommandResult.builder().successCount(0).build();
|
return CommandResult.builder().successCount(0).build();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.command")));
|
sender.sendMessage(ChatColor.convertColor(plugin.api.getLang("SubServers","Command.Generic.Invalid-Permission").replace("$str$", "subservers.request")));
|
||||||
return CommandResult.builder().successCount(0).build();
|
return CommandResult.builder().successCount(0).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user