mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
commit
This commit is contained in:
parent
dce25ba07a
commit
a39ec22c8c
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -44,7 +44,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
|||||||
usage = "/plot add <player>",
|
usage = "/plot add <player>",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
permission = "plots.add",
|
permission = "plots.add",
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Add extends SubCommand {
|
public class Add extends SubCommand {
|
||||||
|
|
||||||
@ -55,8 +55,7 @@ public class Add extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -34,13 +34,13 @@ import com.intellectualcrafters.plot.util.EconHandler;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "auto",
|
command = "auto",
|
||||||
permission = "plots.auto",
|
permission = "plots.auto",
|
||||||
category = CommandCategory.CLAIMING,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
description = "Claim the nearest plot",
|
description = "Claim the nearest plot",
|
||||||
aliases = {"a"},
|
aliases = {"a"},
|
||||||
usage = "/plot auto"
|
usage = "/plot auto"
|
||||||
@ -77,8 +77,8 @@ public class Auto extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
String world;
|
String world;
|
||||||
int size_x = 1;
|
int size_x = 1;
|
||||||
int size_z = 1;
|
int size_z = 1;
|
||||||
|
@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.util.EconHandler;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "buy",
|
command = "buy",
|
||||||
@ -45,13 +45,13 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
usage = "/plot buy",
|
usage = "/plot buy",
|
||||||
permission = "plots.buy",
|
permission = "plots.buy",
|
||||||
category = CommandCategory.CLAIMING,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Buy extends SubCommand {
|
public class Buy extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (EconHandler.manager == null) {
|
if (EconHandler.manager == null) {
|
||||||
return sendMessage(plr, C.ECON_DISABLED);
|
return sendMessage(plr, C.ECON_DISABLED);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "chat",
|
command = "chat",
|
||||||
@ -13,13 +13,13 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
usage = "/plot chat [on|off]",
|
usage = "/plot chat [on|off]",
|
||||||
permission = "plots.chat",
|
permission = "plots.chat",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Chat extends SubCommand {
|
public class Chat extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final String world = plr.getLocation().getWorld();
|
final String world = plr.getLocation().getWorld();
|
||||||
if (!PS.get().isPlotWorld(world)) {
|
if (!PS.get().isPlotWorld(world)) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
return !sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
|
@ -35,14 +35,14 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "claim",
|
command = "claim",
|
||||||
aliases = {"c"},
|
aliases = {"c"},
|
||||||
description = "Claim the current plot you're standing on",
|
description = "Claim the current plot you're standing on",
|
||||||
category = CommandCategory.CLAIMING,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.claim",
|
permission = "plots.claim",
|
||||||
usage = "/plot claim"
|
usage = "/plot claim"
|
||||||
)
|
)
|
||||||
@ -96,8 +96,8 @@ public class Claim extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
String schematic = "";
|
String schematic = "";
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
schematic = args[0];
|
schematic = args[0];
|
||||||
|
@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "clear",
|
command = "clear",
|
||||||
@ -48,39 +48,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class Clear extends SubCommand {
|
public class Clear extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
if (plr == null) {
|
|
||||||
// Is console
|
|
||||||
if (args.length < 2) {
|
|
||||||
PS.log("You need to specify two arguments: ID (0;0) & World (world)");
|
|
||||||
} else {
|
|
||||||
final PlotId id = PlotId.fromString(args[0]);
|
|
||||||
final String world = args[1];
|
|
||||||
if (id == null) {
|
|
||||||
PS.log("Invalid Plot ID: " + args[0]);
|
|
||||||
} else {
|
|
||||||
if (!PS.get().isPlotWorld(world)) {
|
|
||||||
PS.log("Invalid plot world: " + world);
|
|
||||||
} else {
|
|
||||||
final Plot plot = MainUtil.getPlot(world, id);
|
|
||||||
if (plot == null) {
|
|
||||||
PS.log("Could not find plot " + args[0] + " in world " + world);
|
|
||||||
} else {
|
|
||||||
Runnable runnable = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MainUtil.clear(plot, plot.owner == null, null);
|
|
||||||
PS.log("Plot " + plot.getId().toString() + " cleared.");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
TaskManager.runTask(runnable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot;
|
final Plot plot;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
|
@ -29,12 +29,6 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
|
||||||
import com.plotsquared.bukkit.generator.AugmentedPopulator;
|
|
||||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
|
||||||
import com.plotsquared.bukkit.generator.HybridGen;
|
|
||||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -48,21 +42,25 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
|
import com.plotsquared.bukkit.generator.AugmentedPopulator;
|
||||||
|
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||||
|
import com.plotsquared.bukkit.generator.HybridGen;
|
||||||
import com.plotsquared.bukkit.util.SetupUtils;
|
import com.plotsquared.bukkit.util.SetupUtils;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "cluser",
|
command = "cluser",
|
||||||
aliases = {"clusters"},
|
aliases = {"clusters"},
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.cluster",
|
permission = "plots.cluster",
|
||||||
description = "Manage a plot cluster"
|
description = "Manage a plot cluster"
|
||||||
)
|
)
|
||||||
public class Cluster extends SubCommand {
|
public class Cluster extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
// return arguments
|
// return arguments
|
||||||
|
@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -41,14 +41,13 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
aliases = {"msg"},
|
aliases = {"msg"},
|
||||||
description = "Comment on a plot",
|
description = "Comment on a plot",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plot.comment"
|
permission = "plot.comment"
|
||||||
)
|
)
|
||||||
public class Comment extends SubCommand {
|
public class Comment extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
sendMessage(player, C.COMMENT_SYNTAX, StringUtils.join(CommentManager.inboxes.keySet(),"|"));
|
sendMessage(player, C.COMMENT_SYNTAX, StringUtils.join(CommentManager.inboxes.keySet(),"|"));
|
||||||
return false;
|
return false;
|
||||||
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
@ -43,7 +43,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Condense a plotworld",
|
description = "Condense a plotworld",
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = PS.class
|
requiredType = RequiredType.CONSOLE
|
||||||
)
|
)
|
||||||
public class Condense extends SubCommand {
|
public class Condense extends SubCommand {
|
||||||
|
|
||||||
@ -54,8 +54,7 @@ public class Condense extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, String ... args) {
|
public boolean onCommand(final PlotPlayer plr, String ... args) {
|
||||||
final PlotPlayer plr = null;
|
|
||||||
if ((args.length != 2) && (args.length != 3)) {
|
if ((args.length != 2) && (args.length != 3)) {
|
||||||
MainUtil.sendMessage(plr, "/plot condense <world> <start|stop|info> [radius]");
|
MainUtil.sendMessage(plr, "/plot condense <world> <start|stop|info> [radius]");
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.CmdInstance;
|
import com.intellectualcrafters.plot.object.CmdInstance;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.util.CmdConfirm;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "confirm",
|
command = "confirm",
|
||||||
@ -39,8 +39,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class Confirm extends SubCommand {
|
public class Confirm extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
CmdInstance command = CmdConfirm.getPending(plr);
|
CmdInstance command = CmdConfirm.getPending(plr);
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
MainUtil.sendMessage(plr, C.FAILED_CONFIRM);
|
MainUtil.sendMessage(plr, C.FAILED_CONFIRM);
|
||||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "copy",
|
command = "copy",
|
||||||
@ -38,7 +38,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
description = "Copy a plot",
|
description = "Copy a plot",
|
||||||
usage = "/plot copy <X;Z>",
|
usage = "/plot copy <X;Z>",
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Copy extends SubCommand {
|
public class Copy extends SubCommand {
|
||||||
|
|
||||||
@ -49,8 +49,7 @@ public class Copy extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot1 = MainUtil.getPlot(loc);
|
final Plot plot1 = MainUtil.getPlot(loc);
|
||||||
if (plot1 == null) {
|
if (plot1 == null) {
|
||||||
|
@ -29,13 +29,13 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "createroadschematic",
|
command = "createroadschematic",
|
||||||
aliases = {"crs"},
|
aliases = {"crs"},
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.createroadschematic",
|
permission = "plots.createroadschematic",
|
||||||
description = "Add a road schematic to your world using the roads around your current plot",
|
description = "Add a road schematic to your world using the roads around your current plot",
|
||||||
usage = "/plot createroadschematic"
|
usage = "/plot createroadschematic"
|
||||||
@ -43,8 +43,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class CreateRoadSchematic extends SubCommand {
|
public class CreateRoadSchematic extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer player, final String ... args) {
|
||||||
final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -6,7 +6,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.database.MySQL;
|
import com.intellectualcrafters.plot.database.MySQL;
|
||||||
import com.intellectualcrafters.plot.database.SQLManager;
|
import com.intellectualcrafters.plot.database.SQLManager;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -16,7 +16,7 @@ import com.intellectualcrafters.plot.util.StringComparison;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "database",
|
command = "database",
|
||||||
@ -24,7 +24,9 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
permission = "plots.database",
|
permission = "plots.database",
|
||||||
description = "Convert/Backup Storage",
|
description = "Convert/Backup Storage",
|
||||||
|
requiredType = RequiredType.CONSOLE,
|
||||||
usage = "/plots database <type> [details...]"
|
usage = "/plots database <type> [details...]"
|
||||||
|
|
||||||
)
|
)
|
||||||
public class Database extends SubCommand {
|
public class Database extends SubCommand {
|
||||||
|
|
||||||
@ -73,8 +75,7 @@ public class Database extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
return sendMessage(plr, "/plot database [sqlite/mysql]");
|
return sendMessage(plr, "/plot database [sqlite/mysql]");
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.Lag;
|
import com.intellectualcrafters.plot.util.Lag;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debug",
|
command = "debug",
|
||||||
@ -39,8 +39,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class Debug extends SubCommand {
|
public class Debug extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
||||||
final StringBuilder msg = new StringBuilder();
|
final StringBuilder msg = new StringBuilder();
|
||||||
for (final C c : C.values()) {
|
for (final C c : C.values()) {
|
||||||
|
@ -9,14 +9,14 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debugallowunsafe",
|
command = "debugallowunsafe",
|
||||||
description = "Allow unsafe actions until toggled off",
|
description = "Allow unsafe actions until toggled off",
|
||||||
usage = "/plot debugallowunsafe",
|
usage = "/plot debugallowunsafe",
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.debugallowunsafe"
|
permission = "plots.debugallowunsafe"
|
||||||
)
|
)
|
||||||
public class DebugAllowUnsafe extends SubCommand {
|
public class DebugAllowUnsafe extends SubCommand {
|
||||||
@ -24,8 +24,8 @@ public class DebugAllowUnsafe extends SubCommand {
|
|||||||
public static final List<UUID> unsafeAllowed = new ArrayList<>();
|
public static final List<UUID> unsafeAllowed = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (unsafeAllowed.contains(plr.getUUID())) {
|
if (unsafeAllowed.contains(plr.getUUID())) {
|
||||||
unsafeAllowed.remove(plr.getUUID());
|
unsafeAllowed.remove(plr.getUUID());
|
||||||
sendMessage(plr, C.DEBUGALLOWUNSAFE_OFF);
|
sendMessage(plr, C.DEBUGALLOWUNSAFE_OFF);
|
||||||
|
@ -41,13 +41,13 @@ import com.intellectualcrafters.plot.util.EventUtil;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debugclaimtest",
|
command = "debugclaimtest",
|
||||||
description = "If you accidentally delete your database, this command will attempt to restore all plots based on the data from plot sighs. Execution time may vary",
|
description = "If you accidentally delete your database, this command will attempt to restore all plots based on the data from plot sighs. Execution time may vary",
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = PS.class,
|
requiredType = RequiredType.CONSOLE,
|
||||||
permission = "plots.debugclaimtest"
|
permission = "plots.debugclaimtest"
|
||||||
)
|
)
|
||||||
public class DebugClaimTest extends SubCommand {
|
public class DebugClaimTest extends SubCommand {
|
||||||
@ -70,7 +70,7 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
return !MainUtil.sendMessage(null, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
|
return !MainUtil.sendMessage(null, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
|
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debugclear",
|
command = "debugclear",
|
||||||
@ -44,46 +44,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class DebugClear extends SubCommand {
|
public class DebugClear extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(final PlotPlayer plr, String[] args) {
|
||||||
final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
if (plr == null) {
|
|
||||||
// Is console
|
|
||||||
if (args.length < 2) {
|
|
||||||
PS.log("You need to specify two arguments: ID (0;0) & World (world)");
|
|
||||||
} else {
|
|
||||||
final PlotId id = PlotId.fromString(args[0]);
|
|
||||||
final String world = args[1];
|
|
||||||
if (id == null) {
|
|
||||||
PS.log("Invalid Plot ID: " + args[0]);
|
|
||||||
} else {
|
|
||||||
if (!PS.get().isPlotWorld(world) || !(PS.get().getPlotWorld(world) instanceof SquarePlotWorld)) {
|
|
||||||
PS.log("Invalid plot world: " + world);
|
|
||||||
} else {
|
|
||||||
final Plot plot = MainUtil.getPlot(world, id);
|
|
||||||
if (plot == null) {
|
|
||||||
PS.log("Could not find plot " + args[0] + " in world " + world);
|
|
||||||
} else {
|
|
||||||
final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
|
||||||
final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id);
|
|
||||||
if (MainUtil.runners.containsKey(plot)) {
|
|
||||||
MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
MainUtil.runners.put(plot, 1);
|
|
||||||
ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MainUtil.runners.remove(plot);
|
|
||||||
PS.log("Plot " + plot.getId().toString() + " cleared.");
|
|
||||||
PS.log("&aDone!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if ((plot == null) || !(PS.get().getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) {
|
if ((plot == null) || !(PS.get().getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) {
|
||||||
@ -109,8 +70,6 @@ public class DebugClear extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, "&aDone!");
|
MainUtil.sendMessage(plr, "&aDone!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// sign
|
|
||||||
// wall
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -64,17 +64,12 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
public class DebugExec extends SubCommand {
|
public class DebugExec extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
final PlotPlayer player = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
final List<String> allowed_params = Arrays.asList("calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "trim-check");
|
final List<String> allowed_params = Arrays.asList("calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "trim-check");
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
final String arg = args[0].toLowerCase();
|
final String arg = args[0].toLowerCase();
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case "analyze": {
|
case "analyze": {
|
||||||
if (player == null) {
|
|
||||||
MainUtil.sendMessage(player, C.IS_CONSOLE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Plot plot = MainUtil.getPlot(player.getLocation());
|
Plot plot = MainUtil.getPlot(player.getLocation());
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "fill",
|
command = "fill",
|
||||||
@ -39,13 +39,12 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
usage = "/plot fill",
|
usage = "/plot fill",
|
||||||
aliases = {"debugfill"},
|
aliases = {"debugfill"},
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class DebugFill extends SubCommand {
|
public class DebugFill extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer player, final String ... args) {
|
||||||
final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (args.length != 1 || (!args[0].equalsIgnoreCase("outline") && !args[0].equalsIgnoreCase("all"))) {
|
if (args.length != 1 || (!args[0].equalsIgnoreCase("outline") && !args[0].equalsIgnoreCase("all"))) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot fill <outline|all>");
|
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot fill <outline|all>");
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,14 +35,14 @@ import com.intellectualcrafters.plot.util.BlockManager;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debugfixflags",
|
command = "debugfixflags",
|
||||||
usage = "/plot debugfixflags <world>",
|
usage = "/plot debugfixflags <world>",
|
||||||
permission = "plots.debugfixflags",
|
permission = "plots.debugfixflags",
|
||||||
description = "Attempt to fix all flags for a world",
|
description = "Attempt to fix all flags for a world",
|
||||||
requiredType = PS.class,
|
requiredType = RequiredType.CONSOLE,
|
||||||
category = CommandCategory.DEBUG
|
category = CommandCategory.DEBUG
|
||||||
)
|
)
|
||||||
public class DebugFixFlags extends SubCommand {
|
public class DebugFixFlags extends SubCommand {
|
||||||
@ -54,8 +54,7 @@ public class DebugFixFlags extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
final PlotPlayer plr = null;
|
|
||||||
final String world = args[0];
|
final String world = args[0];
|
||||||
if (!BlockManager.manager.isWorld(world) || !PS.get().isPlotWorld(world)) {
|
if (!BlockManager.manager.isWorld(world) || !PS.get().isPlotWorld(world)) {
|
||||||
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
|
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
|
||||||
|
@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debugloadtest",
|
command = "debugloadtest",
|
||||||
@ -35,12 +35,12 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
description = "This debug command will force the reload of all plots in the DB",
|
description = "This debug command will force the reload of all plots in the DB",
|
||||||
usage = "/plot debugloadtest",
|
usage = "/plot debugloadtest",
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = PS.class
|
requiredType = RequiredType.CONSOLE
|
||||||
)
|
)
|
||||||
public class DebugLoadTest extends SubCommand {
|
public class DebugLoadTest extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
try {
|
try {
|
||||||
final Field fPlots = PS.class.getDeclaredField("plots");
|
final Field fPlots = PS.class.getDeclaredField("plots");
|
||||||
fPlots.setAccessible(true);
|
fPlots.setAccessible(true);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.bukkit.BukkitMain;
|
import com.plotsquared.bukkit.BukkitMain;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -26,7 +26,7 @@ import java.io.IOException;
|
|||||||
public class DebugPaste extends SubCommand {
|
public class DebugPaste extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, String[] args) {
|
public boolean onCommand(final PlotPlayer plr, String[] args) {
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -36,7 +36,7 @@ public class DebugPaste extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
latestLOG = HastebinUtility.upload(new File(BukkitMain.THIS.getDirectory(), "../../logs/latest.log"));
|
latestLOG = HastebinUtility.upload(new File(BukkitMain.THIS.getDirectory(), "../../logs/latest.log"));
|
||||||
} catch(final Exception e) {
|
} catch(final Exception e) {
|
||||||
caller.message("&clatest.log is too big to be pasted, will ignore");
|
plr.sendMessage("&clatest.log is too big to be pasted, will ignore");
|
||||||
latestLOG = "too big :(";
|
latestLOG = "too big :(";
|
||||||
}
|
}
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
@ -65,7 +65,7 @@ public class DebugPaste extends SubCommand {
|
|||||||
b.append("\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues");
|
b.append("\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues");
|
||||||
|
|
||||||
String link = HastebinUtility.upload(b.toString());
|
String link = HastebinUtility.upload(b.toString());
|
||||||
caller.message(C.DEBUG_REPORT_CREATED.s().replace("%url%", link));
|
plr.sendMessage(C.DEBUG_REPORT_CREATED.s().replace("%url%", link));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debugroadregen",
|
command = "debugroadregen",
|
||||||
usage = "/plot debugroadregen",
|
usage = "/plot debugroadregen",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
description = "Regenerate all roads based on the road schematic",
|
description = "Regenerate all roads based on the road schematic",
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
permission = "plots.debugroadregen"
|
permission = "plots.debugroadregen"
|
||||||
@ -42,8 +42,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class DebugRoadRegen extends SubCommand {
|
public class DebugRoadRegen extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer player, final String ... args) {
|
||||||
final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
final String world = loc.getWorld();
|
final String world = loc.getWorld();
|
||||||
if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) {
|
if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) {
|
||||||
|
@ -28,20 +28,20 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debugsavetest",
|
command = "debugsavetest",
|
||||||
permission = "plots.debugsavetest",
|
permission = "plots.debugsavetest",
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = PS.class,
|
requiredType = RequiredType.CONSOLE,
|
||||||
usage = "/plot debugsavetest",
|
usage = "/plot debugsavetest",
|
||||||
description = "This command will force the recreation of all plots in the DB"
|
description = "This command will force the recreation of all plots in the DB"
|
||||||
)
|
)
|
||||||
public class DebugSaveTest extends SubCommand {
|
public class DebugSaveTest extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
final ArrayList<Plot> plots = new ArrayList<Plot>();
|
final ArrayList<Plot> plots = new ArrayList<Plot>();
|
||||||
plots.addAll(PS.get().getPlots());
|
plots.addAll(PS.get().getPlots());
|
||||||
MainUtil.sendMessage(null, "&6Starting `DEBUGSAVETEST`");
|
MainUtil.sendMessage(null, "&6Starting `DEBUGSAVETEST`");
|
||||||
|
@ -30,7 +30,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
|||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Debug UUID conversion",
|
description = "Debug UUID conversion",
|
||||||
usage = "/plot uuidconvert <lower|offline|online>",
|
usage = "/plot uuidconvert <lower|offline|online>",
|
||||||
requiredType = PS.class,
|
requiredType = RequiredType.CONSOLE,
|
||||||
category = CommandCategory.DEBUG
|
category = CommandCategory.DEBUG
|
||||||
)
|
)
|
||||||
public class DebugUUID extends SubCommand {
|
public class DebugUUID extends SubCommand {
|
||||||
@ -69,7 +69,7 @@ public class DebugUUID extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
PlotPlayer player = null;
|
PlotPlayer player = null;
|
||||||
|
|
||||||
UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper();
|
UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper();
|
||||||
|
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "delete",
|
command = "delete",
|
||||||
@ -42,13 +42,13 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
description = "Delete a plot",
|
description = "Delete a plot",
|
||||||
usage = "/plot delete",
|
usage = "/plot delete",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Delete extends SubCommand {
|
public class Delete extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -43,7 +43,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
|||||||
description = "Deny a user from a plot",
|
description = "Deny a user from a plot",
|
||||||
usage = "/plot deny <player>",
|
usage = "/plot deny <player>",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Deny extends SubCommand {
|
public class Deny extends SubCommand {
|
||||||
|
|
||||||
@ -54,8 +54,8 @@ public class Deny extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -14,21 +14,21 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "download",
|
command = "download",
|
||||||
aliases = {"dl"},
|
aliases = {"dl"},
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
description = "Download your plot",
|
description = "Download your plot",
|
||||||
permission = "plots.download"
|
permission = "plots.download"
|
||||||
)
|
)
|
||||||
public class Download extends SubCommand {
|
public class Download extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (!Settings.METRICS) {
|
if (!Settings.METRICS) {
|
||||||
MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
|
MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,7 +25,7 @@ import java.util.Arrays;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -45,14 +45,14 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
aliases = {"f"},
|
aliases = {"f"},
|
||||||
description = "Manage plot flags",
|
description = "Manage plot flags",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.flag"
|
permission = "plots.flag"
|
||||||
)
|
)
|
||||||
public class FlagCmd extends SubCommand {
|
public class FlagCmd extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer player, final String ... args) {
|
||||||
final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
/*
|
/*
|
||||||
* plot flag set fly true
|
* plot flag set fly true
|
||||||
* plot flag remove fly
|
* plot flag remove fly
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "help",
|
command = "help",
|
||||||
@ -20,7 +20,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class Help extends SubCommand {
|
public class Help extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "home",
|
command = "home",
|
||||||
@ -36,7 +36,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
description = "Go to your plot",
|
description = "Go to your plot",
|
||||||
usage = "/plot home [id|alias]",
|
usage = "/plot home [id|alias]",
|
||||||
category = CommandCategory.TELEPORT,
|
category = CommandCategory.TELEPORT,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Home extends SubCommand {
|
public class Home extends SubCommand {
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ public class Home extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, String[] args) {
|
public boolean onCommand(final PlotPlayer plr, String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final ArrayList<Plot> plots = PS.get().sortPlotsByWorld(PS.get().getPlots(plr));
|
final ArrayList<Plot> plots = PS.get().sortPlotsByWorld(PS.get().getPlots(plr));
|
||||||
if (plots.size() == 1) {
|
if (plots.size() == 1) {
|
||||||
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
|
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
|
||||||
|
@ -24,7 +24,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -43,7 +43,7 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
usage = "/plot inbox [inbox] [delete <index>|clear|page]",
|
usage = "/plot inbox [inbox] [delete <index>|clear|page]",
|
||||||
permission = "plots.inbox",
|
permission = "plots.inbox",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Inbox extends SubCommand {
|
public class Inbox extends SubCommand {
|
||||||
|
|
||||||
@ -86,8 +86,8 @@ public class Inbox extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer player, final String[] args) {
|
||||||
final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
|
|
||||||
final Plot plot = MainUtil.getPlot(player.getLocation());
|
final Plot plot = MainUtil.getPlot(player.getLocation());
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
|
@ -25,10 +25,10 @@ import java.util.Collection;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
@ -88,9 +88,7 @@ public class Info extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, String[] args) {
|
public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
final PlotPlayer player = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
|
|
||||||
String arg = null;
|
String arg = null;
|
||||||
Plot plot;
|
Plot plot;
|
||||||
if (args.length > 0) arg = args[0] + "";
|
if (args.length > 0) arg = args[0] + "";
|
||||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "kick",
|
command = "kick",
|
||||||
@ -37,13 +37,13 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
description = "Kick a player from your plot",
|
description = "Kick a player from your plot",
|
||||||
permission = "plots.kick",
|
permission = "plots.kick",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Kick extends SubCommand {
|
public class Kick extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -17,13 +17,13 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "load",
|
command = "load",
|
||||||
aliases = {"restore"},
|
aliases = {"restore"},
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
description = "Load your plot",
|
description = "Load your plot",
|
||||||
permission = "plots.load",
|
permission = "plots.load",
|
||||||
usage = "/plot restore"
|
usage = "/plot restore"
|
||||||
@ -31,8 +31,8 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class Load extends SubCommand {
|
public class Load extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (!Settings.METRICS) {
|
if (!Settings.METRICS) {
|
||||||
MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
|
MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
|
||||||
return false;
|
return false;
|
||||||
|
@ -24,22 +24,23 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.callers.ConsoleCaller;
|
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.Command;
|
import com.intellectualsites.commands.Command;
|
||||||
import com.intellectualsites.commands.CommandHandlingOutput;
|
import com.intellectualsites.commands.CommandHandlingOutput;
|
||||||
import com.intellectualsites.commands.CommandManager;
|
import com.intellectualsites.commands.CommandManager;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualsites.commands.util.StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotSquared command class
|
* PlotSquared command class
|
||||||
@ -92,13 +93,12 @@ public class MainCommand extends CommandManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Command> getCommands(final CommandCategory category, final PlotPlayer player) {
|
public static ArrayList<Command> getCommands(final CommandCategory category, final PlotPlayer player) {
|
||||||
final List<Command> cmds = new ArrayList<>();
|
ArrayList<Command> cmds = instance.getCommands();
|
||||||
for (final Command c : instance.commands.values()) {
|
for (Iterator<Command> iter = cmds.iterator(); iter.hasNext();){
|
||||||
if (c.getRequiredType().isInstance(PlotPlayer.class)) {
|
Command cmd = iter.next();
|
||||||
if ((category == null || (c.getCategory().equals(category))) && player.hasPermission(c.getPermission())) {
|
if ((category != null && (cmd.getCategory().equals(category))) || !player.hasPermission(cmd.getPermission())) {
|
||||||
cmds.add(c);
|
iter.remove();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cmds;
|
return cmds;
|
||||||
@ -142,18 +142,20 @@ public class MainCommand extends CommandManager {
|
|||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onCommand(final PlotPlayer player, final String cmd, final String... args) {
|
public static void displayHelp(PlotPlayer player, String cat, int page) {
|
||||||
if ((args.length < 1) || ((args.length >= 1) && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("he")))) {
|
if (cat != null && StringMan.isEqualIgnoreCase(cat, "all")) {
|
||||||
if (args.length < 2) {
|
cat = null;
|
||||||
|
}
|
||||||
|
if (cat == null && page == 0) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
builder.append(C.HELP_INFO.s());
|
builder.append(C.HELP_INFO.s());
|
||||||
for (final CommandCategory category : CommandCategory.values()) {
|
for (final CommandCategory category : CommandCategory.values()) {
|
||||||
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
||||||
}
|
}
|
||||||
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all").replaceAll("%category_desc%", "Display all commands"));
|
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all").replaceAll("%category_desc%", "Display all commands"));
|
||||||
return MainUtil.sendMessage(player, builder.toString());
|
MainUtil.sendMessage(player, builder.toString());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
final String cat = args[1];
|
|
||||||
CommandCategory cato = null;
|
CommandCategory cato = null;
|
||||||
for (final CommandCategory category : CommandCategory.values()) {
|
for (final CommandCategory category : CommandCategory.values()) {
|
||||||
if (cat.equalsIgnoreCase(category.toString())) {
|
if (cat.equalsIgnoreCase(category.toString())) {
|
||||||
@ -167,41 +169,68 @@ public class MainCommand extends CommandManager {
|
|||||||
for (final CommandCategory category : CommandCategory.values()) {
|
for (final CommandCategory category : CommandCategory.values()) {
|
||||||
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
||||||
}
|
}
|
||||||
return MainUtil.sendMessage(player, builder.toString(), false);
|
MainUtil.sendMessage(player, builder.toString(), false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
final StringBuilder help = new StringBuilder();
|
final StringBuilder help = new StringBuilder();
|
||||||
int page = 0;
|
|
||||||
boolean digit = true;
|
|
||||||
String arg2;
|
|
||||||
if (args.length > 2) {
|
|
||||||
arg2 = args[2];
|
|
||||||
} else {
|
|
||||||
arg2 = "1";
|
|
||||||
}
|
|
||||||
for (final char c : arg2.toCharArray()) {
|
|
||||||
if (!Character.isDigit(c)) {
|
|
||||||
digit = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (digit) {
|
|
||||||
page = Integer.parseInt(arg2);
|
|
||||||
if (--page < 0) {
|
|
||||||
page = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final String string : helpMenu(player, cato, page)) {
|
for (final String string : helpMenu(player, cato, page)) {
|
||||||
help.append(string).append("\n");
|
help.append(string).append("\n");
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, help.toString());
|
MainUtil.sendMessage(player, help.toString());
|
||||||
// return PlayerFunctions.sendMessage(player, help.toString());
|
|
||||||
} else {
|
|
||||||
CommandCaller caller;
|
|
||||||
if (player != null) {
|
|
||||||
caller = new PlotPlayerCaller(player);
|
|
||||||
} else {
|
|
||||||
caller = new ConsoleCaller();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean onCommand(final PlotPlayer player, final String cmd, final String... args) {
|
||||||
|
int help_index = -1;
|
||||||
|
String category = null;
|
||||||
|
if (args.length == 0) {
|
||||||
|
help_index = 0;
|
||||||
|
}
|
||||||
|
else if (StringMan.isEqualIgnoreCaseToAny(args[0], "he", "help", "?")) {
|
||||||
|
help_index = 0;
|
||||||
|
switch (args.length) {
|
||||||
|
case 3: {
|
||||||
|
category = args[1];
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
if (MathMan.isInteger(args[args.length - 1])) {
|
||||||
|
category = null;
|
||||||
|
try {
|
||||||
|
help_index = Integer.parseInt(args[1]) - 1;
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {}
|
||||||
|
}
|
||||||
|
if (category == null) {
|
||||||
|
category = args[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (args.length == 3) {
|
||||||
|
if (MathMan.isInteger(args[args.length - 1])) {
|
||||||
|
category = null;
|
||||||
|
try {
|
||||||
|
help_index = Integer.parseInt(args[1]) - 1;
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
category = args[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (MathMan.isInteger(args[args.length - 1])) {
|
||||||
|
try {
|
||||||
|
help_index = Integer.parseInt(args[args.length - 1]) - 1;
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {}
|
||||||
|
}
|
||||||
|
if (help_index != -1) {
|
||||||
|
displayHelp(player, category, help_index);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
PlotPlayer caller;
|
||||||
StringBuilder builder = new StringBuilder(cmd).append(" ");
|
StringBuilder builder = new StringBuilder(cmd).append(" ");
|
||||||
Iterator<String> iterator = Arrays.asList(args).iterator();
|
Iterator<String> iterator = Arrays.asList(args).iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@ -210,7 +239,7 @@ public class MainCommand extends CommandManager {
|
|||||||
builder.append(" ");
|
builder.append(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
instance.handle(caller, builder.toString());
|
instance.handle(player, builder.toString());
|
||||||
// for (final SubCommand command : subCommands) {
|
// for (final SubCommand command : subCommands) {
|
||||||
// if (command.cmd.equalsIgnoreCase(args[0]) || command.alias.contains(args[0].toLowerCase())) {
|
// if (command.cmd.equalsIgnoreCase(args[0]) || command.alias.contains(args[0].toLowerCase())) {
|
||||||
// final String[] arguments = new String[args.length - 1];
|
// final String[] arguments = new String[args.length - 1];
|
||||||
@ -236,12 +265,11 @@ public class MainCommand extends CommandManager {
|
|||||||
// return MainUtil.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
|
// return MainUtil.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
|
||||||
// PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new
|
// PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new
|
||||||
// StringComparsion(args[0], commands).getBestMatch());
|
// StringComparsion(args[0], commands).getBestMatch());
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int handle(CommandCaller caller, String input) {
|
public int handle(PlotPlayer plr, String input) {
|
||||||
String[] parts = input.split(" ");
|
String[] parts = input.split(" ");
|
||||||
String[] args;
|
String[] args;
|
||||||
String command = parts[0].toLowerCase();
|
String command = parts[0].toLowerCase();
|
||||||
@ -252,29 +280,31 @@ public class MainCommand extends CommandManager {
|
|||||||
System.arraycopy(parts, 1, args, 0, args.length);
|
System.arraycopy(parts, 1, args, 0, args.length);
|
||||||
}
|
}
|
||||||
Command cmd = null;
|
Command cmd = null;
|
||||||
|
System.out.print(command);
|
||||||
|
System.out.print(StringMan.join(commands.entrySet(), ", "));
|
||||||
cmd = this.commands.get(command);
|
cmd = this.commands.get(command);
|
||||||
if (cmd == null) {
|
if (cmd == null) {
|
||||||
caller.message(C.NOT_VALID_SUBCOMMAND);
|
MainUtil.sendMessage(plr, C.NOT_VALID_SUBCOMMAND);
|
||||||
{
|
{
|
||||||
final String[] commands = new String[this.commands.size()];
|
final String[] commands = new String[this.commands.size()];
|
||||||
for (int i = 0; i < commands.length; i++) {
|
for (int i = 0; i < commands.length; i++) {
|
||||||
commands[i] = this.commands.get(i).getCommand();
|
commands[i] = this.commands.get(i).getCommand();
|
||||||
}
|
}
|
||||||
final String bestMatch = new StringComparison<String>(args[0], commands).getBestMatch();
|
final String bestMatch = new StringComparison<String>(args[0], commands).getBestMatch();
|
||||||
caller.message(C.DID_YOU_MEAN, "/plot " + bestMatch);
|
MainUtil.sendMessage(plr, C.DID_YOU_MEAN, "/plot " + bestMatch);
|
||||||
}
|
}
|
||||||
return CommandHandlingOutput.NOT_FOUND;
|
return CommandHandlingOutput.NOT_FOUND;
|
||||||
}
|
}
|
||||||
if (!cmd.getRequiredType().isInstance(caller.getSuperCaller())) {
|
if (cmd.getRequiredType().allows(plr)) {
|
||||||
if (caller instanceof PlotPlayerCaller) {
|
if (ConsolePlayer.isConsole(plr)) {
|
||||||
caller.message(C.NOT_CONSOLE);
|
MainUtil.sendMessage(plr, C.IS_CONSOLE);
|
||||||
} else {
|
} else {
|
||||||
caller.message(C.IS_CONSOLE);
|
MainUtil.sendMessage(plr, C.NOT_CONSOLE);
|
||||||
|
}
|
||||||
return CommandHandlingOutput.CALLER_OF_WRONG_TYPE;
|
return CommandHandlingOutput.CALLER_OF_WRONG_TYPE;
|
||||||
}
|
}
|
||||||
}
|
if (!plr.hasPermission(cmd.getPermission())) {
|
||||||
if (!caller.hasPermission(cmd.getPermission())) {
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, cmd.getPermission());
|
||||||
caller.message(C.NO_PERMISSION, cmd.getPermission());
|
|
||||||
return CommandHandlingOutput.NOT_PERMITTED;
|
return CommandHandlingOutput.NOT_PERMITTED;
|
||||||
}
|
}
|
||||||
Argument[] requiredArguments = cmd.getRequiredArguments();
|
Argument[] requiredArguments = cmd.getRequiredArguments();
|
||||||
@ -291,16 +321,16 @@ public class MainCommand extends CommandManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
caller.sendRequiredArgumentsList(this, cmd, requiredArguments);
|
C.COMMAND_SYNTAX.send(plr, cmd.getUsage());
|
||||||
return CommandHandlingOutput.WRONG_USAGE;
|
return CommandHandlingOutput.WRONG_USAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
boolean a = cmd.onCommand(caller, args);
|
boolean result = cmd.onCommand(plr, args);
|
||||||
if (!a) {
|
if (!result) {
|
||||||
String usage = cmd.getUsage();
|
String usage = cmd.getUsage();
|
||||||
if (usage != null && !usage.isEmpty()) {
|
if (usage != null && !usage.isEmpty()) {
|
||||||
caller.message(usage);
|
MainUtil.sendMessage(plr, usage);
|
||||||
}
|
}
|
||||||
return CommandHandlingOutput.WRONG_USAGE;
|
return CommandHandlingOutput.WRONG_USAGE;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
permission = "plots.merge",
|
permission = "plots.merge",
|
||||||
usage = "/plot merge [direction]",
|
usage = "/plot merge [direction]",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Merge extends SubCommand {
|
public class Merge extends SubCommand {
|
||||||
public final static String[] values = new String[] { "north", "east", "south", "west" };
|
public final static String[] values = new String[] { "north", "east", "south", "west" };
|
||||||
@ -86,8 +86,8 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocationFull();
|
final Location loc = plr.getLocationFull();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "move",
|
command = "move",
|
||||||
@ -39,7 +39,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
aliases = {"debugmove"},
|
aliases = {"debugmove"},
|
||||||
permission = "plots.move",
|
permission = "plots.move",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Move extends SubCommand {
|
public class Move extends SubCommand {
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ public class Move extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot1 = MainUtil.getPlot(loc);
|
final Plot plot1 = MainUtil.getPlot(loc);
|
||||||
if (plot1 == null) {
|
if (plot1 == null) {
|
||||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "music",
|
command = "music",
|
||||||
@ -40,13 +40,13 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
description = "Player music in a plot",
|
description = "Player music in a plot",
|
||||||
usage = "/plot music",
|
usage = "/plot music",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class MusicSubcommand extends SubCommand {
|
public class MusicSubcommand extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer player, final String[] args) {
|
||||||
final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -41,7 +41,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Purge all plots for a world",
|
description = "Purge all plots for a world",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PS.class
|
requiredType = RequiredType.CONSOLE
|
||||||
)
|
)
|
||||||
public class Purge extends SubCommand {
|
public class Purge extends SubCommand {
|
||||||
|
|
||||||
@ -55,45 +55,45 @@ public class Purge extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final String arg = args[0].toLowerCase();
|
final String arg = args[0].toLowerCase();
|
||||||
final PlotId id = getId(arg);
|
final PlotId id = getId(arg);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
caller.message("/plot purxe x;z &l<world>");
|
MainUtil.sendMessage(plr, "/plot purxe x;z &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[0], null);
|
final UUID uuid = UUIDHandler.getUUID(args[0], null);
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
caller.message("/plot purge " + args[0] + " &l<world>");
|
MainUtil.sendMessage(plr, "/plot purge " + args[0] + " &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("player")) {
|
if (arg.equals("player")) {
|
||||||
caller.message("/plot purge &l<player> <world>");
|
MainUtil.sendMessage(plr, "/plot purge &l<player> <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("unowned")) {
|
if (arg.equals("unowned")) {
|
||||||
caller.message("/plot purge unowned &l<world>");
|
MainUtil.sendMessage(plr, "/plot purge unowned &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("unknown")) {
|
if (arg.equals("unknown")) {
|
||||||
caller.message("/plot purge unknown &l<world>");
|
MainUtil.sendMessage(plr, "/plot purge unknown &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("all")) {
|
if (arg.equals("all")) {
|
||||||
caller.message("/plot purge all &l<world>");
|
MainUtil.sendMessage(plr, "/plot purge all &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
caller.message(C.PURGE_SYNTAX);
|
MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
caller.message(C.PURGE_SYNTAX);
|
MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String worldname = args[1];
|
final String worldname = args[1];
|
||||||
if (!PS.get().getAllPlotsRaw().containsKey(worldname)) {
|
if (!PS.get().getAllPlotsRaw().containsKey(worldname)) {
|
||||||
caller.message("INVALID WORLD");
|
MainUtil.sendMessage(plr, "INVALID WORLD");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String arg = args[0].toLowerCase();
|
final String arg = args[0].toLowerCase();
|
||||||
@ -160,7 +160,7 @@ public class Purge extends SubCommand {
|
|||||||
DBFunc.purge(worldname, ids);
|
DBFunc.purge(worldname, ids);
|
||||||
return finishPurge(length);
|
return finishPurge(length);
|
||||||
}
|
}
|
||||||
caller.message(C.PURGE_SYNTAX);
|
MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ import java.util.Map.Entry;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.mutable.MutableInt;
|
import org.apache.commons.lang.mutable.MutableInt;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -53,14 +53,12 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
|||||||
usage = "/plot rate [#|next]",
|
usage = "/plot rate [#|next]",
|
||||||
aliases = {"rt"},
|
aliases = {"rt"},
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Rate extends SubCommand {
|
public class Rate extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer player, final String[] args) {
|
||||||
final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (args[0].equalsIgnoreCase("next")) {
|
if (args[0].equalsIgnoreCase("next")) {
|
||||||
ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
|
ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
|
||||||
|
@ -30,16 +30,17 @@ import com.intellectualcrafters.plot.object.ChunkLoc;
|
|||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "regenallroads",
|
command = "regenallroads",
|
||||||
description = "Regenerate all roads in the map using the set road schematic",
|
description = "Regenerate all roads in the map using the set road schematic",
|
||||||
aliases = {"rgar"},
|
aliases = {"rgar"},
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = PS.class,
|
requiredType = RequiredType.CONSOLE,
|
||||||
permission = "plots.regenallroads"
|
permission = "plots.regenallroads"
|
||||||
)
|
)
|
||||||
public class RegenAllRoads extends SubCommand {
|
public class RegenAllRoads extends SubCommand {
|
||||||
@ -51,22 +52,22 @@ public class RegenAllRoads extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
try {
|
try {
|
||||||
height = Integer.parseInt(args[1]);
|
height = Integer.parseInt(args[1]);
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e) {
|
catch (NumberFormatException e) {
|
||||||
caller.message(C.NOT_VALID_NUMBER, "(0, 256)");
|
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(0, 256)");
|
||||||
caller.message(C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final String name = args[0];
|
final String name = args[0];
|
||||||
final PlotManager manager = PS.get().getPlotManager(name);
|
final PlotManager manager = PS.get().getPlotManager(name);
|
||||||
if ((manager == null) || !(manager instanceof HybridPlotManager)) {
|
if ((manager == null) || !(manager instanceof HybridPlotManager)) {
|
||||||
caller.message(C.NOT_VALID_PLOT_WORLD);
|
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final List<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
|
final List<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
|
||||||
|
@ -23,9 +23,9 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "reload",
|
command = "reload",
|
||||||
@ -37,7 +37,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
public class Reload extends SubCommand {
|
public class Reload extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
try {
|
try {
|
||||||
// The following won't affect world generation, as that has to be
|
// The following won't affect world generation, as that has to be
|
||||||
// loaded during startup unfortunately.
|
// loaded during startup unfortunately.
|
||||||
@ -48,9 +48,9 @@ public class Reload extends SubCommand {
|
|||||||
final PlotWorld plotworld = PS.get().getPlotWorld(pw);
|
final PlotWorld plotworld = PS.get().getPlotWorld(pw);
|
||||||
plotworld.loadDefaultConfiguration(PS.get().config.getConfigurationSection("worlds." + pw));
|
plotworld.loadDefaultConfiguration(PS.get().config.getConfigurationSection("worlds." + pw));
|
||||||
}
|
}
|
||||||
caller.message(C.RELOADED_CONFIGS);
|
MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
caller.message(C.RELOAD_FAILED);
|
MainUtil.sendMessage(plr, C.RELOAD_FAILED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
|
||||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -42,7 +41,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
|||||||
description = "Remove a player from a plot",
|
description = "Remove a player from a plot",
|
||||||
usage = "/plot remove <player>",
|
usage = "/plot remove <player>",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.remove"
|
permission = "plots.remove"
|
||||||
)
|
)
|
||||||
public class Remove extends SubCommand {
|
public class Remove extends SubCommand {
|
||||||
@ -54,8 +53,7 @@ public class Remove extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot remove <player>");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot remove <player>");
|
||||||
return true;
|
return true;
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
|
public enum RequiredType {
|
||||||
|
CONSOLE,
|
||||||
|
PLAYER,
|
||||||
|
NONE;
|
||||||
|
|
||||||
|
public boolean allows(PlotPlayer player) {
|
||||||
|
switch (this) {
|
||||||
|
case NONE:
|
||||||
|
return true;
|
||||||
|
case PLAYER:
|
||||||
|
return !ConsolePlayer.isConsole(player);
|
||||||
|
case CONSOLE:
|
||||||
|
return ConsolePlayer.isConsole(player);
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,21 +17,21 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "save",
|
command = "save",
|
||||||
aliases = {"backup"},
|
aliases = {"backup"},
|
||||||
description = "Save your plot",
|
description = "Save your plot",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.save"
|
permission = "plots.save"
|
||||||
)
|
)
|
||||||
public class Save extends SubCommand {
|
public class Save extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (!Settings.METRICS) {
|
if (!Settings.METRICS) {
|
||||||
MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
|
MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
|
||||||
return false;
|
return false;
|
||||||
|
@ -27,7 +27,7 @@ import java.util.HashMap;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
// TODO Add sub-subcommands
|
// TODO Add sub-subcommands
|
||||||
|
|
||||||
@ -61,8 +61,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
sendMessage(plr, C.SCHEMATIC_MISSING_ARG);
|
sendMessage(plr, C.SCHEMATIC_MISSING_ARG);
|
||||||
return true;
|
return true;
|
||||||
@ -72,10 +71,6 @@ public class SchematicCmd extends SubCommand {
|
|||||||
final Schematic schematic;
|
final Schematic schematic;
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case "paste": {
|
case "paste": {
|
||||||
if (plr == null) {
|
|
||||||
PS.log(C.IS_CONSOLE.s());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.schematic.paste")) {
|
if (!Permissions.hasPermission(plr, "plots.schematic.paste")) {
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,7 +25,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
@ -61,15 +61,15 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
usage = "/plot set <arg> <value(s)...>",
|
usage = "/plot set <arg> <value(s)...>",
|
||||||
permission = "plots.set",
|
permission = "plots.set",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Set extends SubCommand {
|
public class Set extends SubCommand {
|
||||||
public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
|
public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
|
||||||
public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
|
public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "setowner",
|
command = "setowner",
|
||||||
@ -45,7 +45,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
usage = "/plot setowner <player>",
|
usage = "/plot setowner <player>",
|
||||||
aliases = {"so"},
|
aliases = {"so"},
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class SetOwner extends SubCommand {
|
public class SetOwner extends SubCommand {
|
||||||
|
|
||||||
@ -60,8 +60,7 @@ public class SetOwner extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller;
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if ((plot == null) || (plot.owner == null)) {
|
if ((plot == null) || (plot.owner == null)) {
|
||||||
|
@ -25,9 +25,9 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
@ -74,9 +74,7 @@ public class Setup extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
PlotPlayer plr = (caller instanceof PlotPlayerCaller) ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
|
|
||||||
// going through setup
|
// going through setup
|
||||||
String name;
|
String name;
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
@ -219,7 +217,7 @@ public class Setup extends SubCommand {
|
|||||||
step.setValue(args[0]);
|
step.setValue(args[0]);
|
||||||
object.setup_index++;
|
object.setup_index++;
|
||||||
if (object.setup_index == object.step.length) {
|
if (object.setup_index == object.step.length) {
|
||||||
onCommand(caller, args);
|
onCommand(plr, args);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
step = object.step[object.setup_index];
|
step = object.step[object.setup_index];
|
||||||
|
@ -34,20 +34,20 @@ import com.intellectualcrafters.plot.util.ClusterManager;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "swap",
|
command = "swap",
|
||||||
description = "Swap two plots",
|
description = "Swap two plots",
|
||||||
aliases = {"switch"},
|
aliases = {"switch"},
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = PlotPlayer.class
|
requiredType = RequiredType.PLAYER
|
||||||
)
|
)
|
||||||
public class Swap extends SubCommand {
|
public class Swap extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
MainUtil.sendMessage(plr, "&cThis command has not been optimized for large selections yet. Please bug me if this becomes an issue.");
|
MainUtil.sendMessage(plr, "&cThis command has not been optimized for large selections yet. Please bug me if this becomes an issue.");
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
MainUtil.sendMessage(plr, C.NEED_PLOT_ID);
|
MainUtil.sendMessage(plr, C.NEED_PLOT_ID);
|
||||||
|
@ -22,7 +22,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
description = "Teleport to a plot",
|
description = "Teleport to a plot",
|
||||||
permission = "plots.tp",
|
permission = "plots.tp",
|
||||||
usage = "/plot tp <alias|id>",
|
usage = "/plot tp <alias|id>",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.TELEPORT
|
category = CommandCategory.TELEPORT
|
||||||
)
|
)
|
||||||
public class TP extends SubCommand {
|
public class TP extends SubCommand {
|
||||||
@ -53,8 +53,7 @@ public class TP extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final String id = args[0];
|
final String id = args[0];
|
||||||
PlotId plotid;
|
PlotId plotid;
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
|
@ -28,14 +28,14 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "target",
|
command = "target",
|
||||||
usage = "/plot target <X;Z>",
|
usage = "/plot target <X;Z>",
|
||||||
description = "Target a plot with your compass",
|
description = "Target a plot with your compass",
|
||||||
permission = "plots.target",
|
permission = "plots.target",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.ACTIONS
|
category = CommandCategory.ACTIONS
|
||||||
)
|
)
|
||||||
public class Target extends SubCommand {
|
public class Target extends SubCommand {
|
||||||
@ -47,8 +47,7 @@ public class Target extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location ploc = plr.getLocation();
|
final Location ploc = plr.getLocation();
|
||||||
if (!PS.get().isPlotWorld(ploc.getWorld())) {
|
if (!PS.get().isPlotWorld(ploc.getWorld())) {
|
||||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
|
@ -42,7 +42,7 @@ import com.intellectualcrafters.plot.object.SetupObject;
|
|||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.bukkit.util.SetupUtils;
|
import com.plotsquared.bukkit.util.SetupUtils;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
@ -119,25 +119,21 @@ public class Template extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
if (args.length != 2 && args.length != 3) {
|
if (args.length != 2 && args.length != 3) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (args[0].equalsIgnoreCase("export")) {
|
if (args[0].equalsIgnoreCase("export")) {
|
||||||
caller.message(C.COMMAND_SYNTAX, "/plot template export <world>");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template export <world>");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("import")) {
|
else if (args[0].equalsIgnoreCase("import")) {
|
||||||
caller.message(C.COMMAND_SYNTAX, "/plot template import <world> <template>");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template import <world> <template>");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
caller.message(C.COMMAND_SYNTAX, "/plot template <import|explort> <world> [template]");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|explort> <world> [template]");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlotPlayer plr = null;
|
|
||||||
if (caller.getSuperCaller() instanceof PlotPlayer) {
|
|
||||||
plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
}
|
|
||||||
final String world = args[1];
|
final String world = args[1];
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "import": {
|
case "import": {
|
||||||
|
@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
// TOGGLE("toggle", "attribute"),
|
// TOGGLE("toggle", "attribute"),
|
||||||
|
|
||||||
@ -34,21 +34,20 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
permission = "plots.toggle",
|
permission = "plots.toggle",
|
||||||
description = "Toggle per user settings",
|
description = "Toggle per user settings",
|
||||||
usage = "/plot toggle <setting>",
|
usage = "/plot toggle <setting>",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.ACTIONS
|
category = CommandCategory.ACTIONS
|
||||||
)
|
)
|
||||||
public class Toggle extends SubCommand {
|
public class Toggle extends SubCommand {
|
||||||
|
|
||||||
public void noArgs(CommandCaller caller) {
|
public void noArgs(PlotPlayer plr) {
|
||||||
caller.message(C.COMMAND_SYNTAX, "/plot toggle <setting>");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot toggle <setting>");
|
||||||
caller.message(C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + "titles");
|
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + "titles");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer player, final String[] args) {
|
||||||
PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
noArgs(caller);
|
noArgs(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
|
@ -40,14 +40,14 @@ import com.intellectualcrafters.plot.util.ChunkManager;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "trim",
|
command = "trim",
|
||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Delete unmodified portions of your plotworld",
|
description = "Delete unmodified portions of your plotworld",
|
||||||
usage = "/plot trim",
|
usage = "/plot trim",
|
||||||
requiredType = PS.class,
|
requiredType = RequiredType.CONSOLE,
|
||||||
category = CommandCategory.DEBUG
|
category = CommandCategory.DEBUG
|
||||||
)
|
)
|
||||||
public class Trim extends SubCommand {
|
public class Trim extends SubCommand {
|
||||||
@ -174,8 +174,7 @@ public class Trim extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
PlotPlayer plr = null;
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final String arg = args[0].toLowerCase();
|
final String arg = args[0].toLowerCase();
|
||||||
final PlotId id = getId(arg);
|
final PlotId id = getId(arg);
|
||||||
|
@ -34,13 +34,13 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "trust",
|
command = "trust",
|
||||||
aliases = {"t"},
|
aliases = {"t"},
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
usage = "/plot trust <player>",
|
usage = "/plot trust <player>",
|
||||||
description = "Allow a player to build in a plot",
|
description = "Allow a player to build in a plot",
|
||||||
category = CommandCategory.ACTIONS
|
category = CommandCategory.ACTIONS
|
||||||
@ -54,8 +54,8 @@ public class Trust extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -30,20 +30,20 @@ import com.intellectualcrafters.plot.util.EconHandler;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "unclaim",
|
command = "unclaim",
|
||||||
usage = "/plot unclaim",
|
usage = "/plot unclaim",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
description = "Unclaim a plot",
|
description = "Unclaim a plot",
|
||||||
category = CommandCategory.ACTIONS
|
category = CommandCategory.ACTIONS
|
||||||
)
|
)
|
||||||
public class Unclaim extends SubCommand {
|
public class Unclaim extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -40,7 +40,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
|||||||
aliases = {"ud"},
|
aliases = {"ud"},
|
||||||
description = "Remove a denied user from a plot",
|
description = "Remove a denied user from a plot",
|
||||||
usage = "/plot undeny <player>",
|
usage = "/plot undeny <player>",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.ACTIONS
|
category = CommandCategory.ACTIONS
|
||||||
)
|
)
|
||||||
public class Undeny extends SubCommand {
|
public class Undeny extends SubCommand {
|
||||||
@ -52,8 +52,8 @@ public class Undeny extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String ... args) {
|
public boolean onCommand(final PlotPlayer plr, final String ... args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -30,21 +30,21 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "unlink",
|
command = "unlink",
|
||||||
aliases = {"u"},
|
aliases = {"u"},
|
||||||
description = "Unlink a mega-plot",
|
description = "Unlink a mega-plot",
|
||||||
usage = "/plot unlink",
|
usage = "/plot unlink",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.ACTIONS
|
category = CommandCategory.ACTIONS
|
||||||
)
|
)
|
||||||
public class Unlink extends SubCommand {
|
public class Unlink extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
// UNTRUST("untrust", "ut"),
|
// UNTRUST("untrust", "ut"),
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
permission = "plot.untrust",
|
permission = "plot.untrust",
|
||||||
description = "Remove a trusted user from a plot",
|
description = "Remove a trusted user from a plot",
|
||||||
usage = "/plot untrust <player>",
|
usage = "/plot untrust <player>",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.ACTIONS
|
category = CommandCategory.ACTIONS
|
||||||
)
|
)
|
||||||
public class Untrust extends SubCommand {
|
public class Untrust extends SubCommand {
|
||||||
@ -54,8 +54,7 @@ public class Untrust extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -28,14 +28,14 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "update",
|
command = "update",
|
||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Update PlotSquared",
|
description = "Update PlotSquared",
|
||||||
usage = "/plot update",
|
usage = "/plot update",
|
||||||
requiredType = PS.class,
|
requiredType = RequiredType.CONSOLE,
|
||||||
aliases = {"updateplugin"},
|
aliases = {"updateplugin"},
|
||||||
category = CommandCategory.DEBUG
|
category = CommandCategory.DEBUG
|
||||||
)
|
)
|
||||||
@ -44,7 +44,7 @@ public class Update extends SubCommand {
|
|||||||
public static String version;
|
public static String version;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
URL url;
|
URL url;
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
url = PS.get().update;
|
url = PS.get().update;
|
||||||
@ -59,12 +59,12 @@ public class Update extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
caller.message(C.COMMAND_SYNTAX, getUsage());
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
caller.message("&cNo update found!");
|
MainUtil.sendMessage(plr, "&cNo update found!");
|
||||||
caller.message("&cTo manually specify an update URL: /plot update <url>");
|
MainUtil.sendMessage(plr, "&cTo manually specify an update URL: /plot update <url>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (PS.get().update(null, url) && url == PS.get().update) {
|
if (PS.get().update(null, url) && url == PS.get().update) {
|
||||||
|
@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.intellectualsites.commands.Argument;
|
import com.intellectualsites.commands.Argument;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "visit",
|
command = "visit",
|
||||||
@ -41,7 +41,7 @@ import com.intellectualsites.commands.CommandCaller;
|
|||||||
description = "Visit someones plot",
|
description = "Visit someones plot",
|
||||||
usage = "/plot visit <player|aliases|world|id> [#]",
|
usage = "/plot visit <player|aliases|world|id> [#]",
|
||||||
aliases = {"v}"},
|
aliases = {"v}"},
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.TELEPORT
|
category = CommandCategory.TELEPORT
|
||||||
)
|
)
|
||||||
public class Visit extends SubCommand {
|
public class Visit extends SubCommand {
|
||||||
@ -63,8 +63,7 @@ public class Visit extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] args) {
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
ArrayList<Plot> plots = new ArrayList<>();
|
ArrayList<Plot> plots = new ArrayList<>();
|
||||||
UUID user = UUIDHandler.getUUID(args[0], null);
|
UUID user = UUIDHandler.getUUID(args[0], null);
|
||||||
if (user != null ) {
|
if (user != null ) {
|
||||||
|
@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.bukkit.listeners.worldedit.WEManager;
|
import com.plotsquared.bukkit.listeners.worldedit.WEManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
@ -35,18 +35,17 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
description = "Force bypass of WorldEdit",
|
description = "Force bypass of WorldEdit",
|
||||||
aliases = {"wea"},
|
aliases = {"wea"},
|
||||||
usage = "/plot weanywhere",
|
usage = "/plot weanywhere",
|
||||||
requiredType = PlotPlayer.class,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.DEBUG
|
category = CommandCategory.DEBUG
|
||||||
)
|
)
|
||||||
public class WE_Anywhere extends SubCommand {
|
public class WE_Anywhere extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandCaller caller, String[] arguments) {
|
public boolean onCommand(PlotPlayer player, String[] arguments) {
|
||||||
if (PS.get().worldEdit == null) {
|
if (PS.get().worldEdit == null) {
|
||||||
caller.message("&cWorldEdit is not enabled on this server");
|
MainUtil.sendMessage(player, "&cWorldEdit is not enabled on this server");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
|
|
||||||
if (Permissions.hasPermission(player, "plots.worldedit.bypass")) {
|
if (Permissions.hasPermission(player, "plots.worldedit.bypass")) {
|
||||||
if (WEManager.bypass.contains(player.getName())) {
|
if (WEManager.bypass.contains(player.getName())) {
|
||||||
WEManager.bypass.remove(player.getName());
|
WEManager.bypass.remove(player.getName());
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
package com.intellectualcrafters.plot.commands.callers;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualsites.commands.Argument;
|
|
||||||
import com.intellectualsites.commands.Command;
|
|
||||||
import com.intellectualsites.commands.CommandManager;
|
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
|
||||||
|
|
||||||
public class ConsoleCaller implements CommandCaller<PS> {
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(String permission) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void message(String message) {
|
|
||||||
MainUtil.sendConsoleMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PS getSuperCaller() {
|
|
||||||
return PS.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void message(C c, String... args) {
|
|
||||||
MainUtil.sendConsoleMessage(c, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendRequiredArgumentsList(CommandManager manager, Command cmd, Argument[] required) {
|
|
||||||
message(C.COMMAND_SYNTAX, cmd.getUsage());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package com.intellectualcrafters.plot.commands.callers;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualsites.commands.Argument;
|
|
||||||
import com.intellectualsites.commands.Command;
|
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
|
||||||
import com.intellectualsites.commands.CommandManager;
|
|
||||||
|
|
||||||
public class PlotPlayerCaller implements CommandCaller<PlotPlayer> {
|
|
||||||
|
|
||||||
private final PlotPlayer player;
|
|
||||||
|
|
||||||
public PlotPlayerCaller(final PlotPlayer player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(String permission) {
|
|
||||||
return player.hasPermission(permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void message(String message) {
|
|
||||||
player.sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlotPlayer getSuperCaller() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void message(C c, String... args) {
|
|
||||||
MainUtil.sendMessage(getSuperCaller(), c, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendRequiredArgumentsList(CommandManager manager, Command cmd, Argument[] required) {
|
|
||||||
message(C.COMMAND_SYNTAX, cmd.getUsage());
|
|
||||||
message("Argument list is yet to be implemented");
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,9 +29,9 @@ import java.util.Map.Entry;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -119,9 +119,7 @@ public class list extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
|
|
||||||
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
noArgs(plr);
|
noArgs(plr);
|
||||||
return false;
|
return false;
|
||||||
|
@ -27,14 +27,14 @@ import java.net.URLConnection;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualsites.commands.CommandDeclaration;
|
import com.intellectualsites.commands.CommandDeclaration;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "plugin",
|
command = "plugin",
|
||||||
@ -70,7 +70,7 @@ public class plugin extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandCaller caller, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -85,7 +85,7 @@ public class plugin extends SubCommand {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (final String s : strings) {
|
for (final String s : strings) {
|
||||||
MainUtil.sendMessage(caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null, StringMan.replaceFromMap(s, C.replacements), false);
|
plr.sendMessage(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -33,6 +33,8 @@ import org.bukkit.ChatColor;
|
|||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -689,4 +691,13 @@ public enum C {
|
|||||||
public String getCat() {
|
public String getCat() {
|
||||||
return cat;
|
return cat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void send(PlotPlayer plr, String... args) {
|
||||||
|
if (plr == null) {
|
||||||
|
MainUtil.sendConsoleMessage(this, args);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MainUtil.sendMessage(plr, this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,126 @@
|
|||||||
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||||
|
|
||||||
|
public class ConsolePlayer implements PlotPlayer {
|
||||||
|
|
||||||
|
private static ConsolePlayer instance;
|
||||||
|
private Location loc;
|
||||||
|
private final HashMap<String, Object> meta;
|
||||||
|
|
||||||
|
public static ConsolePlayer getConsole() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new ConsolePlayer();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConsolePlayer() {
|
||||||
|
String world;
|
||||||
|
Set<String> plotworlds = PS.get().getPlotWorlds();
|
||||||
|
if (plotworlds.size() > 0) {
|
||||||
|
world = plotworlds.iterator().next();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
world = "world";
|
||||||
|
}
|
||||||
|
this.loc = new Location(world, 0, 0, 0);
|
||||||
|
this.meta = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isConsole(PlotPlayer plr) {
|
||||||
|
return instance == plr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getPreviousLogin() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocationFull() {
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID getUUID() {
|
||||||
|
return DBFunc.everyone;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPermission(String perm) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMessage(String message) {
|
||||||
|
PS.log(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void teleport(Location loc) {
|
||||||
|
this.loc = loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOp() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnline() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "*";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCompassTarget(Location loc) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadData() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveData() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAttribute(String key) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getAttribute(String key) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeAttribute(String key) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMeta(String key, Object value) {
|
||||||
|
this.meta.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getMeta(String key) {
|
||||||
|
return this.meta.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMeta(String key) {
|
||||||
|
this.meta.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -606,6 +606,9 @@ public class Plot {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot other = (Plot) obj;
|
final Plot other = (Plot) obj;
|
||||||
|
if (this.hashCode() != other.hashCode()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return ((this.id.x.equals(other.id.x)) && (this.id.y.equals(other.id.y)) && (this.world.equals(other.world)));
|
return ((this.id.x.equals(other.id.x)) && (this.id.y.equals(other.id.y)) && (this.world.equals(other.world)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.PS;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualsites.commands.CommandCaller;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.bukkit.listeners.PlotListener;
|
import com.plotsquared.bukkit.listeners.PlotListener;
|
||||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
@ -1421,15 +1421,6 @@ public class MainUtil {
|
|||||||
return sendMessage(plr, msg, true);
|
return sendMessage(plr, msg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean sendCallerMessage(final CommandCaller plr, final String msg) {
|
|
||||||
if (plr.getSuperCaller() instanceof PlotPlayer) {
|
|
||||||
sendMessage((PlotPlayer) plr.getSuperCaller(), msg);
|
|
||||||
} else {
|
|
||||||
sendConsoleMessage(msg);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sendConsoleMessage(String msg) {
|
public static void sendConsoleMessage(String msg) {
|
||||||
sendMessage(null, msg);
|
sendMessage(null, msg);
|
||||||
}
|
}
|
||||||
@ -1516,15 +1507,6 @@ public class MainUtil {
|
|||||||
return lines.toArray(new String[lines.size()]);
|
return lines.toArray(new String[lines.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean sendCallerMessage(final CommandCaller caller, final C c, final String... args) {
|
|
||||||
if (caller.getSuperCaller() instanceof PlotPlayer) {
|
|
||||||
sendMessage((PlotPlayer) caller.getSuperCaller(), c, args);
|
|
||||||
} else {
|
|
||||||
sendConsoleMessage(c, args);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to the player
|
* Send a message to the player
|
||||||
*
|
*
|
||||||
|
@ -152,23 +152,49 @@ public class StringMan {
|
|||||||
|
|
||||||
public static String join(Object[] array, String delimiter) {
|
public static String join(Object[] array, String delimiter) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
|
System.out.print(array.getClass().getName());
|
||||||
for (int i = 0, j = array.length; i < j; i++) {
|
for (int i = 0, j = array.length; i < j; i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
result.append(delimiter);
|
result.append(delimiter);
|
||||||
}
|
}
|
||||||
|
System.out.print(array[i].getClass().getName());
|
||||||
result.append(array[i]);
|
result.append(array[i]);
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String join(int[] array, String delimiter) {
|
public static String join(int[] array, String delimiter) {
|
||||||
return join(Arrays.asList(array), delimiter);
|
Integer[] wrapped = new Integer[array.length];
|
||||||
|
for (int i = 0; i < array.length; i++) wrapped[i] = array[i];
|
||||||
|
return join(wrapped, delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEqual(String a, String b ) {
|
public static boolean isEqualToAny(String a, String... args) {
|
||||||
|
for (String arg : args) {
|
||||||
|
if (StringMan.isEqual(a, arg)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEqualIgnoreCaseToAny(String a, String... args) {
|
||||||
|
for (String arg : args) {
|
||||||
|
if (StringMan.isEqualIgnoreCase(a, arg)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEqual(String a, String b) {
|
||||||
return (a == b || (a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b)));
|
return (a == b || (a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isEqualIgnoreCase(String a, String b) {
|
||||||
|
return (a == b || (a.length() == b.length() && a.equalsIgnoreCase(b)));
|
||||||
|
}
|
||||||
|
|
||||||
public static String repeat(String s, int n) {
|
public static String repeat(String s, int n) {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
for(int i = 0; i < n; i++) {
|
for(int i = 0; i < n; i++) {
|
||||||
|
@ -79,8 +79,8 @@ public class UUIDHandler {
|
|||||||
implementation.setUUIDWrapper(wrapper);
|
implementation.setUUIDWrapper(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startCaching() {
|
public static void startCaching(Runnable whenDone) {
|
||||||
implementation.startCaching();
|
implementation.startCaching(whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void cache(final BiMap<StringWrapper, UUID> toAdd) {
|
public static void cache(final BiMap<StringWrapper, UUID> toAdd) {
|
||||||
|
@ -40,7 +40,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
* Start UUID caching (this should be an async task)
|
* Start UUID caching (this should be an async task)
|
||||||
* Recommended to override this is you want to cache offline players
|
* Recommended to override this is you want to cache offline players
|
||||||
*/
|
*/
|
||||||
public boolean startCaching() {
|
public boolean startCaching(Runnable whenDone) {
|
||||||
if (CACHED) {
|
if (CACHED) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -55,6 +55,11 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
this.uuidWrapper = wrapper;
|
this.uuidWrapper = wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void rename(UUID uuid, StringWrapper name) {
|
||||||
|
uuidMap.inverse().remove(uuid);
|
||||||
|
uuidMap.put(name, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
public void add(final BiMap<StringWrapper, UUID> toAdd) {
|
public void add(final BiMap<StringWrapper, UUID> toAdd) {
|
||||||
if (uuidMap.size() == 0) {
|
if (uuidMap.size() == 0) {
|
||||||
uuidMap = toAdd;
|
uuidMap = toAdd;
|
||||||
@ -63,7 +68,20 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Map.Entry<StringWrapper, UUID> entry : toAdd.entrySet()) {
|
for (Map.Entry<StringWrapper, UUID> entry : toAdd.entrySet()) {
|
||||||
add(entry.getKey(), entry.getValue());
|
UUID uuid = entry.getValue();
|
||||||
|
StringWrapper name = entry.getKey();
|
||||||
|
if ((uuid == null) || (name == null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BiMap<UUID, StringWrapper> inverse = uuidMap.inverse();
|
||||||
|
if (inverse.containsKey(uuid)) {
|
||||||
|
if (uuidMap.containsKey(name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rename(uuid, name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
uuidMap.put(name, uuid);
|
||||||
}
|
}
|
||||||
PS.log(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
|
PS.log(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
|
||||||
}
|
}
|
||||||
@ -79,7 +97,8 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
if (uuidMap.containsKey(name)) {
|
if (uuidMap.containsKey(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inverse.remove(uuid);
|
rename(uuid, name);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
uuidMap.put(name, uuid);
|
uuidMap.put(name, uuid);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.intellectualsites.commands;
|
package com.intellectualsites.commands;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import org.bukkit.entity.Player;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
|
||||||
public abstract class Argument<T> {
|
public abstract class Argument<T> {
|
||||||
|
|
||||||
@ -28,7 +30,7 @@ public abstract class Argument<T> {
|
|||||||
return this.example;
|
return this.example;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Argument<Integer> Integer = new Argument<java.lang.Integer>("int", 16) {
|
public static final Argument<Integer> Integer = new Argument<Integer>("int", 16) {
|
||||||
@Override
|
@Override
|
||||||
public Integer parse(String in) {
|
public Integer parse(String in) {
|
||||||
Integer value = null;
|
Integer value = null;
|
||||||
@ -39,7 +41,7 @@ public abstract class Argument<T> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Argument<Boolean> Boolean = new Argument<java.lang.Boolean>("boolean", true) {
|
public static final Argument<Boolean> Boolean = new Argument<Boolean>("boolean", true) {
|
||||||
@Override
|
@Override
|
||||||
public Boolean parse(String in) {
|
public Boolean parse(String in) {
|
||||||
Boolean value = null;
|
Boolean value = null;
|
||||||
@ -52,33 +54,31 @@ public abstract class Argument<T> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Argument<String> String = new Argument<java.lang.String>("String", "Example") {
|
public static final Argument<String> String = new Argument<String>("String", "Example") {
|
||||||
@Override
|
@Override
|
||||||
public String parse(String in) {
|
public String parse(String in) {
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Argument<String> PlayerName = new Argument<java.lang.String>("PlayerName", "Dinnerbone") {
|
public static Argument<String> PlayerName = new Argument<String>("PlayerName", "Dinnerbone") {
|
||||||
@Override
|
@Override
|
||||||
public String parse(String in) {
|
public String parse(String in) {
|
||||||
return in.length() < 16 ? in : null;
|
return in.length() < 16 ? in : null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Argument<PlotId> PlotID = new Argument<com.intellectualcrafters.plot.object.PlotId>("PlotID", new PlotId(3, -32)) {
|
public static Argument<PlotId> PlotID = new Argument<PlotId>("PlotID", new PlotId(-6, 3)) {
|
||||||
@Override
|
@Override
|
||||||
public PlotId parse(String in) {
|
public PlotId parse(String in) {
|
||||||
PlotId plotID;
|
return PlotId.fromString(in);
|
||||||
try {
|
|
||||||
String[] parts = in.split(";");
|
|
||||||
int i1 = java.lang.Integer.parseInt(parts[0]);
|
|
||||||
int i2 = java.lang.Integer.parseInt(parts[1]);
|
|
||||||
plotID = new PlotId(i1, i2);
|
|
||||||
} catch(final Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
return plotID;
|
};
|
||||||
|
|
||||||
|
public static Argument<Plot> Plot = new Argument<Plot>("Plot", new Plot("plotworld", new PlotId(3, -6), null)) {
|
||||||
|
@Override
|
||||||
|
public Plot parse(String in) {
|
||||||
|
return MainUtil.getPlotFromString(ConsolePlayer.getConsole(), in, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,13 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.CommandCategory;
|
import com.intellectualcrafters.plot.commands.CommandCategory;
|
||||||
|
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
public abstract class Command extends CommandManager {
|
public abstract class Command extends CommandManager {
|
||||||
|
|
||||||
private Class requiredType = Object.class;
|
private RequiredType requiredType = RequiredType.NONE;
|
||||||
private String command, usage = "", description = "", permission = "";
|
private String command, usage = "", description = "", permission = "";
|
||||||
private Set<String> aliases = new HashSet<>();
|
private Set<String> aliases = new HashSet<>();
|
||||||
private CommandCategory category;
|
private CommandCategory category;
|
||||||
@ -59,7 +62,7 @@ public abstract class Command extends CommandManager {
|
|||||||
this.aliases = new HashSet<>(Arrays.asList(aliases));
|
this.aliases = new HashSet<>(Arrays.asList(aliases));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command(String command, String usage, String description, String permission, String[] aliases, Class requiredType) {
|
public Command(String command, String usage, String description, String permission, String[] aliases, RequiredType requiredType) {
|
||||||
super(null, new ArrayList<Command>());
|
super(null, new ArrayList<Command>());
|
||||||
this.command = command;
|
this.command = command;
|
||||||
this.usage = usage;
|
this.usage = usage;
|
||||||
@ -69,7 +72,7 @@ public abstract class Command extends CommandManager {
|
|||||||
this.requiredType = requiredType;
|
this.requiredType = requiredType;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public Class getRequiredType() {
|
final public RequiredType getRequiredType() {
|
||||||
return this.requiredType;
|
return this.requiredType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,23 +96,19 @@ public abstract class Command extends CommandManager {
|
|||||||
final public String toString() {
|
final public String toString() {
|
||||||
return this.command;
|
return this.command;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
final public int hashCode() {
|
|
||||||
return this.command.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract boolean onCommand(CommandCaller caller, String[] arguments);
|
public abstract boolean onCommand(PlotPlayer plr, String[] arguments);
|
||||||
|
|
||||||
final public int handle(CommandCaller caller, String[] args) {
|
final public int handle(PlotPlayer plr, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
return super.handle(caller, "");
|
return super.handle(plr, "");
|
||||||
}
|
}
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for (String s : args) {
|
for (String s : args) {
|
||||||
builder.append(s).append(" ");
|
builder.append(s).append(" ");
|
||||||
}
|
}
|
||||||
String s = builder.substring(0, builder.length() - 1);
|
String s = builder.substring(0, builder.length() - 1);
|
||||||
return super.handle(caller, s);
|
return super.handle(plr, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
final public String getCommand() {
|
final public String getCommand() {
|
||||||
@ -139,4 +138,32 @@ public abstract class Command extends CommandManager {
|
|||||||
final public CommandCategory getCategory() {
|
final public CommandCategory getCategory() {
|
||||||
return this.category;
|
return this.category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Command other = (Command) obj;
|
||||||
|
if (this.hashCode() != other.hashCode()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.command.equals(other.command);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int hash;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
if (hash == 0) {
|
||||||
|
hash = getCommand().hashCode();
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
package com.intellectualsites.commands;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualsites.commands.Argument;
|
|
||||||
import com.intellectualsites.commands.Command;
|
|
||||||
import com.intellectualsites.commands.CommandManager;
|
|
||||||
|
|
||||||
public interface CommandCaller<T> {
|
|
||||||
|
|
||||||
boolean hasPermission(String permission);
|
|
||||||
|
|
||||||
void message(String message);
|
|
||||||
|
|
||||||
T getSuperCaller();
|
|
||||||
|
|
||||||
void message(C c, String ... args);
|
|
||||||
|
|
||||||
void sendRequiredArgumentsList(CommandManager manager, Command cmd, Argument[] required);
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
package com.intellectualsites.commands;
|
package com.intellectualsites.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.CommandCategory;
|
import com.intellectualcrafters.plot.commands.CommandCategory;
|
||||||
|
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
@ -21,7 +22,7 @@ public @interface CommandDeclaration {
|
|||||||
|
|
||||||
String description() default "";
|
String description() default "";
|
||||||
|
|
||||||
Class requiredType() default Object.class;
|
RequiredType requiredType() default RequiredType.NONE;
|
||||||
|
|
||||||
CommandCategory category();
|
CommandCategory category();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,11 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import com.intellectualsites.commands.util.StringUtil;
|
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class CommandManager {
|
public class CommandManager {
|
||||||
@ -68,8 +72,8 @@ public class CommandManager {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int handle(CommandCaller caller, String input) {
|
public int handle(PlotPlayer plr, String input) {
|
||||||
if (initialCharacter != null && !StringUtil.startsWith(initialCharacter, input)) {
|
if (initialCharacter != null && !input.startsWith(initialCharacter + "")) {
|
||||||
return CommandHandlingOutput.NOT_COMMAND;
|
return CommandHandlingOutput.NOT_COMMAND;
|
||||||
}
|
}
|
||||||
input = initialCharacter == null ? input : input.substring(1);
|
input = initialCharacter == null ? input : input.substring(1);
|
||||||
@ -87,10 +91,10 @@ public class CommandManager {
|
|||||||
if (cmd == null) {
|
if (cmd == null) {
|
||||||
return CommandHandlingOutput.NOT_FOUND;
|
return CommandHandlingOutput.NOT_FOUND;
|
||||||
}
|
}
|
||||||
if (!cmd.getRequiredType().isInstance(caller.getSuperCaller())) {
|
if (!cmd.getRequiredType().allows(plr)) {
|
||||||
return CommandHandlingOutput.CALLER_OF_WRONG_TYPE;
|
return CommandHandlingOutput.CALLER_OF_WRONG_TYPE;
|
||||||
}
|
}
|
||||||
if (!caller.hasPermission(cmd.getPermission())) {
|
if (!plr.hasPermission(cmd.getPermission())) {
|
||||||
return CommandHandlingOutput.NOT_PERMITTED;
|
return CommandHandlingOutput.NOT_PERMITTED;
|
||||||
}
|
}
|
||||||
Argument[] requiredArguments = cmd.getRequiredArguments();
|
Argument[] requiredArguments = cmd.getRequiredArguments();
|
||||||
@ -108,16 +112,16 @@ public class CommandManager {
|
|||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
String usage = cmd.getUsage();
|
String usage = cmd.getUsage();
|
||||||
caller.sendRequiredArgumentsList(this, cmd, requiredArguments);
|
C.COMMAND_SYNTAX.send(plr, cmd.getUsage());
|
||||||
return CommandHandlingOutput.WRONG_USAGE;
|
return CommandHandlingOutput.WRONG_USAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
boolean a = cmd.onCommand(caller, args);
|
boolean a = cmd.onCommand(plr, args);
|
||||||
if (!a) {
|
if (!a) {
|
||||||
String usage = cmd.getUsage();
|
String usage = cmd.getUsage();
|
||||||
if (usage != null && !usage.isEmpty()) {
|
if (usage != null && !usage.isEmpty()) {
|
||||||
caller.message(usage);
|
MainUtil.sendMessage(plr, usage);
|
||||||
}
|
}
|
||||||
return CommandHandlingOutput.WRONG_USAGE;
|
return CommandHandlingOutput.WRONG_USAGE;
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package com.intellectualsites.commands.util;
|
|
||||||
|
|
||||||
public class StringUtil {
|
|
||||||
|
|
||||||
public static final String[] emptyArray = new String[0];
|
|
||||||
|
|
||||||
public static boolean startsWith(char c, String s) {
|
|
||||||
return !(s == null || s.isEmpty()) && s.toCharArray()[0] == c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean inArray(String s, String[] a, boolean matchCase) {
|
|
||||||
for (String aS : a) {
|
|
||||||
if (matchCase) {
|
|
||||||
if (s.equals(aS)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (s.equalsIgnoreCase(aS)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -92,7 +92,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
}
|
}
|
||||||
List<World> worlds = Bukkit.getWorlds();
|
List<World> worlds = Bukkit.getWorlds();
|
||||||
if (worlds.size() > 0) {
|
if (worlds.size() > 0) {
|
||||||
UUIDHandler.startCaching();
|
UUIDHandler.startCaching(null);
|
||||||
for (World world : worlds) {
|
for (World world : worlds) {
|
||||||
try {
|
try {
|
||||||
SetGenCB.setGenerator(world);
|
SetGenCB.setGenerator(world);
|
||||||
@ -456,9 +456,9 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
FlagManager.removeFlag(FlagManager.getFlag("titles"));
|
FlagManager.removeFlag(FlagManager.getFlag("titles"));
|
||||||
} else {
|
} else {
|
||||||
AbstractTitle.TITLE_CLASS = new DefaultTitle();
|
AbstractTitle.TITLE_CLASS = new DefaultTitle();
|
||||||
if (UUIDHandler.getUUIDWrapper() instanceof DefaultUUIDWrapper) {
|
if (wrapper instanceof DefaultUUIDWrapper) {
|
||||||
Settings.TWIN_MODE_UUID = true;
|
Settings.TWIN_MODE_UUID = true;
|
||||||
} else if (UUIDHandler.getUUIDWrapper() instanceof OfflineUUIDWrapper && !Bukkit.getOnlineMode()) {
|
} else if (wrapper instanceof OfflineUUIDWrapper && !Bukkit.getOnlineMode()) {
|
||||||
Settings.TWIN_MODE_UUID = true;
|
Settings.TWIN_MODE_UUID = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||||
@ -31,7 +32,7 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
|
|||||||
if (commandSender instanceof Player) {
|
if (commandSender instanceof Player) {
|
||||||
return MainCommand.onCommand(BukkitUtil.getPlayer((Player) commandSender), commandLabel, args);
|
return MainCommand.onCommand(BukkitUtil.getPlayer((Player) commandSender), commandLabel, args);
|
||||||
}
|
}
|
||||||
return MainCommand.onCommand(null, commandLabel, args);
|
return MainCommand.onCommand(ConsolePlayer.getConsole(), commandLabel, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,6 +47,6 @@ public class WorldEvents implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void worldLoad(final WorldLoadEvent event) {
|
public void worldLoad(final WorldLoadEvent event) {
|
||||||
UUIDHandler.startCaching();
|
UUIDHandler.startCaching(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,14 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean startCaching() {
|
public boolean startCaching(Runnable whenDone) {
|
||||||
if (!super.startCaching()) {
|
if (!super.startCaching(whenDone)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return cache(whenDone);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean cache(final Runnable whenDone) {
|
||||||
final File container = Bukkit.getWorldContainer();
|
final File container = Bukkit.getWorldContainer();
|
||||||
List<World> worlds = Bukkit.getWorlds();
|
List<World> worlds = Bukkit.getWorlds();
|
||||||
final String world;
|
final String world;
|
||||||
@ -48,7 +52,6 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
else {
|
else {
|
||||||
world = worlds.get(0).getName();
|
world = worlds.get(0).getName();
|
||||||
}
|
}
|
||||||
CACHED = true;
|
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -88,6 +91,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
add(toAdd);
|
add(toAdd);
|
||||||
|
if (whenDone != null) whenDone.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final HashSet<String> worlds = new HashSet<>();
|
final HashSet<String> worlds = new HashSet<>();
|
||||||
@ -172,6 +176,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
add(toAdd);
|
add(toAdd);
|
||||||
|
if (whenDone != null) whenDone.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -10,14 +10,15 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.intellectualcrafters.json.JSONObject;
|
import com.intellectualcrafters.json.JSONObject;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -43,13 +44,13 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PreparedStatement stmt = getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS `usercache` (cache_key INTEGER PRIMARY KEY, uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL)");
|
PreparedStatement stmt = getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username))");
|
||||||
stmt.execute();
|
stmt.execute();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
startCaching();
|
startCaching(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SQLUUIDHandlerException extends RuntimeException {
|
private class SQLUUIDHandlerException extends RuntimeException {
|
||||||
@ -71,57 +72,50 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean startCaching() {
|
public boolean startCaching(final Runnable whenDone) {
|
||||||
if (!super.startCaching()) {
|
if (!super.startCaching(whenDone)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
final HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||||
PreparedStatement statement = getConnection().prepareStatement("SELECT `uuid`, `username` FROM `usercache`");
|
PreparedStatement statement = getConnection().prepareStatement("SELECT `uuid`, `username` FROM `usercache`");
|
||||||
ResultSet resultSet = statement.executeQuery();
|
ResultSet resultSet = statement.executeQuery();
|
||||||
StringWrapper username;
|
StringWrapper username;
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
boolean found = false;
|
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
found = true;
|
|
||||||
username = new StringWrapper(resultSet.getString("username"));
|
username = new StringWrapper(resultSet.getString("username"));
|
||||||
uuid = UUID.fromString(resultSet.getString("uuid"));
|
uuid = UUID.fromString(resultSet.getString("uuid"));
|
||||||
add(new StringWrapper(username.value), uuid);
|
toAdd.put(new StringWrapper(username.value), uuid);
|
||||||
}
|
}
|
||||||
add(new StringWrapper("*"), DBFunc.everyone);
|
|
||||||
statement.close();
|
statement.close();
|
||||||
if (!found) {
|
add(toAdd);
|
||||||
PS.log(C.PREFIX.s() + "&cUsing player data files, couldn't find any cached UUIDs");
|
add(new StringWrapper("*"), DBFunc.everyone);
|
||||||
for (World world : Bukkit.getWorlds()) {
|
|
||||||
FileUUIDHandler fileHandler = new FileUUIDHandler(SQLUUIDHandler.this.uuidWrapper);
|
// This should be called as long as there are some unknown plots
|
||||||
fileHandler.startCaching();
|
final List<UUID> toFetch = new ArrayList<>();
|
||||||
}
|
|
||||||
PS.log(C.PREFIX.s() + "&cWill fetch the uuids for all plots!");
|
|
||||||
List<UUID> toFetch = new ArrayList<>();
|
|
||||||
for (UUID u : UUIDHandler.getAllUUIDS()) {
|
for (UUID u : UUIDHandler.getAllUUIDS()) {
|
||||||
if (!uuidExists(u)) {
|
if (!uuidExists(u)) {
|
||||||
toFetch.add(u);
|
toFetch.add(u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PS.log(C.PREFIX.s() + "&cFetching &6" + toFetch.size() + "&c uuids!");
|
|
||||||
List<UUID> fetched = new ArrayList<>();
|
|
||||||
for (UUID u : toFetch) {
|
|
||||||
OfflinePlayer plr = Bukkit.getOfflinePlayer(u);
|
|
||||||
if (plr != null) {
|
|
||||||
if (plr.getName() != null) {
|
|
||||||
add(new StringWrapper(plr.getName()), u);
|
|
||||||
fetched.add(u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PS.log(C.PREFIX.s() + "&cFetched &6" + fetched.size() + "&c from player files!");
|
|
||||||
toFetch.removeAll(fetched);
|
|
||||||
if (!Settings.OFFLINE_MODE) {
|
|
||||||
if (toFetch.isEmpty()) {
|
if (toFetch.isEmpty()) {
|
||||||
|
if (whenDone != null) whenDone.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
FileUUIDHandler fileHandler = new FileUUIDHandler(SQLUUIDHandler.this.uuidWrapper);
|
||||||
|
fileHandler.startCaching(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// If the file based UUID handler didn't cache it, then we can't cache offline mode
|
||||||
|
// Also, trying to cache based on files again, is useless as that's what the file based uuid cacher does
|
||||||
|
if (Settings.OFFLINE_MODE) {
|
||||||
|
if (whenDone != null) whenDone.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Settings.OFFLINE_MODE) {
|
||||||
PS.log(C.PREFIX.s() + "&cWill fetch &6" + toFetch.size() + "&c from mojang!");
|
PS.log(C.PREFIX.s() + "&cWill fetch &6" + toFetch.size() + "&c from mojang!");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Iterator<UUID> iterator = toFetch.iterator();
|
Iterator<UUID> iterator = toFetch.iterator();
|
||||||
@ -161,7 +155,9 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (whenDone != null) whenDone.run();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new SQLUUIDHandlerException("Couldn't select :s", e);
|
throw new SQLUUIDHandlerException("Couldn't select :s", e);
|
||||||
}
|
}
|
||||||
@ -211,7 +207,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
@Override
|
@Override
|
||||||
public boolean add(final StringWrapper name, final UUID uuid) {
|
public boolean add(final StringWrapper name, final UUID uuid) {
|
||||||
// Ignoring duplicates
|
// Ignoring duplicates
|
||||||
if (!super.add(name, uuid)) {
|
if (super.add(name, uuid)) {
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -226,10 +222,10 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This isn't used as any UUID that is unknown is bulk cached (in lots of 16)
|
* This isn't used as any UUID that is unknown is bulk cached (in lots of 16)
|
||||||
@ -263,4 +259,23 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rename(final UUID uuid, final StringWrapper name) {
|
||||||
|
super.rename(uuid, name);
|
||||||
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
PreparedStatement statement = getConnection().prepareStatement("UPDATE usercache SET `username`=? WHERE `uuid`=?");
|
||||||
|
statement.setString(1, name.value);
|
||||||
|
statement.setString(2, uuid.toString());
|
||||||
|
statement.execute();
|
||||||
|
PS.log(C.PREFIX.s() + "Name change for '" + uuid + "' to '" + name.value + "'");
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
|||||||
Collection<World> worlds = server.getWorlds();
|
Collection<World> worlds = server.getWorlds();
|
||||||
if (worlds.size() > 0) {
|
if (worlds.size() > 0) {
|
||||||
log("INJECTING WORLDS!!!!!!!");
|
log("INJECTING WORLDS!!!!!!!");
|
||||||
UUIDHandler.startCaching();
|
UUIDHandler.startCaching(null);
|
||||||
for (World world : server.getWorlds()) {
|
for (World world : server.getWorlds()) {
|
||||||
log("INJECTING WORLD: " + world.getName());
|
log("INJECTING WORLD: " + world.getName());
|
||||||
world.setWorldGenerator(new SpongePlotGenerator(world.getName()));
|
world.setWorldGenerator(new SpongePlotGenerator(world.getName()));
|
||||||
|
Loading…
Reference in New Issue
Block a user