mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Added support for console messages (untested)
This commit is contained in:
parent
2435eab96a
commit
0010b06afa
@ -16,6 +16,11 @@ import org.bukkit.ChatColor;
|
|||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public enum C {
|
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
|
Clipboard
|
||||||
*/
|
*/
|
||||||
@ -128,6 +133,11 @@ public enum C {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
COMMAND_WENT_WRONG("&cSomething went wrong when executing that command..."),
|
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}
|
* No {plot}
|
||||||
*/
|
*/
|
||||||
@ -190,6 +200,7 @@ public enum C {
|
|||||||
PLOT_INFO_UNCLAIMED("&cPlot &6%s&c is not yet claimed"),
|
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_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,"),
|
PLOT_USER_LIST(" &6%user%&c,"),
|
||||||
|
INFO_SYNTAX_CONSOLE("/plot info {world} X;Y"),
|
||||||
/*
|
/*
|
||||||
* Generating
|
* Generating
|
||||||
*/
|
*/
|
||||||
|
@ -156,6 +156,10 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean hasPermissions(Player player, String[] perms) {
|
public static boolean hasPermissions(Player player, String[] perms) {
|
||||||
|
// Assumes null player is console.
|
||||||
|
if (player==null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.PlotWorld;
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class Auto extends SubCommand {
|
public class Auto extends SubCommand {
|
||||||
public Auto() {
|
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!!!!!!!!!!!!
|
// TODO auto claim a mega plot!!!!!!!!!!!!
|
||||||
|
@ -26,7 +26,7 @@ public class Camera extends SubCommand implements Listener {
|
|||||||
private CameraAPI api;
|
private CameraAPI api;
|
||||||
|
|
||||||
public Camera() {
|
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.api = CameraAPI.getInstance();
|
||||||
this.travelers = new ArrayList<String>();
|
this.travelers = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
|||||||
public class Claim extends SubCommand {
|
public class Claim extends SubCommand {
|
||||||
|
|
||||||
public Claim() {
|
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
|
@Override
|
||||||
|
@ -20,7 +20,10 @@ import com.intellectualcrafters.plot.Plot;
|
|||||||
public class Clear extends SubCommand {
|
public class Clear extends SubCommand {
|
||||||
|
|
||||||
public Clear() {
|
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
|
@Override
|
||||||
|
@ -13,7 +13,7 @@ import static com.intellectualcrafters.plot.PlotSelection.currentSelection;
|
|||||||
public class Clipboard extends SubCommand {
|
public class Clipboard extends SubCommand {
|
||||||
|
|
||||||
public Clipboard() {
|
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
|
@Override
|
||||||
|
@ -83,6 +83,10 @@ public enum Command {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
SET("set", "s"),
|
SET("set", "s"),
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
PURGE("purge"),
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,8 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-03.
|
* Created by Citymonstret on 2014-08-03.
|
||||||
*
|
*
|
||||||
@ -35,6 +37,6 @@ public class CommandPermission {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hasPermission(Player player) {
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class Copy extends SubCommand {
|
public class Copy extends SubCommand {
|
||||||
|
|
||||||
public Copy() {
|
public Copy() {
|
||||||
super(Command.COPY, "Copy a plot", "clear", CommandCategory.ACTIONS);
|
super(Command.COPY, "Copy a plot", "clear", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
@ -33,7 +34,7 @@ public class Debug extends SubCommand {
|
|||||||
// private extends SubCommand^Implements {Command, Information} from
|
// private extends SubCommand^Implements {Command, Information} from
|
||||||
// >>\\S.txt6\\
|
// >>\\S.txt6\\
|
||||||
public Debug() {
|
public Debug() {
|
||||||
super(Command.DEBUG, "Show debug information", "debug [msg]", CommandCategory.INFO);
|
super(Command.DEBUG, "Show debug information", "debug [msg]", CommandCategory.INFO, false);
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* This.
|
* This.
|
||||||
@ -43,7 +44,6 @@ public class Debug extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player plr, String... args) {
|
public boolean execute(Player plr, String... args) {
|
||||||
PlotMain.getWorldSettings(plr.getWorld());
|
|
||||||
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
for (C c : C.values()) {
|
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, "Owned Plots", PlotMain.getPlots().size()));
|
||||||
// information.append(getLine(line, "PlotWorld Size",
|
// information.append(getLine(line, "PlotWorld Size",
|
||||||
// PlotHelper.getWorldFolderSize() + "MB"));
|
// PlotHelper.getWorldFolderSize() + "MB"));
|
||||||
for (String world : PlotMain.getPlotWorlds()) {
|
for (String worldname : PlotMain.getPlotWorlds()) {
|
||||||
information.append(getLine(line, "World: " + world + " size", PlotHelper.getWorldFolderSize(Bukkit.getWorld(world))));
|
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(getSection(section, "RAM"));
|
||||||
information.append(getLine(line, "Free Ram", RUtils.getFreeRam() + "MB"));
|
information.append(getLine(line, "Free Ram", RUtils.getFreeRam() + "MB"));
|
||||||
information.append(getLine(line, "Total Ram", RUtils.getTotalRam() + "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) {
|
private String getLine(String line, String var, Object val) {
|
||||||
return line.replaceAll("%var%", var).replaceAll("%val%", "" + val) + "\n";
|
return line.replaceAll("%var%", var).replaceAll("%val%", "" + val) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
public class Delete extends SubCommand {
|
public class Delete extends SubCommand {
|
||||||
|
|
||||||
public Delete() {
|
public Delete() {
|
||||||
super(Command.DELETE, "Delete a plot", "delete", CommandCategory.ACTIONS);
|
super(Command.DELETE, "Delete a plot", "delete", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
|||||||
public class Denied extends SubCommand {
|
public class Denied extends SubCommand {
|
||||||
|
|
||||||
public Denied() {
|
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
|
@Override
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
*/
|
*/
|
||||||
public class Help extends SubCommand {
|
public class Help extends SubCommand {
|
||||||
public Help() {
|
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
|
@Override
|
||||||
|
@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
|||||||
public class Helpers extends SubCommand {
|
public class Helpers extends SubCommand {
|
||||||
|
|
||||||
public Helpers() {
|
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
|
@Override
|
||||||
|
@ -21,7 +21,7 @@ import com.intellectualcrafters.plot.PlotMain;
|
|||||||
public class Home extends SubCommand {
|
public class Home extends SubCommand {
|
||||||
|
|
||||||
public Home() {
|
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) {
|
private Plot isAlias(String a) {
|
||||||
|
@ -22,6 +22,9 @@ import com.intellectualcrafters.plot.C;
|
|||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
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.UUIDHandler;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
|
||||||
@ -31,18 +34,43 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
public class Info extends SubCommand {
|
public class Info extends SubCommand {
|
||||||
|
|
||||||
public Info() {
|
public Info() {
|
||||||
super(Command.INFO, "Display plot info", "info", CommandCategory.INFO);
|
super(Command.INFO, "Display plot info", "info", CommandCategory.INFO, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, String... args) {
|
public boolean execute(Player player, String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(player)) {
|
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
Plot plot;
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ||
|
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(player);
|
|
||||||
|
|
||||||
boolean hasOwner = plot.hasOwner();
|
boolean hasOwner = plot.hasOwner();
|
||||||
boolean containsEveryone;
|
boolean containsEveryone;
|
||||||
|
@ -20,7 +20,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
public class Inventory extends SubCommand {
|
public class Inventory extends SubCommand {
|
||||||
|
|
||||||
public Inventory() {
|
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
|
@Override
|
||||||
|
@ -21,7 +21,7 @@ import com.intellectualcrafters.plot.Plot;
|
|||||||
public class Kick extends SubCommand {
|
public class Kick extends SubCommand {
|
||||||
|
|
||||||
public Kick() {
|
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
|
@Override
|
||||||
|
@ -45,20 +45,14 @@ public class MainCommand implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
Player player;
|
||||||
if (args.length > 0) {
|
if (sender instanceof Player) {
|
||||||
if (args[0].equalsIgnoreCase("reload")) {
|
player = (Player) sender;
|
||||||
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 = (Player) sender;
|
else {
|
||||||
if (!player.hasPermission("plots.use")) {
|
player = null;
|
||||||
|
}
|
||||||
|
if (PlotMain.hasPermission(player, "plots.use")) {
|
||||||
return no_permission(player);
|
return no_permission(player);
|
||||||
}
|
}
|
||||||
if ((args.length < 1)
|
if ((args.length < 1)
|
||||||
@ -106,7 +100,13 @@ public class MainCommand implements CommandExecutor {
|
|||||||
arguments[x - 1] = args[x];
|
arguments[x - 1] = args[x];
|
||||||
}
|
}
|
||||||
if (command.permission.hasPermission(player)) {
|
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 {
|
else {
|
||||||
return no_permission(player);
|
return no_permission(player);
|
||||||
|
@ -36,7 +36,7 @@ public class Merge extends SubCommand {
|
|||||||
public static String[] aliases = new String[] { "n", "e", "s", "w" };
|
public static String[] aliases = new String[] { "n", "e", "s", "w" };
|
||||||
|
|
||||||
public Merge() {
|
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) {
|
public static String direction(float yaw) {
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class Paste extends SubCommand {
|
public class Paste extends SubCommand {
|
||||||
|
|
||||||
public Paste() {
|
public Paste() {
|
||||||
super(Command.PASTE, "Paste a plot", "paste", CommandCategory.ACTIONS);
|
super(Command.PASTE, "Paste a plot", "paste", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -17,7 +17,7 @@ public class Rate extends SubCommand {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public Rate() {
|
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
|
@Override
|
||||||
|
@ -20,7 +20,10 @@ import com.intellectualcrafters.plot.PlotMain;
|
|||||||
public class Reload extends SubCommand {
|
public class Reload extends SubCommand {
|
||||||
|
|
||||||
public Reload() {
|
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
|
@Override
|
||||||
@ -30,12 +33,7 @@ public class Reload extends SubCommand {
|
|||||||
PlotMain.BroadcastWithPerms(C.RELOADED_CONFIGS);
|
PlotMain.BroadcastWithPerms(C.RELOADED_CONFIGS);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
if (plr != null) {
|
PlayerFunctions.sendMessage(plr, C.RELOAD_FAILED);
|
||||||
PlayerFunctions.sendMessage(plr, C.RELOAD_FAILED);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
PlotMain.sendConsoleSenderMessage(C.RELOAD_FAILED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,9 @@ import com.intellectualcrafters.plot.SchematicHandler;
|
|||||||
public class Schematic extends SubCommand {
|
public class Schematic extends SubCommand {
|
||||||
|
|
||||||
public Schematic() {
|
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
|
@Override
|
||||||
|
@ -40,7 +40,7 @@ import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
|
|||||||
public class Set extends SubCommand {
|
public class Set extends SubCommand {
|
||||||
|
|
||||||
public Set() {
|
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",
|
public static String[] values = new String[] { "biome", "wall", "wall_filling", "floor", "alias", "home", "rain",
|
||||||
|
@ -23,7 +23,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
public class SetOwner extends SubCommand {
|
public class SetOwner extends SubCommand {
|
||||||
|
|
||||||
public SetOwner() {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,15 +54,22 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Setup() {
|
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
|
@Override
|
||||||
public boolean execute(Player plr, String... args) {
|
public boolean execute(Player plr, String... args) {
|
||||||
boolean finished = false;
|
String plrname;
|
||||||
|
|
||||||
if (setupMap.containsKey(plr.getName())) {
|
if (plr==null) {
|
||||||
SetupObject object = setupMap.get(plr.getName());
|
plrname = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
plrname = plr.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setupMap.containsKey(plrname)) {
|
||||||
|
SetupObject object = setupMap.get(plrname);
|
||||||
if (object.getCurrent() == object.getMax()) {
|
if (object.getCurrent() == object.getMax()) {
|
||||||
ConfigurationNode[] steps = object.step;
|
ConfigurationNode[] steps = object.step;
|
||||||
String world = object.world;
|
String world = object.world;
|
||||||
@ -88,7 +95,7 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
}
|
}
|
||||||
sendMessage(plr, C.SETUP_FINISHED, object.world);
|
sendMessage(plr, C.SETUP_FINISHED, object.world);
|
||||||
|
|
||||||
setupMap.remove(plr.getName());
|
setupMap.remove(plrname);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -100,7 +107,7 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (args[0].equalsIgnoreCase("cancel")) {
|
if (args[0].equalsIgnoreCase("cancel")) {
|
||||||
setupMap.remove(plr.getName());
|
setupMap.remove(plrname);
|
||||||
PlayerFunctions.sendMessage(plr, "&cCancelled setup.");
|
PlayerFunctions.sendMessage(plr, "&cCancelled setup.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -189,9 +196,9 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
plotworld = new DefaultPlotWorld(world);
|
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);
|
sendMessage(plr, C.SETUP_INIT);
|
||||||
SetupObject object = setupMap.get(plr.getName());
|
SetupObject object = setupMap.get(plrname);
|
||||||
ConfigurationNode step = object.step[object.current];
|
ConfigurationNode step = object.step[object.current];
|
||||||
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue()
|
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue()
|
||||||
+ "");
|
+ "");
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
@ -19,7 +20,7 @@ import com.intellectualcrafters.plot.PlayerFunctions;
|
|||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public abstract class SubCommand {
|
public abstract class SubCommand {
|
||||||
|
public boolean isPlayer;
|
||||||
/**
|
/**
|
||||||
* Command
|
* Command
|
||||||
*/
|
*/
|
||||||
@ -59,13 +60,14 @@ public abstract class SubCommand {
|
|||||||
* CommandCategory. Pick whichever closests to what you want.
|
* CommandCategory. Pick whichever closests to what you want.
|
||||||
*/
|
*/
|
||||||
public SubCommand(String cmd, String permission, String description, String usage, String alias,
|
public SubCommand(String cmd, String permission, String description, String usage, String alias,
|
||||||
CommandCategory category) {
|
CommandCategory category, boolean isPlayer) {
|
||||||
this.cmd = cmd;
|
this.cmd = cmd;
|
||||||
this.permission = new CommandPermission(permission);
|
this.permission = new CommandPermission(permission);
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
this.usage = usage;
|
this.usage = usage;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
this.isPlayer = isPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,13 +80,14 @@ public abstract class SubCommand {
|
|||||||
* @param category
|
* @param category
|
||||||
* CommandCategory. Pick whichever closests to what you want.
|
* 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.cmd = command.getCommand();
|
||||||
this.permission = command.getPermission();
|
this.permission = command.getPermission();
|
||||||
this.alias = command.getAlias();
|
this.alias = command.getAlias();
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.usage = usage;
|
this.usage = usage;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
this.isPlayer = isPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.PlotMain;
|
|||||||
public class TP extends SubCommand {
|
public class TP extends SubCommand {
|
||||||
|
|
||||||
public TP() {
|
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
|
@Override
|
||||||
|
@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
|||||||
public class Trusted extends SubCommand {
|
public class Trusted extends SubCommand {
|
||||||
|
|
||||||
public Trusted() {
|
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
|
@Override
|
||||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
|
|||||||
public class Unlink extends SubCommand {
|
public class Unlink extends SubCommand {
|
||||||
|
|
||||||
public Unlink() {
|
public Unlink() {
|
||||||
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS);
|
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ import com.intellectualcrafters.plot.PlotMain;
|
|||||||
|
|
||||||
public class Visit extends SubCommand {
|
public class Visit extends SubCommand {
|
||||||
public Visit() {
|
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) {
|
public List<Plot> getPlots(UUID uuid) {
|
||||||
|
@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.UUIDHandler;
|
|||||||
public class list extends SubCommand {
|
public class list extends SubCommand {
|
||||||
|
|
||||||
public list() {
|
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
|
@Override
|
||||||
@ -35,11 +35,16 @@ public class list extends SubCommand {
|
|||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
|
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());
|
PlayerFunctions.sendMessage(plr, builder.toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("mine")) {
|
if (args[0].equalsIgnoreCase("mine") && plr!=null) {
|
||||||
StringBuilder string = new StringBuilder();
|
StringBuilder string = new StringBuilder();
|
||||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "your") + "\n");
|
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "your") + "\n");
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
@ -58,7 +63,7 @@ public class list extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (args[0].equalsIgnoreCase("shared")) {
|
if (args[0].equalsIgnoreCase("shared") && plr!=null) {
|
||||||
StringBuilder string = new StringBuilder();
|
StringBuilder string = new StringBuilder();
|
||||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all") + "\n");
|
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all") + "\n");
|
||||||
for (Plot p : PlotMain.getPlots()) {
|
for (Plot p : PlotMain.getPlots()) {
|
||||||
@ -86,7 +91,7 @@ public class list extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (args[0].equalsIgnoreCase("world")) {
|
if (args[0].equalsIgnoreCase("world") && plr!=null) {
|
||||||
StringBuilder string = new StringBuilder();
|
StringBuilder string = new StringBuilder();
|
||||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all") + "\n");
|
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all") + "\n");
|
||||||
HashMap<PlotId, Plot> plots = PlotMain.getPlots(plr.getWorld());
|
HashMap<PlotId, Plot> plots = PlotMain.getPlots(plr.getWorld());
|
||||||
|
@ -23,7 +23,7 @@ import java.util.ArrayList;
|
|||||||
public class plugin extends SubCommand {
|
public class plugin extends SubCommand {
|
||||||
|
|
||||||
public plugin() {
|
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
|
public static String
|
||||||
|
@ -629,6 +629,10 @@ public class DBFunc {
|
|||||||
PlotMain.getMain().getServer().getScheduler().runTaskAsynchronously(PlotMain.getMain(), r);
|
PlotMain.getMain().getServer().getScheduler().runTaskAsynchronously(PlotMain.getMain(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void purge(final String world) {
|
||||||
|
// TODO purge
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param position
|
* @param position
|
||||||
|
Loading…
Reference in New Issue
Block a user