use of com.sk89q.minecraft.util.commands.Command in project WorldGuard by EngineHub.
the class DebuggingCommands method firePlaceEvent.
@Command(aliases = { "testplace" }, usage = "[player]", desc = "Simulate a block place", min = 1, max = 1, flags = "ts")
@CommandPermissions("worldguard.debug.event")
public void firePlaceEvent(CommandContext args, final Actor sender) throws CommandException {
LocalPlayer target = worldGuard.getPlatform().getMatcher().matchSinglePlayer(sender, args.getString(0));
worldGuard.getPlatform().getDebugHandler().testPlace(sender, target, args.hasFlag('t'), args.hasFlag('s'));
}
use of com.sk89q.minecraft.util.commands.Command in project WorldGuard by EngineHub.
the class GeneralCommands method heal.
@Command(aliases = { "heal" }, usage = "[player]", desc = "Heal a player", flags = "s", max = 1)
public void heal(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
Iterable<? extends LocalPlayer> targets = null;
boolean included = false;
// Detect arguments based on the number of arguments provided
if (args.argsLength() == 0) {
targets = worldGuard.getPlatform().getMatcher().matchPlayers(worldGuard.checkPlayer(sender));
// Check permissions!
sender.checkPermission("worldguard.heal");
} else if (args.argsLength() == 1) {
targets = worldGuard.getPlatform().getMatcher().matchPlayers(sender, args.getString(0));
// Check permissions!
sender.checkPermission("worldguard.heal.other");
}
for (LocalPlayer player : targets) {
player.setHealth(player.getMaxHealth());
player.setFoodLevel(20);
player.setSaturation(20);
player.setExhaustion(0);
// Tell the user
if (player.equals(sender)) {
player.print("Healed!");
// Keep track of this
included = true;
} else {
player.print("Healed by " + sender.getDisplayName() + ".");
}
}
// user a message so s/he know that something is indeed working
if (!included && args.hasFlag('s')) {
sender.print("Players healed.");
}
}
use of com.sk89q.minecraft.util.commands.Command in project WorldGuard by EngineHub.
the class GeneralCommands method stack.
@Command(aliases = { "stack", ";" }, usage = "", desc = "Stack items", max = 0)
@CommandPermissions({ "worldguard.stack" })
public void stack(CommandContext args, Actor sender) throws CommandException {
LocalPlayer player = worldGuard.checkPlayer(sender);
WorldGuard.getInstance().getPlatform().stackPlayerInventory(player);
player.print("Items compacted into stacks!");
}
use of com.sk89q.minecraft.util.commands.Command in project WorldGuard by EngineHub.
the class GeneralCommands method god.
@Command(aliases = { "god" }, usage = "[player]", desc = "Enable godmode on a player", flags = "s", max = 1)
public void god(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
Iterable<? extends LocalPlayer> targets = null;
boolean included = false;
// Detect arguments based on the number of arguments provided
if (args.argsLength() == 0) {
targets = worldGuard.getPlatform().getMatcher().matchPlayers(worldGuard.checkPlayer(sender));
// Check permissions!
sender.checkPermission("worldguard.god");
} else {
targets = worldGuard.getPlatform().getMatcher().matchPlayers(sender, args.getString(0));
// Check permissions!
sender.checkPermission("worldguard.god.other");
}
for (LocalPlayer player : targets) {
Session session = WorldGuard.getInstance().getPlatform().getSessionManager().get(player);
if (GodMode.set(player, session, true)) {
player.setFireTicks(0);
// Tell the user
if (player.equals(sender)) {
player.print("God mode enabled! Use /ungod to disable.");
// Keep track of this
included = true;
} else {
player.print("God enabled by " + sender.getDisplayName() + ".");
}
}
}
// user a message so s/he know that something is indeed working
if (!included && args.hasFlag('s')) {
sender.print("Players now have god mode.");
}
}
use of com.sk89q.minecraft.util.commands.Command in project WorldGuard by EngineHub.
the class GeneralCommands method locate.
@Command(aliases = { "locate" }, usage = "[player]", desc = "Locate a player", max = 1)
@CommandPermissions({ "worldguard.locate" })
public void locate(CommandContext args, Actor sender) throws CommandException {
LocalPlayer player = worldGuard.checkPlayer(sender);
if (args.argsLength() == 0) {
player.setCompassTarget(new Location(player.getWorld(), player.getWorld().getSpawnPosition().toVector3()));
sender.print("Compass reset to spawn.");
} else {
LocalPlayer target = worldGuard.getPlatform().getMatcher().matchSinglePlayer(sender, args.getString(0));
player.setCompassTarget(target.getLocation());
sender.print("Compass repointed.");
}
}
Aggregations