mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-09-07 04:48:07 +02:00
Updated for new commands format
This commit is contained in:
parent
f904c91443
commit
8b4332e842
@ -24,6 +24,7 @@
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
@ -51,6 +52,7 @@
|
||||
import com.sk89q.minecraft.util.commands.CommandsManager;
|
||||
import com.sk89q.minecraft.util.commands.MissingNestedCommandException;
|
||||
import com.sk89q.minecraft.util.commands.WrappedCommandException;
|
||||
import com.sk89q.minecraft.util.commands.Injector;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.TickSyncDelayLoggerFilter;
|
||||
@ -116,6 +118,16 @@ public boolean hasPermission(CommandSender player, String perm) {
|
||||
return plugin.hasPermission(player, perm);
|
||||
}
|
||||
};
|
||||
commands.setInjector(new Injector() {
|
||||
public Object getInstance(Class<?> cls) throws InvocationTargetException, IllegalAccessException, InstantiationException {
|
||||
try {
|
||||
return cls.getConstructor(WorldGuardPlugin.class).newInstance(this);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Register command classes
|
||||
commands.register(ToggleCommands.class);
|
||||
@ -203,7 +215,7 @@ public void onDisable() {
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label,
|
||||
String[] args) {
|
||||
try {
|
||||
commands.execute(cmd.getName(), args, sender, this, sender);
|
||||
commands.execute(cmd.getName(), args, sender, sender);
|
||||
} catch (CommandPermissionsException e) {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have permission.");
|
||||
} catch (MissingNestedCommandException e) {
|
||||
|
@ -33,13 +33,15 @@
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
||||
public class GeneralCommands {
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
public GeneralCommands(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Command(aliases = {"god"},
|
||||
usage = "[player]",
|
||||
desc = "Enable godmode on a player",
|
||||
flags = "s", min = 0, max = 1)
|
||||
public static void god(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"god"}, usage = "[player]",
|
||||
desc = "Enable godmode on a player", flags = "s", max = 1)
|
||||
public void god(CommandContext args, CommandSender sender) throws CommandException {
|
||||
ConfigurationManager config = plugin.getGlobalStateManager();
|
||||
|
||||
Iterable<Player> targets = null;
|
||||
@ -82,12 +84,9 @@ public static void god(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"ungod"},
|
||||
usage = "[player]",
|
||||
desc = "Disable godmode on a player",
|
||||
flags = "s", min = 0, max = 1)
|
||||
public static void ungod(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"ungod"}, usage = "[player]",
|
||||
desc = "Disable godmode on a player", flags = "s", max = 1)
|
||||
public void ungod(CommandContext args, CommandSender sender) throws CommandException {
|
||||
ConfigurationManager config = plugin.getGlobalStateManager();
|
||||
|
||||
Iterable<Player> targets = null;
|
||||
@ -129,12 +128,8 @@ public static void ungod(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"heal"},
|
||||
usage = "[player]",
|
||||
desc = "Heal a player",
|
||||
flags = "s", min = 0, max = 1)
|
||||
public static void heal(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"heal"}, usage = "[player]", desc = "Heal a player", flags = "s", max = 1)
|
||||
public void heal(CommandContext args,CommandSender sender) throws CommandException {
|
||||
|
||||
Iterable<Player> targets = null;
|
||||
boolean included = false;
|
||||
@ -176,10 +171,7 @@ public static void heal(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"slay"},
|
||||
usage = "[player]",
|
||||
desc = "Slay a player",
|
||||
flags = "s", min = 0, max = 1)
|
||||
@Command(aliases = {"slay"}, usage = "[player]", desc = "Slay a player", flags = "s", max = 1)
|
||||
public static void slay(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
|
||||
@ -222,13 +214,9 @@ public static void slay(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"locate"},
|
||||
usage = "[player]",
|
||||
desc = "Locate a player",
|
||||
flags = "", min = 0, max = 1)
|
||||
@Command(aliases = {"locate"}, usage = "[player]", desc = "Locate a player", max = 1)
|
||||
@CommandPermissions({"worldguard.locate"})
|
||||
public static void locate(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void locate(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
|
||||
@ -244,13 +232,9 @@ public static void locate(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"stack", ";"},
|
||||
usage = "",
|
||||
desc = "Stack items",
|
||||
flags = "", min = 0, max = 0)
|
||||
@Command(aliases = {"stack", ";"}, usage = "", desc = "Stack items", max = 0)
|
||||
@CommandPermissions({"worldguard.stack"})
|
||||
public static void stack(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void stack(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
boolean ignoreMax = plugin.hasPermission(player, "worldguard.stack.illegitimate");
|
||||
@ -288,7 +272,8 @@ public static void stack(CommandContext args, WorldGuardPlugin plugin,
|
||||
// Blocks store their color in the damage value
|
||||
if (item2.getTypeId() == item.getTypeId() &&
|
||||
(!ItemType.usesDamageValue(item.getTypeId())
|
||||
|| item.getDurability() == item2.getDurability())) {
|
||||
|| item.getDurability() == item2.getDurability()) &&
|
||||
item.getEnchantments().equals(item2.getEnchantments())) {
|
||||
// This stack won't fit in the parent stack
|
||||
if (item2.getAmount() > needed) {
|
||||
item.setAmount(64);
|
||||
|
@ -23,22 +23,21 @@
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.NestedCommand;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
||||
public class ProtectionCommands {
|
||||
@Command(aliases = {"region"},
|
||||
desc = "Region management commands")
|
||||
@NestedCommand({RegionCommands.class, RegionMemberCommands.class})
|
||||
public static void region(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
public ProtectionCommands(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Command(aliases = {"worldguard"},
|
||||
desc = "WorldGuard commands")
|
||||
@Command(aliases = {"region"}, desc = "Region management commands")
|
||||
@NestedCommand({RegionCommands.class, RegionMemberCommands.class})
|
||||
public void region(CommandContext args, CommandSender sender) {}
|
||||
|
||||
@Command(aliases = {"worldguard"}, desc = "WorldGuard commands")
|
||||
@NestedCommand({WorldGuardCommands.class})
|
||||
public static void worldGuard(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
}
|
||||
public void worldGuard(CommandContext args, CommandSender sender) {}
|
||||
}
|
||||
|
@ -56,14 +56,16 @@
|
||||
import com.sk89q.worldguard.util.RegionUtil;
|
||||
|
||||
public class RegionCommands {
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
public RegionCommands(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Command(aliases = {"define", "def", "d"},
|
||||
usage = "<id> [<owner1> [<owner2> [<owners...>]]]",
|
||||
desc = "Defines a region",
|
||||
flags = "", min = 1, max = -1)
|
||||
@Command(aliases = {"define", "def", "d"}, usage = "<id> [<owner1> [<owner2> [<owners...>]]]",
|
||||
desc = "Defines a region", min = 1)
|
||||
@CommandPermissions({"worldguard.region.define"})
|
||||
public static void define(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void define(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
WorldEditPlugin worldEdit = plugin.getWorldEdit();
|
||||
@ -122,12 +124,9 @@ public static void define(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"redefine", "update", "move"},
|
||||
usage = "<id>",
|
||||
desc = "Re-defines the shape of a region",
|
||||
flags = "", min = 1, max = 1)
|
||||
public static void redefine(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"redefine", "update", "move"}, usage = "<id>",
|
||||
desc = "Re-defines the shape of a region", min = 1, max = 1)
|
||||
public void redefine(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
@ -199,13 +198,10 @@ public static void redefine(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"claim"},
|
||||
usage = "<id> [<owner1> [<owner2> [<owners...>]]]",
|
||||
desc = "Claim a region",
|
||||
flags = "", min = 1, max = -1)
|
||||
@Command(aliases = {"claim"}, usage = "<id> [<owner1> [<owner2> [<owners...>]]]",
|
||||
desc = "Claim a region", min = 1)
|
||||
@CommandPermissions({"worldguard.region.claim"})
|
||||
public static void claim(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void claim(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
@ -332,12 +328,9 @@ public static void claim(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"select", "sel", "s"},
|
||||
usage = "<id>",
|
||||
desc = "Load a region as a WorldEdit selection",
|
||||
flags = "", min = 1, max = 1)
|
||||
public static void select(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"select", "sel", "s"}, usage = "<id>",
|
||||
desc = "Load a region as a WorldEdit selection", min = 1, max = 1)
|
||||
public void select(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
@ -381,12 +374,9 @@ public static void select(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"info", "i"},
|
||||
usage = "[world] <id>",
|
||||
desc = "Get information about a region",
|
||||
flags = "", min = 1, max = 2)
|
||||
public static void info(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"info", "i"}, usage = "[world] <id>",
|
||||
desc = "Get information about a region", min = 1, max = 2)
|
||||
public void info(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = null;
|
||||
LocalPlayer localPlayer = null;
|
||||
@ -468,13 +458,10 @@ public static void info(CommandContext args, WorldGuardPlugin plugin,
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + "Bounds: " + c);
|
||||
}
|
||||
|
||||
@Command(aliases = {"list"},
|
||||
usage = "[.player] [page] [world]",
|
||||
desc = "Get a list of regions",
|
||||
flags = "", min = 0, max = 3)
|
||||
@Command(aliases = {"list"}, usage = "[.player] [page] [world]",
|
||||
desc = "Get a list of regions", max = 3)
|
||||
// @CommandPermissions({"worldguard.region.list"})
|
||||
public static void list(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void list(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
World world;
|
||||
int page = 0;
|
||||
@ -559,7 +546,7 @@ else if (regions.get(id).isMember(localPlayer)) {
|
||||
int pages = (int) Math.ceil(size / (float) listSize);
|
||||
|
||||
sender.sendMessage(ChatColor.RED
|
||||
+ (name == "" ? "Regions (page " : "Regions for " + name + " (page ")
|
||||
+ (name.equals("") ? "Regions (page " : "Regions for " + name + " (page ")
|
||||
+ (page + 1) + " of " + pages + "):");
|
||||
|
||||
if (page < pages) {
|
||||
@ -573,12 +560,9 @@ else if (regions.get(id).isMember(localPlayer)) {
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"flag", "f"},
|
||||
usage = "<id> <flag> [value]",
|
||||
desc = "Set flags",
|
||||
flags = "", min = 2, max = -1)
|
||||
public static void flag(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"flag", "f"}, usage = "<id> <flag> [value]",
|
||||
desc = "Set flags", min = 2)
|
||||
public void flag(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
@ -679,7 +663,7 @@ public static void flag(CommandContext args, WorldGuardPlugin plugin,
|
||||
|
||||
if (value != null) {
|
||||
try {
|
||||
setFlag(region, foundFlag, plugin, sender, value);
|
||||
setFlag(region, foundFlag, sender, value);
|
||||
} catch (InvalidFlagFormat e) {
|
||||
throw new CommandException(e.getMessage());
|
||||
}
|
||||
@ -702,18 +686,15 @@ public static void flag(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
public static <V> void setFlag(ProtectedRegion region,
|
||||
Flag<V> flag, WorldGuardPlugin plugin, CommandSender sender, String value)
|
||||
public <V> void setFlag(ProtectedRegion region,
|
||||
Flag<V> flag, CommandSender sender, String value)
|
||||
throws InvalidFlagFormat {
|
||||
region.setFlag(flag, flag.parseInput(plugin, sender, value));
|
||||
}
|
||||
|
||||
@Command(aliases = {"setpriority", "priority", "pri"},
|
||||
usage = "<id> <priority>",
|
||||
desc = "Set the priority of a region",
|
||||
flags = "", min = 2, max = 2)
|
||||
public static void setPriority(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"setpriority", "priority", "pri"}, usage = "<id> <priority>",
|
||||
desc = "Set the priority of a region", min = 2, max = 2)
|
||||
public void setPriority(CommandContext args, CommandSender sender) throws CommandException {
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
@ -754,12 +735,9 @@ public static void setPriority(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"setparent", "parent", "par"},
|
||||
usage = "<id> [parent-id]",
|
||||
desc = "Set the parent of a region",
|
||||
flags = "", min = 1, max = 2)
|
||||
public static void setParent(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"setparent", "parent", "par"}, usage = "<id> [parent-id]",
|
||||
desc = "Set the parent of a region", min = 1, max = 2)
|
||||
public void setParent(CommandContext args, CommandSender sender) throws CommandException {
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
@ -828,12 +806,9 @@ public static void setParent(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"remove", "delete", "del", "rem"},
|
||||
usage = "<id>",
|
||||
desc = "Remove a region",
|
||||
flags = "", min = 1, max = 1)
|
||||
public static void remove(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"remove", "delete", "del", "rem"}, usage = "<id>",
|
||||
desc = "Remove a region", min = 1, max = 1)
|
||||
public void remove(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
@ -869,12 +844,9 @@ public static void remove(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"load", "reload"},
|
||||
usage = "[world]",
|
||||
desc = "Reload regions from file",
|
||||
flags = "", min = 0, max = 1)
|
||||
public static void load(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"load", "reload"}, usage = "[world]",
|
||||
desc = "Reload regions from file", max = 1)
|
||||
public void load(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
World world = null;
|
||||
|
||||
@ -910,12 +882,9 @@ public static void load(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"save", "write"},
|
||||
usage = "[world]",
|
||||
desc = "Re-save regions to file",
|
||||
flags = "", min = 0, max = 1)
|
||||
public static void save(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"save", "write"}, usage = "[world]",
|
||||
desc = "Re-save regions to file", max = 1)
|
||||
public void save(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
World world = null;
|
||||
|
||||
|
@ -40,13 +40,15 @@
|
||||
// @TODO: A lot of code duplication here! Need to fix.
|
||||
|
||||
public class RegionMemberCommands {
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
public RegionMemberCommands(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Command(aliases = {"addmember", "addmember"},
|
||||
usage = "<id> <members...>",
|
||||
desc = "Add a member to a region",
|
||||
flags = "", min = 2, max = -1)
|
||||
public static void addMember(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"addmember", "addmember"}, usage = "<id> <members...>",
|
||||
desc = "Add a member to a region", min = 2)
|
||||
public void addMember(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
@ -82,12 +84,9 @@ public static void addMember(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"addowner", "addowner"},
|
||||
usage = "<id> <owners...>",
|
||||
desc = "Add an owner to a region",
|
||||
flags = "", min = 2, max = -1)
|
||||
public static void addOwner(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"addowner", "addowner"}, usage = "<id> <owners...>",
|
||||
desc = "Add an owner to a region", min = 2)
|
||||
public void addOwner(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
@ -133,12 +132,9 @@ public static void addOwner(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"removemember", "remmember", "removemem", "remmem"},
|
||||
usage = "<id> <owners...>",
|
||||
desc = "Remove an owner to a region",
|
||||
flags = "", min = 2, max = -1)
|
||||
public static void removeMember(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
@Command(aliases = {"removemember", "remmember", "removemem", "remmem"}, usage = "<id> <owners...>",
|
||||
desc = "Remove an owner to a region", min = 2)
|
||||
public void removeMember(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
World world = player.getWorld();
|
||||
@ -174,11 +170,9 @@ public static void removeMember(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"removeowner", "remowner"},
|
||||
usage = "<id> <owners...>",
|
||||
desc = "Remove an owner to a region",
|
||||
flags = "", min = 2, max = -1)
|
||||
public static void removeOwner(CommandContext args, WorldGuardPlugin plugin,
|
||||
@Command(aliases = {"removeowner", "remowner"}, usage = "<id> <owners...>",
|
||||
desc = "Remove an owner to a region", min = 2)
|
||||
public void removeOwner(CommandContext args,
|
||||
CommandSender sender) throws CommandException {
|
||||
|
||||
Player player = plugin.checkPlayer(sender);
|
||||
|
@ -35,13 +35,16 @@
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
||||
public class ToggleCommands {
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
@Command(aliases = {"stopfire"},
|
||||
usage = "[<world>]", desc = "Disables all fire spread temporarily",
|
||||
flags = "", min = 0, max = 1)
|
||||
public ToggleCommands(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Command(aliases = {"stopfire"}, usage = "[<world>]",
|
||||
desc = "Disables all fire spread temporarily", max = 1)
|
||||
@CommandPermissions({"worldguard.fire-toggle.stop"})
|
||||
public static void stopFire(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void stopFire(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
World world;
|
||||
|
||||
@ -67,12 +70,10 @@ public static void stopFire(CommandContext args, WorldGuardPlugin plugin,
|
||||
wcfg.fireSpreadDisableToggle = true;
|
||||
}
|
||||
|
||||
@Command(aliases = {"allowfire"},
|
||||
usage = "[<world>]", desc = "Allows all fire spread temporarily",
|
||||
flags = "", min = 0, max = 1)
|
||||
@Command(aliases = {"allowfire"}, usage = "[<world>]",
|
||||
desc = "Allows all fire spread temporarily", max = 1)
|
||||
@CommandPermissions({"worldguard.fire-toggle.stop"})
|
||||
public static void allowFire(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void allowFire(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
World world;
|
||||
|
||||
@ -97,8 +98,7 @@ public static void allowFire(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
|
||||
@Command(aliases = {"halt-activity"},
|
||||
usage = "", desc = "Attempts to cease as much activity in order to stop lag",
|
||||
flags = "c", min = 0, max = 0)
|
||||
desc = "Attempts to cease as much activity in order to stop lag", flags = "c", max = 0)
|
||||
@CommandPermissions({"worldguard.halt-activity"})
|
||||
public static void stopLag(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
|
@ -39,26 +39,23 @@
|
||||
import com.sk89q.worldguard.util.PastebinPoster.PasteCallback;
|
||||
|
||||
public class WorldGuardCommands {
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
@Command(aliases = {"version"},
|
||||
usage = "",
|
||||
desc = "Get the WorldGuard version",
|
||||
flags = "", min = 0, max = 0)
|
||||
public static void version(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public WorldGuardCommands(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Command(aliases = {"version"}, desc = "Get the WorldGuard version", max = 0)
|
||||
public void version(CommandContext args, CommandSender sender) throws CommandException {
|
||||
sender.sendMessage(ChatColor.YELLOW
|
||||
+ "WorldGuard " + plugin.getDescription().getVersion());
|
||||
sender.sendMessage(ChatColor.YELLOW
|
||||
+ "http://www.sk89q.com");
|
||||
}
|
||||
|
||||
@Command(aliases = {"reload"},
|
||||
usage = "",
|
||||
desc = "Reload WorldGuard configuration",
|
||||
flags = "", min = 0, max = 0)
|
||||
@Command(aliases = {"reload"}, desc = "Reload WorldGuard configuration", max = 0)
|
||||
@CommandPermissions({"worldguard.reload"})
|
||||
public static void relload(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void reload(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
LoggerToChatHandler handler = null;
|
||||
Logger minecraftLogger = null;
|
||||
@ -86,10 +83,7 @@ public static void relload(CommandContext args, WorldGuardPlugin plugin,
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"report"},
|
||||
usage = "",
|
||||
desc = "Writes a report on WorldGuard",
|
||||
flags = "p", min = 0, max = 0)
|
||||
@Command(aliases = {"report"}, desc = "Writes a report on WorldGuard", flags = "p", max = 0)
|
||||
@CommandPermissions({"worldguard.report"})
|
||||
public static void report(CommandContext args, WorldGuardPlugin plugin,
|
||||
final CommandSender sender) throws CommandException {
|
||||
@ -126,12 +120,9 @@ public void handleError(String err) {
|
||||
}
|
||||
|
||||
@Command(aliases = {"flushstates", "clearstates"},
|
||||
usage = "[player]",
|
||||
desc = "Flush the state manager",
|
||||
flags = "", min = 0, max = 1)
|
||||
usage = "[player]", desc = "Flush the state manager", max = 1)
|
||||
@CommandPermissions("worldguard.flushstates")
|
||||
public static void flushStates(CommandContext args, WorldGuardPlugin plugin,
|
||||
CommandSender sender) throws CommandException {
|
||||
public void flushStates(CommandContext args, CommandSender sender) throws CommandException {
|
||||
if (args.argsLength() == 0) {
|
||||
plugin.getFlagStateManager().forgetAll();
|
||||
sender.sendMessage("Cleared all states.");
|
||||
|
Loading…
Reference in New Issue
Block a user