mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
messages
This commit is contained in:
parent
4cf92c4a0a
commit
6c2bce824c
@ -57,7 +57,7 @@ public class Claim extends SubCommand {
|
||||
if (!event.isCancelled()) {
|
||||
MainUtil.createPlot(player, plot);
|
||||
MainUtil.setSign(player, plot);
|
||||
BukkitPlayerFunctions.sendMessage(player, C.CLAIMED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.CLAIMED);
|
||||
if (teleport) {
|
||||
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ public class Cluster extends SubCommand {
|
||||
DBFunc.setInvited(world, cluster, uuid);
|
||||
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
||||
if (player != null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.CLUSTER_INVITED, cluster.getName());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.CLUSTER_INVITED, cluster.getName());
|
||||
}
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED_USER);
|
||||
@ -367,7 +367,7 @@ public class Cluster extends SubCommand {
|
||||
DBFunc.removeInvited(cluster, uuid);
|
||||
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
||||
if (player != null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.CLUSTER_REMOVED, cluster.getName());
|
||||
}
|
||||
for (final Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) {
|
||||
final PlotCluster current = ClusterManager.getCluster(plot);
|
||||
|
@ -38,7 +38,7 @@ public class CreateRoadSchematic extends SubCommand {
|
||||
@Override
|
||||
public boolean execute(final Player player, final String... args) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(player)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
if (!(PlotSquared.getPlotWorld(player.getWorld()) instanceof HybridPlotWorld)) {
|
||||
@ -48,7 +48,7 @@ public class CreateRoadSchematic extends SubCommand {
|
||||
final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld());
|
||||
manager.setupRoadSchematic(plot);
|
||||
MainUtil.update(BukkitUtil.getLocation(entity));
|
||||
BukkitPlayerFunctions.sendMessage(player, "&6Saved new road schematic");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&6Saved new road schematic");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public class Database extends SubCommand {
|
||||
if (player == null) {
|
||||
PlotSquared.log(msg);
|
||||
} else {
|
||||
BukkitPlayerFunctions.sendMessage(player, msg);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), msg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class DebugClaimTest extends SubCommand {
|
||||
if (!event.isCancelled()) {
|
||||
MainUtil.createPlot(player, plot);
|
||||
MainUtil.setSign(player, plot);
|
||||
BukkitPlayerFunctions.sendMessage(player, C.CLAIMED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.CLAIMED);
|
||||
if (teleport) {
|
||||
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class DebugExec extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, "Possible sub commands: /plot debugexec <" + StringUtils.join(allowed_params, "|") + ">");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "Possible sub commands: /plot debugexec <" + StringUtils.join(allowed_params, "|") + ">");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||
if (result) {
|
||||
SetBlockManager.setBlockManager.update(Arrays.asList(new Chunk[] { chunk }));
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, "&6Regenerating chunk: " + chunk.getX() + "," + chunk.getZ() + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&6Regenerating chunk: " + chunk.getX() + "," + chunk.getZ() + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class Denied extends SubCommand {
|
||||
if (!uuid.equals(DBFunc.everyone) && (player != null) && player.isOnline()) {
|
||||
final Plot pl = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||
if ((pl != null) && pl.id.equals(plot.id)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.YOU_BE_DENIED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.YOU_BE_DENIED);
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
}
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ public class FlagCmd extends SubCommand {
|
||||
* plot flag list
|
||||
*/
|
||||
if (args.length == 0) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||
return false;
|
||||
}
|
||||
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||
if (plot == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
@ -66,88 +66,88 @@ public class FlagCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasRights(player) && !BukkitMain.hasPermission(player, "plots.set.flag.other")) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag.other");
|
||||
return false;
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "info": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag")) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.info");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.info");
|
||||
return false;
|
||||
}
|
||||
if (args.length != 2) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
||||
return false;
|
||||
}
|
||||
final AbstractFlag af = FlagManager.getFlag(args[1]);
|
||||
if (af == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
||||
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
||||
return false;
|
||||
}
|
||||
// flag key
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_KEY, af.getKey());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_KEY, af.getKey());
|
||||
// flag type
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_TYPE, af.value.getClass().getSimpleName());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_TYPE, af.value.getClass().getSimpleName());
|
||||
// Flag type description
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_DESC, af.getValueDesc());
|
||||
BukkitPlayerFunctions.sendMessage(player, "&cNot implemented.");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_DESC, af.getValueDesc());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&cNot implemented.");
|
||||
}
|
||||
case "set": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag")) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag");
|
||||
return false;
|
||||
}
|
||||
if (args.length < 3) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag set <flag> <value>");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag set <flag> <value>");
|
||||
return false;
|
||||
}
|
||||
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
||||
if (af == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||
final Object parsed = af.parseValueRaw(value);
|
||||
if (parsed == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, "&c" + af.getValueDesc());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&c" + af.getValueDesc());
|
||||
return false;
|
||||
}
|
||||
final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed);
|
||||
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
||||
if (!result) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_NOT_ADDED);
|
||||
return false;
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_ADDED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_ADDED);
|
||||
PlotListener.plotEntry(player, plot);
|
||||
return true;
|
||||
}
|
||||
case "remove": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.flag.remove")) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.remove");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.remove");
|
||||
return false;
|
||||
}
|
||||
if ((args.length != 2) && (args.length != 3)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
|
||||
return false;
|
||||
}
|
||||
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
||||
if (af == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
final Flag flag = FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase());
|
||||
if (flag == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_IN_PLOT);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
if ((args.length == 3) && flag.getAbstractFlag().isList()) {
|
||||
@ -157,36 +157,36 @@ public class FlagCmd extends SubCommand {
|
||||
} else {
|
||||
final boolean result = FlagManager.removePlotFlag(plot, flag.getKey());
|
||||
if (!result) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_REMOVED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_NOT_REMOVED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_REMOVED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_REMOVED);
|
||||
PlotListener.plotEntry(player, plot);
|
||||
return true;
|
||||
}
|
||||
case "add": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.flag.add")) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.add");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.add");
|
||||
return false;
|
||||
}
|
||||
if (args.length < 3) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag add <flag> <values>");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag add <flag> <values>");
|
||||
return false;
|
||||
}
|
||||
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
||||
if (af == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||
final Object parsed = af.parseValueRaw(value);
|
||||
if (parsed == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, "&c" + af.getValueDesc());
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&c" + af.getValueDesc());
|
||||
return false;
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, args[1].toLowerCase());
|
||||
@ -197,21 +197,21 @@ public class FlagCmd extends SubCommand {
|
||||
}
|
||||
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
||||
if (!result) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_NOT_ADDED);
|
||||
return false;
|
||||
}
|
||||
DBFunc.setFlags(plot.world, plot, plot.settings.flags);
|
||||
BukkitPlayerFunctions.sendMessage(player, C.FLAG_ADDED);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.FLAG_ADDED);
|
||||
PlotListener.plotEntry(player, plot);
|
||||
return true;
|
||||
}
|
||||
case "list": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.flag.list")) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.list");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.list");
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag list");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag list");
|
||||
return false;
|
||||
}
|
||||
final HashMap<String, ArrayList<String>> flags = new HashMap<>();
|
||||
@ -228,11 +228,11 @@ public class FlagCmd extends SubCommand {
|
||||
message += prefix + "&6" + flag + ": &7" + StringUtils.join(flags.get(flag), ", ");
|
||||
prefix = "\n";
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, message);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), message);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ public class Info extends SubCommand {
|
||||
if (player != null) {
|
||||
world = player.getWorld();
|
||||
if (!PlotSquared.isPlotWorld(world)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT_WORLD);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitPlayerFunctions.isInPlot(player)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
plot = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||
@ -73,7 +73,7 @@ public class Info extends SubCommand {
|
||||
}
|
||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[0]);
|
||||
if (plotworld == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_WORLD);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_WORLD);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@ -81,7 +81,7 @@ public class Info extends SubCommand {
|
||||
final PlotId id = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
||||
plot = MainUtil.getPlot(Bukkit.getWorld(plotworld.worldname), id);
|
||||
if (plot == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_PLOT_ID);
|
||||
return false;
|
||||
}
|
||||
world = Bukkit.getWorld(args[0]);
|
||||
@ -91,7 +91,7 @@ public class Info extends SubCommand {
|
||||
args = new String[0];
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.INFO_SYNTAX_CONSOLE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class Info extends SubCommand {
|
||||
}
|
||||
// Unclaimed?
|
||||
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.PLOT_INFO_UNCLAIMED, (plot.id.x + ";" + plot.id.y));
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.PLOT_INFO_UNCLAIMED, (plot.id.x + ";" + plot.id.y));
|
||||
return true;
|
||||
}
|
||||
String owner = "none";
|
||||
@ -123,13 +123,13 @@ public class Info extends SubCommand {
|
||||
if (args.length == 1) {
|
||||
info = getCaption(args[0].toLowerCase());
|
||||
if (info == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, "&6Categories&7: &ahelpers&7, &aalias&7, &abiome&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, &aowner&7, &arating");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&6Categories&7: &ahelpers&7, &aalias&7, &abiome&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, &aowner&7, &arating");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
info = format(info, world, plot, player);
|
||||
BukkitPlayerFunctions.sendMessage(player, C.PLOT_INFO_HEADER);
|
||||
BukkitPlayerFunctions.sendMessage(player, info, false);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.PLOT_INFO_HEADER);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), info, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class MainCommand {
|
||||
};
|
||||
|
||||
public static boolean no_permission(final PlotPlayer player, final String permission) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, permission);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, permission);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ public class MainCommand {
|
||||
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"));
|
||||
return BukkitPlayerFunctions.sendMessage(player, builder.toString());
|
||||
return MainUtil.sendMessage(BukkitUtil.getPlayer(player), builder.toString());
|
||||
}
|
||||
final String cat = args[1];
|
||||
SubCommand.CommandCategory cato = null;
|
||||
@ -137,7 +137,7 @@ public class MainCommand {
|
||||
for (final SubCommand.CommandCategory category : SubCommand.CommandCategory.values()) {
|
||||
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
||||
}
|
||||
return BukkitPlayerFunctions.sendMessage(player, builder.toString(), false);
|
||||
return MainUtil.sendMessage(BukkitUtil.getPlayer(player), builder.toString(), false);
|
||||
}
|
||||
final StringBuilder help = new StringBuilder();
|
||||
int page = 0;
|
||||
@ -181,14 +181,14 @@ public class MainCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_SUBCOMMAND);
|
||||
final String[] commands = new String[subCommands.size()];
|
||||
for (int x = 0; x < subCommands.size(); x++) {
|
||||
commands[x] = subCommands.get(x).cmd;
|
||||
}
|
||||
/* Let's try to get a proper usage string */
|
||||
final String command = new StringComparison(args[0], commands).getBestMatch();
|
||||
return BukkitPlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
|
||||
return MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.DID_YOU_MEAN, "/plot " + command);
|
||||
// PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new
|
||||
// StringComparsion(args[0], commands).getBestMatch());
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
passed = false;
|
||||
}
|
||||
if (passed) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.BORDER);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.BORDER);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
final UUID uuid = UUIDHandler.getUUID(player);
|
||||
if (plot.isDenied(uuid)) {
|
||||
if (!BukkitMain.hasPermission(player, "plots.admin.entry.denied")) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.entry.denied");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.entry.denied");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -265,7 +265,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.destroy.unowned")) {
|
||||
return;
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -279,7 +279,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (BukkitMain.hasPermission(event.getPlayer(), "plots.admin.destroy.other")) {
|
||||
return;
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.other");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.destroy.other");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -289,7 +289,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
if (isPlotArea(loc)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.road");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.destroy.road");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -529,7 +529,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.interact.unowned")) {
|
||||
return;
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -542,7 +542,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) {
|
||||
return;
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.interact.other");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -552,7 +552,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
if (isPlotArea(loc)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.interact.road");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -746,6 +746,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (Setup.setupMap.containsKey(event.getPlayer().getName())) {
|
||||
Setup.setupMap.remove(event.getPlayer().getName());
|
||||
}
|
||||
BukkitUtil.removePlayer(event.getPlayer().getName());
|
||||
if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) {
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(event.getPlayer().getName()).values();
|
||||
for (final Plot plot : plots) {
|
||||
@ -1079,7 +1080,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.build.unowned")) {
|
||||
return;
|
||||
}
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -1090,7 +1091,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.admin.build.other")) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.other");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.other");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -1099,7 +1100,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.admin.build.road")) {
|
||||
if (isPlotArea(loc)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.road");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -108,12 +108,12 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(player));
|
||||
if (plot == null) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT);
|
||||
return;
|
||||
}
|
||||
UUID uuid = UUIDHandler.getUUID(player);
|
||||
if (!plot.isAdded(uuid)) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NO_PLOT_PERMS);
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PLOT_PERMS);
|
||||
return;
|
||||
}
|
||||
final Set<Player> plotPlayers = new HashSet<>();
|
||||
@ -215,7 +215,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOTIFY_ENTER.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOTIFY_ENTER.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -258,7 +258,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
BukkitPlayerFunctions.sendMessage(player, C.NOTIFY_LEAVE.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOTIFY_LEAVE.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,14 @@ public class BukkitUtil extends BlockManager {
|
||||
private static Player lastPlayer = null;
|
||||
private static PlotPlayer lastPlotPlayer = null;
|
||||
|
||||
public static void removePlayer(String plr) {
|
||||
if (lastPlayer != null && lastPlayer.getName().equals(plr)) {
|
||||
lastPlayer = null;
|
||||
lastPlotPlayer = null;
|
||||
}
|
||||
players.remove(plr);
|
||||
}
|
||||
|
||||
public static PlotPlayer getPlayer(Player player) {
|
||||
if (player == lastPlayer) {
|
||||
return lastPlotPlayer;
|
||||
|
Loading…
Reference in New Issue
Block a user