Move command permissions to EssentiaCommand interface.
This commit is contained in:
parent
162ffd3599
commit
dbb3f45898
|
|
@ -58,7 +58,7 @@ public class EssentiaPlugin extends JavaPlugin implements EssentiaAPI {
|
|||
}
|
||||
|
||||
void loadCommands() {
|
||||
Reflections reflections = new Reflections("com.alttd.essentia.commands");
|
||||
Reflections reflections = new Reflections("com.alttd.essentia.commands.list");
|
||||
Set<Class<?>> subTypes = reflections.get(Scanners.SubTypes.of(EssentiaCommand.class).asClass());
|
||||
|
||||
LifecycleEventManager<Plugin> manager = this.getLifecycleManager();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import java.util.List;
|
|||
// TODO -- add optional -s -silent parameters to commands?
|
||||
public interface EssentiaCommand {
|
||||
|
||||
String commandName();
|
||||
|
||||
@NotNull LiteralCommandNode<CommandSourceStack> command();
|
||||
|
||||
default String description() {
|
||||
|
|
@ -19,4 +21,20 @@ public interface EssentiaCommand {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
default String baseCommandPermission() {
|
||||
return "essentia.command.player." + commandName();
|
||||
}
|
||||
|
||||
default String baseOtherCommandPermission() {
|
||||
return "essentia.command.player." + commandName() + "other";
|
||||
}
|
||||
|
||||
default String adminCommandPermission() {
|
||||
return "essentia.command.admin." + commandName();
|
||||
}
|
||||
|
||||
default String adminOtherCommandPermission() {
|
||||
return "essentia.command.admin." + commandName() + "other";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,14 +16,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class BurnCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "burn";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "burn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
)
|
||||
.executes((source) -> {
|
||||
if (source.getSource().getSender() instanceof Player player)
|
||||
|
|
@ -33,7 +36,7 @@ public class BurnCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -16,14 +16,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class ClearInventoryCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "clearinventory";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "clearinventory";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
@ -34,7 +37,7 @@ public class ClearInventoryCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -19,18 +19,21 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class CuffCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "cuff";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "cuff";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
)
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -20,14 +20,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class EnchantCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "enchant";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "enchant";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
)
|
||||
.then(
|
||||
Commands.argument("enchantment", new EnchantmentArgument())
|
||||
|
|
@ -51,7 +54,7 @@ public class EnchantCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -10,11 +10,16 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class EssentiaAdminCommand implements EssentiaCommand {
|
||||
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "essentiareload";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal("essentia")
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin.reload"))
|
||||
Commands.literal(commandName())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()))
|
||||
.executes((commandContext -> 1))
|
||||
.then(
|
||||
Commands.literal("reload")
|
||||
|
|
|
|||
|
|
@ -16,14 +16,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class FeedCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "feed";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "feed";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
@ -34,7 +37,7 @@ public class FeedCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -20,14 +20,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class FlyCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "fly";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "fly";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
@ -38,7 +41,7 @@ public class FlyCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class FlySpeedCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "flyspeed";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "flyspeed";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
).then(
|
||||
Commands.argument("speed", FloatArgumentType.floatArg(-1, 1))
|
||||
.executes((source) -> {
|
||||
|
|
@ -39,7 +42,7 @@ public class FlySpeedCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -17,14 +17,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class GameModeCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "gamemode";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "gamemode";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
)
|
||||
.then(
|
||||
Commands.argument("gamemode", ArgumentTypes.gameMode())
|
||||
|
|
@ -38,7 +41,7 @@ public class GameModeCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -20,14 +20,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class GodCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "god";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "god";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
@ -38,7 +41,7 @@ public class GodCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -14,17 +14,19 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class HealCommand
|
||||
implements EssentiaCommand {
|
||||
public class HealCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "heal";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "heal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
@ -35,7 +37,7 @@ public class HealCommand
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -15,14 +15,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class InfoCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "info";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "info";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
)
|
||||
.executes((source) -> {
|
||||
if (source.getSource().getSender() instanceof Player player)
|
||||
|
|
@ -32,7 +35,7 @@ public class InfoCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -13,14 +13,17 @@ import java.util.List;
|
|||
// TODO -- output messages
|
||||
public class PlayerTimeCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "playertime";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "playertime";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@ import java.util.List;
|
|||
// TODO -- output messages
|
||||
public class PlayerWeatherCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "playerweather";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "playerweather";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
|
|
@ -49,7 +52,7 @@ public class PlayerWeatherCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes(commandContext -> {
|
||||
CommandSourceStack sourceStack = commandContext.getSource();
|
||||
Player target = commandContext.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -13,14 +13,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class SetSpawnCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "setspawn";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "setspawn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@ import java.util.List;
|
|||
|
||||
public class SmiteCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "smite";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "smite";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
)
|
||||
.executes((source) -> {
|
||||
if (source.getSource().getSender() instanceof Player player)
|
||||
|
|
@ -35,7 +38,7 @@ public class SmiteCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -14,19 +14,22 @@ import java.util.List;
|
|||
|
||||
public class TeleportCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "teleport";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "teleport";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -14,19 +14,22 @@ import java.util.List;
|
|||
|
||||
public class TeleportHereCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "teleporthere";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "teleporthere";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -16,14 +16,17 @@ import java.util.List;
|
|||
|
||||
public class TeleportPositionCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "teleportposition";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "teleportposition";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
|
|
@ -39,7 +42,7 @@ public class TeleportPositionCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
if (!(source.getSource().getSender() instanceof Player player))
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -12,14 +12,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
// TODO -- output messages
|
||||
public class TimeCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "time";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "time";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
|
|
|
|||
|
|
@ -19,18 +19,21 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class UnCuffCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "uncuff";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "uncuff";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
)
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class WalkSpeedCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "walkspeed";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "walkspeed";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
).then(
|
||||
Commands.argument("speed", FloatArgumentType.floatArg(-1, 1))
|
||||
.executes((source) -> {
|
||||
|
|
@ -39,7 +42,7 @@ public class WalkSpeedCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -20,14 +20,17 @@ import java.util.Random;
|
|||
// TODO -- output messages
|
||||
public class WeatherCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "weather";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "weather";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
|
|
|
|||
|
|
@ -17,14 +17,17 @@ import java.util.List;
|
|||
|
||||
public class WorkBenchCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "workbench";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "workbench";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(adminCommandPermission())
|
||||
)
|
||||
.executes((source) -> {
|
||||
if (source.getSource().getSender() instanceof Player player)
|
||||
|
|
@ -34,7 +37,7 @@ public class WorkBenchCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(adminOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class BackCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "back";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "back";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
|
|||
|
|
@ -20,14 +20,17 @@ import java.util.List;
|
|||
|
||||
public class DeathBackCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "deathback";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "deathback";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
|
|||
|
|
@ -23,14 +23,17 @@ import java.util.Collection;
|
|||
|
||||
public class DelHomeCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "delhome";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "delhome";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
@ -70,7 +73,7 @@ public class DelHomeCommand implements EssentiaCommand {
|
|||
)
|
||||
.then(
|
||||
Commands.argument("player", new OfflinePlayerArgument())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(baseOtherCommandPermission()))
|
||||
.then(
|
||||
Commands.argument("home", StringArgumentType.word())
|
||||
.suggests((context, suggestionsBuilder) -> {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class DisposeCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "dispose";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "dispose";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission())
|
||||
)
|
||||
.executes((source) -> {
|
||||
if (source.getSource().getSender() instanceof Player player)
|
||||
|
|
@ -35,7 +38,7 @@ public class DisposeCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(baseOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -26,14 +26,17 @@ import java.util.Collection;
|
|||
// TODO - home other
|
||||
public class HomeCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "home";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "home";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
|
|||
|
|
@ -19,14 +19,17 @@ import java.util.List;
|
|||
|
||||
public class HomeListCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "homelist";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "homelist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission())
|
||||
)
|
||||
.executes((source) -> {
|
||||
if (source.getSource().getSender() instanceof Player player)
|
||||
|
|
@ -36,7 +39,7 @@ public class HomeListCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", new OfflinePlayerCompletingArgument())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(baseOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
OfflinePlayer target = source.getArgument("player", OfflinePlayer.class);
|
||||
execute(source.getSource().getSender(), target);
|
||||
|
|
|
|||
|
|
@ -20,14 +20,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class SetHomeCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "sethome";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "sethome";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
@ -49,7 +52,7 @@ public class SetHomeCommand implements EssentiaCommand {
|
|||
)
|
||||
.then(
|
||||
Commands.argument("player", new OfflinePlayerArgument())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(baseOtherCommandPermission()))
|
||||
.then(
|
||||
Commands.argument("name", StringArgumentType.word())
|
||||
.executes((source) -> {
|
||||
|
|
|
|||
|
|
@ -21,14 +21,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class SpawnCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "spawn";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "spawn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission())
|
||||
)
|
||||
.executes((source) -> {
|
||||
if (source.getSource().getSender() instanceof Player player)
|
||||
|
|
@ -38,7 +41,7 @@ public class SpawnCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(baseOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
|
|
@ -16,14 +16,17 @@ import java.util.List;
|
|||
|
||||
public class TeleportAcceptCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "teleportaccept";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "teleportaccept";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
|
|||
|
|
@ -16,14 +16,17 @@ import java.util.List;
|
|||
|
||||
public class TeleportDenyCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "teleportdeny";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "teleportdeny";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.executes((source) -> {
|
||||
|
|
|
|||
|
|
@ -20,19 +20,22 @@ import java.util.List;
|
|||
|
||||
public class TeleportRequestCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "teleportrequesthere";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "teleportrequesthere";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(baseOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
if (!(source.getSource().getSender() instanceof Player player))
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -20,19 +20,22 @@ import java.util.List;
|
|||
|
||||
public class TeleportRequestHereCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "teleportrequesthere";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "teleportrequesthere";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName) &&
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission()) &&
|
||||
commandSourceStack.getSender() instanceof Player
|
||||
)
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(baseOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
if (!(source.getSource().getSender() instanceof Player player))
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -21,14 +21,17 @@ import java.util.List;
|
|||
|
||||
public class TeleportToggleCommand implements EssentiaCommand {
|
||||
|
||||
static String commandName = "teleporttoggle";
|
||||
@Override
|
||||
public String commandName() {
|
||||
return "teleporttoggle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LiteralCommandNode<CommandSourceStack> command() {
|
||||
final LiteralArgumentBuilder<CommandSourceStack> builder =
|
||||
Commands.literal(commandName)
|
||||
Commands.literal(commandName())
|
||||
.requires(
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName)
|
||||
commandSourceStack -> commandSourceStack.getSender().hasPermission(baseCommandPermission())
|
||||
)
|
||||
.executes((source) -> {
|
||||
if (source.getSource().getSender() instanceof Player player)
|
||||
|
|
@ -38,7 +41,7 @@ public class TeleportToggleCommand implements EssentiaCommand {
|
|||
})
|
||||
.then(
|
||||
Commands.argument("player", ArgumentTypes.player())
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.player." + commandName + ".other"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(baseOtherCommandPermission()))
|
||||
.executes((source) -> {
|
||||
CommandSourceStack sourceStack = source.getSource();
|
||||
Player target = source.getArgument("player", PlayerSelectorArgumentResolver.class).resolve(sourceStack).getFirst();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user