Added op + deop aliases (trusted)

This commit is contained in:
Sauilitired 2014-11-09 19:27:46 +01:00
parent 790bb4e948
commit f8db0ceec5
5 changed files with 70 additions and 3 deletions

View File

@ -100,8 +100,7 @@ public class PlotSettings {
} }
/** /**
* @return * @return biome at plot loc
* @deprecated
*/ */
public Biome getBiome() { public Biome getBiome() {
return PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId()).add(1, 0, 1).getBlock().getBiome(); return PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId()).add(1, 0, 1).getBlock().getBiome();

View File

@ -127,6 +127,8 @@ public enum Command {
/** /**
* *
*/ */
OP("op", "admin"),
DEOP("deop", "deadmin"),
BAN("ban", "block"), BAN("ban", "block"),
UNBAN("unban", "unblock"), UNBAN("unban", "unblock"),
TP("tp", "tp"); TP("tp", "tp");

View File

@ -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]);
}
}

View File

@ -46,7 +46,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
public static final String public static final String
MAIN_PERMISSION = "plots.use"; 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<SubCommand> subCommands = new ArrayList<SubCommand>() { public static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
{ {

View File

@ -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]);
}
}