From f8db0ceec5ad216a18e1fa1a1c7c37170eafc5a6 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Sun, 9 Nov 2014 19:27:46 +0100 Subject: [PATCH] Added op + deop aliases (trusted) --- .../plot/PlotSettings.java | 3 +- .../plot/commands/Command.java | 2 ++ .../plot/commands/DEOP.java | 33 +++++++++++++++++++ .../plot/commands/MainCommand.java | 2 +- .../plot/commands/OP.java | 33 +++++++++++++++++++ 5 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java create mode 100644 PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java index f49bfb0d1..1522900cc 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java @@ -100,8 +100,7 @@ public class PlotSettings { } /** - * @return - * @deprecated + * @return biome at plot loc */ public Biome getBiome() { return PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId()).add(1, 0, 1).getBlock().getBiome(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java index 4f1a55d99..73d1dfd0f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java @@ -127,6 +127,8 @@ public enum Command { /** * */ + OP("op", "admin"), + DEOP("deop", "deadmin"), BAN("ban", "block"), UNBAN("unban", "unblock"), TP("tp", "tp"); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java new file mode 100644 index 000000000..b942d8ee5 --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java @@ -0,0 +1,33 @@ +package com.intellectualcrafters.plot.commands; + +import com.intellectualcrafters.plot.C; +import com.intellectualcrafters.plot.PlayerFunctions; +import com.intellectualcrafters.plot.Plot; +import org.bukkit.entity.Player; + +/** + * Created 2014-11-09 for PlotSquared + * + * @author Citymonstret + */ +public class DEOP extends SubCommand { + + public DEOP() { + super(Command.DEOP, "Alis for /plot trusted remove", "/plot deop [player]", CommandCategory.ACTIONS, true); + } + + @Override + public boolean execute(Player plr, String... args) { + if (args.length < 1) { + return PlayerFunctions.sendMessage(plr, "&cUsage: &c" + usage); + } + if (!PlayerFunctions.isInPlot(plr)) { + return sendMessage(plr, C.NOT_IN_PLOT); + } + Plot plot = PlayerFunctions.getCurrentPlot(plr); + if (!plot.hasRights(plr)) { + return sendMessage(plr, C.NO_PLOT_PERMS); + } + return plr.performCommand("plot trusted remove " + args[0]); + } +} diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index a29c1f6aa..e067d4b33 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -46,7 +46,7 @@ public class MainCommand implements CommandExecutor, TabCompleter { public static final String MAIN_PERMISSION = "plots.use"; - private static SubCommand[] _subCommands = new SubCommand[]{new Ban(), new Unban(), new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Setup(), new DebugClaimTest(), new Inbox(), new Comment(), new Swap(), new MusicSubcommand()}; + private static SubCommand[] _subCommands = new SubCommand[]{new Ban(), new Unban(), new OP(), new DEOP(), new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Setup(), new DebugClaimTest(), new Inbox(), new Comment(), new Swap(), new MusicSubcommand()}; public static ArrayList subCommands = new ArrayList() { { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java new file mode 100644 index 000000000..e3b2d6a21 --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java @@ -0,0 +1,33 @@ +package com.intellectualcrafters.plot.commands; + +import com.intellectualcrafters.plot.C; +import com.intellectualcrafters.plot.PlayerFunctions; +import com.intellectualcrafters.plot.Plot; +import org.bukkit.entity.Player; + +/** + * Created 2014-11-09 for PlotSquared + * + * @author Citymonstret + */ +public class OP extends SubCommand { + + public OP() { + super(Command.OP, "Alis for /plot trusted add", "/plot op [player]", CommandCategory.ACTIONS, true); + } + + @Override + public boolean execute(Player plr, String... args) { + if (args.length < 1) { + return PlayerFunctions.sendMessage(plr, "&cUsage: &c" + usage); + } + if (!PlayerFunctions.isInPlot(plr)) { + return sendMessage(plr, C.NOT_IN_PLOT); + } + Plot plot = PlayerFunctions.getCurrentPlot(plr); + if (!plot.hasRights(plr)) { + return sendMessage(plr, C.NO_PLOT_PERMS); + } + return plr.performCommand("plot trusted add " + args[0]); + } +}