Added support for console messages (untested)

This commit is contained in:
Jesse Boyd 2014-10-18 11:06:29 -07:00
parent 2435eab96a
commit 0010b06afa
37 changed files with 197 additions and 78 deletions

View File

@ -16,6 +16,11 @@ import org.bukkit.ChatColor;
* @author Citymonstret
*/
public enum C {
/*
* Console
*/
NOT_CONSOLE("&cFor safety reasons, this command can only be executed by console."),
IS_CONSOLE("&cThis command can only be executed by a player."),
/*
Clipboard
*/
@ -128,6 +133,11 @@ public enum C {
*
*/
COMMAND_WENT_WRONG("&cSomething went wrong when executing that command..."),
/*
* purge
*/
PURGE_SYNTAX("&c/plots purge {world}"),
PURGE_SUCCESS("All plots for the specified world have now been purged."),
/*
* No {plot}
*/
@ -190,6 +200,7 @@ public enum C {
PLOT_INFO_UNCLAIMED("&cPlot &6%s&c is not yet claimed"),
PLOT_INFO("ID: &6%id%&c, Alias: &6%alias%&c, Owner: &6%owner%&c, Biome: &6%biome%&c, Time: &6%time%&c, Weather: &6%weather%&c, Helpers:&6%helpers%&c, Trusted:&6%trusted%&c, Denied:&6%denied%&c, Rating: &6%rating%&c, Flags: &6%flags%"),
PLOT_USER_LIST(" &6%user%&c,"),
INFO_SYNTAX_CONSOLE("/plot info {world} X;Y"),
/*
* Generating
*/

View File

@ -156,6 +156,10 @@ public class PlotMain extends JavaPlugin {
* @return
*/
public static boolean hasPermissions(Player player, String[] perms) {
// Assumes null player is console.
if (player==null) {
return true;
}
if (player.isOp()) {
return true;
}

View File

@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.PlotWorld;
@SuppressWarnings("deprecation")
public class Auto extends SubCommand {
public Auto() {
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING);
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING, true);
}
// TODO auto claim a mega plot!!!!!!!!!!!!

View File

@ -26,7 +26,7 @@ public class Camera extends SubCommand implements Listener {
private CameraAPI api;
public Camera() {
super("camera", "plots.camera", "Go into camera mode", "camera", "c", CommandCategory.TELEPORT);
super("camera", "plots.camera", "Go into camera mode", "camera", "c", CommandCategory.TELEPORT, true);
this.api = CameraAPI.getInstance();
this.travelers = new ArrayList<String>();
}

View File

@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
public class Claim extends SubCommand {
public Claim() {
super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING);
super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true);
}
@Override

View File

@ -20,7 +20,10 @@ import com.intellectualcrafters.plot.Plot;
public class Clear extends SubCommand {
public Clear() {
super(Command.CLEAR, "Clear a plot", "clear", CommandCategory.ACTIONS);
super(Command.CLEAR, "Clear a plot", "clear", CommandCategory.ACTIONS, true);
// TODO console clear plot at location
}
@Override

View File

@ -13,7 +13,7 @@ import static com.intellectualcrafters.plot.PlotSelection.currentSelection;
public class Clipboard extends SubCommand {
public Clipboard() {
super(Command.CLIPBOARD, "View information about your current copy", "clipboard", CommandCategory.INFO);
super(Command.CLIPBOARD, "View information about your current copy", "clipboard", CommandCategory.INFO, true);
}
@Override

View File

@ -83,6 +83,10 @@ public enum Command {
*
*/
SET("set", "s"),
/**
*
*/
PURGE("purge"),
/**
*
*/

View File

@ -11,6 +11,8 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain;
/**
* Created by Citymonstret on 2014-08-03.
*
@ -35,6 +37,6 @@ public class CommandPermission {
* @return
*/
public boolean hasPermission(Player player) {
return player.hasPermission(this.permission) || player.hasPermission("plots.admin");
return PlotMain.hasPermission(player, this.permission) || PlotMain.hasPermission(player, "plots.admin");
}
}

View File

@ -18,7 +18,7 @@ import org.bukkit.entity.Player;
public class Copy extends SubCommand {
public Copy() {
super(Command.COPY, "Copy a plot", "clear", CommandCategory.ACTIONS);
super(Command.COPY, "Copy a plot", "clear", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -9,6 +9,7 @@
package com.intellectualcrafters.plot.commands;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.C;
@ -33,7 +34,7 @@ public class Debug extends SubCommand {
// private extends SubCommand^Implements {Command, Information} from
// >>\\S.txt6\\
public Debug() {
super(Command.DEBUG, "Show debug information", "debug [msg]", CommandCategory.INFO);
super(Command.DEBUG, "Show debug information", "debug [msg]", CommandCategory.INFO, false);
{
/**
* This.
@ -43,7 +44,6 @@ public class Debug extends SubCommand {
@Override
public boolean execute(Player plr, String... args) {
PlotMain.getWorldSettings(plr.getWorld());
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
StringBuilder msg = new StringBuilder();
for (C c : C.values()) {
@ -87,12 +87,13 @@ public class Debug extends SubCommand {
information.append(getLine(line, "Owned Plots", PlotMain.getPlots().size()));
// information.append(getLine(line, "PlotWorld Size",
// PlotHelper.getWorldFolderSize() + "MB"));
for (String world : PlotMain.getPlotWorlds()) {
information.append(getLine(line, "World: " + world + " size", PlotHelper.getWorldFolderSize(Bukkit.getWorld(world))));
for (String worldname : PlotMain.getPlotWorlds()) {
World world = Bukkit.getWorld(worldname);
information.append(getLine(line, "World: " + world + " size", PlotHelper.getWorldFolderSize(world)));
information.append(getLine(line, " - Entities", PlotHelper.getEntities(world)));
information.append(getLine(line, " - Loaded Tile Entities", PlotHelper.getTileEntities(world)));
information.append(getLine(line, " - Loaded Chunks", PlotHelper.getLoadedChunks(world)));
}
information.append(getLine(line, "Entities", PlotHelper.getEntities(plr.getWorld())));
information.append(getLine(line, "Loaded Tile Entities", PlotHelper.getTileEntities(plr.getWorld())));
information.append(getLine(line, "Loaded Chunks", PlotHelper.getLoadedChunks(plr.getWorld())));
information.append(getSection(section, "RAM"));
information.append(getLine(line, "Free Ram", RUtils.getFreeRam() + "MB"));
information.append(getLine(line, "Total Ram", RUtils.getTotalRam() + "MB"));
@ -117,5 +118,4 @@ public class Debug extends SubCommand {
private String getLine(String line, String var, Object val) {
return line.replaceAll("%var%", var).replaceAll("%val%", "" + val) + "\n";
}
}

View File

@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
public class Delete extends SubCommand {
public Delete() {
super(Command.DELETE, "Delete a plot", "delete", CommandCategory.ACTIONS);
super(Command.DELETE, "Delete a plot", "delete", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
public class Denied extends SubCommand {
public Denied() {
super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS);
super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
*/
public class Help extends SubCommand {
public Help() {
super("help", "", "Get this help menu", "help", "he", SubCommand.CommandCategory.INFO);
super("help", "", "Get this help menu", "help", "he", SubCommand.CommandCategory.INFO, false);
}
@Override

View File

@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
public class Helpers extends SubCommand {
public Helpers() {
super(Command.HELPERS, "Manage plot helpers", "helpers {add|remove} {player}", CommandCategory.ACTIONS);
super(Command.HELPERS, "Manage plot helpers", "helpers {add|remove} {player}", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -21,7 +21,7 @@ import com.intellectualcrafters.plot.PlotMain;
public class Home extends SubCommand {
public Home() {
super(Command.HOME, "Go to your plot", "home {id|alias}", CommandCategory.TELEPORT);
super(Command.HOME, "Go to your plot", "home {id|alias}", CommandCategory.TELEPORT, true);
}
private Plot isAlias(String a) {

View File

@ -22,6 +22,9 @@ import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotHelper;
import com.intellectualcrafters.plot.PlotId;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.PlotWorld;
import com.intellectualcrafters.plot.UUIDHandler;
import com.intellectualcrafters.plot.database.DBFunc;
@ -31,18 +34,43 @@ import com.intellectualcrafters.plot.database.DBFunc;
public class Info extends SubCommand {
public Info() {
super(Command.INFO, "Display plot info", "info", CommandCategory.INFO);
super(Command.INFO, "Display plot info", "info", CommandCategory.INFO, false);
}
@Override
public boolean execute(Player player, String... args) {
if (!PlayerFunctions.isInPlot(player)) {
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
return true;
}
// ||
Plot plot = PlayerFunctions.getCurrentPlot(player);
Plot plot;
if (player!=null) {
if (!PlayerFunctions.isInPlot(player)) {
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
return false;
}
plot = PlayerFunctions.getCurrentPlot(player);
}
else {
if (args.length!=2) {
PlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE);
return false;
}
PlotWorld plotworld = PlotMain.getWorldSettings(args[0]);
if (plotworld==null) {
PlayerFunctions.sendMessage(player, C.NOT_VALID_WORLD);
return false;
}
try {
String[] split = args[1].split(";");
PlotId id = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
plot = PlotHelper.getPlot(Bukkit.getWorld(plotworld.worldname), id);
if (plot==null) {
PlayerFunctions.sendMessage(player, C.NOT_VALID_PLOT_ID);
}
}
catch (Exception e) {
PlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE);
return false;
}
}
boolean hasOwner = plot.hasOwner();
boolean containsEveryone;

View File

@ -20,7 +20,7 @@ import org.bukkit.inventory.meta.ItemMeta;
public class Inventory extends SubCommand {
public Inventory() {
super("inventory", "plots.inventory", "Open a command inventory", "inventory", "inv", CommandCategory.INFO);
super("inventory", "plots.inventory", "Open a command inventory", "inventory", "inv", CommandCategory.INFO, true);
}
@Override

View File

@ -21,7 +21,7 @@ import com.intellectualcrafters.plot.Plot;
public class Kick extends SubCommand {
public Kick() {
super(Command.KICK, "Kick a player from your plot", "kick", CommandCategory.ACTIONS);
super(Command.KICK, "Kick a player from your plot", "kick", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -45,20 +45,14 @@ public class MainCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (!(sender instanceof Player)) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
new Reload().executeConsole(args);
}
}
else {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + C.HELP_HEADER.s());
PlotMain.sendConsoleSenderMessage("&6/plots reload &c-&6 reloads the plugin");
}
return false;
Player player;
if (sender instanceof Player) {
player = (Player) sender;
}
Player player = (Player) sender;
if (!player.hasPermission("plots.use")) {
else {
player = null;
}
if (PlotMain.hasPermission(player, "plots.use")) {
return no_permission(player);
}
if ((args.length < 1)
@ -106,7 +100,13 @@ public class MainCommand implements CommandExecutor {
arguments[x - 1] = args[x];
}
if (command.permission.hasPermission(player)) {
return command.execute(player, arguments);
if (player!=null || !command.isPlayer ) {
return command.execute(player, arguments);
}
else {
PlayerFunctions.sendMessage(player, C.IS_CONSOLE);
return false;
}
}
else {
return no_permission(player);

View File

@ -36,7 +36,7 @@ public class Merge extends SubCommand {
public static String[] aliases = new String[] { "n", "e", "s", "w" };
public Merge() {
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS);
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS, true);
}
public static String direction(float yaw) {

View File

@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
public class Paste extends SubCommand {
public Paste() {
super(Command.PASTE, "Paste a plot", "paste", CommandCategory.ACTIONS);
super(Command.PASTE, "Paste a plot", "paste", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
* and/or monetize any of our intellectual property. IntellectualCrafters is not
* affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
*
* >> File = Purge.java >> Generated by: Citymonstret at 2014-08-09 01:42
*/
package com.intellectualcrafters.plot.commands;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.PlotWorld;
import com.intellectualcrafters.plot.database.DBFunc;
/**
* @Deprecated
*/
public class Purge extends SubCommand {
public Purge() {
super("purge", "plots.admin", "Purge all plots for a world", "", "purge", CommandCategory.ACTIONS, false);
}
@Override
public boolean execute(Player plr, String... args) {
if (args.length!=1) {
PlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX);
return false;
}
PlotWorld plotworld = PlotMain.getWorldSettings(args[0]);
if (plotworld == null) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false;
}
if (plr!=null) {
PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
return false;
}
DBFunc.purge(args[0]);
PlayerFunctions.sendMessage(plr, (C.PURGE_SUCCESS));
return true;
}
}

View File

@ -17,7 +17,7 @@ public class Rate extends SubCommand {
*/
public Rate() {
super("rate", "plots.rate", "Rate the plot", "rate {0-10}", "rt", CommandCategory.ACTIONS);
super("rate", "plots.rate", "Rate the plot", "rate {0-10}", "rt", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -20,7 +20,10 @@ import com.intellectualcrafters.plot.PlotMain;
public class Reload extends SubCommand {
public Reload() {
super("reload", "plots.admin", "Reload configurations", "", "reload", CommandCategory.INFO);
super("reload", "plots.admin", "Reload configurations", "", "reload", CommandCategory.INFO, false);
// TODO reload worlds as well
}
@Override
@ -30,12 +33,7 @@ public class Reload extends SubCommand {
PlotMain.BroadcastWithPerms(C.RELOADED_CONFIGS);
}
catch (Exception e) {
if (plr != null) {
PlayerFunctions.sendMessage(plr, C.RELOAD_FAILED);
}
else {
PlotMain.sendConsoleSenderMessage(C.RELOAD_FAILED);
}
PlayerFunctions.sendMessage(plr, C.RELOAD_FAILED);
}
return true;
}

View File

@ -11,7 +11,9 @@ import com.intellectualcrafters.plot.SchematicHandler;
public class Schematic extends SubCommand {
public Schematic() {
super("schematic", "plots.admin", "Schematic Command", "schematic {arg}", "sch", CommandCategory.ACTIONS);
super("schematic", "plots.admin", "Schematic Command", "schematic {arg}", "sch", CommandCategory.ACTIONS, true);
// TODO command to fetch schematic from worldedit directory
}
@Override

View File

@ -40,7 +40,7 @@ import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
public class Set extends SubCommand {
public Set() {
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS);
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS, true);
}
public static String[] values = new String[] { "biome", "wall", "wall_filling", "floor", "alias", "home", "rain",

View File

@ -23,7 +23,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
public class SetOwner extends SubCommand {
public SetOwner() {
super("setowner", "plots.admin", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS);
super("setowner", "plots.admin", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS, true);
}
/*

View File

@ -54,15 +54,22 @@ public class Setup extends SubCommand implements Listener {
}
public Setup() {
super("setup", "plots.admin", "Setup a PlotWorld", "setup {world}", "setup", CommandCategory.ACTIONS);
super("setup", "plots.admin", "Setup a PlotWorld", "setup {world}", "setup", CommandCategory.ACTIONS, false);
}
@Override
public boolean execute(Player plr, String... args) {
boolean finished = false;
String plrname;
if (setupMap.containsKey(plr.getName())) {
SetupObject object = setupMap.get(plr.getName());
if (plr==null) {
plrname = "";
}
else {
plrname = plr.getName();
}
if (setupMap.containsKey(plrname)) {
SetupObject object = setupMap.get(plrname);
if (object.getCurrent() == object.getMax()) {
ConfigurationNode[] steps = object.step;
String world = object.world;
@ -88,7 +95,7 @@ public class Setup extends SubCommand implements Listener {
}
sendMessage(plr, C.SETUP_FINISHED, object.world);
setupMap.remove(plr.getName());
setupMap.remove(plrname);
return true;
}
@ -100,7 +107,7 @@ public class Setup extends SubCommand implements Listener {
}
else {
if (args[0].equalsIgnoreCase("cancel")) {
setupMap.remove(plr.getName());
setupMap.remove(plrname);
PlayerFunctions.sendMessage(plr, "&cCancelled setup.");
return true;
}
@ -189,9 +196,9 @@ public class Setup extends SubCommand implements Listener {
plotworld = new DefaultPlotWorld(world);
}
setupMap.put(plr.getName(), new SetupObject(world, plotworld, args[1]));
setupMap.put(plrname, new SetupObject(world, plotworld, args[1]));
sendMessage(plr, C.SETUP_INIT);
SetupObject object = setupMap.get(plr.getName());
SetupObject object = setupMap.get(plrname);
ConfigurationNode step = object.step[object.current];
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue()
+ "");

View File

@ -8,6 +8,7 @@
package com.intellectualcrafters.plot.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.C;
@ -19,7 +20,7 @@ import com.intellectualcrafters.plot.PlayerFunctions;
* @author Citymonstret
*/
public abstract class SubCommand {
public boolean isPlayer;
/**
* Command
*/
@ -59,13 +60,14 @@ public abstract class SubCommand {
* CommandCategory. Pick whichever closests to what you want.
*/
public SubCommand(String cmd, String permission, String description, String usage, String alias,
CommandCategory category) {
CommandCategory category, boolean isPlayer) {
this.cmd = cmd;
this.permission = new CommandPermission(permission);
this.description = description;
this.alias = alias;
this.usage = usage;
this.category = category;
this.isPlayer = isPlayer;
}
/**
@ -78,13 +80,14 @@ public abstract class SubCommand {
* @param category
* CommandCategory. Pick whichever closests to what you want.
*/
public SubCommand(Command command, String description, String usage, CommandCategory category) {
public SubCommand(Command command, String description, String usage, CommandCategory category, boolean isPlayer) {
this.cmd = command.getCommand();
this.permission = command.getPermission();
this.alias = command.getAlias();
this.description = description;
this.usage = usage;
this.category = category;
this.isPlayer = isPlayer;
}
/**

View File

@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.PlotMain;
public class TP extends SubCommand {
public TP() {
super(Command.TP, "Teleport to a plot", "tp {alias|id}", CommandCategory.TELEPORT);
super(Command.TP, "Teleport to a plot", "tp {alias|id}", CommandCategory.TELEPORT, true);
}
@Override

View File

@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
public class Trusted extends SubCommand {
public Trusted() {
super(Command.TRUSTED, "Manage trusted users for a plot", "trusted {add|remove} {player}", CommandCategory.ACTIONS);
super(Command.TRUSTED, "Manage trusted users for a plot", "trusted {add|remove} {player}", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
public class Unlink extends SubCommand {
public Unlink() {
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS);
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS, true);
}
@Override

View File

@ -22,7 +22,7 @@ import com.intellectualcrafters.plot.PlotMain;
public class Visit extends SubCommand {
public Visit() {
super("visit", "plots.visit", "Visit someones plot", "visit {player} [#]", "v", CommandCategory.TELEPORT);
super("visit", "plots.visit", "Visit someones plot", "visit {player} [#]", "v", CommandCategory.TELEPORT, true);
}
public List<Plot> getPlots(UUID uuid) {

View File

@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.UUIDHandler;
public class list extends SubCommand {
public list() {
super(Command.LIST, "List all plots", "list {mine|all|world}", CommandCategory.INFO);
super(Command.LIST, "List all plots", "list {mine|shared|all|world}", CommandCategory.INFO, false);
}
@Override
@ -35,11 +35,16 @@ public class list extends SubCommand {
if (args.length < 1) {
StringBuilder builder = new StringBuilder();
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all" }));
if (plr!=null) {
builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all" }));
}
else {
builder.append(getArgumentList(new String[] { "all" }));
}
PlayerFunctions.sendMessage(plr, builder.toString());
return true;
}
if (args[0].equalsIgnoreCase("mine")) {
if (args[0].equalsIgnoreCase("mine") && plr!=null) {
StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "your") + "\n");
int idx = 0;
@ -58,7 +63,7 @@ public class list extends SubCommand {
return true;
}
else
if (args[0].equalsIgnoreCase("shared")) {
if (args[0].equalsIgnoreCase("shared") && plr!=null) {
StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all") + "\n");
for (Plot p : PlotMain.getPlots()) {
@ -86,7 +91,7 @@ public class list extends SubCommand {
return true;
}
else
if (args[0].equalsIgnoreCase("world")) {
if (args[0].equalsIgnoreCase("world") && plr!=null) {
StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all") + "\n");
HashMap<PlotId, Plot> plots = PlotMain.getPlots(plr.getWorld());

View File

@ -23,7 +23,7 @@ import java.util.ArrayList;
public class plugin extends SubCommand {
public plugin() {
super("plugin", "plots.use", "Show plugin information", "plugin", "pl", CommandCategory.INFO);
super("plugin", "plots.use", "Show plugin information", "plugin", "pl", CommandCategory.INFO, false);
}
public static String

View File

@ -629,6 +629,10 @@ public class DBFunc {
PlotMain.getMain().getServer().getScheduler().runTaskAsynchronously(PlotMain.getMain(), r);
}
public static void purge(final String world) {
// TODO purge
}
/**
* @param plot
* @param position