admin claim tp

This commit is contained in:
Flemmli97 2021-06-13 19:46:57 +02:00
parent 5855f02480
commit c1bcf5621f
2 changed files with 9 additions and 3 deletions

View File

@ -106,9 +106,11 @@ public class CommandClaim {
return CommandSource.suggestMatching(list, build);
}).executes(CommandClaim::removePlayer))))))
.then(CommandManager.literal("teleport").requires(src -> CommandPermission.perm(src, CommandPermission.cmdTeleport))
.then(CommandManager.literal("self").then(CommandManager.argument("claim", StringArgumentType.word()).suggests((ctx, b) -> CommandClaim.claimSuggestions(ctx, b, ctx.getSource().getPlayer().getUuid()))
.then(CommandManager.literal("self").then(CommandManager.argument("claim", StringArgumentType.string()).suggests((ctx, b) -> CommandClaim.claimSuggestions(ctx, b, ctx.getSource().getPlayer().getUuid()))
.executes(CommandClaim::teleport)))
.then(CommandManager.literal("other").then(CommandManager.argument("player", GameProfileArgumentType.gameProfile()).then(CommandManager.argument("claim", StringArgumentType.word()).suggests((ctx, b) -> CommandClaim.claimSuggestions(ctx, b, CommandClaim.singleProfile(ctx, "player").getId()))
.then(CommandManager.literal("admin").then(CommandManager.argument("claim", StringArgumentType.string()).suggests((ctx, b) -> CommandClaim.claimSuggestions(ctx, b, null))
.executes(CommandClaim::teleportAdminClaims)))
.then(CommandManager.literal("other").then(CommandManager.argument("player", GameProfileArgumentType.gameProfile()).then(CommandManager.argument("claim", StringArgumentType.string()).suggests((ctx, b) -> CommandClaim.claimSuggestions(ctx, b, CommandClaim.singleProfile(ctx, "player").getId()))
.executes(src -> CommandClaim.teleport(src, CommandClaim.singleProfile(src, "player").getId()))))))
.then(CommandManager.literal("permission").requires(src -> CommandPermission.perm(src, CommandPermission.cmdPermission))
.then(CommandManager.literal("personal").then(CommandManager.argument("group", StringArgumentType.string()).suggests(CommandClaim::personalGroupSuggestion)
@ -762,6 +764,10 @@ public class CommandClaim {
return teleport(context, context.getSource().getPlayer().getUuid());
}
public static int teleportAdminClaims(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
return teleport(context, null);
}
public static int teleport(CommandContext<ServerCommandSource> context, UUID owner) throws CommandSyntaxException {
ServerPlayerEntity player = context.getSource().getPlayer();
String name = StringArgumentType.getString(context, "claim");

View File

@ -27,7 +27,7 @@ public class LangCommands {
map.put("trapped", new String[]{"trapped", "If in a claim not owned by the player attempts to teleport the player out of it after 5 seconds."});
map.put("unlockDrops", new String[]{"unlockDrops <players>", "Unlocks dropped items from death so other players can pick them up too. Or all of the given players (needs OP)"});
map.put("setHome", new String[]{"setHome", "Standing in a claim with sufficient permission sets that claims home to the players position"});
map.put("teleport", new String[]{"teleport self | (other <player>) (<claim name> | <claim uuid>)", "Teleport to the given claims home position"});
map.put("teleport", new String[]{"teleport self | admin | (other <player>) (<claim name> | <claim uuid>)", "Teleport to the given claims home position. Use admin to teleport to admin claims"});
map.put("name", new String[]{"name self <name>", "Sets the current claims name"});
map.put("reload", new String[]{"reload", "Reloads the config ingame."});