Doc Updates, Renaming, Reformatting, and a Test

Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
matt 2019-02-22 11:51:06 -05:00
parent bfc6b62213
commit 25530ed7f0
102 changed files with 1590 additions and 1386 deletions

View File

@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.bukkit.uuid.*;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
@ -140,7 +140,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
if (Settings.Enabled_Components.METRICS) {
this.startMetrics();
} else {
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
PlotSquared.log(Captions.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
}
if (Settings.Enabled_Components.WORLDS) {
TaskManager.IMP.taskRepeat(this::unload, 20);
@ -238,7 +238,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override public void log(@NonNull String message) {
try {
message = C.color(message);
message = Captions.color(message);
if (!Settings.Chat.CONSOLE_COLOR) {
message = ChatColor.stripColor(message);
}
@ -287,7 +287,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
}
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
PlotSquared.log(Captions.PREFIX + "KillAllEntities started.");
TaskManager.runTaskRepeat(() -> PlotSquared.get().forEachPlotArea(plotArea -> {
final World world = Bukkit.getWorld(plotArea.worldname);
try {
@ -621,55 +621,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
return new BukkitSetupUtils();
}
@Override public UUIDHandlerImplementation initUUIDHandler() {
boolean checkVersion = false;
try {
OfflinePlayer.class.getDeclaredMethod("getUniqueId");
checkVersion = true;
} catch (Throwable ignore) {
}
final UUIDWrapper wrapper;
if (Settings.UUID.OFFLINE) {
if (Settings.UUID.FORCE_LOWERCASE) {
wrapper = new LowerOfflineUUIDWrapper();
} else {
wrapper = new OfflineUUIDWrapper();
}
Settings.UUID.OFFLINE = true;
} else if (checkVersion) {
wrapper = new DefaultUUIDWrapper();
Settings.UUID.OFFLINE = false;
} else {
if (Settings.UUID.FORCE_LOWERCASE) {
wrapper = new LowerOfflineUUIDWrapper();
} else {
wrapper = new OfflineUUIDWrapper();
}
Settings.UUID.OFFLINE = true;
}
if (!checkVersion) {
PlotSquared.log(C.PREFIX
+ " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
Settings.TITLES = false;
} else {
AbstractTitle.TITLE_CLASS = new DefaultTitle_111();
if (wrapper instanceof DefaultUUIDWrapper
|| wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) {
Settings.UUID.NATIVE_UUID_PROVIDER = true;
}
}
if (Settings.UUID.OFFLINE) {
PlotSquared.log(C.PREFIX + " &6" + getPluginName()
+ " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
+ "Bukkit");
} else {
PlotSquared.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs");
}
if (Settings.UUID.USE_SQLUUIDHANDLER) {
return new SQLUUIDHandler(wrapper);
} else {
return new FileUUIDHandler(wrapper);
@Override public void startMetrics() {
if (this.metricsStarted) {
return;
}
System.setProperty("bstats.relocatecheck",
"false"); // We do not want to relocate the package...
Metrics metrics = new Metrics(this);// bstats
PlotSquared.log(Captions.PREFIX + "&6Metrics enabled.");
this.metricsStarted = true;
}
@Override public ChunkManager initChunkManager() {
@ -700,15 +660,55 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
return new BukkitInventoryUtil();
}
@Override public void startMetrics() {
if (this.metricsStarted) {
return;
@Override public UUIDHandlerImplementation initUUIDHandler() {
boolean checkVersion = false;
try {
OfflinePlayer.class.getDeclaredMethod("getUniqueId");
checkVersion = true;
} catch (Throwable ignore) {
}
final UUIDWrapper wrapper;
if (Settings.UUID.OFFLINE) {
if (Settings.UUID.FORCE_LOWERCASE) {
wrapper = new LowerOfflineUUIDWrapper();
} else {
wrapper = new OfflineUUIDWrapper();
}
Settings.UUID.OFFLINE = true;
} else if (checkVersion) {
wrapper = new DefaultUUIDWrapper();
Settings.UUID.OFFLINE = false;
} else {
if (Settings.UUID.FORCE_LOWERCASE) {
wrapper = new LowerOfflineUUIDWrapper();
} else {
wrapper = new OfflineUUIDWrapper();
}
Settings.UUID.OFFLINE = true;
}
if (!checkVersion) {
PlotSquared.log(Captions.PREFIX
+ " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
Settings.TITLES = false;
} else {
AbstractTitle.TITLE_CLASS = new DefaultTitle_111();
if (wrapper instanceof DefaultUUIDWrapper
|| wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) {
Settings.UUID.NATIVE_UUID_PROVIDER = true;
}
}
if (Settings.UUID.OFFLINE) {
PlotSquared.log(Captions.PREFIX + " &6" + getPluginName()
+ " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
+ "Bukkit");
} else {
PlotSquared.log(Captions.PREFIX + " &6" + getPluginName() + " is using online UUIDs");
}
if (Settings.UUID.USE_SQLUUIDHANDLER) {
return new SQLUUIDHandler(wrapper);
} else {
return new FileUUIDHandler(wrapper);
}
System.setProperty("bstats.relocatecheck",
"false"); // We do not want to relocate the package...
Metrics metrics = new Metrics(this);// bstats
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
this.metricsStarted = true;
}
@Override public void setGenerator(@NonNull final String worldName) {

View File

@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.commands.SubCommand;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -55,14 +55,15 @@ import java.util.Map.Entry;
Class<?> clazz = Class.forName(args[0]);
newWrapper = (UUIDWrapper) clazz.newInstance();
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot uuidconvert <lower|offline|online>");
return false;
}
}
if (args.length != 2 || !"-o".equals(args[1])) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot uuidconvert " + args[0] + " - o");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot uuidconvert " + args[0] + " - o");
MainUtil.sendMessage(player, "&cBe aware of the following!");
MainUtil.sendMessage(player,
"&8 - &cUse the database command or another method to backup your plots beforehand");
@ -109,7 +110,8 @@ import java.util.Map.Entry;
UUID uuid = UUID.fromString(s);
uuids.add(uuid);
} catch (Exception ignored) {
MainUtil.sendMessage(player, C.PREFIX + "Invalid playerdata: " + current);
MainUtil.sendMessage(player,
Captions.PREFIX + "Invalid playerdata: " + current);
}
}
}
@ -137,7 +139,7 @@ import java.util.Map.Entry;
}
} catch (Throwable ignored) {
MainUtil.sendMessage(player,
C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
Captions.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
}
}
for (String name : names) {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.bukkit.listeners;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -227,8 +227,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
if (!chunk.isLoaded()) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
PlotSquared.debug(
Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@ -236,8 +236,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
if (tiles.length == 0) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
PlotSquared.debug(
Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@ -247,8 +247,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
if (i >= tiles.length) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
PlotSquared.debug(
Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@ -273,13 +273,15 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
}
}
PlotSquared.debug(
C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4)
Captions.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX()
<< 4)
+ "," + (chunk.getX() << 4));
}
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
if (unload) {
PlotSquared.debug(
C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (
Captions.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + ","
+ (
chunk.getX() << 4));
cleanChunk(chunk);
return true;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -85,7 +85,8 @@ import java.util.UUID;
if (plot.isAdded(uuid)) {
Set<PlotPlayer> players = getNearbyPlayers(player, plot);
for (PlotPlayer oPlayer : players) {
if (!Permissions.hasPermission(oPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
if (!Permissions
.hasPermission(oPlayer, Captions.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
((BukkitPlayer) oPlayer).player
.setVelocity(calculateVelocity(plotPlayer, oPlayer));
}
@ -95,7 +96,8 @@ import java.util.UUID;
if (oPlayer == null) {
return;
}
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
if (!Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
}
}

View File

@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.bukkit.object.BukkitLazyBlock;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType;
@ -453,14 +453,14 @@ import java.util.regex.Pattern;
if (shooter instanceof Player) {
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
if (plot == null) {
if (!Permissions.hasPermission(pp, C.PERMISSION_PROJECTILE_UNOWNED)) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_PROJECTILE_UNOWNED)) {
entity.remove();
return false;
}
return true;
}
if (plot.isAdded(pp.getUUID()) || Permissions
.hasPermission(pp, C.PERMISSION_PROJECTILE_OTHER)) {
.hasPermission(pp, Captions.PERMISSION_PROJECTILE_OTHER)) {
return true;
}
entity.remove();
@ -508,7 +508,7 @@ import java.util.regex.Pattern;
case "worldedit:up":
case "worldedit:/up":
if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions
.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER, true))) {
.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) {
event.setCancelled(true);
return;
}
@ -519,7 +519,7 @@ import java.util.regex.Pattern;
}
Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS);
if (flag.isPresent() && !Permissions
.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
List<String> blocked_cmds = flag.get();
String part = parts[0];
if (parts[0].contains(":")) {
@ -569,7 +569,7 @@ import java.util.regex.Pattern;
perm = "plots.admin.command.blocked-cmds.other";
}
if (!Permissions.hasPermission(pp, perm)) {
MainUtil.sendMessage(pp, C.COMMAND_BLOCKED);
MainUtil.sendMessage(pp, Captions.COMMAND_BLOCKED);
event.setCancelled(true);
}
return;
@ -637,8 +637,8 @@ import java.util.regex.Pattern;
if (plot != null) {
final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot);
if (!result) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT,
C.PERMISSION_ADMIN_ENTRY_DENIED);
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_ENTRY_DENIED);
event.setCancelled(true);
if (lastLoc != null) {
pp.setMeta(PlotPlayer.META_LOCATION, lastLoc);
@ -760,7 +760,8 @@ import java.util.regex.Pattern;
if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
.getMeta("kick", false)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_EXIT_DENIED);
this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) {
player.teleport(from);
@ -774,7 +775,8 @@ import java.util.regex.Pattern;
} else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_ENTRY_DENIED);
this.tmpTeleport = false;
to.setX(from.getBlockX());
to.setY(from.getBlockY());
@ -789,14 +791,14 @@ import java.util.regex.Pattern;
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
MainUtil.sendMessage(pp, C.BORDER);
MainUtil.sendMessage(pp, Captions.BORDER);
}
if (x2 < -border && this.tmpTeleport) {
to.setX(-border + 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
MainUtil.sendMessage(pp, C.BORDER);
MainUtil.sendMessage(pp, Captions.BORDER);
}
}
int z2;
@ -818,7 +820,8 @@ import java.util.regex.Pattern;
if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
.getMeta("kick", false)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_EXIT_DENIED);
this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) {
player.teleport(from);
@ -832,7 +835,8 @@ import java.util.regex.Pattern;
} else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_ENTRY_DENIED);
this.tmpTeleport = false;
player.teleport(from);
to.setX(from.getBlockX());
@ -848,13 +852,13 @@ import java.util.regex.Pattern;
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
MainUtil.sendMessage(pp, C.BORDER);
MainUtil.sendMessage(pp, Captions.BORDER);
} else if (z2 < -border && this.tmpTeleport) {
to.setZ(-border + 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
MainUtil.sendMessage(pp, C.BORDER);
MainUtil.sendMessage(pp, Captions.BORDER);
}
}
}
@ -876,7 +880,7 @@ import java.util.regex.Pattern;
}
event.setCancelled(true);
String message = event.getMessage();
String format = C.PLOT_CHAT_FORMAT.s();
String format = Captions.PLOT_CHAT_FORMAT.s();
String sender = event.getPlayer().getDisplayName();
PlotId id = plot.getId();
Set<Player> recipients = event.getRecipients();
@ -896,14 +900,15 @@ import java.util.regex.Pattern;
String partial = ChatColor.translateAlternateColorCodes('&',
format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender));
if (plotPlayer.hasPermission("plots.chat.color")) {
message = C.color(message);
message = Captions.color(message);
}
String full = partial.replace("%msg%", message);
for (Player receiver : recipients) {
receiver.sendMessage(full);
}
if (!spies.isEmpty()) {
String spyMessage = C.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y)
String spyMessage =
Captions.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y)
.replace("%sender%", sender).replace("%msg%", message);
for (Player player : spies) {
player.sendMessage(spyMessage);
@ -924,26 +929,27 @@ import java.util.regex.Pattern;
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
if (event.getBlock().getY() == 0) {
if (!Permissions
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL);
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL);
event.setCancelled(true);
return;
}
} else if (
(location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
&& !Permissions
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(plotPlayer,
C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.s()
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
}
if (!plot.hasOwner()) {
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
if (Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
return;
}
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
C.PERMISSION_ADMIN_DESTROY_UNOWNED);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED);
event.setCancelled(true);
return;
}
@ -954,16 +960,17 @@ import java.util.regex.Pattern;
.contains(PlotBlock.get(block.getType().name()))) {
return;
}
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
if (Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
return;
}
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
C.PERMISSION_ADMIN_DESTROY_OTHER);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
C.PERMISSION_ADMIN_BUILD_OTHER);
if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
return;
}
@ -971,7 +978,7 @@ import java.util.regex.Pattern;
return;
}
PlotPlayer pp = BukkitUtil.getPlayer(player);
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) {
return;
}
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
@ -980,7 +987,8 @@ import java.util.regex.Pattern;
return;
}
}
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
MainUtil
.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_DESTROY_ROAD);
event.setCancelled(true);
}
@ -1051,7 +1059,7 @@ import java.util.regex.Pattern;
plotExit(pp, plot);
}
if (PlotSquared.get().worldedit != null) {
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_WORLDEDIT_BYPASS)) {
if (pp.getAttribute("worldedit")) {
pp.removeAttribute("worldedit");
}
@ -1224,7 +1232,8 @@ import java.util.regex.Pattern;
}
if (!plot.hasOwner()) {
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
if (Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
return;
}
event.setCancelled(true);
@ -1236,7 +1245,7 @@ import java.util.regex.Pattern;
Block block = event.getBlock();
if (destroy.isPresent() && destroy.get()
.contains(PlotBlock.get(block.getType().name())) || Permissions
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
return;
}
event.setCancelled(true);
@ -1245,7 +1254,7 @@ import java.util.regex.Pattern;
return;
}
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) {
return;
}
event.setCancelled(true);
@ -1612,19 +1621,21 @@ import java.util.regex.Pattern;
boolean cancelled = false;
if (plot == null) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road");
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.road");
cancelled = true;
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned");
MainUtil
.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.unowned");
cancelled = true;
}
} else {
UUID uuid = pp.getUUID();
if (!plot.isAdded(uuid)) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other");
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
"plots.admin.interact.other");
cancelled = true;
}
}
@ -1672,12 +1683,13 @@ import java.util.regex.Pattern;
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
if (plot == null) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road");
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.road");
e.setCancelled(true);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned");
MainUtil
.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.unowned");
e.setCancelled(true);
}
} else {
@ -1687,7 +1699,8 @@ import java.util.regex.Pattern;
return;
}
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other");
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
"plots.admin.interact.other");
e.setCancelled(true);
}
}
@ -2161,19 +2174,21 @@ import java.util.regex.Pattern;
if (player != null) {
PlotPlayer pp = BukkitUtil.getPlayer(player);
if (plot == null) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_ROAD);
event.setCancelled(true);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
event.setCancelled(true);
}
} else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
}
} else if (Flags.BLOCK_IGNITION.isFalse(plot)) {
@ -2237,29 +2252,33 @@ import java.util.regex.Pattern;
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
Plot plot = area.getPlot(location);
if (plot == null) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
return;
}
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_ROAD);
event.setCancelled(true);
} else if (!plot.hasOwner()) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
return;
}
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
event.setCancelled(true);
} else if (!plot.isAdded(pp.getUUID())) {
if (Flags.USE.contains(plot, PlotBlock.get(event.getBucket().getId(), 0))) {
return;
}
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
return;
}
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
}
}
@ -2293,17 +2312,18 @@ import java.util.regex.Pattern;
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
Plot plot = area.getPlot(location);
if (plot == null) {
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_ROAD)) {
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
return;
}
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_ROAD);
event.setCancelled(true);
} else if (!plot.hasOwner()) {
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
return;
}
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
event.setCancelled(true);
} else if (!plot.isAdded(plotPlayer.getUUID())) {
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
@ -2311,15 +2331,16 @@ import java.util.regex.Pattern;
if (use.isPresent() && use.get().contains(PlotBlock.get(block.getType().name()))) {
return;
}
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
return;
}
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
}
}
@ -2356,24 +2377,25 @@ import java.util.regex.Pattern;
PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = area.getPlot(location);
if (plot == null) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_ROAD);
event.setCancelled(true);
}
} else {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
event.setCancelled(true);
}
return;
}
if (!plot.isAdded(pp.getUUID())) {
if (!plot.getFlag(Flags.HANGING_PLACE, false)) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
}
return;
@ -2399,24 +2421,24 @@ import java.util.regex.Pattern;
PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = area.getPlot(location);
if (plot == null) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_DESTROY_ROAD);
event.setCancelled(true);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED);
event.setCancelled(true);
}
} else if (!plot.isAdded(pp.getUUID())) {
if (plot.getFlag(Flags.HANGING_BREAK, false)) {
return;
}
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
event.setCancelled(true);
}
}
@ -2434,17 +2456,17 @@ import java.util.regex.Pattern;
if (plot != null) {
if (!plot.hasOwner()) {
if (!Permissions
.hasPermission(player, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT,
C.PERMISSION_ADMIN_DESTROY_UNOWNED);
.hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED);
event.setCancelled(true);
}
} else if (!plot.isAdded(player.getUUID())) {
if (!plot.getFlag(Flags.HANGING_BREAK, false)) {
if (!Permissions
.hasPermission(player, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT,
C.PERMISSION_ADMIN_DESTROY_OTHER);
.hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
event.setCancelled(true);
}
}
@ -2467,14 +2489,15 @@ import java.util.regex.Pattern;
PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = area.getPlot(location);
if (plot == null) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_ROAD);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_INTERACT_ROAD);
event.setCancelled(true);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_UNOWNED);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED);
event.setCancelled(true);
}
} else if (!plot.isAdded(pp.getUUID())) {
@ -2501,8 +2524,9 @@ import java.util.regex.Pattern;
if (entity instanceof ItemFrame && plot.getFlag(Flags.MISC_INTERACT, false)) {
return;
}
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_OTHER);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_INTERACT_OTHER);
event.setCancelled(true);
}
}
@ -2522,14 +2546,14 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location);
if (plot == null) {
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.road");
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
"plots.admin.vehicle.break.road");
event.setCancelled(true);
}
} else {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT,
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
"plots.admin.vehicle.break.unowned");
event.setCancelled(true);
return;
@ -2541,7 +2565,7 @@ import java.util.regex.Pattern;
return;
}
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT,
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
"plots.admin.vehicle.break.other");
event.setCancelled(true);
}
@ -2680,7 +2704,7 @@ import java.util.regex.Pattern;
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.destroy." + stub);
return false;
}
@ -2690,7 +2714,7 @@ import java.util.regex.Pattern;
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.destroy." + stub);
return false;
}
@ -2701,8 +2725,8 @@ import java.util.regex.Pattern;
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.pve." + stub);
return false;
}
} else if (victim instanceof Tameable) { // victim is tameable
@ -2711,15 +2735,15 @@ import java.util.regex.Pattern;
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.pve." + stub);
return false;
}
} else if (victim instanceof Player) {
if (plot != null) {
if (Flags.PVP.isFalse(plot) && !Permissions
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.pvp." + stub);
return false;
} else {
@ -2727,8 +2751,8 @@ import java.util.regex.Pattern;
}
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.pvp." + stub);
return false;
}
} else if (victim instanceof Creature) { // victim is animal
@ -2737,8 +2761,8 @@ import java.util.regex.Pattern;
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.pve." + stub);
return false;
}
} else if (victim instanceof Vehicle) { // Vehicles are managed in vehicle destroy event
@ -2749,8 +2773,8 @@ import java.util.regex.Pattern;
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.pve." + stub);
return false;
}
}
@ -2775,20 +2799,20 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location);
if (plot == null) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) {
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road");
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.projectile.road");
event.setHatching(false);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.projectile.unowned");
event.setHatching(false);
}
} else if (!plot.isAdded(plotPlayer.getUUID())) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) {
MainUtil
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other");
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
"plots.admin.projectile.other");
event.setHatching(false);
}
}
@ -2806,15 +2830,15 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location);
if (plot != null) {
if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
&& !Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
&& !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(pp,
C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.s()
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
}
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
event.setCancelled(true);
return;
}
@ -2826,14 +2850,16 @@ import java.util.regex.Pattern;
return;
}
}
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
return;
}
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
return;
}
@ -2844,8 +2870,9 @@ import java.util.regex.Pattern;
sendBlockChange(block.getLocation(), block.getBlockData());
}
}
} else if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
} else if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_BUILD_ROAD);
event.setCancelled(true);
}
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -100,15 +100,15 @@ public class BukkitPlayer extends PlotPlayer {
}
@Override public int hasPermissionRange(String stub, int range) {
if (hasPermission(C.PERMISSION_ADMIN.s())) {
if (hasPermission(Captions.PERMISSION_ADMIN.s())) {
return Integer.MAX_VALUE;
}
String[] nodes = stub.split("\\.");
StringBuilder n = new StringBuilder();
for (int i = 0; i < (nodes.length - 1); i++) {
n.append(nodes[i]).append(".");
if (!stub.equals(n + C.PERMISSION_STAR.s())) {
if (hasPermission(n + C.PERMISSION_STAR.s())) {
if (!stub.equals(n + Captions.PERMISSION_STAR.s())) {
if (hasPermission(n + Captions.PERMISSION_STAR.s())) {
return Integer.MAX_VALUE;
}
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.schematic;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.sk89q.jnbt.*;
import org.bukkit.Material;
import org.bukkit.World;
@ -132,7 +132,7 @@ public class StateWrapper {
.replace("\"underlined\":true,", "&n").replace("\"italic\":true,", "&o")
.replace("[{\"text\":\"", "&0").replace("{\"text\":\"", "&0").replace("\"},", "")
.replace("\"}]", "").replace("\"}", "");
for (Entry<String, String> entry : C.replacements.entrySet()) {
for (Entry<String, String> entry : Captions.replacements.entrySet()) {
str = str.replace(entry.getKey(), entry.getValue());
}
return str;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.chat.FancyMessage;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
@ -21,7 +21,7 @@ public class BukkitChatManager extends ChatManager<FancyMessage> {
}
@Override public void color(PlotMessage message, String color) {
message.$(this).color(ChatColor.getByChar(C.color(color).substring(1)));
message.$(this).color(ChatColor.getByChar(Captions.color(color).substring(1)));
}
@Override public void tooltip(PlotMessage message, PlotMessage... tooltips) {

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem;
import com.github.intellectualsites.plotsquared.plot.util.*;
@ -174,9 +174,9 @@ import java.util.*;
*
* @param player the recipient of the message
* @param caption the message
* @see MainUtil#sendMessage(PlotPlayer, C, String...)
* @see MainUtil#sendMessage(PlotPlayer, Captions, String...)
*/
public static void sendMessage(Player player, C caption) {
public static void sendMessage(Player player, Captions caption) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), caption);
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid;
import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
@ -48,7 +48,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
world = worlds.get(0).getName();
}
TaskManager.runTaskAsync(() -> {
PlotSquared.debug(C.PREFIX + "&6Starting player data caching for: " + world);
PlotSquared.debug(Captions.PREFIX + "&6Starting player data caching for: " + world);
File uuidFile = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt");
if (uuidFile.exists()) {
try {
@ -115,7 +115,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
}
} catch (Exception e) {
e.printStackTrace();
PlotSquared.debug(C.PREFIX + "Invalid playerdata: " + current);
PlotSquared.debug(Captions.PREFIX + "Invalid playerdata: " + current);
}
}
}
@ -145,7 +145,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
UUID uuid = UUID.fromString(s);
uuids.add(uuid);
} catch (Exception ignored) {
PlotSquared.debug(C.PREFIX + "Invalid PlayerData: " + current);
PlotSquared.debug(Captions.PREFIX + "Invalid PlayerData: " + current);
}
}
break;
@ -199,8 +199,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
}
}
} catch (Exception ignored) {
PlotSquared
.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
PlotSquared.debug(
Captions.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
}
}
for (String name : names) {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.bukkit.uuid;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
@ -153,7 +153,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
}
@Override public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
PlotSquared.debug(C.PREFIX + "UUID for '" + name
PlotSquared.debug(Captions.PREFIX + "UUID for '" + name
+ "' was null. We'll cache this from the Mojang servers!");
if (ifFetch == null) {
return;
@ -196,25 +196,6 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
}
}
@Override public boolean add(final StringWrapper name, final UUID uuid) {
// Ignoring duplicates
if (super.add(name, uuid)) {
TaskManager.runTaskAsync(() -> {
try (PreparedStatement statement = getConnection()
.prepareStatement("REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) {
statement.setString(1, uuid.toString());
statement.setString(2, name.toString());
statement.execute();
PlotSquared.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
} catch (SQLException e) {
e.printStackTrace();
}
});
return true;
}
return false;
}
/**
* This is useful for name changes
*/
@ -226,14 +207,34 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
statement.setString(1, name.value);
statement.setString(2, uuid.toString());
statement.execute();
PlotSquared
.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
PlotSquared.debug(
Captions.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
} catch (SQLException e) {
e.printStackTrace();
}
});
}
@Override public boolean add(final StringWrapper name, final UUID uuid) {
// Ignoring duplicates
if (super.add(name, uuid)) {
TaskManager.runTaskAsync(() -> {
try (PreparedStatement statement = getConnection()
.prepareStatement("REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) {
statement.setString(1, uuid.toString());
statement.setString(2, name.toString());
statement.execute();
PlotSquared
.debug(Captions.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
} catch (SQLException e) {
e.printStackTrace();
}
});
return true;
}
return false;
}
private class SQLUUIDHandlerException extends RuntimeException {
SQLUUIDHandlerException(String s, Throwable c) {

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.api;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -57,7 +57,7 @@ import java.util.UUID;
}
/**
* Add a plot world.
* Adds a plot world.
*
* @param plotArea Plot World Object
* @see PlotSquared#addPlotArea(PlotArea)
@ -67,13 +67,13 @@ import java.util.UUID;
}
/**
* Returns the PlotSquared configurations file.
* Gets the configuration file for this plugin.
*
* @return main configuration
* @see PlotSquared#config
* @return the configuration file for PlotSquared
* =
*/
public YamlConfiguration getConfig() {
return PlotSquared.get().config;
return PlotSquared.get().getConfig();
}
/**
@ -151,20 +151,20 @@ import java.util.UUID;
* Send a message to the console. The message supports color codes.
*
* @param message the message
* @see MainUtil#sendConsoleMessage(C, String...)
* @see MainUtil#sendConsoleMessage(Captions, String...)
*/
public void sendConsoleMessage(String message) {
PlotSquared.log(message);
}
/**
* Send a message to the console.
* Sends a message to the console.
*
* @param caption the message
* @see #sendConsoleMessage(String)
* @see C
* @see Captions
*/
public void sendConsoleMessage(C caption) {
public void sendConsoleMessage(Captions caption) {
sendConsoleMessage(caption.s());
}

View File

@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
@ -239,18 +239,19 @@ public abstract class Command {
if (page < totalPages && page > 0) { // Back | Next
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ")
.color("$3").text("->").color("$1").command(baseCommand + " " + (page + 2))
.text(C.CLICKABLE.s()).color("$2").send(player);
.text(Captions.CLICKABLE.s()).color("$2").send(player);
return;
}
if (page == 0 && totalPages != 0) { // Next
new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1")
.command(baseCommand + " " + (0 + 2)).text(C.CLICKABLE.s()).color("$2")
.command(baseCommand + " " + (0 + 2)).text(Captions.CLICKABLE.s()).color("$2")
.send(player);
return;
}
if (page == totalPages && totalPages != 0) { // Back
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ")
.color("$3").text("->").color("$3").text(C.CLICKABLE.s()).color("$2").send(player);
.color("$3").text("->").color("$3").text(Captions.CLICKABLE.s()).color("$2")
.send(player);
}
}
@ -267,7 +268,7 @@ public abstract class Command {
if (this.parent == null) {
MainCommand.getInstance().help.displayHelp(player, null, 0);
} else {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
}
return;
}
@ -279,7 +280,7 @@ public abstract class Command {
Command cmd = getCommand(args[0]);
if (cmd == null) {
if (this.parent != null) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return;
}
// Help command
@ -294,11 +295,11 @@ public abstract class Command {
} catch (IllegalArgumentException ignored) {
}
// Command recommendation
MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
MainUtil.sendMessage(player, Captions.NOT_VALID_SUBCOMMAND);
List<Command> commands = getCommands(player);
if (commands.isEmpty()) {
MainUtil
.sendMessage(player, C.DID_YOU_MEAN, MainCommand.getInstance().help.getUsage());
MainUtil.sendMessage(player, Captions.DID_YOU_MEAN,
MainCommand.getInstance().help.getUsage());
return;
}
String[] allargs =
@ -313,7 +314,7 @@ public abstract class Command {
if (cmd == null) {
cmd = new StringComparison<>(args[0], this.allCommands).getMatchObject();
}
MainUtil.sendMessage(player, C.DID_YOU_MEAN, cmd.getUsage());
MainUtil.sendMessage(player, Captions.DID_YOU_MEAN, cmd.getUsage());
return;
}
String[] newArgs = Arrays.copyOfRange(args, 1, args.length);
@ -344,7 +345,7 @@ public abstract class Command {
failed = failed || reqArgs[i].parse(args[i]) == null;
}
if (failed) {
C.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " "));
Captions.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " "));
return false;
}
}
@ -426,12 +427,13 @@ public abstract class Command {
}
if (!this.required.allows(player)) {
if (message) {
MainUtil.sendMessage(player,
this.required == RequiredType.PLAYER ? C.IS_CONSOLE : C.NOT_CONSOLE);
MainUtil.sendMessage(player, this.required == RequiredType.PLAYER ?
Captions.IS_CONSOLE :
Captions.NOT_CONSOLE);
}
} else if (!Permissions.hasPermission(player, getPermission())) {
if (message) {
C.NO_PERMISSION.send(player, getPermission());
Captions.NO_PERMISSION.send(player, getPermission());
}
} else {
return true;
@ -548,13 +550,13 @@ public abstract class Command {
return this.getFullId().hashCode();
}
public void checkTrue(boolean mustBeTrue, C message, Object... args) {
public void checkTrue(boolean mustBeTrue, Captions message, Object... args) {
if (!mustBeTrue) {
throw new CommandException(message, args);
}
}
public <T extends Object> T check(T object, C message, Object... args) {
public <T extends Object> T check(T object, Captions message, Object... args) {
if (object == null) {
throw new CommandException(message, args);
}
@ -568,9 +570,9 @@ public abstract class Command {
public static class CommandException extends RuntimeException {
private final Object[] args;
private final C message;
private final Captions message;
public CommandException(C message, Object... args) {
public CommandException(Captions message, Object... args) {
this.message = message;
this.args = args;
}

View File

@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.MemorySection;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization;
import com.github.intellectualsites.plotsquared.plot.commands.WE_Anywhere;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.config.Storage;
@ -42,6 +42,7 @@ import java.util.*;
import java.util.Map.Entry;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@ -64,13 +65,13 @@ import java.util.zip.ZipInputStream;
public File commandsFile;
public File translationFile;
public YamlConfiguration style;
public YamlConfiguration config;
public YamlConfiguration worlds;
public YamlConfiguration storage;
public YamlConfiguration commands;
// Temporary hold the plots/clusters before the worlds load
public HashMap<String, Set<PlotCluster>> clusters_tmp;
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
private YamlConfiguration config;
// Implementation logger
@Setter @Getter private ILogger logger;
// Platform / Version / Update URL
@ -129,7 +130,7 @@ import java.util.zip.ZipInputStream;
this.translationFile = MainUtil.getFile(this.IMP.getDirectory(),
Settings.Paths.TRANSLATIONS + File.separator + IMP.getPluginName()
+ ".use_THIS.yml");
C.load(this.translationFile);
Captions.load(this.translationFile);
// Setup plotAreaManager
if (Settings.Enabled_Components.WORLDS) {
@ -158,7 +159,7 @@ import java.util.zip.ZipInputStream;
if (Settings.Enabled_Components.METRICS) {
this.IMP.startMetrics();
} else {
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName()));
PlotSquared.log(Captions.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName()));
}
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
this.IMP.registerChunkProcessor();
@ -285,7 +286,7 @@ import java.util.zip.ZipInputStream;
e.printStackTrace();
}
PlotSquared.log(C.ENABLED.f(IMP.getPluginName()));
PlotSquared.log(Captions.ENABLED.f(IMP.getPluginName()));
}
/**
@ -801,9 +802,9 @@ import java.util.zip.ZipInputStream;
}
/**
* Gets all the plots in a single set.
* Gets all the plots across all plotworlds in one {@code Set}.
*
* @return Set of Plots
* @return all the plots on the server loaded by this plugin
*/
public Set<Plot> getPlots() {
int size = getPlotCount();
@ -886,12 +887,9 @@ import java.util.zip.ZipInputStream;
* @return Set of plot
*/
public Set<Plot> getPlots(String world, UUID uuid) {
final Set<Plot> plots = new HashSet<>();
for (final Plot plot : getPlots(world)) {
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
plots.add(plot);
}
}
final Set<Plot> plots =
getPlots(world).stream().filter(plot -> plot.hasOwner() && plot.isOwnerAbs(uuid))
.collect(Collectors.toSet());
return Collections.unmodifiableSet(plots);
}
@ -999,7 +997,7 @@ import java.util.zip.ZipInputStream;
}
/**
* Unregister a plot from local memory (does not call DB).
* Unregisters a plot from local memory without calling the database.
*
* @param plot the plot to remove
* @param callEvent If to call an event about the plot being removed
@ -1091,11 +1089,12 @@ import java.util.zip.ZipInputStream;
// Conventional plot generator
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
PlotManager plotManager = plotGenerator.getNewPlotManager();
PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'");
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
PlotSquared.log(Captions.PREFIX + "&aDetected world load for '" + world + "'");
PlotSquared
.log(C.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName());
.log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
PlotSquared.log(
Captions.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName());
if (!this.worlds.contains(path)) {
this.worlds.createSection(path);
worldSection = this.worlds.getConfigurationSection(path);
@ -1120,7 +1119,7 @@ import java.util.zip.ZipInputStream;
debug("World possibly already loaded: " + world);
return;
}
PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'");
PlotSquared.log(Captions.PREFIX + "&aDetected world load for '" + world + "'");
String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName());
if (type == 2) {
Set<PlotCluster> clusters =
@ -1137,7 +1136,7 @@ import java.util.zip.ZipInputStream;
worldSection.createSection("areas." + fullId);
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
PlotSquared.log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2);
PlotSquared.log(Captions.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2);
GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string);
if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
@ -1151,11 +1150,13 @@ import java.util.zip.ZipInputStream;
} catch (IOException e) {
e.printStackTrace();
}
PlotSquared.log(
Captions.PREFIX + "&c | &9generator: &7" + baseGenerator + ">"
+ areaGen);
PlotSquared.log(Captions.PREFIX + "&c | &9plotworld: &7" + pa);
PlotSquared.log(Captions.PREFIX + "&c | &9manager: &7" + pa);
PlotSquared
.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa);
PlotSquared.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name
.log(Captions.PREFIX + "&cNote: &7Area created for cluster:" + name
+ " (invalid or old configuration?)");
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
@ -1178,9 +1179,10 @@ import java.util.zip.ZipInputStream;
} catch (IOException e) {
e.printStackTrace();
}
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + pa);
PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager());
PlotSquared
.log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + pa);
PlotSquared.log(Captions.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
@ -1191,7 +1193,7 @@ import java.util.zip.ZipInputStream;
"Invalid type for multi-area world. Expected `2`, got `" + 1 + "`");
}
for (String areaId : areasSection.getKeys(false)) {
PlotSquared.log(C.PREFIX + "&3 - " + areaId);
PlotSquared.log(Captions.PREFIX + "&3 - " + areaId);
String[] split = areaId.split("(?<=[^;-])-");
if (split.length != 3) {
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
@ -1253,10 +1255,11 @@ import java.util.zip.ZipInputStream;
} catch (IOException e) {
e.printStackTrace();
}
PlotSquared.log(C.PREFIX + "&aDetected area load for '" + world + "'");
PlotSquared.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
PlotSquared.log(Captions.PREFIX + "&aDetected area load for '" + world + "'");
PlotSquared
.log(Captions.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
PlotSquared.log(Captions.PREFIX + "&c | &9plotworld: &7" + pa);
PlotSquared.log(Captions.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
@ -1403,20 +1406,16 @@ import java.util.zip.ZipInputStream;
public String normalisedVersion(@NonNull final String version) {
final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
final StringBuilder sb = new StringBuilder();
for (final String s : split) {
sb.append(String.format("%" + 4 + 's', s));
}
return sb.toString();
return Arrays.stream(split).map(s -> String.format("%4s", s)).collect(Collectors.joining());
}
public boolean update(PlotPlayer sender, URL url) {
private boolean update(PlotPlayer sender, URL url) {
try {
String name = this.jarFile.getName();
File newJar = new File("plugins/update/" + name);
MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url);
URLConnection con = url.openConnection();
try (InputStream stream = con.getInputStream()) {
File newJar = new File("plugins/update/" + name);
File parent = newJar.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
@ -1443,7 +1442,7 @@ import java.util.zip.ZipInputStream;
}
/**
* Copy a file from inside the jar to a location
* Copies a file from inside the jar to a location
*
* @param file Name of the file inside PlotSquared.jar
* @param folder The output location relative to /plugins/PlotSquared/
@ -1511,7 +1510,7 @@ import java.util.zip.ZipInputStream;
}
/**
* Close the database connection.
* Safely closes the database connection.
*/
public void disable() {
try {
@ -1548,7 +1547,7 @@ import java.util.zip.ZipInputStream;
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
database = new SQLite(file);
} else {
PlotSquared.log(C.PREFIX + "&cNo storage type is set!");
PlotSquared.log(Captions.PREFIX + "&cNo storage type is set!");
this.IMP.shutdown(); //shutdown used instead of disable because no database is set
return;
}
@ -1566,8 +1565,8 @@ import java.util.zip.ZipInputStream;
}
this.clusters_tmp = DBFunc.getClusters();
} catch (ClassNotFoundException | SQLException e) {
PlotSquared.log(
C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
PlotSquared.log(Captions.PREFIX
+ "&cFailed to open DATABASE connection. The plugin will disable itself.");
if (Storage.MySQL.USE) {
PlotSquared.log("$4MYSQL");
} else if (Storage.SQLite.USE) {
@ -1589,15 +1588,16 @@ import java.util.zip.ZipInputStream;
* @throws IOException if the config failed to save
*/
public void setupConfig() throws IOException {
String lastVersionString = this.config.getString("version");
String lastVersionString = this.getConfig().getString("version");
if (lastVersionString != null) {
String[] split = lastVersionString.split("\\.");
int[] lastVersion = new int[] {Integer.parseInt(split[0]), Integer.parseInt(split[1]),
Integer.parseInt(split[2])};
if (checkVersion(new int[] {3, 4, 0}, lastVersion)) {
Settings.convertLegacy(configFile);
if (config.contains("worlds")) {
ConfigurationSection worldSection = config.getConfigurationSection("worlds");
if (getConfig().contains("worlds")) {
ConfigurationSection worldSection =
getConfig().getConfigurationSection("worlds");
worlds.set("worlds", worldSection);
try {
worlds.save(worldsFile);
@ -1639,7 +1639,7 @@ import java.util.zip.ZipInputStream;
public boolean setupConfigs() {
File folder = new File(this.IMP.getDirectory(), "config");
if (!folder.exists() && !folder.mkdirs()) {
PlotSquared.log(C.PREFIX
PlotSquared.log(Captions.PREFIX
+ "&cFailed to create the /plugins/config folder. Please create it manually.");
}
try {
@ -1655,11 +1655,11 @@ import java.util.zip.ZipInputStream;
.getString("configuration_version")
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION)) {
// Conversion needed
log(C.LEGACY_CONFIG_FOUND.s());
log(Captions.LEGACY_CONFIG_FOUND.s());
try {
com.google.common.io.Files
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
log(C.LEGACY_CONFIG_BACKUP.s());
log(Captions.LEGACY_CONFIG_BACKUP.s());
final ConfigurationSection worlds =
this.worlds.getConfigurationSection("worlds");
final LegacyConverter converter = new LegacyConverter(worlds);
@ -1668,9 +1668,9 @@ import java.util.zip.ZipInputStream;
.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
this.worlds.set("worlds", worlds); // Redundant, but hey... ¯\_()_/¯
this.worlds.save(this.worldsFile);
log(C.LEGACY_CONFIG_DONE.s());
log(Captions.LEGACY_CONFIG_DONE.s());
} catch (final Exception e) {
log(C.LEGACY_CONFIG_CONVERSION_FAILED.s());
log(Captions.LEGACY_CONFIG_CONVERSION_FAILED.s());
e.printStackTrace();
}
// Disable plugin
@ -1759,7 +1759,7 @@ import java.util.zip.ZipInputStream;
if (Settings.DEBUG) {
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
for (Entry<String, Object> component : components.entrySet()) {
PlotSquared.log(C.PREFIX + String
PlotSquared.log(Captions.PREFIX + String
.format("&cKey: &6%s&c, Value: &6%s", component.getKey(),
component.getValue()));
}
@ -1790,7 +1790,7 @@ import java.util.zip.ZipInputStream;
*
* @return the java version
*/
public double getJavaVersion() {
private double getJavaVersion() {
return Double.parseDouble(System.getProperty("java.specification.version"));
}
@ -1800,36 +1800,36 @@ import java.util.zip.ZipInputStream;
}
}
public void forEachPlotArea(@NonNull final String world, Consumer<PlotArea> runnable) {
public void forEachPlotArea(@NonNull final String world, Consumer<PlotArea> consumer) {
final PlotArea[] array = this.plotAreaManager.getPlotAreas(world, null);
if (array == null) {
return;
}
for (final PlotArea area : array) {
runnable.accept(area);
consumer.accept(area);
}
}
public void forEachPlot(Consumer<Plot> runnable) {
public void forEachPlot(Consumer<Plot> consumer) {
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
area.getPlots().forEach(runnable);
area.getPlots().forEach(consumer);
}
}
public void forEachPlotRaw(Consumer<Plot> runnable) {
public void forEachPlotRaw(Consumer<Plot> consumer) {
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
area.getPlots().forEach(runnable);
area.getPlots().forEach(consumer);
}
if (this.plots_tmp != null) {
for (final HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
entry.values().forEach(runnable);
entry.values().forEach(consumer);
}
}
}
public void forEachBasePlot(Consumer<Plot> run) {
public void forEachBasePlot(Consumer<Plot> consumer) {
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
area.forEachBasePlot(run);
area.forEachBasePlot(consumer);
}
}
@ -1961,6 +1961,10 @@ import java.util.zip.ZipInputStream;
return Collections.unmodifiableSet(set);
}
public YamlConfiguration getConfig() {
return config;
}
public enum SortType {
CREATION_DATE, CREATION_DATE_TIMESTAMP, LAST_MODIFIED, DISTANCE_FROM_ORIGIN
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -28,31 +28,32 @@ import java.util.UUID;
@Override public void execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
checkTrue(plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS);
checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage());
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
Captions.NO_PLOT_PERMS);
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]);
checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]);
Iterator<UUID> iter = uuids.iterator();
int size = plot.getTrusted().size() + plot.getMembers().size();
while (iter.hasNext()) {
UUID uuid = iter.next();
if (uuid == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid));
iter.remove();
continue;
}
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid));
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid));
iter.remove();
continue;
}
if (plot.getMembers().contains(uuid)) {
MainUtil.sendMessage(player, C.ALREADY_ADDED, MainUtil.getName(uuid));
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid));
iter.remove();
continue;
}
@ -60,7 +61,8 @@ import java.util.UUID;
}
checkTrue(!uuids.isEmpty(), null);
checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
Captions.PLOT_MAX_MEMBERS);
confirm.run(this, new Runnable() {
@Override // Success
public void run() {
@ -74,7 +76,7 @@ import java.util.UUID;
}
plot.addMember(uuid);
EventUtil.manager.callMember(player, plot, uuid, true);
MainUtil.sendMessage(player, C.MEMBER_ADDED);
MainUtil.sendMessage(player, Captions.MEMBER_ADDED);
}
}
}, null);

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -21,23 +21,23 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
@Override public boolean onCommand(PlotPlayer player, String[] args) {
if (args.length == 0) {
C.COMMAND_SYNTAX.send(player, "/plot alias <set|remove> <value>");
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set|remove> <value>");
return false;
}
Location loc = player.getLocation();
Plot plot = loc.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
sendMessage(player, C.PLOT_NOT_CLAIMED);
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
return false;
}
if (!plot.isOwner(player.getUUID())) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
@ -46,25 +46,25 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
switch (args[0].toLowerCase()) {
case "set":
if (args.length != 2) {
C.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
return false;
}
if (canExecuteCommand(player, C.PERMISSION_ALIAS_SET, false) || canExecuteCommand(
player, C.PERMISSION_ALIAS_SET_OBSOLETE, false)) {
if (canExecuteCommand(player, Captions.PERMISSION_ALIAS_SET, false)
|| canExecuteCommand(player, Captions.PERMISSION_ALIAS_SET_OBSOLETE, false)) {
result = setAlias(player, plot, args[1]);
} else {
MainUtil.sendMessage(player, C.NO_PERMISSION);
MainUtil.sendMessage(player, Captions.NO_PERMISSION);
}
break;
case "remove":
if (canExecuteCommand(player, C.PERMISSION_ALIAS_REMOVE, true)) {
if (canExecuteCommand(player, Captions.PERMISSION_ALIAS_REMOVE, true)) {
result = removeAlias(player, plot);
}
break;
default:
C.COMMAND_SYNTAX.send(player, "/plot alias <set|remove> <alias>");
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set|remove> <alias>");
result = false;
}
@ -74,47 +74,47 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
private boolean setAlias(PlotPlayer player, Plot plot, String alias) {
if (alias.isEmpty()) {
C.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
return false;
}
if (alias.length() >= 50) {
MainUtil.sendMessage(player, C.ALIAS_TOO_LONG);
MainUtil.sendMessage(player, Captions.ALIAS_TOO_LONG);
return false;
}
if (alias.contains(" ")) {
C.NOT_VALID_VALUE.send(player);
Captions.NOT_VALID_VALUE.send(player);
return false;
}
if (MathMan.isInteger(alias)) {
C.NOT_VALID_VALUE.send(player);
Captions.NOT_VALID_VALUE.send(player);
return false;
}
for (Plot p : PlotSquared.get().getPlots(plot.getArea())) {
if (p.getAlias().equalsIgnoreCase(alias)) {
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN);
return false;
}
}
if (UUIDHandler.nameExists(new StringWrapper(alias)) || PlotSquared.get()
.hasPlotArea(alias)) {
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN);
return false;
}
plot.setAlias(alias);
MainUtil.sendMessage(player, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
MainUtil.sendMessage(player, Captions.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
return true;
}
private boolean removeAlias(PlotPlayer player, Plot plot) {
plot.setAlias(null);
MainUtil.sendMessage(player, C.ALIAS_REMOVED.s());
MainUtil.sendMessage(player, Captions.ALIAS_REMOVED.s());
return true;
}
private boolean canExecuteCommand(PlotPlayer player, C caption, boolean sendMessage) {
private boolean canExecuteCommand(PlotPlayer player, Captions caption, boolean sendMessage) {
if (!Permissions.hasPermission(player, caption)) {
if (sendMessage) {
MainUtil.sendMessage(player, C.NO_PERMISSION);
MainUtil.sendMessage(player, Captions.NO_PERMISSION);
}
return false;
}

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
@ -20,20 +20,20 @@ public class Area extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length == 0) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
switch (args[0].toLowerCase()) {
case "c":
case "setup":
case "create":
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_CREATE)) {
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_CREATE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_CREATE)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_CREATE);
return false;
}
switch (args.length) {
case 1:
C.COMMAND_SYNTAX
Captions.COMMAND_SYNTAX
.send(player, "/plot area create [world[:id]] [<modifier>=<value>]...");
return false;
case 2:
@ -41,13 +41,13 @@ public class Area extends SubCommand {
case "pos1": { // Set position 1
HybridPlotWorld area = player.getMeta("area_create_area");
if (area == null) {
C.COMMAND_SYNTAX.send(player,
Captions.COMMAND_SYNTAX.send(player,
"/plot area create [world[:id]] [<modifier>=<value>]...");
return false;
}
Location location = player.getLocation();
player.setMeta("area_pos1", location);
C.SET_ATTRIBUTE.send(player, "area_pos1",
Captions.SET_ATTRIBUTE.send(player, "area_pos1",
location.getX() + "," + location.getZ());
MainUtil.sendMessage(player,
"You will now set pos2: /plot area create pos2"
@ -57,7 +57,7 @@ public class Area extends SubCommand {
case "pos2": // Set position 2 and finish creation for type=2 (partial)
final HybridPlotWorld area = player.getMeta("area_create_area");
if (area == null) {
C.COMMAND_SYNTAX.send(player,
Captions.COMMAND_SYNTAX.send(player,
"/plot area create [world[:id]] [<modifier>=<value>]...");
return false;
}
@ -84,7 +84,7 @@ public class Area extends SubCommand {
Set<PlotArea> areas =
PlotSquared.get().getPlotAreas(area.worldname, region);
if (!areas.isEmpty()) {
C.CLUSTER_INTERSECTION
Captions.CLUSTER_INTERSECTION
.send(player, areas.iterator().next().toString());
return false;
}
@ -113,7 +113,7 @@ public class Area extends SubCommand {
final String world = SetupUtils.manager.setupWorld(object);
if (WorldUtil.IMP.isWorld(world)) {
PlotSquared.get().loadWorld(world, null);
C.SETUP_FINISHED.send(player);
Captions.SETUP_FINISHED.send(player);
player.teleport(WorldUtil.IMP.getSpawn(world));
if (area.TERRAIN != 3) {
ChunkManager.largeRegionTask(world, region,
@ -153,7 +153,7 @@ public class Area extends SubCommand {
PlotSquared.get().IMP.getDefaultGenerator(), null, null);
PlotArea other = PlotSquared.get().getPlotArea(pa.worldname, id);
if (other != null && Objects.equals(pa.id, other.id)) {
C.SETUP_WORLD_TAKEN.send(player, pa.toString());
Captions.SETUP_WORLD_TAKEN.send(player, pa.toString());
return false;
}
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(pa.worldname);
@ -165,7 +165,7 @@ public class Area extends SubCommand {
for (int i = 2; i < args.length; i++) {
String[] pair = args[i].split("=");
if (pair.length != 2) {
C.COMMAND_SYNTAX.send(player, getCommandString()
Captions.COMMAND_SYNTAX.send(player, getCommandString()
+ " create [world[:id]] [<modifier>=<value>]...");
return false;
}
@ -213,14 +213,14 @@ public class Area extends SubCommand {
object.type = pa.TYPE;
break;
default:
C.COMMAND_SYNTAX.send(player, getCommandString()
Captions.COMMAND_SYNTAX.send(player, getCommandString()
+ " create [world[:id]] [<modifier>=<value>]...");
return false;
}
}
if (pa.TYPE != 2) {
if (WorldUtil.IMP.isWorld(pa.worldname)) {
C.SETUP_WORLD_TAKEN.send(player, pa.worldname);
Captions.SETUP_WORLD_TAKEN.send(player, pa.worldname);
return false;
}
Runnable run = () -> {
@ -236,7 +236,7 @@ public class Area extends SubCommand {
object.setupGenerator = PlotSquared.imp().getPluginName();
String world = SetupUtils.manager.setupWorld(object);
if (WorldUtil.IMP.isWorld(world)) {
C.SETUP_FINISHED.send(player);
Captions.SETUP_FINISHED.send(player);
player.teleport(WorldUtil.IMP.getSpawn(world));
} else {
MainUtil.sendMessage(player,
@ -258,7 +258,7 @@ public class Area extends SubCommand {
return true;
}
if (pa.id == null) {
C.COMMAND_SYNTAX.send(player, getCommandString()
Captions.COMMAND_SYNTAX.send(player, getCommandString()
+ " create [world[:id]] [<modifier>=<value>]...");
return false;
}
@ -281,8 +281,8 @@ public class Area extends SubCommand {
return true;
case "i":
case "info": {
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_INFO)) {
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_INFO);
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_INFO)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_INFO);
return false;
}
PlotArea area;
@ -294,14 +294,14 @@ public class Area extends SubCommand {
area = PlotSquared.get().getPlotAreaByString(args[1]);
break;
default:
C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
return false;
}
if (area == null) {
if (args.length == 2) {
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
} else {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
}
return false;
}
@ -328,13 +328,14 @@ public class Area extends SubCommand {
+ "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + "\n$1Region: $2"
+ region + "\n$1Generator: $2" + generator;
MainUtil.sendMessage(player,
C.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + C.PLOT_INFO_FOOTER.s(), false);
Captions.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER
.s(), false);
return true;
}
case "l":
case "list":
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_LIST)) {
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_LIST);
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_LIST)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_LIST);
return false;
}
int page;
@ -348,7 +349,7 @@ public class Area extends SubCommand {
break;
}
default:
C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
return false;
}
ArrayList<PlotArea> areas = new ArrayList<>(PlotSquared.get().getPlotAreas());
@ -390,19 +391,19 @@ public class Area extends SubCommand {
.color("$1").text(" - ").color("$2")
.text(area.TYPE + ":" + area.TERRAIN).color("$3");
}
}, "/plot area list", C.AREA_LIST_HEADER_PAGED.s());
}, "/plot area list", Captions.AREA_LIST_HEADER_PAGED.s());
return true;
case "regen":
case "clear":
case "reset":
case "regenerate": {
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_REGEN)) {
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_REGEN);
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_REGEN)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_REGEN);
return false;
}
final PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
return false;
}
if (area.TYPE != 2) {
@ -423,17 +424,17 @@ public class Area extends SubCommand {
case "teleport":
case "visit":
case "tp":
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_TP)) {
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_TP);
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_TP)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_TP);
return false;
}
if (args.length != 2) {
C.COMMAND_SYNTAX.send(player, "/plot visit [area]");
Captions.COMMAND_SYNTAX.send(player, "/plot visit [area]");
return false;
}
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
if (area == null) {
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
return false;
}
Location center;
@ -459,7 +460,7 @@ public class Area extends SubCommand {
+ "\n$1Stop the server and delete it from these locations.");
return true;
}
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -30,14 +30,14 @@ public class Auto extends SubCommand {
int diff = currentPlots - allowed_plots;
if (diff + size_x * size_z > 0) {
if (diff < 0) {
MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, -diff + "");
MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS_NUM, -diff + "");
return false;
} else if (player.hasPersistentMeta("grantedPlots")) {
int grantedPlots =
ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots"));
if (grantedPlots - diff < size_x * size_z) {
player.removePersistentMeta("grantedPlots");
MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS);
MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
return false;
} else {
int left = grantedPlots - diff - size_x * size_z;
@ -47,11 +47,11 @@ public class Auto extends SubCommand {
player.setPersistentMeta("grantedPlots",
ByteArrayUtilities.integerToBytes(left));
}
MainUtil.sendMessage(player, C.REMOVED_GRANTED_PLOT, "" + left,
MainUtil.sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "" + left,
"" + (grantedPlots - left));
}
} else {
MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS);
MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
return false;
}
}
@ -106,7 +106,7 @@ public class Auto extends SubCommand {
@Override public void run(Object ignore) {
player.deleteMeta(Auto.class.getName());
if (plot == null) {
MainUtil.sendMessage(player, C.NO_FREE_PLOTS);
MainUtil.sendMessage(player, Captions.NO_FREE_PLOTS);
} else if (checkAllowedPlots(player, area, allowed_plots, 1, 1)) {
plot.claim(player, true, schem, false);
if (area.AUTO_MERGE) {
@ -150,7 +150,7 @@ public class Auto extends SubCommand {
}
}
if (plotarea == null) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
return false;
}
}
@ -158,7 +158,7 @@ public class Auto extends SubCommand {
int size_z = 1;
String schematic = null;
if (args.length > 0) {
if (Permissions.hasPermission(player, C.PERMISSION_AUTO_MEGA)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_AUTO_MEGA)) {
try {
String[] split = args[0].split(",|;");
size_x = Integer.parseInt(split[0]);
@ -179,12 +179,12 @@ public class Auto extends SubCommand {
}
} else {
schematic = args[0];
// PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
// PlayerFunctions.sendMessage(plr, Captions.NO_PERMISSION);
// return false;
}
}
if (size_x * size_z > Settings.Claim.MAX_AUTO_AREA) {
MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM,
MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS_NUM,
Settings.Claim.MAX_AUTO_AREA + "");
return false;
}
@ -196,13 +196,14 @@ public class Auto extends SubCommand {
if (schematic != null && !schematic.isEmpty()) {
if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) {
sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic);
return true;
}
if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
&& !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLAIM_SCHEMATIC.f(schematic));
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
&& !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic));
return true;
}
}
@ -214,11 +215,11 @@ public class Auto extends SubCommand {
cost = (size_x * size_z) * cost;
if (cost > 0d) {
if (EconHandler.manager.getMoney(player) < cost) {
sendMessage(player, C.CANNOT_AFFORD_PLOT, "" + cost);
sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost);
return true;
}
EconHandler.manager.withdrawMoney(player, cost);
sendMessage(player, C.REMOVED_BALANCE, cost + "");
sendMessage(player, Captions.REMOVED_BALANCE, cost + "");
}
}
// TODO handle type 2 the same as normal worlds!
@ -227,7 +228,7 @@ public class Auto extends SubCommand {
return true;
} else {
if (plotarea.TYPE == 2) {
MainUtil.sendMessage(player, C.NO_FREE_PLOTS);
MainUtil.sendMessage(player, Captions.NO_FREE_PLOTS);
return false;
}
while (true) {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -17,20 +17,20 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
int biome = WorldUtil.IMP.getBiomeFromString(value);
if (biome == -1) {
String biomes =
StringMan.join(WorldUtil.IMP.getBiomeList(), C.BLOCK_LIST_SEPARATER.s());
C.NEED_BIOME.send(player);
MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes);
StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s());
Captions.NEED_BIOME.send(player);
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes);
return false;
}
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
plot.addRunning();
plot.setBiome(value.toUpperCase(), new Runnable() {
@Override public void run() {
plot.removeRunning();
MainUtil.sendMessage(player, C.BIOME_SET_TO.s() + value.toLowerCase());
MainUtil.sendMessage(player, Captions.BIOME_SET_TO.s() + value.toLowerCase());
}
});
return true;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -26,39 +26,39 @@ import java.util.Set;
@Override public void execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
final RunnableVal2<Command, CommandResult> whenDone) {
check(EconHandler.manager, C.ECON_DISABLED);
check(EconHandler.manager, Captions.ECON_DISABLED);
final Plot plot;
if (args.length != 0) {
checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage());
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
plot = check(MainUtil.getPlotFromString(player, args[0], true), null);
} else {
plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
}
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
checkTrue(!plot.isOwner(player.getUUID()), C.CANNOT_BUY_OWN);
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
checkTrue(!plot.isOwner(player.getUUID()), Captions.CANNOT_BUY_OWN);
Set<Plot> plots = plot.getConnectedPlots();
checkTrue(player.getPlotCount() + plots.size() <= player.getAllowedPlots(),
C.CANT_CLAIM_MORE_PLOTS);
Captions.CANT_CLAIM_MORE_PLOTS);
Optional<Double> flag = plot.getFlag(Flags.PRICE);
if (!flag.isPresent()) {
throw new CommandException(C.NOT_FOR_SALE);
throw new CommandException(Captions.NOT_FOR_SALE);
}
final double price = flag.get();
checkTrue(player.getMoney() >= price, C.CANNOT_AFFORD_PLOT);
checkTrue(player.getMoney() >= price, Captions.CANNOT_AFFORD_PLOT);
player.withdraw(price);
// Failure
// Success
confirm.run(this, () -> {
C.REMOVED_BALANCE.send(player, price);
Captions.REMOVED_BALANCE.send(player, price);
EconHandler.manager
.depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.owner), price);
PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
if (owner != null) {
C.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price);
Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price);
}
plot.removeFlag(Flags.PRICE);
plot.setOwner(player.getUUID());
C.CLAIMED.send(player);
Captions.CLAIMED.send(player);
whenDone.run(Buy.this, CommandResult.SUCCESS);
}, () -> {
player.deposit(price);

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -23,7 +23,7 @@ public class Claim extends SubCommand {
Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs();
if (plot == null) {
return sendMessage(player, C.NOT_IN_PLOT);
return sendMessage(player, Captions.NOT_IN_PLOT);
}
int currentPlots =
Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
@ -34,40 +34,43 @@ public class Claim extends SubCommand {
ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots"));
if (grants <= 0) {
player.removePersistentMeta("grantedPlots");
return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS);
return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
}
} else {
return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS);
return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
}
}
if (!plot.canClaim(player)) {
return sendMessage(player, C.PLOT_IS_CLAIMED);
return sendMessage(player, Captions.PLOT_IS_CLAIMED);
}
final PlotArea area = plot.getArea();
if (!schematic.isEmpty()) {
if (area.SCHEMATIC_CLAIM_SPECIFY) {
if (!area.SCHEMATICS.contains(schematic.toLowerCase())) {
return sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
return sendMessage(player, Captions.SCHEMATIC_INVALID,
"non-existent: " + schematic);
}
if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
&& !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
&& !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic);
}
}
}
int border = area.getBorder();
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border) {
return !sendMessage(player, C.BORDER);
return !sendMessage(player, Captions.BORDER);
}
if ((EconHandler.manager != null) && area.USE_ECONOMY) {
Expression<Double> costExr = area.PRICES.get("claim");
double cost = costExr.evaluate((double) currentPlots);
if (cost > 0d) {
if (EconHandler.manager.getMoney(player) < cost) {
return sendMessage(player, C.CANNOT_AFFORD_PLOT, "" + cost);
return sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost);
}
EconHandler.manager.withdrawMoney(player, cost);
sendMessage(player, C.REMOVED_BALANCE, cost + "");
sendMessage(player, Captions.REMOVED_BALANCE, cost + "");
}
}
if (grants > 0) {
@ -77,7 +80,7 @@ public class Claim extends SubCommand {
player.setPersistentMeta("grantedPlots",
ByteArrayUtilities.integerToBytes(grants - 1));
}
sendMessage(player, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
}
if (plot.canClaim(player)) {
plot.owner = player.getUUID();
@ -89,10 +92,10 @@ public class Claim extends SubCommand {
plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
}
}
}), () -> sendMessage(player, C.PLOT_NOT_CLAIMED));
}), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED));
return true;
} else {
sendMessage(player, C.PLOT_NOT_CLAIMED);
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
}
return false;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
@ -28,13 +28,14 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
@Override public void execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage());
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage());
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
checkTrue(plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CLEAR), C.NO_PLOT_PERMS);
checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CLEAR),
Captions.NO_PLOT_PERMS);
checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER);
checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions
.hasPermission(player, C.PERMISSION_CONTINUE), C.DONE_ALREADY_DONE);
.hasPermission(player, Captions.PERMISSION_CONTINUE), Captions.DONE_ALREADY_DONE);
confirm.run(this, new Runnable() {
@Override public void run() {
final long start = System.currentTimeMillis();
@ -51,14 +52,14 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
if (plot.getFlag(Flags.ANALYSIS).isPresent()) {
FlagManager.removePlotFlag(plot, Flags.ANALYSIS);
}
MainUtil.sendMessage(player, C.CLEARING_DONE,
MainUtil.sendMessage(player, Captions.CLEARING_DONE,
"" + (System.currentTimeMillis() - start));
}
});
}
});
if (!result) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
} else {
plot.addRunning();
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -25,56 +25,59 @@ import java.util.UUID;
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
if (args.length == 0) {
// return arguments
MainUtil.sendMessage(player, C.CLUSTER_AVAILABLE_ARGS);
MainUtil.sendMessage(player, Captions.CLUSTER_AVAILABLE_ARGS);
return false;
}
String sub = args[0].toLowerCase();
switch (sub) {
case "l":
case "list": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LIST)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LIST);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LIST)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_LIST);
return false;
}
if (args.length != 1) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster list");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster list");
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
return false;
}
Set<PlotCluster> clusters = area.getClusters();
MainUtil.sendMessage(player, C.CLUSTER_LIST_HEADING, clusters.size() + "");
MainUtil.sendMessage(player, Captions.CLUSTER_LIST_HEADING, clusters.size() + "");
for (PlotCluster cluster : clusters) {
// Ignore unmanaged clusters
String name = "'" + cluster.getName() + "' : " + cluster.toString();
if (player.getUUID().equals(cluster.owner)) {
MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&a" + name);
MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&a" + name);
} else if (cluster.helpers.contains(player.getUUID())) {
MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&3" + name);
MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&3" + name);
} else if (cluster.invited.contains(player.getUUID())) {
MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&9" + name);
MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&9" + name);
} else {
MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, cluster.toString());
MainUtil
.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, cluster.toString());
}
}
return true;
}
case "c":
case "create": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_CREATE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_CREATE);
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
return false;
}
if (args.length != 4) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot cluster create <name> <id-bot> <id-top>");
return false;
}
@ -82,7 +85,7 @@ import java.util.UUID;
player.getClusterCount() :
player.getPlotCount(player.getLocation().getWorld());
if (currentClusters >= player.getAllowedPlots()) {
return sendMessage(player, C.CANT_CLAIM_MORE_CLUSTERS);
return sendMessage(player, Captions.CANT_CLAIM_MORE_CLUSTERS);
}
PlotId pos1;
PlotId pos2;
@ -91,13 +94,13 @@ import java.util.UUID;
pos1 = PlotId.fromString(args[2]);
pos2 = PlotId.fromString(args[3]);
} catch (IllegalArgumentException ignored) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
return false;
}
// check if name is taken
String name = args[1];
if (area.getCluster(name) != null) {
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN);
return false;
}
if (pos2.x < pos1.x || pos2.y < pos1.y) {
@ -108,22 +111,23 @@ import java.util.UUID;
//check if overlap
PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2);
if (cluster != null) {
MainUtil.sendMessage(player, C.CLUSTER_INTERSECTION, cluster.getName());
MainUtil.sendMessage(player, Captions.CLUSTER_INTERSECTION, cluster.getName());
return false;
}
// Check if it occupies existing plots
if (!area.contains(pos1) || !area.contains(pos2)) {
C.CLUSTER_OUTSIDE.send(player, area);
Captions.CLUSTER_OUTSIDE.send(player, area);
return false;
}
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
if (!plots.isEmpty()) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE_OTHER)) {
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE_OTHER)) {
UUID uuid = player.getUUID();
for (Plot plot : plots) {
if (!plot.isOwner(uuid)) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER_CREATE_OTHER);
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_CREATE_OTHER);
return false;
}
}
@ -137,11 +141,12 @@ import java.util.UUID;
} else {
current = player.getPlayerClusterCount(player.getLocation().getWorld());
}
int allowed = Permissions.hasPermissionRange(player, C.PERMISSION_CLUSTER_SIZE,
int allowed =
Permissions.hasPermissionRange(player, Captions.PERMISSION_CLUSTER_SIZE,
Settings.Limit.MAX_PLOTS);
if (current + cluster.getArea() > allowed) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()));
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()));
return false;
}
// create cluster
@ -157,58 +162,62 @@ import java.util.UUID;
}
}
}
MainUtil.sendMessage(player, C.CLUSTER_ADDED);
MainUtil.sendMessage(player, Captions.CLUSTER_ADDED);
return true;
}
case "disband":
case "del":
case "delete": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_DELETE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_DELETE);
return false;
}
if (args.length != 1 && args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster delete [name]");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot cluster delete [name]");
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
return false;
}
PlotCluster cluster;
if (args.length == 2) {
cluster = area.getCluster(args[1]);
if (cluster == null) {
MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]);
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
return false;
}
} else {
cluster = area.getCluster(player.getLocation());
if (cluster == null) {
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
return false;
}
}
if (!cluster.owner.equals(player.getUUID())) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER_DELETE_OTHER);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_DELETE_OTHER);
return false;
}
}
DBFunc.delete(cluster);
MainUtil.sendMessage(player, C.CLUSTER_DELETED);
MainUtil.sendMessage(player, Captions.CLUSTER_DELETED);
return true;
}
case "res":
case "resize": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_RESIZE);
return false;
}
if (args.length != 3) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot cluster resize <pos1> <pos2>");
return false;
}
@ -219,7 +228,7 @@ import java.util.UUID;
pos1 = PlotId.fromString(args[2]);
pos2 = PlotId.fromString(args[3]);
} catch (IllegalArgumentException ignored) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
return false;
}
if (pos2.x < pos1.x || pos2.y < pos1.y) {
@ -229,25 +238,27 @@ import java.util.UUID;
// check if in cluster
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
return false;
}
PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) {
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER_RESIZE_OTHER);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_RESIZE_OTHER);
return false;
}
}
//check if overlap
PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2);
if (intersect != null) {
MainUtil.sendMessage(player, C.CLUSTER_INTERSECTION, intersect.getName());
MainUtil
.sendMessage(player, Captions.CLUSTER_INTERSECTION, intersect.getName());
return false;
}
Set<Plot> existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2());
@ -258,17 +269,19 @@ import java.util.UUID;
removed.removeAll(newPlots);
// Check expand / shrink
if (!removed.isEmpty()) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER_RESIZE_SHRINK);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_RESIZE_SHRINK);
return false;
}
}
newPlots.removeAll(existing);
if (!newPlots.isEmpty()) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER_RESIZE_EXPAND);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_RESIZE_EXPAND);
return false;
}
}
@ -280,50 +293,53 @@ import java.util.UUID;
current = player.getPlayerClusterCount(player.getLocation().getWorld());
}
current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y);
int allowed = Permissions
.hasPermissionRange(player, C.PERMISSION_CLUSTER, Settings.Limit.MAX_PLOTS);
int allowed = Permissions.hasPermissionRange(player, Captions.PERMISSION_CLUSTER,
Settings.Limit.MAX_PLOTS);
if (current + cluster.getArea() > allowed) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea()));
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea()));
return false;
}
// resize cluster
DBFunc.resizeCluster(cluster, pos1, pos2);
MainUtil.sendMessage(player, C.CLUSTER_RESIZED);
MainUtil.sendMessage(player, Captions.CLUSTER_RESIZED);
return true;
}
case "add":
case "inv":
case "invite": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INVITE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_INVITE);
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster invite <player>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot cluster invite <player>");
return false;
}
// check if in cluster
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
}
PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) {
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER_INVITE_OTHER);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_INVITE_OTHER);
return false;
}
}
// check uuid
UUID uuid = UUIDHandler.getUUID(args[1], null);
if (uuid == null) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[2]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[2]);
return false;
}
if (!cluster.isAdded(uuid)) {
@ -332,49 +348,52 @@ import java.util.UUID;
DBFunc.setInvited(cluster, uuid);
PlotPlayer player2 = UUIDHandler.getPlayer(uuid);
if (player2 != null) {
MainUtil.sendMessage(player2, C.CLUSTER_INVITED, cluster.getName());
MainUtil.sendMessage(player2, Captions.CLUSTER_INVITED, cluster.getName());
}
}
MainUtil.sendMessage(player, C.CLUSTER_ADDED_USER);
MainUtil.sendMessage(player, Captions.CLUSTER_ADDED_USER);
return true;
}
case "k":
case "remove":
case "kick": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_KICK);
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster kick <player>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot cluster kick <player>");
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
}
PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) {
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK_OTHER)) {
MainUtil
.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK_OTHER);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_KICK_OTHER);
return false;
}
}
// check uuid
UUID uuid = UUIDHandler.getUUID(args[1], null);
if (uuid == null) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[1]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[1]);
return false;
}
// Can't kick if the player is yourself, the owner, or not added to the cluster
if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner) || !cluster
.isAdded(uuid)) {
MainUtil.sendMessage(player, C.CANNOT_KICK_PLAYER, cluster.getName());
MainUtil.sendMessage(player, Captions.CANNOT_KICK_PLAYER, cluster.getName());
return false;
}
if (cluster.helpers.contains(uuid)) {
@ -385,7 +404,7 @@ import java.util.UUID;
DBFunc.removeInvited(cluster, uuid);
PlotPlayer player2 = UUIDHandler.getPlayer(uuid);
if (player2 != null) {
MainUtil.sendMessage(player2, C.CLUSTER_REMOVED, cluster.getName());
MainUtil.sendMessage(player2, Captions.CLUSTER_REMOVED, cluster.getName());
}
for (Plot plot : new ArrayList<>(
PlotSquared.get().getPlots(player2.getLocation().getWorld(), uuid))) {
@ -394,44 +413,46 @@ import java.util.UUID;
plot.unclaim();
}
}
MainUtil.sendMessage(player2, C.CLUSTER_KICKED_USER);
MainUtil.sendMessage(player2, Captions.CLUSTER_KICKED_USER);
return true;
}
case "quit":
case "leave": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LEAVE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LEAVE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LEAVE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_LEAVE);
return false;
}
if (args.length != 1 && args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster leave [name]");
MainUtil
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster leave [name]");
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
}
PlotCluster cluster;
if (args.length == 2) {
cluster = area.getCluster(args[1]);
if (cluster == null) {
MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]);
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
return false;
}
} else {
cluster = area.getCluster(player.getLocation());
if (cluster == null) {
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
return false;
}
}
UUID uuid = player.getUUID();
if (!cluster.isAdded(uuid)) {
MainUtil.sendMessage(player, C.CLUSTER_NOT_ADDED);
MainUtil.sendMessage(player, Captions.CLUSTER_NOT_ADDED);
return false;
}
if (uuid.equals(cluster.owner)) {
MainUtil.sendMessage(player, C.CLUSTER_CANNOT_LEAVE);
MainUtil.sendMessage(player, Captions.CLUSTER_CANNOT_LEAVE);
return false;
}
if (cluster.helpers.contains(uuid)) {
@ -440,7 +461,7 @@ import java.util.UUID;
}
cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster, uuid);
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
MainUtil.sendMessage(player, Captions.CLUSTER_REMOVED, cluster.getName());
for (Plot plot : new ArrayList<>(
PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) {
PlotCluster current = plot.getCluster();
@ -455,102 +476,107 @@ import java.util.UUID;
case "admin":
case "helper":
case "helpers": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_HELPERS)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_HELPERS);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_HELPERS)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_HELPERS);
return false;
}
if (args.length != 3) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot cluster helpers <add|remove> <player>");
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
}
PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) {
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
return false;
}
UUID uuid = UUIDHandler.getUUID(args[2], null);
if (uuid == null) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[2]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[2]);
return false;
}
if (args[1].equalsIgnoreCase("add")) {
cluster.helpers.add(uuid);
DBFunc.setHelper(cluster, uuid);
return MainUtil.sendMessage(player, C.CLUSTER_ADDED_HELPER);
return MainUtil.sendMessage(player, Captions.CLUSTER_ADDED_HELPER);
}
if (args[1].equalsIgnoreCase("remove")) {
cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster, uuid);
return MainUtil.sendMessage(player, C.CLUSTER_REMOVED_HELPER);
return MainUtil.sendMessage(player, Captions.CLUSTER_REMOVED_HELPER);
}
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot cluster helpers <add|remove> <player>");
return false;
}
case "spawn":
case "home":
case "tp": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_TP);
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster tp <name>");
MainUtil
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster tp <name>");
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
return false;
}
PlotCluster cluster = area.getCluster(args[1]);
if (cluster == null) {
MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]);
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
return false;
}
UUID uuid = player.getUUID();
if (!cluster.isAdded(uuid)) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP_OTHER)) {
MainUtil
.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP_OTHER);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_TP_OTHER);
return false;
}
}
player.teleport(cluster.getHome());
return MainUtil.sendMessage(player, C.CLUSTER_TELEPORTING);
return MainUtil.sendMessage(player, Captions.CLUSTER_TELEPORTING);
}
case "i":
case "info":
case "show":
case "information": {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INFO)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INFO);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INFO)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_INFO);
return false;
}
if (args.length != 1 && args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster info [name]");
MainUtil
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster info [name]");
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
}
PlotCluster cluster;
if (args.length == 2) {
cluster = area.getCluster(args[1]);
if (cluster == null) {
MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]);
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
return false;
}
} else {
cluster = area.getCluster(player.getLocation());
if (cluster == null) {
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
return false;
}
}
@ -563,7 +589,7 @@ import java.util.UUID;
String size = (cluster.getP2().x - cluster.getP1().x + 1) + "x" + (
cluster.getP2().y - cluster.getP1().y + 1);
String rights = cluster.isAdded(player.getUUID()) + "";
String message = C.CLUSTER_INFO.s();
String message = Captions.CLUSTER_INFO.s();
message = message.replaceAll("%id%", id);
message = message.replaceAll("%owner%", owner);
message = message.replaceAll("%name%", name);
@ -575,27 +601,29 @@ import java.util.UUID;
case "sh":
case "setspawn":
case "sethome":
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SETHOME);
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_SETHOME);
return false;
}
if (args.length != 1 && args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster sethome");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster sethome");
return false;
}
PlotArea area = player.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(player);
Captions.NOT_IN_PLOT_WORLD.send(player);
}
PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) {
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_CLUSTER_SETHOME_OTHER);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_CLUSTER_SETHOME_OTHER);
return false;
}
}
@ -605,9 +633,9 @@ import java.util.UUID;
cluster.settings.setPosition(blockloc);
DBFunc.setPosition(cluster,
relative.getX() + "," + relative.getY() + "," + relative.getZ());
return MainUtil.sendMessage(player, C.POSITION_SET);
return MainUtil.sendMessage(player, Captions.POSITION_SET);
}
MainUtil.sendMessage(player, C.CLUSTER_AVAILABLE_ARGS);
MainUtil.sendMessage(player, Captions.CLUSTER_AVAILABLE_ARGS);
return false;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
@ -22,13 +22,13 @@ public class Comment extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
if (args.length < 2) {
sendMessage(player, C.COMMENT_SYNTAX,
sendMessage(player, Captions.COMMENT_SYNTAX,
StringMan.join(CommentManager.inboxes.keySet(), "|"));
return false;
}
CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
if (inbox == null) {
sendMessage(player, C.COMMENT_SYNTAX,
sendMessage(player, Captions.COMMENT_SYNTAX,
StringMan.join(CommentManager.inboxes.keySet(), "|"));
return false;
}
@ -37,7 +37,7 @@ public class Comment extends SubCommand {
try {
id = PlotId.fromString(args[1]);
} catch (IllegalArgumentException ignored) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
return false;
}
Plot plot = MainUtil.getPlotFromString(player, args[1], false);
@ -47,14 +47,14 @@ public class Comment extends SubCommand {
plot = loc.getPlotAbs();
} else {
if (args.length < 4) {
sendMessage(player, C.COMMENT_SYNTAX,
sendMessage(player, Captions.COMMENT_SYNTAX,
StringMan.join(CommentManager.inboxes.keySet(), "|"));
return false;
}
index = 2;
}
if (!inbox.canWrite(plot, player)) {
sendMessage(player, C.NO_PERM_INBOX, "");
sendMessage(player, Captions.NO_PERM_INBOX, "");
return false;
}
String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " ");
@ -63,8 +63,8 @@ public class Comment extends SubCommand {
System.currentTimeMillis());
boolean result = inbox.addComment(plot, comment);
if (!result) {
sendMessage(player, C.NO_PLOT_INBOX, "");
sendMessage(player, C.COMMENT_SYNTAX,
sendMessage(player, Captions.NO_PLOT_INBOX, "");
sendMessage(player, Captions.COMMENT_SYNTAX,
StringMan.join(CommentManager.inboxes.keySet(), "|"));
return false;
}
@ -74,7 +74,7 @@ public class Comment extends SubCommand {
MainUtil.sendMessage(pp, "/plot comment " + StringMan.join(args, " "));
}
}
sendMessage(player, C.COMMENT_ADDED);
sendMessage(player, Captions.COMMENT_ADDED);
return true;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.CmdInstance;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -16,13 +16,13 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
@Override public boolean onCommand(PlotPlayer player, String[] args) {
CmdInstance command = CmdConfirm.getPending(player);
if (command == null) {
MainUtil.sendMessage(player, C.FAILED_CONFIRM);
MainUtil.sendMessage(player, Captions.FAILED_CONFIRM);
return false;
}
CmdConfirm.removePending(player);
if ((System.currentTimeMillis() - command.timestamp)
> Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS * 1000) {
MainUtil.sendMessage(player, C.EXPIRED_CONFIRM);
MainUtil.sendMessage(player, Captions.EXPIRED_CONFIRM);
return false;
}
TaskManager.runTask(command.command);

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -17,29 +17,30 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
@Override public boolean onCommand(PlotPlayer player, String[] args) {
Plot plot = player.getCurrentPlot();
if ((plot == null) || !plot.hasOwner()) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
if (!plot.hasFlag(Flags.DONE)) {
MainUtil.sendMessage(player, C.DONE_NOT_DONE);
MainUtil.sendMessage(player, Captions.DONE_NOT_DONE);
return false;
}
int size = plot.getConnectedPlots().size();
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots()
< player.getPlotCount() + size)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_ADMIN_COMMAND_CONTINUE);
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_ADMIN_COMMAND_CONTINUE);
return false;
}
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
plot.removeFlag(Flags.DONE);
MainUtil.sendMessage(player, C.DONE_REMOVED);
MainUtil.sendMessage(player, Captions.DONE_REMOVED);
return true;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -16,15 +16,15 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
Location loc = player.getLocation();
Plot plot1 = loc.getPlotAbs();
if (plot1 == null) {
return !MainUtil.sendMessage(player, C.NOT_IN_PLOT);
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN.s())) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN.s())) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
if (args.length != 1) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
@ -32,22 +32,22 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
return false;
}
if (plot1.equals(plot2)) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
C.COMMAND_SYNTAX.send(player, getUsage());
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
if (!plot1.getArea().isCompatible(plot2.getArea())) {
C.PLOTWORLD_INCOMPATIBLE.send(player);
Captions.PLOTWORLD_INCOMPATIBLE.send(player);
return false;
}
if (plot1.copy(plot2, new Runnable() {
@Override public void run() {
MainUtil.sendMessage(player, C.COPY_SUCCESS);
MainUtil.sendMessage(player, Captions.COPY_SUCCESS);
}
})) {
return true;
} else {
MainUtil.sendMessage(player, C.REQUIRES_UNOWNED);
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED);
return false;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
import com.github.intellectualsites.plotsquared.plot.object.Location;
@ -19,10 +19,10 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
Location loc = player.getLocation();
Plot plot = loc.getPlotAbs();
if (plot == null) {
return sendMessage(player, C.NOT_IN_PLOT);
return sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!(loc.getPlotArea() instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
}
HybridUtils.manager.setupRoadSchematic(plot);
MainUtil.sendMessage(player,

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
@ -14,23 +14,23 @@ public class Debug extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
StringBuilder msg = new StringBuilder();
for (C caption : C.values()) {
for (Captions caption : Captions.values()) {
msg.append(caption.s()).append("\n");
}
MainUtil.sendMessage(player, msg.toString());
return true;
}
StringBuilder information = new StringBuilder();
String header = C.DEBUG_HEADER.s();
String line = C.DEBUG_LINE.s();
String section = C.DEBUG_SECTION.s();
String header = Captions.DEBUG_HEADER.s();
String line = Captions.DEBUG_LINE.s();
String section = Captions.DEBUG_SECTION.s();
information.append(header);
information.append(getSection(section, "PlotArea"));
information.append(
getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", ")));
information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size()));
information.append(getSection(section, "Messages"));
information.append(getLine(line, "Total Messages", C.values().length));
information.append(getLine(line, "Total Messages", Captions.values().length));
information.append(getLine(line, "View all captions", "/plot debug msg"));
MainUtil.sendMessage(player, information.toString());
return true;

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import java.util.ArrayList;
@ -19,10 +19,10 @@ import java.util.UUID;
if (unsafeAllowed.contains(player.getUUID())) {
unsafeAllowed.remove(player.getUUID());
sendMessage(player, C.DEBUGALLOWUNSAFE_OFF);
sendMessage(player, Captions.DEBUGALLOWUNSAFE_OFF);
} else {
unsafeAllowed.add(player.getUUID());
sendMessage(player, C.DEBUGALLOWUNSAFE_ON);
sendMessage(player, Captions.DEBUGALLOWUNSAFE_ON);
}
return true;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
@ -29,7 +29,7 @@ public class DebugClaimTest extends SubCommand {
}
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
Captions.NOT_VALID_PLOT_WORLD.send(player, args[0]);
return false;
}
PlotId min, max;

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
@ -111,7 +111,7 @@ import java.util.*;
this.scope.put("MainCommand", MainCommand.getInstance());
// enums
for (Enum<?> value : C.values()) {
for (Enum<?> value : Captions.values()) {
this.scope.put("C_" + value.name(), value);
}
}
@ -129,7 +129,7 @@ import java.util.*;
case "analyze": {
Plot plot = player.getCurrentPlot();
if (plot == null) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
return false;
}
PlotAnalysis analysis = plot.getComplexity(null);
@ -148,7 +148,7 @@ import java.util.*;
}
case "calibrate-analysis":
if (args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot debugexec analyze <threshold>");
MainUtil.sendMessage(player,
"$1<threshold> $2= $1The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating "
@ -174,7 +174,7 @@ import java.util.*;
return MainUtil.sendMessage(player, "Cancelled task.");
case "remove-flag":
if (args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot debugexec remove-flag <flag>");
return false;
}
@ -194,7 +194,7 @@ import java.util.*;
}
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
if (area == null) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[1]);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[1]);
return false;
}
boolean result;
@ -274,15 +274,15 @@ import java.util.*;
DebugExec.this.engine.eval(cmd, DebugExec.this.scope);
} catch (ScriptException e) {
e.printStackTrace();
MainUtil.sendMessage(player, C.COMMAND_WENT_WRONG);
MainUtil.sendMessage(player, Captions.COMMAND_WENT_WRONG);
}
}
};
return true;
} catch (IOException e) {
e.printStackTrace();
MainUtil
.sendMessage(player, C.COMMAND_SYNTAX, "/plot debugexec addcmd <file>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot debugexec addcmd <file>");
return false;
}
case "runasync":
@ -322,7 +322,8 @@ import java.util.*;
break;
}
default:
C.COMMAND_SYNTAX.send(player, "/plot debugexec list-scripts [#]");
Captions.COMMAND_SYNTAX
.send(player, "/plot debugexec list-scripts [#]");
return false;
}
@ -339,7 +340,7 @@ import java.util.*;
return true;
case "allcmd":
if (args.length < 3) {
C.COMMAND_SYNTAX
Captions.COMMAND_SYNTAX
.send(player, "/plot debugexec allcmd <condition> <command>");
return false;
}
@ -379,7 +380,8 @@ import java.util.*;
break;
case "all":
if (args.length < 3) {
C.COMMAND_SYNTAX.send(player, "/plot debugexec all <condition> <code>");
Captions.COMMAND_SYNTAX
.send(player, "/plot debugexec all <condition> <code>");
return false;
}
script =
@ -392,7 +394,7 @@ import java.util.*;
script = StringMan.join(args, " ");
}
if (!(player instanceof ConsolePlayer)) {
MainUtil.sendMessage(player, C.NOT_CONSOLE);
MainUtil.sendMessage(player, Captions.NOT_CONSOLE);
return false;
}
init();

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -28,7 +28,7 @@ public class DebugFixFlags extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[0]);
return false;
}
MainUtil.sendMessage(player, "&8--- &6Starting task &8 ---");

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.IncendoPaster;
@ -123,7 +123,8 @@ import java.util.stream.Collectors;
final String pasteId = jsonObject.get("paste_id").getAsString();
final String link =
String.format("https://incendo.org/paste/view/%s", pasteId);
player.sendMessage(C.DEBUG_REPORT_CREATED.s().replace("%url%", link));
player
.sendMessage(Captions.DEBUG_REPORT_CREATED.s().replace("%url%", link));
} else {
final String responseMessage = jsonObject.get("response").getAsString();
MainUtil.sendMessage(player, String

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
import com.github.intellectualsites.plotsquared.plot.object.Location;
@ -20,13 +20,13 @@ public class DebugRoadRegen extends SubCommand {
Location loc = player.getLocation();
PlotArea plotArea = loc.getPlotArea();
if (!(plotArea instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
}
Plot plot = player.getCurrentPlot();
if (plot == null) {
C.NOT_IN_PLOT.send(player);
Captions.NOT_IN_PLOT.send(player);
} else if (plot.isMerged()) {
C.REQUIRES_UNMERGED.send(player);
Captions.REQUIRES_UNMERGED.send(player);
} else {
HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager();
manager.createRoadEast(plotArea, plot);

View File

@ -16,14 +16,10 @@ import java.util.ArrayList;
public class DebugSaveTest extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
ArrayList<Plot> plots = new ArrayList<Plot>();
plots.addAll(PlotSquared.get().getPlots());
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots());
MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`");
DBFunc.createPlotsAndData(plots, new Runnable() {
@Override public void run() {
MainUtil.sendMessage(player, "&6Database sync finished!");
}
});
DBFunc.createPlotsAndData(plots,
() -> MainUtil.sendMessage(player, "&6Database sync finished!"));
return true;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.*;
@ -19,14 +19,14 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
return !sendMessage(player, C.PLOT_UNOWNED);
return !sendMessage(player, Captions.PLOT_UNOWNED);
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DELETE)) {
return !sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DELETE)) {
return !sendMessage(player, Captions.NO_PLOT_PERMS);
}
final PlotArea plotArea = plot.getArea();
final java.util.Set<Plot> plots = plot.getConnectedPlots();
@ -35,7 +35,7 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
Runnable run = new Runnable() {
@Override public void run() {
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return;
}
final long start = System.currentTimeMillis();
@ -47,17 +47,17 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
double value = plots.size() * valueExr.evaluate((double) currentPlots);
if (value > 0d) {
EconHandler.manager.depositMoney(player, value);
sendMessage(player, C.ADDED_BALANCE, String.valueOf(value));
sendMessage(player, Captions.ADDED_BALANCE, String.valueOf(value));
}
}
MainUtil.sendMessage(player, C.DELETING_DONE,
MainUtil.sendMessage(player, Captions.DELETING_DONE,
System.currentTimeMillis() - start);
}
});
if (result) {
plot.addRunning();
} else {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
}
}
};

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -28,38 +28,38 @@ import java.util.UUID;
Location location = player.getLocation();
Plot plot = location.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return true;
}
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
if (uuids.isEmpty()) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
return false;
}
Iterator<UUID> iter = uuids.iterator();
while (iter.hasNext()) {
UUID uuid = iter.next();
if (uuid == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, C.PERMISSION_DENY_EVERYONE) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY))) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid));
continue;
}
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid));
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid));
return false;
}
if (plot.getDenied().contains(uuid)) {
MainUtil.sendMessage(player, C.ALREADY_ADDED, MainUtil.getName(uuid));
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid));
return false;
}
if (uuid != DBFunc.EVERYONE) {
@ -77,7 +77,7 @@ import java.util.UUID;
}
}
if (!uuids.isEmpty()) {
MainUtil.sendMessage(player, C.DENIED_ADDED);
MainUtil.sendMessage(player, Captions.DENIED_ADDED);
}
return true;
}
@ -97,13 +97,13 @@ import java.util.UUID;
}
Location loc = player.getLocation();
Location spawn = WorldUtil.IMP.getSpawn(loc.getWorld());
MainUtil.sendMessage(player, C.YOU_GOT_DENIED);
MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED);
if (plot.equals(spawn.getPlot())) {
Location newSpawn =
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
if (plot.equals(newSpawn.getPlot())) {
// Kick from server if you can't be teleported to spawn
player.kick(C.YOU_GOT_DENIED.s());
player.kick(Captions.YOU_GOT_DENIED.s());
} else {
player.teleport(newSpawn);
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -16,15 +16,15 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@Override public boolean set(PlotPlayer player, Plot plot, String desc) {
if (desc.isEmpty()) {
plot.removeFlag(Flags.DESCRIPTION);
MainUtil.sendMessage(player, C.DESC_UNSET);
MainUtil.sendMessage(player, Captions.DESC_UNSET);
return true;
}
boolean result = FlagManager.addPlotFlag(plot, Flags.DESCRIPTION, desc);
if (!result) {
MainUtil.sendMessage(player, C.FLAG_NOT_ADDED);
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
return false;
}
MainUtil.sendMessage(player, C.DESC_SET);
MainUtil.sendMessage(player, Captions.DESC_SET);
return true;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
@ -22,23 +22,23 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs();
if ((plot == null) || !plot.hasOwner()) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DONE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DONE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
if (plot.hasFlag(Flags.DONE)) {
MainUtil.sendMessage(player, C.DONE_ALREADY_DONE);
MainUtil.sendMessage(player, Captions.DONE_ALREADY_DONE);
return false;
}
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
plot.addRunning();
MainUtil.sendMessage(player, C.GENERATING_LINK);
MainUtil.sendMessage(player, Captions.GENERATING_LINK);
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
if (ExpireManager.IMP == null || doneRequirements == null) {
finish(plot, player, true);
@ -60,9 +60,9 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
if (success) {
long flagValue = System.currentTimeMillis() / 1000;
plot.setFlag(Flags.DONE, flagValue);
MainUtil.sendMessage(pp, C.DONE_SUCCESS);
MainUtil.sendMessage(pp, Captions.DONE_SUCCESS);
} else {
MainUtil.sendMessage(pp, C.DONE_INSUFFICIENT_COMPLEXITY);
MainUtil.sendMessage(pp, Captions.DONE_INSUFFICIENT_COMPLEXITY);
}
}
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -21,34 +21,34 @@ import java.net.URL;
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld();
if (!PlotSquared.get().hasPlotArea(world)) {
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
}
final Plot plot = player.getCurrentPlot();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent()))
&& !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
MainUtil.sendMessage(player, C.DONE_NOT_DONE);
&& !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
MainUtil.sendMessage(player, Captions.DONE_NOT_DONE);
return false;
}
if ((!plot.isOwner(player.getUUID())) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN.s())) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN.s())) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
if (args.length == 0 || (args.length == 1 && StringMan
.isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) {
if (plot.getVolume() > Integer.MAX_VALUE) {
C.SCHEMATIC_TOO_LARGE.send(player);
Captions.SCHEMATIC_TOO_LARGE.send(player);
return false;
}
plot.addRunning();
@ -58,7 +58,7 @@ import java.net.URL;
SchematicHandler.manager.upload(value, null, null, new RunnableVal<URL>() {
@Override public void run(URL url) {
if (url == null) {
MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED);
MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED);
return;
}
MainUtil.sendMessage(player, url.toString());
@ -68,8 +68,8 @@ import java.net.URL;
});
} else if (args.length == 1 && StringMan
.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
if (!Permissions.hasPermission(player, C.PERMISSION_DOWNLOAD_WORLD)) {
C.NO_PERMISSION.send(player, C.PERMISSION_DOWNLOAD_WORLD);
if (!Permissions.hasPermission(player, Captions.PERMISSION_DOWNLOAD_WORLD)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_DOWNLOAD_WORLD);
return false;
}
MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512");
@ -79,17 +79,17 @@ import java.net.URL;
@Override public void run(URL url) {
plot.removeRunning();
if (url == null) {
MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED);
MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED);
return;
}
MainUtil.sendMessage(player, url.toString());
}
});
} else {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
MainUtil.sendMessage(player, C.GENERATING_LINK);
MainUtil.sendMessage(player, Captions.GENERATING_LINK);
return true;
}
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.*;
@ -22,7 +22,8 @@ import java.util.*;
private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) {
key = key.toLowerCase();
value = value.toLowerCase();
String perm = C.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase());
String perm =
Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase());
if (flag instanceof IntegerFlag && MathMan.isInteger(value)) {
try {
int numeric = Integer.parseInt(value);
@ -33,8 +34,8 @@ import java.util.*;
Settings.Limit.MAX_PLOTS;
final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric;
if (!result) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_SET_FLAG_KEY_VALUE
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SET_FLAG_KEY_VALUE
.f(key.toLowerCase(), value.toLowerCase()));
}
return result;
@ -46,12 +47,13 @@ import java.util.*;
final PlotBlockListFlag blockListFlag = (PlotBlockListFlag) flag;
final HashSet<PlotBlock> parsedBlocks = blockListFlag.parseValue(value);
for (final PlotBlock block : parsedBlocks) {
final String permission = C.PERMISSION_SET_FLAG_KEY_VALUE
final String permission = Captions.PERMISSION_SET_FLAG_KEY_VALUE
.f(key.toLowerCase(), block.getRawId().toString().toLowerCase());
final boolean result = Permissions.hasPermission(player, permission);
if (!result) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()));
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SET_FLAG_KEY_VALUE
.f(key.toLowerCase(), value.toLowerCase()));
return false;
}
}
@ -59,8 +61,8 @@ import java.util.*;
}
final boolean result = Permissions.hasPermission(player, perm);
if (!result) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()));
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()));
}
return result;
}
@ -75,22 +77,24 @@ import java.util.*;
* plot flag list
*/
if (args.length == 0) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot flag <set|remove|add|list|info>");
return false;
}
Location loc = player.getLocation();
Plot plot = loc.getPlotAbs();
if (plot == null) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
return false;
}
if (!plot.hasOwner()) {
sendMessage(player, C.PLOT_NOT_CLAIMED);
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_SET_FLAG_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_OTHER);
.hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER);
return false;
}
Flag<?> flag = null;
@ -103,41 +107,43 @@ import java.util.*;
new StringComparison<>(args[1], Flags.getFlags());
String best = stringComparison.getBestMatch();
if (best != null) {
MainUtil.sendMessage(player, C.NOT_VALID_FLAG_SUGGESTED, best);
MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG_SUGGESTED, best);
suggested = true;
}
} catch (final Exception ignored) { /* Happens sometimes because of mean code */ }
if (!suggested) {
MainUtil.sendMessage(player, C.NOT_VALID_FLAG);
MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG);
}
return false;
}
}
switch (args[0].toLowerCase()) {
case "info": {
if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.info");
if (!Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.flag.info");
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag info <flag>");
return false;
}
// flag key
MainUtil.sendMessage(player, C.FLAG_KEY, flag.getName());
MainUtil.sendMessage(player, Captions.FLAG_KEY, flag.getName());
// flag type
MainUtil.sendMessage(player, C.FLAG_TYPE, flag.getClass().getSimpleName());
MainUtil.sendMessage(player, Captions.FLAG_TYPE, flag.getClass().getSimpleName());
// Flag type description
MainUtil.sendMessage(player, C.FLAG_DESC, flag.getValueDescription());
MainUtil.sendMessage(player, Captions.FLAG_DESC, flag.getValueDescription());
return true;
}
case "set": {
if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG);
if (!Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG);
return false;
}
if (args.length < 3) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag set <flag> <value>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot flag set <flag> <value>");
return false;
}
String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
@ -151,27 +157,28 @@ import java.util.*;
}
boolean result = plot.setFlag(flag, parsed);
if (!result) {
MainUtil.sendMessage(player, C.FLAG_NOT_ADDED);
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
return false;
}
MainUtil.sendMessage(player, C.FLAG_ADDED);
MainUtil.sendMessage(player, Captions.FLAG_ADDED);
return true;
}
case "remove": {
if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_REMOVE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_REMOVE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_REMOVE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_FLAG_REMOVE);
return false;
}
if (args.length != 2 && args.length != 3) {
MainUtil
.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot flag remove <flag> [values]");
return false;
}
if (!Permissions
.hasPermission(player, C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) {
if (!Permissions.hasPermission(player,
Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) {
if (args.length != 3) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()));
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()));
return false;
}
for (String entry : args[2].split(",")) {
@ -190,16 +197,16 @@ import java.util.*;
if (flag1.get().isEmpty()) {
final boolean result = plot.removeFlag(flag);
if (result) {
MainUtil.sendMessage(player, C.FLAG_REMOVED);
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
} else {
MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED);
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
}
return true;
} else {
MainUtil.sendMessage(player, C.FLAG_REMOVED);
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
}
} else {
MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED);
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
return false;
}
}
@ -208,7 +215,7 @@ import java.util.*;
} else {
boolean result = plot.removeFlag(flag);
if (!result) {
MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED);
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
return false;
}
}
@ -217,17 +224,18 @@ import java.util.*;
} else if (flag == Flags.WEATHER) {
player.setWeather(PlotWeather.RESET);
}
MainUtil.sendMessage(player, C.FLAG_REMOVED);
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
return true;
}
case "add":
if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_ADD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_ADD);
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_ADD)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_ADD);
return false;
}
if (args.length < 3) {
MainUtil
.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag add <flag> <values>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot flag add <flag> <values>");
return false;
}
for (String entry : args[2].split(",")) {
@ -248,28 +256,29 @@ import java.util.*;
if (flag1.isPresent()) {
boolean o = flag1.get().addAll((Collection) parsed);
if (o) {
MainUtil.sendMessage(player, C.FLAG_ADDED);
MainUtil.sendMessage(player, Captions.FLAG_ADDED);
val = flag1.get();
} else {
MainUtil.sendMessage(player, C.FLAG_NOT_ADDED);
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
return false;
}
}
}
boolean result = plot.setFlag(flag, val);
if (!result) {
MainUtil.sendMessage(player, C.FLAG_NOT_ADDED);
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
return false;
}
MainUtil.sendMessage(player, C.FLAG_ADDED);
MainUtil.sendMessage(player, Captions.FLAG_ADDED);
return true;
case "list":
if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_LIST)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_LIST);
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_LIST)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_LIST);
return false;
}
if (args.length > 1) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag list");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag list");
return false;
}
HashMap<String, ArrayList<String>> flags = new HashMap<>();
@ -293,7 +302,8 @@ import java.util.*;
MainUtil.sendMessage(player, message.toString());
return true;
}
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
MainUtil
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
return false;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import java.io.File;
@ -142,7 +142,7 @@ public class GenerateDocs {
Matcher m2 = p2.matcher(line);
while (m2.find()) {
perms.add(C.valueOf("PERMISSION_" + m2.group(1)).s());
perms.add(Captions.valueOf("PERMISSION_" + m2.group(1)).s());
}
if (line.contains("Permissions.hasPermission(")) {
String[] split = line.split("Permissions.hasPermission");
@ -151,7 +151,7 @@ public class GenerateDocs {
String perm = method.split("[,|)]")[1].trim();
if (!perm.equalsIgnoreCase(perm)) {
if (perm.startsWith("C.")) {
perm = C.valueOf(perm.split("\\.")[1]).s();
perm = Captions.valueOf(perm.split("\\.")[1]).s();
} else {
continue;
}
@ -181,7 +181,7 @@ public class GenerateDocs {
String perm = method.split("[,|)]")[1].trim();
if (!perm.equalsIgnoreCase(perm)) {
if (perm.startsWith("C.")) {
perm = C.valueOf(perm.split("\\.")[1]).s();
perm = Captions.valueOf(perm.split("\\.")[1]).s();
} else {
continue;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
@ -26,13 +26,13 @@ import java.util.UUID;
@Override public void execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
checkTrue(args.length >= 1 && args.length <= 2, C.COMMAND_SYNTAX, getUsage());
checkTrue(args.length >= 1 && args.length <= 2, Captions.COMMAND_SYNTAX, getUsage());
final String arg0 = args[0].toLowerCase();
switch (arg0) {
case "add":
case "check":
if (!Permissions.hasPermission(player, C.PERMISSION_GRANT.f(arg0))) {
C.NO_PERMISSION.send(player, C.PERMISSION_GRANT.f(arg0));
if (!Permissions.hasPermission(player, Captions.PERMISSION_GRANT.f(arg0))) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_GRANT.f(arg0));
return;
}
if (args.length > 2) {
@ -41,7 +41,7 @@ import java.util.UUID;
final UUID uuid =
args.length == 2 ? UUIDHandler.getUUIDFromString(args[1]) : player.getUUID();
if (uuid == null) {
C.INVALID_PLAYER.send(player, args[1]);
Captions.INVALID_PLAYER.send(player, args[1]);
return;
}
MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal<byte[]>() {
@ -49,7 +49,7 @@ import java.util.UUID;
if (arg0.equals("check")) { // check
int granted =
array == null ? 0 : ByteArrayUtilities.bytesToInteger(array);
C.GRANTED_PLOTS.send(player, granted);
Captions.GRANTED_PLOTS.send(player, granted);
} else { // add
int amount =
1 + (array == null ? 0 : ByteArrayUtilities.bytesToInteger(array));
@ -66,6 +66,6 @@ import java.util.UUID;
}
});
}
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
}
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
@ -50,7 +50,7 @@ public class Help extends Command {
}
return;
default:
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
}
}
@ -74,15 +74,16 @@ public class Help extends Command {
}
if (cat == null && page == 0) {
StringBuilder builder = new StringBuilder();
builder.append(C.HELP_HEADER.s());
builder.append(Captions.HELP_HEADER.s());
for (CommandCategory c : CommandCategory.values()) {
builder.append("\n" + StringMan
.replaceAll(C.HELP_INFO_ITEM.s(), "%category%", c.toString().toLowerCase(),
.replaceAll(Captions.HELP_INFO_ITEM.s(), "%category%",
c.toString().toLowerCase(),
"%category_desc%", c.toString()));
}
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all")
builder.append("\n").append(Captions.HELP_INFO_ITEM.s().replaceAll("%category%", "all")
.replaceAll("%category_desc%", "Display all commands"));
builder.append("\n" + C.HELP_FOOTER.s());
builder.append("\n" + Captions.HELP_FOOTER.s());
MainUtil.sendMessage(player, builder.toString(), false);
return;
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
@ -20,7 +20,7 @@ import java.util.List;
public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
if (oldComments == null || oldComments.isEmpty()) {
MainUtil.sendMessage(player, C.INBOX_EMPTY);
MainUtil.sendMessage(player, Captions.INBOX_EMPTY);
return;
}
PlotComment[] comments = oldComments.toArray(new PlotComment[oldComments.size()]);
@ -40,7 +40,7 @@ import java.util.List;
}
StringBuilder string = new StringBuilder();
string.append(StringMan
.replaceAll(C.COMMENT_LIST_HEADER_PAGED.s(), "%amount%", comments.length, "%cur",
.replaceAll(Captions.COMMENT_LIST_HEADER_PAGED.s(), "%amount%", comments.length, "%cur",
page + 1, "%max", totalPages + 1, "%word", "all") + '\n');
// This might work xD
@ -62,15 +62,15 @@ import java.util.List;
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
final Plot plot = player.getCurrentPlot();
if (plot == null) {
sendMessage(player, C.NOT_IN_PLOT);
sendMessage(player, Captions.NOT_IN_PLOT);
return false;
}
if (!plot.hasOwner()) {
sendMessage(player, C.PLOT_UNOWNED);
sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
if (args.length == 0) {
sendMessage(player, C.COMMAND_SYNTAX,
sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot inbox [inbox] [delete <index>|clear|page]");
for (final CommentInbox inbox : CommentManager.inboxes.values()) {
if (inbox.canRead(plot, player)) {
@ -93,16 +93,16 @@ import java.util.List;
} else {
color = "";
}
sendMessage(player, C.INBOX_ITEM,
sendMessage(player, Captions.INBOX_ITEM,
color + inbox.toString() + " (" + total + '/' + unread
+ ')');
return;
}
}
sendMessage(player, C.INBOX_ITEM, inbox.toString());
sendMessage(player, Captions.INBOX_ITEM, inbox.toString());
}
})) {
sendMessage(player, C.INBOX_ITEM, inbox.toString());
sendMessage(player, Captions.INBOX_ITEM, inbox.toString());
}
}
}
@ -110,7 +110,7 @@ import java.util.List;
}
final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
if (inbox == null) {
sendMessage(player, C.INVALID_INBOX,
sendMessage(player, Captions.INVALID_INBOX,
StringMan.join(CommentManager.inboxes.keySet(), ", "));
return false;
}
@ -120,22 +120,22 @@ import java.util.List;
switch (args[1].toLowerCase()) {
case "delete":
if (!inbox.canModify(plot, player)) {
sendMessage(player, C.NO_PERM_INBOX_MODIFY);
sendMessage(player, Captions.NO_PERM_INBOX_MODIFY);
return false;
}
if (args.length != 3) {
sendMessage(player, C.COMMAND_SYNTAX,
sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot inbox " + inbox.toString() + " delete <index>");
}
final int index;
try {
index = Integer.parseInt(args[2]);
if (index < 1) {
sendMessage(player, C.NOT_VALID_INBOX_INDEX, index + "");
sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + "");
return false;
}
} catch (NumberFormatException ignored) {
sendMessage(player, C.COMMAND_SYNTAX,
sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot inbox " + inbox.toString() + " delete <index>");
return false;
}
@ -143,35 +143,35 @@ import java.util.List;
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
@Override public void run(List<PlotComment> value) {
if (index > value.size()) {
sendMessage(player, C.NOT_VALID_INBOX_INDEX, index + "");
sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + "");
return;
}
PlotComment comment = value.get(index - 1);
inbox.removeComment(plot, comment);
plot.removeComment(comment);
MainUtil.sendMessage(player, C.COMMENT_REMOVED, comment.comment);
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, comment.comment);
}
})) {
sendMessage(player, C.NOT_IN_PLOT);
sendMessage(player, Captions.NOT_IN_PLOT);
return false;
}
return true;
case "clear":
if (!inbox.canModify(plot, player)) {
sendMessage(player, C.NO_PERM_INBOX_MODIFY);
sendMessage(player, Captions.NO_PERM_INBOX_MODIFY);
}
inbox.clearInbox(plot);
List<PlotComment> comments = plot.getComments(inbox.toString());
if (!comments.isEmpty()) {
plot.removeComments(comments);
}
MainUtil.sendMessage(player, C.COMMENT_REMOVED, "*");
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, "*");
return true;
default:
try {
page = Integer.parseInt(args[1]);
} catch (NumberFormatException ignored) {
sendMessage(player, C.COMMAND_SYNTAX,
sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot inbox [inbox] [delete <index>|clear|page]");
return false;
}
@ -180,7 +180,7 @@ import java.util.List;
page = 1;
}
if (!inbox.canRead(plot, player)) {
sendMessage(player, C.NO_PERM_INBOX);
sendMessage(player, Captions.NO_PERM_INBOX);
return false;
}
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
@ -188,7 +188,7 @@ import java.util.List;
displayComments(player, value, page);
}
})) {
sendMessage(player, C.PLOT_UNOWNED);
sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
return true;

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -50,7 +50,7 @@ import java.util.UUID;
plot = player.getCurrentPlot();
}
if (plot == null) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT.s());
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.s());
return false;
}
if (arg != null) {
@ -97,11 +97,11 @@ import java.util.UUID;
boolean trustedEveryone = plot.getMembers().contains(DBFunc.EVERYONE);
// Unclaimed?
if (!hasOwner && !containsEveryone && !trustedEveryone) {
MainUtil
.sendMessage(player, C.PLOT_INFO_UNCLAIMED, plot.getId().x + ";" + plot.getId().y);
MainUtil.sendMessage(player, Captions.PLOT_INFO_UNCLAIMED,
plot.getId().x + ";" + plot.getId().y);
return true;
}
String info = C.PLOT_INFO.s();
String info = Captions.PLOT_INFO.s();
boolean full;
if (arg != null) {
info = getCaption(arg);
@ -118,7 +118,8 @@ import java.util.UUID;
MainUtil.format(info, plot, player, full, new RunnableVal<String>() {
@Override public void run(String value) {
MainUtil.sendMessage(player,
C.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + C.PLOT_INFO_FOOTER.s(), false);
Captions.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER
.s(), false);
}
});
return true;
@ -127,27 +128,27 @@ import java.util.UUID;
private String getCaption(String string) {
switch (string) {
case "trusted":
return C.PLOT_INFO_TRUSTED.s();
return Captions.PLOT_INFO_TRUSTED.s();
case "alias":
return C.PLOT_INFO_ALIAS.s();
return Captions.PLOT_INFO_ALIAS.s();
case "biome":
return C.PLOT_INFO_BIOME.s();
return Captions.PLOT_INFO_BIOME.s();
case "denied":
return C.PLOT_INFO_DENIED.s();
return Captions.PLOT_INFO_DENIED.s();
case "flags":
return C.PLOT_INFO_FLAGS.s();
return Captions.PLOT_INFO_FLAGS.s();
case "id":
return C.PLOT_INFO_ID.s();
return Captions.PLOT_INFO_ID.s();
case "size":
return C.PLOT_INFO_SIZE.s();
return Captions.PLOT_INFO_SIZE.s();
case "members":
return C.PLOT_INFO_MEMBERS.s();
return Captions.PLOT_INFO_MEMBERS.s();
case "owner":
return C.PLOT_INFO_OWNER.s();
return Captions.PLOT_INFO_OWNER.s();
case "rating":
return C.PLOT_INFO_RATING.s();
return Captions.PLOT_INFO_RATING.s();
case "seen":
return C.PLOT_INFO_SEEN.s();
return Captions.PLOT_INFO_SEEN.s();
default:
return null;
}

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -29,16 +29,16 @@ import java.util.UUID;
Location location = player.getLocation();
Plot plot = location.getPlot();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_KICK)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_KICK)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
if (uuids.isEmpty()) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
return false;
}
Set<PlotPlayer> players = new HashSet<>();
@ -46,7 +46,7 @@ import java.util.UUID;
if (uuid == DBFunc.EVERYONE) {
for (PlotPlayer pp : plot.getPlayersInPlot()) {
if (pp == player || Permissions
.hasPermission(pp, C.PERMISSION_ADMIN_ENTRY_DENIED)) {
.hasPermission(pp, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) {
continue;
}
players.add(pp);
@ -60,26 +60,26 @@ import java.util.UUID;
}
players.remove(player); // Don't ever kick the calling player
if (players.isEmpty()) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
return false;
}
for (PlotPlayer player2 : players) {
if (!plot.equals(player2.getCurrentPlot())) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
return false;
}
if (Permissions.hasPermission(player2, C.PERMISSION_ADMIN_ENTRY_DENIED)) {
C.CANNOT_KICK_PLAYER.send(player, player2.getName());
if (Permissions.hasPermission(player2, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) {
Captions.CANNOT_KICK_PLAYER.send(player, player2.getName());
return false;
}
Location spawn = WorldUtil.IMP.getSpawn(location.getWorld());
C.YOU_GOT_KICKED.send(player2);
Captions.YOU_GOT_KICKED.send(player2);
if (plot.equals(spawn.getPlot())) {
Location newSpawn = WorldUtil.IMP
.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
if (plot.equals(newSpawn.getPlot())) {
// Kick from server if you can't be teleported to spawn
player2.kick(C.YOU_GOT_KICKED.s());
player2.kick(Captions.YOU_GOT_KICKED.s());
} else {
player2.plotkick(newSpawn);
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
@ -23,12 +23,12 @@ import java.util.UUID;
@Override public void execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
checkTrue(plot.isAdded(player.getUUID()), C.NO_PLOT_PERMS);
checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage());
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
checkTrue(plot.isAdded(player.getUUID()), Captions.NO_PLOT_PERMS);
checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage());
if (plot.isOwner(player.getUUID())) {
checkTrue(plot.hasOwner(), C.ALREADY_OWNER);
checkTrue(plot.hasOwner(), Captions.ALREADY_OWNER);
// TODO setowner, other
} else {
UUID uuid = player.getUUID();
@ -39,9 +39,9 @@ import java.util.UUID;
if (plot.removeMember(uuid)) {
EventUtil.manager.callMember(player, plot, uuid, false);
}
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
} else {
MainUtil.sendMessage(player, C.REMOVED_PLAYERS, 1);
MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, 1);
}
}
}

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.*;
@ -20,43 +20,43 @@ public class ListCmd extends SubCommand {
private String[] getArgumentList(PlotPlayer player) {
List<String> args = new ArrayList<>();
if (EconHandler.manager != null && Permissions
.hasPermission(player, C.PERMISSION_LIST_FORSALE)) {
.hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) {
args.add("forsale");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
args.add("mine");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) {
args.add("shared");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
args.add("world");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) {
args.add("top");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) {
args.add("all");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) {
args.add("unowned");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNKNOWN)) {
args.add("unknown");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) {
args.add("<player>");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
args.add("<world>");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) {
args.add("done");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) {
args.add("expired");
}
if (Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) {
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) {
args.add("fuzzy <search...>");
}
return args.toArray(new String[args.size()]);
@ -64,7 +64,7 @@ public class ListCmd extends SubCommand {
public void noArgs(PlotPlayer player) {
MainUtil.sendMessage(player,
C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(player)));
Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(player)));
}
@Override public boolean onCommand(PlotPlayer player, String[] args) {
@ -93,16 +93,18 @@ public class ListCmd extends SubCommand {
boolean sort = true;
switch (arg) {
case "mine":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_MINE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_MINE);
return false;
}
sort = false;
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getBasePlots(player));
break;
case "shared":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_SHARED);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_SHARED);
return false;
}
plots = new ArrayList<>();
@ -114,20 +116,23 @@ public class ListCmd extends SubCommand {
}
break;
case "world":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_WORLD);
return false;
}
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_LIST_WORLD_NAME.f(world));
if (!Permissions
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_WORLD_NAME.f(world));
return false;
}
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
break;
case "expired":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_EXPIRED);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_EXPIRED);
return false;
}
plots = ExpireManager.IMP == null ?
@ -135,27 +140,31 @@ public class ListCmd extends SubCommand {
new ArrayList<>(ExpireManager.IMP.getPendingExpired());
break;
case "area":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_AREA)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_AREA);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_AREA)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_AREA);
return false;
}
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_LIST_WORLD_NAME.f(world));
if (!Permissions
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_WORLD_NAME.f(world));
return false;
}
plots = area == null ? new ArrayList<Plot>() : new ArrayList<>(area.getPlots());
break;
case "all":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_ALL);
return false;
}
plots = new ArrayList<>(PlotSquared.get().getPlots());
break;
case "done":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_DONE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_DONE);
return false;
}
plots = new ArrayList<>();
@ -179,8 +188,9 @@ public class ListCmd extends SubCommand {
sort = false;
break;
case "top":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_TOP);
return false;
}
plots = new ArrayList<>(PlotSquared.get().getPlots());
@ -212,8 +222,9 @@ public class ListCmd extends SubCommand {
sort = false;
break;
case "forsale":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FORSALE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FORSALE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_FORSALE);
return false;
}
if (EconHandler.manager == null) {
@ -228,8 +239,9 @@ public class ListCmd extends SubCommand {
}
break;
case "unowned":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNOWNED);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_UNOWNED);
return false;
}
plots = new ArrayList<>();
@ -240,8 +252,9 @@ public class ListCmd extends SubCommand {
}
break;
case "unknown":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNKNOWN);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNKNOWN)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_UNKNOWN);
return false;
}
plots = new ArrayList<>();
@ -255,12 +268,13 @@ public class ListCmd extends SubCommand {
}
break;
case "fuzzy":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FUZZY);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_FUZZY);
return false;
}
if (args.length < (page == -1 ? 2 : 3)) {
C.COMMAND_SYNTAX.send(player, "/plot list fuzzy <search...> [#]");
Captions.COMMAND_SYNTAX.send(player, "/plot list fuzzy <search...> [#]");
return false;
}
String term;
@ -274,14 +288,15 @@ public class ListCmd extends SubCommand {
break;
default:
if (PlotSquared.get().hasPlotArea(args[0])) {
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_WORLD);
return false;
}
if (!Permissions
.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(args[0]))) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_LIST_WORLD_NAME.f(args[0]));
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]))) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]));
return false;
}
plots = new ArrayList<>(PlotSquared.get().getPlots(args[0]));
@ -295,8 +310,9 @@ public class ListCmd extends SubCommand {
}
}
if (uuid != null) {
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_PLAYER);
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_LIST_PLAYER);
return false;
}
sort = false;
@ -306,14 +322,14 @@ public class ListCmd extends SubCommand {
}
if (plots == null) {
sendMessage(player, C.DID_YOU_MEAN,
sendMessage(player, Captions.DID_YOU_MEAN,
new StringComparison<>(args[0], new String[] {"mine", "shared", "world", "all"})
.getBestMatch());
return false;
}
if (plots.isEmpty()) {
MainUtil.sendMessage(player, C.FOUND_NO_PLOTS);
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
return false;
}
displayPlots(player, plots, 12, page, area, args, sort);
@ -347,18 +363,20 @@ public class ListCmd extends SubCommand {
} else {
color = "$1";
}
PlotMessage trusted = new PlotMessage().text(C.color(C.PLOT_INFO_TRUSTED.s()
PlotMessage trusted =
new PlotMessage().text(Captions.color(Captions.PLOT_INFO_TRUSTED.s()
.replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted()))))
.color("$1");
PlotMessage members = new PlotMessage().text(C.color(C.PLOT_INFO_MEMBERS.s()
PlotMessage members =
new PlotMessage().text(Captions.color(Captions.PLOT_INFO_MEMBERS.s()
.replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers()))))
.color("$1");
String strFlags = StringMan.join(plot.getFlags().values(), ",");
if (strFlags.isEmpty()) {
strFlags = C.NONE.s();
strFlags = Captions.NONE.s();
}
PlotMessage flags = new PlotMessage()
.text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags)))
PlotMessage flags = new PlotMessage().text(Captions
.color(Captions.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags)))
.color("$1");
message.text("[").color("$3").text(i + "")
.command("/plot visit " + plot.getArea() + ";" + plot.getId())
@ -386,7 +404,7 @@ public class ListCmd extends SubCommand {
prefix = ", ";
}
}
}, "/plot list " + args[0], C.PLOT_LIST_HEADER_PAGED.s());
}, "/plot list " + args[0], Captions.PLOT_LIST_HEADER_PAGED.s());
}
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
@ -22,23 +22,23 @@ import java.util.List;
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld();
if (!PlotSquared.get().hasPlotArea(world)) {
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
}
final Plot plot = player.getCurrentPlot();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_LOAD)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_LOAD)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
@ -47,7 +47,7 @@ import java.util.List;
List<String> schematics = player.getMeta("plot_schematics");
if (schematics == null) {
// No schematics found:
MainUtil.sendMessage(player, C.LOAD_NULL);
MainUtil.sendMessage(player, Captions.LOAD_NULL);
return false;
}
String schem;
@ -55,8 +55,8 @@ import java.util.List;
schem = schematics.get(Integer.parseInt(args[0]) - 1);
} catch (Exception ignored) {
// use /plot load <index>
MainUtil
.sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')');
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER,
"(1, " + schematics.size() + ')');
return false;
}
final URL url;
@ -64,16 +64,16 @@ import java.util.List;
url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schem);
} catch (MalformedURLException e) {
e.printStackTrace();
MainUtil.sendMessage(player, C.LOAD_FAILED);
MainUtil.sendMessage(player, Captions.LOAD_FAILED);
return false;
}
plot.addRunning();
MainUtil.sendMessage(player, C.GENERATING_COMPONENT);
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT);
TaskManager.runTaskAsync(() -> {
Schematic schematic = SchematicHandler.manager.getSchematic(url);
if (schematic == null) {
plot.removeRunning();
sendMessage(player, C.SCHEMATIC_INVALID,
sendMessage(player, Captions.SCHEMATIC_INVALID,
"non-existent or not in gzip format");
return;
}
@ -84,9 +84,9 @@ import java.util.List;
@Override public void run(Boolean value) {
plot.removeRunning();
if (value) {
sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS);
sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS);
} else {
sendMessage(player, C.SCHEMATIC_PASTE_FAILED);
sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED);
}
}
});
@ -94,7 +94,7 @@ import java.util.List;
return true;
}
plot.removeRunning();
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot load <index>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot load <index>");
return false;
}
@ -107,7 +107,7 @@ import java.util.List;
List<String> schematics1 = SchematicHandler.manager.getSaves(player.getUUID());
plot.removeRunning();
if ((schematics1 == null) || schematics1.isEmpty()) {
MainUtil.sendMessage(player, C.LOAD_FAILED);
MainUtil.sendMessage(player, Captions.LOAD_FAILED);
return;
}
player.setMeta("plot_schematics", schematics1);
@ -141,7 +141,7 @@ import java.util.List;
e.printStackTrace();
}
}
MainUtil.sendMessage(player, C.LOAD_LIST);
MainUtil.sendMessage(player, Captions.LOAD_LIST);
}
public String secToTime(long time) {

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
@ -200,7 +200,8 @@ public class MainCommand extends Command {
PlotArea area = player.getApplicablePlotArea();
Plot newPlot = Plot.fromString(area, args[0]);
if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea()
.equals(area) || Permissions.hasPermission(player, C.PERMISSION_ADMIN)) && !newPlot
.equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN))
&& !newPlot
.isDenied(player.getUUID())) {
Location newLoc = newPlot.getCenter();
if (player.canTeleport(newLoc)) {
@ -212,7 +213,7 @@ public class MainCommand extends Command {
player.setMeta(PlotPlayer.META_LOCATION, newLoc);
player.setMeta(PlotPlayer.META_LAST_PLOT, newPlot);
} else {
C.BORDER.send(player);
Captions.BORDER.send(player);
}
// Trim command
args = Arrays.copyOfRange(args, 1, args.length);
@ -247,7 +248,7 @@ public class MainCommand extends Command {
args = Arrays.copyOfRange(args, 1, args.length);
break;
default:
C.INVALID_COMMAND_FLAG.send(player);
Captions.INVALID_COMMAND_FLAG.send(player);
return;
}
}
@ -260,9 +261,9 @@ public class MainCommand extends Command {
e.printStackTrace();
String message = e.getLocalizedMessage();
if (message != null) {
C.ERROR.send(player, message);
Captions.ERROR.send(player, message);
} else {
C.ERROR.send(player);
Captions.ERROR.send(player);
}
}
// Reset command scope //

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.*;
@ -43,16 +43,16 @@ public class Merge extends SubCommand {
Location loc = player.getLocationFull();
final Plot plot = loc.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
UUID uuid = player.getUUID();
if (!plot.isOwner(uuid)) {
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_MERGE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_MERGE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
} else {
uuid = plot.guessOwner();
@ -65,13 +65,13 @@ public class Merge extends SubCommand {
final double price = priceExr == null ? 0d : priceExr.evaluate((double) size);
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d
&& EconHandler.manager.getMoney(player) < price) {
sendMessage(player, C.CANNOT_AFFORD_MERGE, String.valueOf(price));
sendMessage(player, Captions.CANNOT_AFFORD_MERGE, String.valueOf(price));
return false;
}
final int maxSize =
Permissions.hasPermissionRange(player, "plots.merge", Settings.Limit.MAX_PLOTS);
if (size - 1 > maxSize) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.merge." + (size + 1));
MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.merge." + (size + 1));
return false;
}
int direction = -1;
@ -96,19 +96,21 @@ public class Merge extends SubCommand {
if (args.length == 2) {
terrain = "true".equalsIgnoreCase(args[1]);
}
if (!terrain && !Permissions.hasPermission(player, C.PERMISSION_MERGE_KEEPROAD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_KEEPROAD.s());
if (!terrain && !Permissions
.hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_MERGE_KEEPROAD.s());
return true;
}
if (plot.autoMerge(-1, maxSize, uuid, terrain)) {
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
EconHandler.manager.withdrawMoney(player, price);
sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price));
sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price));
}
MainUtil.sendMessage(player, C.SUCCESS_MERGE);
MainUtil.sendMessage(player, Captions.SUCCESS_MERGE);
return true;
}
MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE);
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
return false;
}
@ -120,10 +122,10 @@ public class Merge extends SubCommand {
}
}
if (direction == -1) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot merge <" + StringMan.join(values, "|") + "> [removeroads]");
MainUtil
.sendMessage(player, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
MainUtil.sendMessage(player,
Captions.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
return false;
}
final boolean terrain;
@ -132,26 +134,27 @@ public class Merge extends SubCommand {
} else {
terrain = true;
}
if (!terrain && !Permissions.hasPermission(player, C.PERMISSION_MERGE_KEEPROAD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_KEEPROAD.s());
if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_MERGE_KEEPROAD.s());
return true;
}
if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) {
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
EconHandler.manager.withdrawMoney(player, price);
sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price));
sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price));
}
MainUtil.sendMessage(player, C.SUCCESS_MERGE);
MainUtil.sendMessage(player, Captions.SUCCESS_MERGE);
return true;
}
Plot adjacent = plot.getRelative(direction);
if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4)
|| adjacent.isOwner(uuid)) {
MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE);
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
return false;
}
if (!Permissions.hasPermission(player, C.PERMISSION_MERGE_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER);
if (!Permissions.hasPermission(player, Captions.PERMISSION_MERGE_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_MERGE_OTHER);
return false;
}
java.util.Set<UUID> uuids = adjacent.getOwners();
@ -164,35 +167,35 @@ public class Merge extends SubCommand {
isOnline = true;
final int dir = direction;
Runnable run = () -> {
MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED);
MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED);
plot.autoMerge(dir, maxSize - size, owner, terrain);
PlotPlayer plotPlayer = UUIDHandler.getPlayer(player.getUUID());
if (plotPlayer == null) {
sendMessage(accepter, C.MERGE_NOT_VALID);
sendMessage(accepter, Captions.MERGE_NOT_VALID);
return;
}
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
if (EconHandler.manager.getMoney(player) < price) {
sendMessage(player, C.CANNOT_AFFORD_MERGE, String.valueOf(price));
sendMessage(player, Captions.CANNOT_AFFORD_MERGE, String.valueOf(price));
return;
}
EconHandler.manager.withdrawMoney(player, price);
sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price));
sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price));
}
MainUtil.sendMessage(player, C.SUCCESS_MERGE);
MainUtil.sendMessage(player, Captions.SUCCESS_MERGE);
};
if (hasConfirmation(player)) {
CmdConfirm.addPending(accepter,
C.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run);
Captions.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run);
} else {
run.run();
}
}
if (!isOnline) {
MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE);
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
return false;
}
MainUtil.sendMessage(player, C.MERGE_REQUESTED);
MainUtil.sendMessage(player, Captions.MERGE_REQUESTED);
return true;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -18,10 +18,10 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
Location location = player.getLocation();
Plot plot = location.getPlot();
if (plot == null) {
return sendMessage(player, C.NOT_IN_PLOT);
return sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
return sendMessage(player, C.PLOT_UNOWNED);
return sendMessage(player, Captions.PLOT_UNOWNED);
}
player.teleport(plot.getCenter());
return true;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
@ -18,11 +18,11 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
Location loc = player.getLocation();
Plot plot1 = loc.getPlotAbs();
if (plot1 == null) {
return !MainUtil.sendMessage(player, C.NOT_IN_PLOT);
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN.s())) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN.s())) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
boolean override = false;
@ -31,7 +31,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
override = true;
}
if (args.length != 1) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
@ -45,19 +45,19 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
plot2 = area.getPlotAbs(plot1.getId());
}
if (plot1.equals(plot2)) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy <X;Z>");
return false;
}
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions
.hasPermission(player, C.PERMISSION_ADMIN.s()))) {
C.PLOTWORLD_INCOMPATIBLE.send(player);
.hasPermission(player, Captions.PERMISSION_ADMIN.s()))) {
Captions.PLOTWORLD_INCOMPATIBLE.send(player);
return false;
}
if (plot1.move(plot2, () -> MainUtil.sendMessage(player, C.MOVE_SUCCESS), false)) {
if (plot1.move(plot2, () -> MainUtil.sendMessage(player, Captions.MOVE_SUCCESS), false)) {
return true;
} else {
MainUtil.sendMessage(player, C.REQUIRES_UNOWNED);
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED);
return false;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -23,10 +23,10 @@ import java.util.Locale;
Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.isAdded(player.getUUID())) {
sendMessage(player, C.NO_PLOT_PERMS);
sendMessage(player, Captions.NO_PLOT_PERMS);
return true;
}
PlotInventory inv = new PlotInventory(player, 2, "Plot Jukebox") {
@ -37,12 +37,12 @@ import java.util.Locale;
}
if (item.getPlotBlock().equalsAny(7, "bedrock")) {
plot.removeFlag(Flags.MUSIC);
C.FLAG_REMOVED.send(player);
Captions.FLAG_REMOVED.send(player);
} else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) {
plot.setFlag(Flags.MUSIC, item.getPlotBlock().getRawId());
C.FLAG_ADDED.send(player);
Captions.FLAG_ADDED.send(player);
} else {
C.FLAG_NOT_ADDED.send(player);
Captions.FLAG_NOT_ADDED.send(player);
}
return false;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
@ -18,7 +18,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
@Override public void execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
C.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", "));
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
Captions.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", "));
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -34,7 +34,7 @@ import java.util.UUID;
if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value
.equalsIgnoreCase("-")) {
if (!Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) {
return false;
}
Set<Plot> connected = plot.getConnectedPlots();
@ -43,20 +43,20 @@ import java.util.UUID;
current.unclaim();
current.removeSign();
}
MainUtil.sendMessage(player, C.SET_OWNER);
MainUtil.sendMessage(player, Captions.SET_OWNER);
return true;
}
C.INVALID_PLAYER.send(player, value);
Captions.INVALID_PLAYER.send(player, value);
return false;
}
final PlotPlayer other = UUIDHandler.getPlayer(uuid);
if (plot.isOwner(uuid)) {
C.ALREADY_OWNER.send(player, MainUtil.getName(uuid));
Captions.ALREADY_OWNER.send(player, MainUtil.getName(uuid));
return false;
}
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER)) {
if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER)) {
if (other == null) {
C.INVALID_PLAYER_OFFLINE.send(player, value);
Captions.INVALID_PLAYER_OFFLINE.send(player, value);
return false;
}
int size = plots.size();
@ -64,7 +64,7 @@ import java.util.UUID;
other.getPlotCount() :
other.getPlotCount(plot.getWorldName())) + size;
if (currentPlots > other.getAllowedPlots()) {
sendMessage(player, C.CANT_TRANSFER_MORE_PLOTS);
sendMessage(player, Captions.CANT_TRANSFER_MORE_PLOTS);
return false;
}
}
@ -77,13 +77,14 @@ import java.util.UUID;
if (removeDenied)
plot.removeDenied(finalUUID);
plot.setSign(finalName);
MainUtil.sendMessage(player, C.SET_OWNER);
MainUtil.sendMessage(player, Captions.SET_OWNER);
if (other != null) {
MainUtil
.sendMessage(other, C.NOW_OWNER, plot.getArea() + ";" + plot.getId());
MainUtil.sendMessage(other, Captions.NOW_OWNER,
plot.getArea() + ";" + plot.getId());
}
} else
MainUtil.sendMessage(player, C.SET_OWNER_CANCELLED);
} else {
MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED);
}
}
};
if (hasConfirmation(player)) {

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -38,7 +38,7 @@ import java.util.UUID;
for (String arg : args) {
String[] split = arg.split(":");
if (split.length != 2) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
switch (split[0].toLowerCase()) {
@ -50,7 +50,7 @@ import java.util.UUID;
case "a":
area = PlotSquared.get().getPlotAreaByString(split[1]);
if (area == null) {
C.NOT_VALID_PLOT_WORLD.send(player, split[1]);
Captions.NOT_VALID_PLOT_WORLD.send(player, split[1]);
return false;
}
break;
@ -59,7 +59,7 @@ import java.util.UUID;
try {
id = PlotId.fromString(split[1]);
} catch (IllegalArgumentException ignored) {
C.NOT_VALID_PLOT_ID.send(player, split[1]);
Captions.NOT_VALID_PLOT_ID.send(player, split[1]);
return false;
}
break;
@ -67,7 +67,7 @@ import java.util.UUID;
case "o":
owner = UUIDHandler.getUUID(split[1], null);
if (owner == null) {
C.INVALID_PLAYER.send(player, split[1]);
Captions.INVALID_PLAYER.send(player, split[1]);
return false;
}
break;
@ -75,7 +75,7 @@ import java.util.UUID;
case "s":
added = UUIDHandler.getUUID(split[1], null);
if (added == null) {
C.INVALID_PLAYER.send(player, split[1]);
Captions.INVALID_PLAYER.send(player, split[1]);
return false;
}
break;
@ -85,7 +85,7 @@ import java.util.UUID;
unknown = Boolean.parseBoolean(split[1]);
break;
default:
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
}
@ -137,7 +137,7 @@ import java.util.UUID;
}
}
if (toDelete.isEmpty()) {
C.FOUND_NO_PLOTS.send(player);
Captions.FOUND_NO_PLOTS.send(player);
return false;
}
String cmd =
@ -156,7 +156,7 @@ import java.util.UUID;
}
}
DBFunc.purgeIds(ids);
C.PURGE_SUCCESS.send(player, ids.size() + "/" + toDelete.size());
Captions.PURGE_SUCCESS.send(player, ids.size() + "/" + toDelete.size());
};
if (hasConfirmation(player)) {
CmdConfirm.addPending(player, cmd, run);

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
@ -48,48 +48,50 @@ import java.util.UUID;
.isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p
.isAdded(uuid)) {
p.teleportPlayer(player);
MainUtil.sendMessage(player, C.RATE_THIS);
MainUtil.sendMessage(player, Captions.RATE_THIS);
return true;
}
}
MainUtil.sendMessage(player, C.FOUND_NO_PLOTS);
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
return false;
}
case "purge": {
final Plot plot = player.getCurrentPlot();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_RATE, true)) {
if (!Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_RATE, true)) {
return false;
}
plot.clearRatings();
C.RATINGS_PURGED.send(player);
Captions.RATINGS_PURGED.send(player);
return true;
}
}
}
final Plot plot = player.getCurrentPlot();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
sendMessage(player, C.RATING_NOT_OWNED);
sendMessage(player, Captions.RATING_NOT_OWNED);
return false;
}
if (plot.isOwner(player.getUUID())) {
sendMessage(player, C.RATING_NOT_YOUR_OWN);
sendMessage(player, Captions.RATING_NOT_YOUR_OWN);
return false;
}
if (Settings.Done.REQUIRED_FOR_RATINGS && !plot.hasFlag(Flags.DONE)) {
sendMessage(player, C.RATING_NOT_DONE);
sendMessage(player, Captions.RATING_NOT_DONE);
return false;
}
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
final Runnable run = new Runnable() {
@Override public void run() {
if (plot.getRatings().containsKey(player.getUUID())) {
sendMessage(player, C.RATING_ALREADY_EXISTS, plot.getId().toString());
sendMessage(player, Captions.RATING_ALREADY_EXISTS,
plot.getId().toString());
return;
}
final MutableInt index = new MutableInt(0);
@ -105,14 +107,14 @@ import java.util.UUID;
EventUtil.manager.callRating(this.player, plot, new Rating(rV));
if (result != null) {
plot.addRating(this.player.getUUID(), result);
sendMessage(this.player, C.RATING_APPLIED,
sendMessage(this.player, Captions.RATING_APPLIED,
plot.getId().toString());
if (Permissions
.hasPermission(this.player, C.PERMISSION_COMMENT)) {
.hasPermission(this.player, Captions.PERMISSION_COMMENT)) {
Command command =
MainCommand.getInstance().getCommand(Comment.class);
if (command != null) {
MainUtil.sendMessage(this.player, C.COMMENT_THIS,
MainUtil.sendMessage(this.player, Captions.COMMENT_THIS,
command.getUsage());
}
}
@ -149,7 +151,7 @@ import java.util.UUID;
return true;
}
if (args.length < 1) {
sendMessage(player, C.RATING_NOT_VALID);
sendMessage(player, Captions.RATING_NOT_VALID);
return true;
}
String arg = args[0];
@ -157,23 +159,23 @@ import java.util.UUID;
if (MathMan.isInteger(arg) && arg.length() < 3 && !arg.isEmpty()) {
rating = Integer.parseInt(arg);
if (rating > 10 || rating < 1) {
sendMessage(player, C.RATING_NOT_VALID);
sendMessage(player, Captions.RATING_NOT_VALID);
return false;
}
} else {
sendMessage(player, C.RATING_NOT_VALID);
sendMessage(player, Captions.RATING_NOT_VALID);
return false;
}
final UUID uuid = player.getUUID();
final Runnable run = () -> {
if (plot.getRatings().containsKey(uuid)) {
sendMessage(player, C.RATING_ALREADY_EXISTS, plot.getId().toString());
sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString());
return;
}
Rating result = EventUtil.manager.callRating(player, plot, new Rating(rating));
if (result != null) {
plot.addRating(uuid, result);
sendMessage(player, C.RATING_APPLIED, plot.getId().toString());
sendMessage(player, Captions.RATING_APPLIED, plot.getId().toString());
}
};
if (plot.getSettings().ratings == null) {

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
@ -22,24 +22,25 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
try {
height = Integer.parseInt(args[1]);
} catch (NumberFormatException ignored) {
MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(0, 256)");
MainUtil
.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot regenallroads <world> [height]");
return false;
}
} else if (args.length != 1) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot regenallroads <world> [height]");
return false;
}
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
if (area == null) {
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
Captions.NOT_VALID_PLOT_WORLD.send(player, args[0]);
return false;
}
String name = args[0];
PlotManager manager = area.getPlotManager();
if (!(manager instanceof HybridPlotManager)) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
return false;
}
//Set<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
@ -20,7 +20,7 @@ import java.util.HashSet;
RunnableVal2<Command, CommandResult> whenDone) {
final Plot plot = player.getCurrentPlot();
if (plot == null) {
C.NOT_IN_PLOT.send(player);
Captions.NOT_IN_PLOT.send(player);
return;
}
HashSet<RegionWrapper> regions = plot.getRegions();
@ -32,7 +32,7 @@ import java.util.HashSet;
}, new Runnable() {
@Override public void run() {
plot.refreshChunks();
C.SET_BLOCK_ACTION_FINISHED.send(player);
Captions.SET_BLOCK_ACTION_FINISHED.send(player);
}
}, 5);
}

View File

@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -21,7 +21,7 @@ import java.util.Objects;
// The following won't affect world generation, as that has to be
// loaded during startup unfortunately.
PlotSquared.get().setupConfigs();
C.load(PlotSquared.get().translationFile);
Captions.load(PlotSquared.get().translationFile);
PlotSquared.get().forEachPlotArea(area -> {
ConfigurationSection worldSection =
PlotSquared.get().worlds.getConfigurationSection("worlds." + area.worldname);
@ -70,10 +70,10 @@ import java.util.Objects;
}
});
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
MainUtil.sendMessage(player, C.RELOADED_CONFIGS);
MainUtil.sendMessage(player, Captions.RELOADED_CONFIGS);
} catch (IOException e) {
e.printStackTrace();
MainUtil.sendMessage(player, C.RELOAD_FAILED);
MainUtil.sendMessage(player, Captions.RELOAD_FAILED);
}
return true;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -30,15 +30,15 @@ import java.util.UUID;
Location location = player.getLocation();
Plot plot = location.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_REMOVE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_REMOVE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return true;
}
int count = 0;
@ -98,10 +98,10 @@ import java.util.UUID;
break;
}
if (count == 0) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
return false;
} else {
MainUtil.sendMessage(player, C.REMOVED_PLAYERS, count + "");
MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, count + "");
}
return true;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
@ -21,23 +21,23 @@ import java.util.UUID;
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld();
if (!PlotSquared.get().hasPlotArea(world)) {
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
}
final Plot plot = player.getCurrentPlot();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SAVE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SAVE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
plot.addRunning();
@ -58,10 +58,10 @@ import java.util.UUID;
@Override public void run(URL url) {
plot.removeRunning();
if (url == null) {
MainUtil.sendMessage(player, C.SAVE_FAILED);
MainUtil.sendMessage(player, Captions.SAVE_FAILED);
return;
}
MainUtil.sendMessage(player, C.SAVE_SUCCESS);
MainUtil.sendMessage(player, Captions.SAVE_SUCCESS);
List<String> schematics = player.getMeta("plot_schematics");
if (schematics != null) {
schematics.add(file + ".schematic");

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
@ -22,32 +22,33 @@ public class SchematicCmd extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length < 1) {
sendMessage(player, C.SCHEMATIC_MISSING_ARG);
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG);
return true;
}
String arg = args[0].toLowerCase();
switch (arg) {
case "paste": {
if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_PASTE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SCHEMATIC_PASTE);
return false;
}
if (args.length < 2) {
sendMessage(player, C.SCHEMATIC_MISSING_ARG);
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG);
break;
}
Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
if (this.running) {
@ -66,7 +67,7 @@ public class SchematicCmd extends SubCommand {
schematic = SchematicHandler.manager.getSchematic(url);
} catch (Exception e) {
e.printStackTrace();
sendMessage(player, C.SCHEMATIC_INVALID,
sendMessage(player, Captions.SCHEMATIC_INVALID,
"non-existent url: " + location);
SchematicCmd.this.running = false;
return;
@ -80,7 +81,7 @@ public class SchematicCmd extends SubCommand {
}
if (schematic == null) {
SchematicCmd.this.running = false;
sendMessage(player, C.SCHEMATIC_INVALID,
sendMessage(player, Captions.SCHEMATIC_INVALID,
"non-existent or not in gzip format");
return;
}
@ -89,9 +90,9 @@ public class SchematicCmd extends SubCommand {
@Override public void run(Boolean value) {
SchematicCmd.this.running = false;
if (value) {
sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS);
sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS);
} else {
sendMessage(player, C.SCHEMATIC_PASTE_FAILED);
sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED);
}
}
});
@ -101,39 +102,39 @@ public class SchematicCmd extends SubCommand {
// TODO test
// case "test": {
// if (!Permissions.hasPermission(plr, "plots.schematic.test")) {
// MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test");
// MainUtil.sendMessage(plr, Captions.NO_PERMISSION, "plots.schematic.test");
// return false;
// }
// if (args.length < 2) {
// sendMessage(plr, C.SCHEMATIC_MISSING_ARG);
// sendMessage(plr, Captions.SCHEMATIC_MISSING_ARG);
// return false;
// }
// final Location loc = plr.getLocation();
// final Plot plot = MainUtil.getPlot(loc);
// if (plot == null) {
// sendMessage(plr, C.NOT_IN_PLOT);
// sendMessage(plr, Captions.NOT_IN_PLOT);
// return false;
// }
// file = args[1];
// schematic = SchematicHandler.manager.getSchematic(file);
// if (schematic == null) {
// sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
// sendMessage(plr, Captions.SCHEMATIC_INVALID, "non-existent");
// return false;
// }
// final int l1 = schematic.getSchematicDimension().getX();
// final int l2 = schematic.getSchematicDimension().getZ();
// final int length = MainUtil.getPlotWidth(loc.getWorld(), plot.id);
// if ((l1 < length) || (l2 < length)) {
// sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length));
// sendMessage(plr, Captions.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length));
// break;
// }
// sendMessage(plr, C.SCHEMATIC_VALID);
// sendMessage(plr, Captions.SCHEMATIC_VALID);
// break;
// }
case "saveall":
case "exportall": {
if (!(player instanceof ConsolePlayer)) {
MainUtil.sendMessage(player, C.NOT_CONSOLE);
MainUtil.sendMessage(player, Captions.NOT_CONSOLE);
return false;
}
if (args.length != 2) {
@ -143,7 +144,7 @@ public class SchematicCmd extends SubCommand {
}
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
if (area == null) {
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
return false;
}
Collection<Plot> plots = area.getPlots();
@ -167,8 +168,9 @@ public class SchematicCmd extends SubCommand {
}
case "export":
case "save":
if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_SAVE);
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SCHEMATIC_SAVE);
return false;
}
if (this.running) {
@ -178,15 +180,15 @@ public class SchematicCmd extends SubCommand {
Location location = player.getLocation();
Plot plot = location.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
location.getWorld();
@ -204,17 +206,18 @@ public class SchematicCmd extends SubCommand {
}
break;
case "list": {
if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_LIST)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_LIST);
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_LIST)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SCHEMATIC_LIST);
return false;
}
final String string =
StringMan.join(SchematicHandler.manager.getShematicNames(), "$2, $1");
C.SCHEMATIC_LIST.send(player, string);
Captions.SCHEMATIC_LIST.send(player, string);
}
break;
default:
sendMessage(player, C.SCHEMATIC_MISSING_ARG);
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG);
break;
}
return true;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.config.Configuration.UnknownBlockException;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
@ -47,17 +47,17 @@ import java.util.stream.IntStream;
for (String component : components) {
if (component.equalsIgnoreCase(args[0])) {
if (!Permissions
.hasPermission(player, C.PERMISSION_SET_COMPONENT.f(component))) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_SET_COMPONENT.f(component));
if (!Permissions.hasPermission(player,
Captions.PERMISSION_SET_COMPONENT.f(component))) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SET_COMPONENT.f(component));
return false;
}
// PlotBlock[] blocks;
BlockBucket bucket;
try {
if (args.length < 2) {
MainUtil.sendMessage(player, C.NEED_BLOCK);
MainUtil.sendMessage(player, Captions.NEED_BLOCK);
return true;
}
String[] split = material.split(",");
@ -67,14 +67,14 @@ import java.util.stream.IntStream;
bucket = Configuration.BLOCK_BUCKET.parseString(material);
} catch (final UnknownBlockException unknownBlockException) {
final String unknownBlock = unknownBlockException.getUnknownValue();
C.NOT_VALID_BLOCK.send(player, unknownBlock);
Captions.NOT_VALID_BLOCK.send(player, unknownBlock);
StringComparison<PlotBlock>.ComparisonResult match =
WorldUtil.IMP.getClosestBlock(unknownBlock);
if (match != null) {
final String found =
WorldUtil.IMP.getClosestMatchingName(match.best);
if (found != null) {
MainUtil.sendMessage(player, C.DID_YOU_MEAN,
MainUtil.sendMessage(player, Captions.DID_YOU_MEAN,
found.toLowerCase());
}
}
@ -84,24 +84,24 @@ import java.util.stream.IntStream;
if (!allowUnsafe) {
for (final PlotBlock block : bucket.getBlocks()) {
if (!block.isAir() && !WorldUtil.IMP.isBlockSolid(block)) {
C.NOT_ALLOWED_BLOCK.send(player, block.toString());
Captions.NOT_ALLOWED_BLOCK.send(player, block.toString());
return false;
}
}
}
} catch (Exception ignored) {
MainUtil.sendMessage(player, C.NOT_VALID_BLOCK, material);
MainUtil.sendMessage(player, Captions.NOT_VALID_BLOCK, material);
return false;
}
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
plot.addRunning();
for (Plot current : plot.getConnectedPlots()) {
current.setComponent(component, bucket);
}
MainUtil.sendMessage(player, C.GENERATING_COMPONENT);
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT);
GlobalBlockQueue.IMP.addTask(plot::removeRunning);
return true;
}
@ -119,8 +119,8 @@ import java.util.stream.IntStream;
newValues.addAll(
Arrays.asList(plot.getManager().getPlotComponents(plot.getArea(), plot.getId())));
}
MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan
.join(newValues, C.BLOCK_LIST_SEPARATER.formatted()));
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan
.join(newValues, Captions.BLOCK_LIST_SEPARATER.formatted()));
return false;
}
@ -139,7 +139,7 @@ import java.util.stream.IntStream;
// Additional checks
Plot plot = player.getCurrentPlot();
if (plot == null) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
return false;
}
// components

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -14,21 +14,23 @@ public abstract class SetCommand extends SubCommand {
Location loc = player.getLocation();
Plot plot = loc.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_ADMIN_COMMAND.f(getFullId()));
MainUtil.sendMessage(player, C.PLOT_NOT_CLAIMED);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()));
MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED);
return false;
}
}
if (!plot.isOwner(player.getUUID())) {
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
MainUtil.sendMessage(player, C.NO_PERMISSION,
C.PERMISSION_ADMIN_COMMAND.f(getFullId()));
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
if (!Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()));
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.BlockLoc;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -21,7 +21,7 @@ public class SetHome extends SetCommand {
case "none": {
Plot base = plot.getBasePlot(false);
base.setHome(null);
return MainUtil.sendMessage(player, C.POSITION_UNSET);
return MainUtil.sendMessage(player, Captions.POSITION_UNSET);
}
case "":
Plot base = plot.getBasePlot(false);
@ -31,9 +31,9 @@ public class SetHome extends SetCommand {
new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(),
loc.getYaw(), loc.getPitch());
base.setHome(rel);
return MainUtil.sendMessage(player, C.POSITION_SET);
return MainUtil.sendMessage(player, Captions.POSITION_SET);
default:
MainUtil.sendMessage(player, C.HOME_ARGUMENT);
MainUtil.sendMessage(player, Captions.HOME_ARGUMENT);
return false;
}
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
@ -43,7 +43,7 @@ import java.util.Map.Entry;
object = new SetupObject();
player.setMeta("setup", object);
SetupUtils.manager.updateGenerators();
sendMessage(player, C.SETUP_INIT);
sendMessage(player, Captions.SETUP_INIT);
displayGenerators(player);
return false;
}
@ -57,7 +57,8 @@ import java.util.Map.Entry;
if (object.setup_index > 0) {
object.setup_index--;
ConfigurationNode node = object.step[object.setup_index];
sendMessage(player, C.SETUP_STEP, object.setup_index + 1, node.getDescription(),
sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1,
node.getDescription(),
node.getType().getType(), String.valueOf(node.getDefaultValue()));
return false;
} else if (object.current > 0) {
@ -75,7 +76,7 @@ import java.util.Map.Entry;
.join(SetupUtils.generators.keySet(), prefix)
.replaceAll(PlotSquared.imp().getPluginName(),
"&2" + PlotSquared.imp().getPluginName()));
sendMessage(player, C.SETUP_INIT);
sendMessage(player, Captions.SETUP_INIT);
return false;
}
object.setupGenerator = args[0];
@ -129,7 +130,8 @@ import java.util.Map.Entry;
return true;
}
ConfigurationNode step = object.step[object.setup_index];
sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(),
sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1,
step.getDescription(),
step.getType().getType(), String.valueOf(step.getDefaultValue()));
} else {
if (gen.isFull()) {
@ -231,7 +233,8 @@ import java.util.Map.Entry;
.getSettingNodes();
}
ConfigurationNode step = object.step[object.setup_index];
sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(),
sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1,
step.getDescription(),
step.getType().getType(), String.valueOf(step.getDefaultValue()));
break;
}
@ -244,7 +247,8 @@ import java.util.Map.Entry;
}
ConfigurationNode step = object.step[object.setup_index];
if (args.length < 1) {
sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(),
sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1,
step.getDescription(),
step.getType().getType(), String.valueOf(step.getDefaultValue()));
return false;
}
@ -253,10 +257,10 @@ import java.util.Map.Entry;
try {
valid = step.isValid(args[0]);
} catch (final Configuration.UnsafeBlockException e) {
C.NOT_ALLOWED_BLOCK.send(player, e.getUnsafeBlock().toString());
Captions.NOT_ALLOWED_BLOCK.send(player, e.getUnsafeBlock().toString());
}
if (valid) {
sendMessage(player, C.SETUP_VALID_ARG, step.getConstant(), args[0]);
sendMessage(player, Captions.SETUP_VALID_ARG, step.getConstant(), args[0]);
step.setValue(args[0]);
object.setup_index++;
if (object.setup_index == object.step.length) {
@ -264,12 +268,14 @@ import java.util.Map.Entry;
return false;
}
step = object.step[object.setup_index];
sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(),
sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1,
step.getDescription(),
step.getType().getType(), String.valueOf(step.getDefaultValue()));
return false;
} else {
sendMessage(player, C.SETUP_INVALID_ARG, args[0], step.getConstant());
sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(),
sendMessage(player, Captions.SETUP_INVALID_ARG, args[0], step.getConstant());
sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1,
step.getDescription(),
step.getType().getType(), String.valueOf(step.getDefaultValue()));
return false;
}
@ -302,7 +308,7 @@ import java.util.Map.Entry;
player.sendMessage("&cAn error occurred. See console for more information");
e.printStackTrace();
}
sendMessage(player, C.SETUP_FINISHED, object.world);
sendMessage(player, Captions.SETUP_FINISHED, object.world);
}
return false;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
@ -32,7 +32,7 @@ public abstract class SubCommand extends Command {
public abstract boolean onCommand(PlotPlayer player, String[] args);
public boolean sendMessage(PlotPlayer player, C message, Object... args) {
public boolean sendMessage(PlotPlayer player, Captions message, Object... args) {
message.send(player, args);
return true;
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -16,15 +16,15 @@ public class Swap extends SubCommand {
Location loc = player.getLocation();
Plot plot1 = loc.getPlotAbs();
if (plot1 == null) {
return !MainUtil.sendMessage(player, C.NOT_IN_PLOT);
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN.s())) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN.s())) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
return false;
}
if (args.length != 1) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
@ -32,22 +32,22 @@ public class Swap extends SubCommand {
return false;
}
if (plot1.equals(plot2)) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy <X;Z>");
return false;
}
if (!plot1.getArea().isCompatible(plot2.getArea())) {
C.PLOTWORLD_INCOMPATIBLE.send(player);
Captions.PLOTWORLD_INCOMPATIBLE.send(player);
return false;
}
if (plot1.move(plot2, new Runnable() {
@Override public void run() {
MainUtil.sendMessage(player, C.SWAP_SUCCESS);
MainUtil.sendMessage(player, Captions.SWAP_SUCCESS);
}
}, true)) {
return true;
} else {
MainUtil.sendMessage(player, C.SWAP_OVERLAP);
MainUtil.sendMessage(player, Captions.SWAP_OVERLAP);
return false;
}
}

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -22,7 +22,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
@Override public boolean onCommand(PlotPlayer player, String[] args) {
Location location = player.getLocation();
if (!location.isPlotArea()) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
return false;
}
Plot target = null;
@ -36,14 +36,14 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
}
}
if (target == null) {
MainUtil.sendMessage(player, C.FOUND_NO_PLOTS);
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
return false;
}
} else if ((target = MainUtil.getPlotFromString(player, args[0], true)) == null) {
return false;
}
player.setCompassTarget(target.getCenter());
MainUtil.sendMessage(player, C.COMPASS_TARGET);
MainUtil.sendMessage(player, Captions.COMPASS_TARGET);
return true;
}
}

View File

@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -107,15 +107,16 @@ import java.util.zip.ZipOutputStream;
if (args.length != 2 && args.length != 3) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("export")) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot template export <world>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template export <world>");
return true;
} else if (args[0].equalsIgnoreCase("import")) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template import <world> <template>");
return true;
}
}
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template <import|export> <world> [template]");
return true;
}
@ -123,12 +124,12 @@ import java.util.zip.ZipOutputStream;
switch (args[0].toLowerCase()) {
case "import": {
if (args.length != 3) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template import <world> <template>");
return false;
}
if (PlotSquared.get().hasPlotArea(world)) {
MainUtil.sendMessage(player, C.SETUP_WORLD_TAKEN, world);
MainUtil.sendMessage(player, Captions.SETUP_WORLD_TAKEN, world);
return false;
}
boolean result = extractAllFiles(world, args[2]);
@ -171,12 +172,13 @@ import java.util.zip.ZipOutputStream;
}
case "export":
if (args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot template export <world>");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template export <world>");
return false;
}
final PlotArea area = PlotSquared.get().getPlotAreaByString(world);
if (area == null) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
return false;
}
final PlotManager manager = area.getPlotManager();
@ -194,7 +196,7 @@ import java.util.zip.ZipOutputStream;
});
return true;
default:
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
}
return false;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
@ -22,9 +22,9 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "chatspy")) {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
} else {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
}
}
@ -34,9 +34,9 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "worldedit")) {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
} else {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
}
}
@ -46,9 +46,9 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "chat")) {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
} else {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
}
}
@ -58,9 +58,9 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "ignoreExpireTask")) {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
} else {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
}
}
@ -72,9 +72,9 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
PlotArea area = player.getApplicablePlotArea();
boolean chat = area != null && area.PLOT_CHAT;
if (toggle(player, "disabletitles") != chat) {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
} else {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
}
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -128,16 +128,16 @@ import java.util.Set;
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length == 0) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
final String world = args[0];
if (!WorldUtil.IMP.isWorld(world) || !PlotSquared.get().hasPlotArea(world)) {
MainUtil.sendMessage(player, C.NOT_VALID_WORLD);
MainUtil.sendMessage(player, Captions.NOT_VALID_WORLD);
return false;
}
if (Trim.TASK) {
C.TRIM_IN_PROGRESS.send(player);
Captions.TRIM_IN_PROGRESS.send(player);
return false;
}
Trim.TASK = true;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -28,31 +28,32 @@ import java.util.UUID;
@Override public void execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
checkTrue(plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS);
checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage());
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
Captions.NO_PLOT_PERMS);
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]);
checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]);
Iterator<UUID> iter = uuids.iterator();
int size = plot.getTrusted().size() + plot.getMembers().size();
while (iter.hasNext()) {
UUID uuid = iter.next();
if (uuid == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid));
iter.remove();
continue;
}
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid));
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid));
iter.remove();
continue;
}
if (plot.getTrusted().contains(uuid)) {
MainUtil.sendMessage(player, C.ALREADY_ADDED, MainUtil.getName(uuid));
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid));
iter.remove();
continue;
}
@ -60,7 +61,8 @@ import java.util.UUID;
}
checkTrue(!uuids.isEmpty(), null);
checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
Captions.PLOT_MAX_MEMBERS);
// Success
confirm.run(this, () -> {
for (UUID uuid : uuids) {
@ -73,7 +75,7 @@ import java.util.UUID;
}
plot.addTrusted(uuid);
EventUtil.manager.callTrusted(player, plot, uuid, true);
MainUtil.sendMessage(player, C.TRUSTED_ADDED);
MainUtil.sendMessage(player, Captions.TRUSTED_ADDED);
}
}, null);
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -17,22 +17,22 @@ public class Unlink extends SubCommand {
Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs();
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
return !sendMessage(player, Captions.NOT_IN_PLOT);
}
if (!plot.hasOwner()) {
return !sendMessage(player, C.PLOT_UNOWNED);
return !sendMessage(player, Captions.PLOT_UNOWNED);
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_UNLINK)) {
return sendMessage(player, C.NO_PLOT_PERMS);
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_UNLINK)) {
return sendMessage(player, Captions.NO_PLOT_PERMS);
}
if (!plot.isMerged()) {
return sendMessage(player, C.UNLINK_IMPOSSIBLE);
return sendMessage(player, Captions.UNLINK_IMPOSSIBLE);
}
final boolean createRoad;
if (args.length != 0) {
if (args.length != 1 || !StringMan.isEqualIgnoreCaseToAny(args[0], "true", "false")) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
createRoad = Boolean.parseBoolean(args[0]);
@ -45,7 +45,7 @@ public class Unlink extends SubCommand {
MainUtil.sendMessage(player, "&cUnlink has been cancelled");
return;
}
MainUtil.sendMessage(player, C.UNLINK_SUCCESS);
MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS);
}
};
if (hasConfirmation(player)) {

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -39,8 +39,8 @@ import java.util.*;
switch (args.length) {
case 3:
if (!MathMan.isInteger(args[1])) {
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.NOT_VALID_NUMBER.send(player, "(1, ∞)");
Captions.COMMAND_SYNTAX.send(player, getUsage());
return;
}
page = Integer.parseInt(args[2]);
@ -48,13 +48,13 @@ import java.util.*;
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
sortByArea = PlotSquared.get().getPlotAreaByString(args[1]);
if (sortByArea == null) {
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.NOT_VALID_NUMBER.send(player, "(1, ∞)");
Captions.COMMAND_SYNTAX.send(player, getUsage());
return;
}
UUID user = UUIDHandler.getUUIDFromString(args[0]);
if (user == null) {
C.COMMAND_SYNTAX.send(player, getUsage());
Captions.COMMAND_SYNTAX.send(player, getUsage());
return;
}
unsorted = PlotSquared.get().getBasePlots(user);
@ -92,13 +92,13 @@ import java.util.*;
page = 1;
}
if (unsorted == null || unsorted.isEmpty()) {
C.FOUND_NO_PLOTS.send(player);
Captions.FOUND_NO_PLOTS.send(player);
return;
}
unsorted = new ArrayList<>(unsorted);
unsorted.removeIf(plot -> !plot.isBasePlot());
if (page < 1 || page > unsorted.size()) {
C.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")");
Captions.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")");
return;
}
List<Plot> plots;
@ -110,24 +110,24 @@ import java.util.*;
}
final Plot plot = plots.get(page - 1);
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_UNOWNED)) {
C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_UNOWNED);
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_UNOWNED)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_UNOWNED);
return;
}
} else if (plot.isOwner(player.getUUID())) {
if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OWNED) && !Permissions
.hasPermission(player, C.PERMISSION_HOME)) {
C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OWNED);
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OWNED) && !Permissions
.hasPermission(player, Captions.PERMISSION_HOME)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OWNED);
return;
}
} else if (plot.isAdded(player.getUUID())) {
if (!Permissions.hasPermission(player, C.PERMISSION_SHARED)) {
C.NO_PERMISSION.send(player, C.PERMISSION_SHARED);
if (!Permissions.hasPermission(player, Captions.PERMISSION_SHARED)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_SHARED);
return;
}
} else {
if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OTHER)) {
C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OTHER);
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OTHER)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OTHER);
return;
}
}

View File

@ -13,7 +13,7 @@ import java.util.*;
/**
* Captions class.
*/
public enum C {
public enum Captions {
/*
* Static flags
@ -896,7 +896,7 @@ public enum C {
* @param def default
* @param prefix use prefix
*/
C(String def, boolean prefix, String category) {
Captions(String def, boolean prefix, String category) {
this.def = def;
this.s = def;
this.prefix = prefix;
@ -908,7 +908,7 @@ public enum C {
*
* @param def default
*/
C(String def, String category) {
Captions(String def, String category) {
this(def, true, category.toLowerCase());
}
@ -923,7 +923,7 @@ public enum C {
if (arg == null || arg.isEmpty()) {
map.put("%s" + i, "");
} else {
arg = C.color(arg);
arg = Captions.color(arg);
map.put("%s" + i, arg);
}
if (i == 0) {
@ -935,9 +935,9 @@ public enum C {
return m;
}
public static String format(C caption, Object... args) {
public static String format(Captions caption, Object... args) {
if (caption.usePrefix() && caption.s.length() > 0) {
return C.PREFIX.s() + format(caption.s, args);
return Captions.PREFIX.s() + format(caption.s, args);
} else {
return format(caption.s, args);
}
@ -955,15 +955,15 @@ public enum C {
}
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
Set<String> keys = yml.getKeys(true);
EnumSet<C> allEnums = EnumSet.allOf(C.class);
EnumSet<Captions> allEnums = EnumSet.allOf(Captions.class);
HashSet<String> allNames = new HashSet<>();
HashSet<String> categories = new HashSet<>();
HashSet<String> toRemove = new HashSet<>();
for (C caption : allEnums) {
for (Captions caption : allEnums) {
allNames.add(caption.name());
categories.add(caption.category.toLowerCase());
}
HashSet<C> captions = new HashSet<>();
HashSet<Captions> captions = new HashSet<>();
boolean changed = false;
for (String key : keys) {
if (!yml.isString(key)) {
@ -974,7 +974,7 @@ public enum C {
}
String[] split = key.split("\\.");
String node = split[split.length - 1].toUpperCase();
C caption;
Captions caption;
if (allNames.contains(node)) {
caption = valueOf(node);
} else {
@ -1013,7 +1013,7 @@ public enum C {
replacements.put("\\\\n", "\n");
replacements.put("\\n", "\n");
replacements.put("&-", "\n");
for (C caption : allEnums) {
for (Captions caption : allEnums) {
if (!captions.contains(caption)) {
if (caption.getCategory().startsWith("static")) {
continue;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
@ -214,7 +214,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}*/
}
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
PlotSquared.debug(C.PREFIX + "&3 - schematic: &7false");
PlotSquared.debug(Captions.PREFIX + "&3 - schematic: &7false");
return;
}
this.ROAD_SCHEMATIC_ENABLED = true;

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.listener.WEExtent;
@ -153,7 +153,7 @@ public abstract class HybridUtils {
}
if (regions.isEmpty() && chunks.isEmpty()) {
HybridUtils.UPDATE = false;
PlotSquared.debug(C.PREFIX.s() + "Finished road conversion");
PlotSquared.debug(Captions.PREFIX.s() + "Finished road conversion");
// CANCEL TASK
} else {
final Runnable task = this;

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.listener;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
@ -52,7 +52,7 @@ public class PlotListener {
Optional<String> greetingFlag = plot.getFlag(Flags.GREETING);
if (greetingFlag.isPresent()) {
greeting = greetingFlag.get();
MainUtil.format(C.PREFIX_GREETING.s() + greeting, plot, player, false,
MainUtil.format(Captions.PREFIX_GREETING.s() + greeting, plot, player, false,
new RunnableVal<String>() {
@Override public void run(String value) {
MainUtil.sendMessage(player, value);
@ -68,7 +68,7 @@ public class PlotListener {
PlotPlayer owner = UUIDHandler.getPlayer(uuid);
if (owner != null && !owner.getUUID().equals(player.getUUID())) {
MainUtil.sendMessage(owner,
C.NOTIFY_ENTER.s().replace("%player", player.getName())
Captions.NOTIFY_ENTER.s().replace("%player", player.getName())
.replace("%plot", plot.getId().toString()));
}
}
@ -94,7 +94,8 @@ public class PlotListener {
player.setGameMode(gamemodeFlag.get());
} else {
MainUtil.sendMessage(player, StringMan
.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.getId(),
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}",
plot.getId(),
"{gamemode}", gamemodeFlag.get()));
}
}
@ -107,7 +108,8 @@ public class PlotListener {
player.setGameMode(guestGamemodeFlag.get());
} else {
MainUtil.sendMessage(player, StringMan
.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.getId(),
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}",
plot.getId(),
"{gamemode}", guestGamemodeFlag.get()));
}
}
@ -155,7 +157,8 @@ public class PlotListener {
CommentManager.sendTitle(player, plot);
}
if (titles) {
if (!C.TITLE_ENTERED_PLOT.s().isEmpty() || !C.TITLE_ENTERED_PLOT_SUB.s()
if (!Captions.TITLE_ENTERED_PLOT.s().isEmpty() || !Captions.TITLE_ENTERED_PLOT_SUB
.s()
.isEmpty()) {
TaskManager.runTaskLaterAsync(() -> {
Plot lastPlot = player.getMeta(PlotPlayer.META_LAST_PLOT);
@ -167,10 +170,10 @@ public class PlotListener {
replacements.put("%greeting%", greeting);
replacements.put("%alias", plot.toString());
replacements.put("%s", MainUtil.getName(plot.owner));
String main =
StringMan.replaceFromMap(C.TITLE_ENTERED_PLOT.s(), replacements);
String main = StringMan
.replaceFromMap(Captions.TITLE_ENTERED_PLOT.s(), replacements);
String sub = StringMan
.replaceFromMap(C.TITLE_ENTERED_PLOT_SUB.s(), replacements);
.replaceFromMap(Captions.TITLE_ENTERED_PLOT_SUB.s(), replacements);
AbstractTitle.sendTitle(player, main, sub);
}
}, 20);
@ -202,14 +205,16 @@ public class PlotListener {
player.setGameMode(pw.GAMEMODE);
} else {
MainUtil.sendMessage(player, StringMan
.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.toString(),
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}",
plot.toString(),
"{gamemode}", pw.GAMEMODE.name().toLowerCase()));
}
}
}
Optional<String> farewell = plot.getFlag(Flags.FAREWELL);
farewell.ifPresent(s -> MainUtil
.format(C.PREFIX_FAREWELL.s() + s, plot, player, false, new RunnableVal<String>() {
.format(Captions.PREFIX_FAREWELL.s() + s, plot, player, false,
new RunnableVal<String>() {
@Override public void run(String value) {
MainUtil.sendMessage(player, value);
}
@ -221,7 +226,7 @@ public class PlotListener {
PlotPlayer owner = UUIDHandler.getPlayer(uuid);
if ((owner != null) && !owner.getUUID().equals(player.getUUID())) {
MainUtil.sendMessage(owner,
C.NOTIFY_LEAVE.s().replace("%player", player.getName())
Captions.NOTIFY_LEAVE.s().replace("%player", player.getName())
.replace("%plot", plot.getId().toString()));
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.listener;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
import com.sk89q.worldedit.WorldEditException;
@ -107,7 +107,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
this.BSblocked = true;
PlotSquared.debug(
C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getX() + ","
Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getX() + ","
+ location.getZ());
}
if (WEManager
@ -162,7 +162,8 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
this.Eblocked = true;
PlotSquared.debug(
C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location
Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + ","
+ location
.getBlockZ());
}
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.listener;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -54,7 +54,7 @@ public class WESubscriber {
mask = WEManager.getMask(pp);
if (mask.isEmpty()) {
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
MainUtil.sendMessage(pp, Captions.WORLDEDIT_BYPASS);
}
if (PlotSquared.get().hasPlotArea(world)) {
event.setExtent(new NullExtent());

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.google.common.collect.ImmutableMap;
import lombok.EqualsAndHashCode;
@ -159,7 +159,7 @@ import java.util.Map.Entry;
}
}
} else if (!unassigned.isEmpty()) {
C.BUCKET_ENTRIES_IGNORED.send(ConsolePlayer.getConsole());
Captions.BUCKET_ENTRIES_IGNORED.send(ConsolePlayer.getConsole());
}
//
// If the sum adds up to more than 100, divide all values

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -967,10 +967,14 @@ public class Plot {
if (this.area.ALLOW_SIGNS) {
Location loc = manager.getSignLoc(this.area, this);
String id = this.id.x + ";" + this.id.y;
String[] lines = new String[] {C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", name)};
String[] lines =
new String[] {Captions.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
Captions.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll(
"%plr%", name),
Captions.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll(
"%plr%", name),
Captions.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll(
"%plr%", name)};
WorldUtil.IMP.setSign(this.getWorldName(), loc.getX(), loc.getY(), loc.getZ(), lines);
}
}
@ -1428,7 +1432,7 @@ public class Plot {
area.addPlot(this);
}
setSign(player.getName());
MainUtil.sendMessage(player, C.CLAIMED);
MainUtil.sendMessage(player, Captions.CLAIMED);
if (teleport) {
teleportPlayer(player);
}
@ -1452,9 +1456,9 @@ public class Plot {
new RunnableVal<Boolean>() {
@Override public void run(Boolean value) {
if (value) {
MainUtil.sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS);
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS);
} else {
MainUtil.sendMessage(player, C.SCHEMATIC_PASTE_FAILED);
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED);
}
}
});
@ -2093,7 +2097,7 @@ public class Plot {
}
loop:
for (int i = 4; i > 0; i--) {
String caption = C.valueOf("OWNER_SIGN_LINE_" + i).s();
String caption = Captions.valueOf("OWNER_SIGN_LINE_" + i).s();
int index = caption.indexOf("%plr%");
if (index < 0) {
continue;
@ -2681,21 +2685,22 @@ public class Plot {
}
if (Settings.Teleport.DELAY == 0 || Permissions
.hasPermission(player, "plots.teleport.delay.bypass")) {
MainUtil.sendMessage(player, C.TELEPORTED_TO_PLOT);
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
player.teleport(location);
return true;
}
MainUtil.sendMessage(player, C.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + "");
MainUtil
.sendMessage(player, Captions.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + "");
final String name = player.getName();
TaskManager.TELEPORT_QUEUE.add(name);
TaskManager.runTaskLater(() -> {
if (!TaskManager.TELEPORT_QUEUE.contains(name)) {
MainUtil.sendMessage(player, C.TELEPORT_FAILED);
MainUtil.sendMessage(player, Captions.TELEPORT_FAILED);
return;
}
TaskManager.TELEPORT_QUEUE.remove(name);
if (player.isOnline()) {
MainUtil.sendMessage(player, C.TELEPORTED_TO_PLOT);
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
player.teleport(location);
}
}, Settings.Teleport.DELAY * 20);

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager;
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
@ -59,7 +59,7 @@ public class PlotMessage {
}
public PlotMessage color(String color) {
ChatManager.manager.color(this, C.color(color));
ChatManager.manager.color(this, Captions.color(color));
return this;
}

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
@ -166,15 +166,15 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
public int hasPermissionRange(String stub, int range) {
if (hasPermission(C.PERMISSION_ADMIN.s())) {
if (hasPermission(Captions.PERMISSION_ADMIN.s())) {
return Integer.MAX_VALUE;
}
String[] nodes = stub.split("\\.");
StringBuilder builder = new StringBuilder();
for (int i = 0; i < (nodes.length - 1); i++) {
builder.append(nodes[i]).append(".");
if (!stub.equals(builder + C.PERMISSION_STAR.s())) {
if (hasPermission(builder + C.PERMISSION_STAR.s())) {
if (!stub.equals(builder + Captions.PERMISSION_STAR.s())) {
if (hasPermission(builder + Captions.PERMISSION_STAR.s())) {
return Integer.MAX_VALUE;
}
}
@ -563,7 +563,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
TaskManager.runTask(() -> {
if (getMeta("teleportOnLogin", true)) {
teleport(loc);
sendMessage(C.TELEPORTED_TO_PLOT.f()
sendMessage(
Captions.TELEPORTED_TO_PLOT.f()
+ " (quitLoc) (" + plotX + ","
+ plotZ + ")");
}
@ -577,7 +578,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
true)) {
teleport(loc);
sendMessage(
C.TELEPORTED_TO_PLOT.f()
Captions.TELEPORTED_TO_PLOT
.f()
+ " (quitLoc-unloaded) ("
+ plotX + "," + plotZ
+ ")");

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object.chat;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
@ -26,7 +26,7 @@ public class PlainChatManager extends ChatManager<List<StringBuilder>> {
}
@Override public void text(PlotMessage message, String text) {
message.$(this).add(new StringBuilder(C.color(text)));
message.$(this).add(new StringBuilder(Captions.color(text)));
}
@Override public void send(PlotMessage plotMessage, PlotPlayer player) {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object.worlds;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -48,7 +48,7 @@ public class SinglePlot extends Plot {
if (isLoaded()) {
return super.teleportPlayer(player);
} else {
C.NOT_LOADED.send(player);
Captions.NOT_LOADED.send(player);
return false;
}
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.CmdInstance;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -18,7 +18,7 @@ public class CmdConfirm {
final Runnable runnable) {
removePending(player);
if (commandStr != null) {
MainUtil.sendMessage(player, C.REQUIRES_CONFIRM, commandStr);
MainUtil.sendMessage(player, Captions.REQUIRES_CONFIRM, commandStr);
}
TaskManager.runTaskLater(new Runnable() {
@Override public void run() {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -41,7 +41,7 @@ public class CommentManager {
}
if ((size.decrementAndGet() == 0) && (total > 0)) {
AbstractTitle.sendTitle(player, "",
C.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total));
Captions.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total));
}
}
});

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
@ -71,7 +71,7 @@ public abstract class EventUtil {
}
if (PlotSquared.get().worldedit != null) {
if (player.getAttribute("worldedit")) {
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASSED);
MainUtil.sendMessage(player, Captions.WORLDEDIT_BYPASSED);
}
}
final Plot plot = player.getCurrentPlot();
@ -82,7 +82,7 @@ public abstract class EventUtil {
}
});
MainUtil.sendMessage(player,
C.TELEPORTED_TO_ROAD.f() + " (on-login) " + "(" + plot.getId().x + ";" + plot
Captions.TELEPORTED_TO_ROAD.f() + " (on-login) " + "(" + plot.getId().x + ";" + plot
.getId().y + ")");
}
}
@ -91,7 +91,7 @@ public abstract class EventUtil {
final Plot plot = player.getCurrentPlot();
if (Settings.Teleport.ON_DEATH && plot != null) {
TaskManager.runTask(() -> plot.teleportPlayer(player));
MainUtil.sendMessage(player, C.TELEPORTED_TO_ROAD);
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_ROAD);
}
}
@ -120,11 +120,12 @@ public abstract class EventUtil {
case BREAK_BLOCK:
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
}
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
@ -144,69 +145,80 @@ public abstract class EventUtil {
}
}
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
return true;
}
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
C.FLAG_USE.s() + '/' + C.FLAG_BREAK.s()));
return !(!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_USE.s() + '/' + Captions.FLAG_BREAK.s()));
case BREAK_HANGING:
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (plot.getFlag(Flags.HANGING_BREAK).orElse(false)) {
return true;
}
if (plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(
!notifyPerms || MainUtil
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_HANGING_BREAK.s()));
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)
|| !(
!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_HANGING_BREAK.s()));
}
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
case BREAK_MISC:
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (plot.getFlag(Flags.MISC_BREAK).orElse(false)) {
return true;
}
if (plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(
!notifyPerms || MainUtil
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_BREAK.s()));
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)
|| !(
!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_MISC_BREAK.s()));
}
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
case BREAK_VEHICLE:
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (plot.getFlag(Flags.VEHICLE_BREAK).orElse(false)) {
return true;
}
if (plot.hasOwner()) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
false)) {
return true;
}
return !(!notifyPerms || MainUtil
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_BREAK.s()));
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_VEHICLE_BREAK.s()));
}
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
case INTERACT_BLOCK: {
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
}
Optional<HashSet<PlotBlock>> flagValue = plot.getFlag(Flags.USE);
@ -214,42 +226,47 @@ public abstract class EventUtil {
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(
!notifyPerms || MainUtil
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s()));
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)
|| !(
!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_USE.s()));
}
return true;
}
case PLACE_BLOCK: {
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_BUILD_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_BUILD_UNOWNED.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_UNOWNED.s(),
notifyPerms);
}
Optional<HashSet<PlotBlock>> flagValue = plot.getFlag(Flags.PLACE);
HashSet<PlotBlock> value = flagValue.orElse(null);
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_BUILD_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_OTHER.s(), false)) {
return true;
}
return !(!notifyPerms || MainUtil
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_PLACE.s()));
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_PLACE.s()));
}
return true;
}
case TRIGGER_PHYSICAL: {
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), false);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), false);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), false);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
false);
}
if (plot.getFlag(Flags.DEVICE_INTERACT).orElse(false)) {
return true;
@ -259,7 +276,8 @@ public abstract class EventUtil {
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
false)) {
return true;
}
return false;
@ -269,11 +287,12 @@ public abstract class EventUtil {
case INTERACT_HANGING: {
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
}
if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) {
@ -284,22 +303,25 @@ public abstract class EventUtil {
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
false)) {
return true;
}
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
C.FLAG_USE.s() + '/' + C.FLAG_HANGING_INTERACT.s()));
return !(!notifyPerms || MainUtil
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_USE.s() + '/' + Captions.FLAG_HANGING_INTERACT.s()));
}
return true;
}
case INTERACT_MISC: {
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
}
if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) {
@ -310,22 +332,25 @@ public abstract class EventUtil {
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
false)) {
return true;
}
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
C.FLAG_USE.s() + '/' + C.FLAG_MISC_INTERACT.s()));
return !(!notifyPerms || MainUtil
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_USE.s() + '/' + Captions.FLAG_MISC_INTERACT.s()));
}
return true;
}
case INTERACT_VEHICLE: {
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
}
if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) {
@ -336,22 +361,25 @@ public abstract class EventUtil {
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
false)) {
return true;
}
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
C.FLAG_USE.s() + '/' + C.FLAG_VEHICLE_USE.s()));
return !(!notifyPerms || MainUtil
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_USE.s() + '/' + Captions.FLAG_VEHICLE_USE.s()));
}
return true;
}
case SPAWN_MOB: {
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
}
if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) {
@ -362,11 +390,13 @@ public abstract class EventUtil {
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
false)) {
return true;
}
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
C.FLAG_MOB_PLACE.s() + '/' + C.FLAG_PLACE.s()));
return !(!notifyPerms || MainUtil
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_MOB_PLACE.s() + '/' + Captions.FLAG_PLACE.s()));
}
return true;
}
@ -375,11 +405,12 @@ public abstract class EventUtil {
case PLACE_MISC: {
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
}
if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) {
@ -390,11 +421,13 @@ public abstract class EventUtil {
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
false)) {
return true;
}
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
C.FLAG_MISC_PLACE.s() + '/' + C.FLAG_PLACE.s()));
return !(!notifyPerms || MainUtil
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_MISC_PLACE.s() + '/' + Captions.FLAG_PLACE.s()));
}
return true;
@ -402,11 +435,12 @@ public abstract class EventUtil {
case PLACE_VEHICLE:
if (plot == null) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
notifyPerms);
}
if (!plot.hasOwner()) {
return Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
notifyPerms);
}
if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) {
@ -417,11 +451,13 @@ public abstract class EventUtil {
if (value == null || !PlotBlock.containsEverything(value) && !value
.contains(block.getPlotBlock())) {
if (Permissions
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
false)) {
return true;
}
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
C.FLAG_VEHICLE_PLACE.s() + '/' + C.FLAG_PLACE.s()));
return !(!notifyPerms || MainUtil
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
Captions.FLAG_VEHICLE_PLACE.s() + '/' + Captions.FLAG_PLACE.s()));
}
return true;
default:

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import lombok.NonNull;
@ -84,7 +84,7 @@ import java.util.Map;
@NonNull final String key, @NonNull final String block) {
final BlockBucket bucket = this.blockToBucket(block);
this.setString(section, key, bucket);
PlotSquared.log(C.LEGACY_CONFIG_REPLACED.f(block, bucket.toString()));
PlotSquared.log(Captions.LEGACY_CONFIG_REPLACED.f(block, bucket.toString()));
}
private void convertBlockList(@NonNull final ConfigurationSection section,
@ -92,8 +92,8 @@ import java.util.Map;
final PlotBlock[] blocks = this.splitBlockList(blockList);
final BlockBucket bucket = this.blockListToBucket(blocks);
this.setString(section, key, bucket);
PlotSquared
.log(C.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString()));
PlotSquared.log(
Captions.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString()));
}
private String plotBlockArrayString(@NonNull final PlotBlock[] blocks) {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.DoubleFlag;
@ -86,8 +86,8 @@ public class MainUtil {
public static void sendAdmin(final String s) {
for (final PlotPlayer player : UUIDHandler.getPlayers().values()) {
if (player.hasPermission(C.PERMISSION_ADMIN.s())) {
player.sendMessage(C.color(s));
if (player.hasPermission(Captions.PERMISSION_ADMIN.s())) {
player.sendMessage(Captions.color(s));
}
}
PlotSquared.debug(s);
@ -329,14 +329,14 @@ public class MainUtil {
*/
@Nonnull public static String getName(UUID owner) {
if (owner == null) {
return C.NONE.s();
return Captions.NONE.s();
}
if (owner.equals(DBFunc.EVERYONE)) {
return C.EVERYONE.s();
return Captions.EVERYONE.s();
}
String name = UUIDHandler.getName(owner);
if (name == null) {
return C.UNKNOWN.s();
return Captions.UNKNOWN.s();
}
return name;
}
@ -457,7 +457,7 @@ public class MainUtil {
if (arg == null) {
if (player == null) {
if (message) {
PlotSquared.log(C.NOT_VALID_PLOT_WORLD);
PlotSquared.log(Captions.NOT_VALID_PLOT_WORLD);
}
return null;
}
@ -496,13 +496,13 @@ public class MainUtil {
}
}
if (message) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
}
return null;
}
if (area == null) {
if (message) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
}
return null;
}
@ -564,7 +564,7 @@ public class MainUtil {
* @param caption
* @param args
*/
public static void sendConsoleMessage(C caption, String... args) {
public static void sendConsoleMessage(Captions caption, String... args) {
sendMessage(null, caption, args);
}
@ -579,10 +579,10 @@ public class MainUtil {
public static boolean sendMessage(PlotPlayer player, String msg, boolean prefix) {
if (!msg.isEmpty()) {
if (player == null) {
String message = (prefix ? C.PREFIX.s() : "") + msg;
String message = (prefix ? Captions.PREFIX.s() : "") + msg;
PlotSquared.log(message);
} else {
player.sendMessage((prefix ? C.PREFIX.s() : "") + C.color(msg));
player.sendMessage((prefix ? Captions.PREFIX.s() : "") + Captions.color(msg));
}
}
return true;
@ -595,7 +595,7 @@ public class MainUtil {
* @param caption the message to send
* @return boolean success
*/
public static boolean sendMessage(PlotPlayer player, C caption, String... args) {
public static boolean sendMessage(PlotPlayer player, Captions caption, String... args) {
return sendMessage(player, caption, (Object[]) args);
}
@ -606,14 +606,14 @@ public class MainUtil {
* @param caption the message to send
* @return boolean success
*/
public static boolean sendMessage(final PlotPlayer player, final C caption,
public static boolean sendMessage(final PlotPlayer player, final Captions caption,
final Object... args) {
if (caption.s().isEmpty()) {
return true;
}
TaskManager.runTaskAsync(new Runnable() {
@Override public void run() {
String m = C.format(caption, args);
String m = Captions.format(caption, args);
if (player == null) {
PlotSquared.log(m);
} else {
@ -706,7 +706,7 @@ public class MainUtil {
public static void format(String info, final Plot plot, PlotPlayer player, final boolean full,
final RunnableVal<String> whenDone) {
int num = plot.getConnectedPlots().size();
String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : C.NONE.s();
String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : Captions.NONE.s();
Location bot = plot.getCorners()[0];
String biome = WorldUtil.IMP.getBiome(plot.getWorldName(), bot.getX(), bot.getZ());
String trusted = getPlayerList(plot.getTrusted());
@ -715,28 +715,27 @@ public class MainUtil {
String seen;
if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
if (plot.isOnline()) {
seen = C.NOW.s();
seen = Captions.NOW.s();
} else {
int time = (int) (ExpireManager.IMP.getAge(plot) / 1000);
if (time != 0) {
seen = MainUtil.secToTime(time);
} else {
seen = C.UNKNOWN.s();
seen = Captions.UNKNOWN.s();
}
}
} else {
seen = C.NEVER.s();
seen = Captions.NEVER.s();
}
Optional<String> descriptionFlag = plot.getFlag(Flags.DESCRIPTION);
String description = !descriptionFlag.isPresent() ?
C.NONE.s() :
String description = !descriptionFlag.isPresent() ? Captions.NONE.s() :
Flags.DESCRIPTION.valueToString(descriptionFlag.get());
StringBuilder flags = new StringBuilder();
HashMap<Flag<?>, Object> flagMap =
FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true);
if (flagMap.isEmpty()) {
flags.append(C.NONE.s());
flags.append(Captions.NONE.s());
} else {
String prefix = "";
for (Entry<Flag<?>, Object> entry : flagMap.entrySet()) {
@ -746,7 +745,8 @@ public class MainUtil {
df.setMaximumFractionDigits(340);
value = df.format(value);
}
flags.append(prefix).append(C.PLOT_FLAG_LIST.f(entry.getKey().getName(), value));
flags.append(prefix)
.append(Captions.PLOT_FLAG_LIST.f(entry.getKey().getName(), value));
prefix = ", ";
}
}
@ -815,7 +815,7 @@ public class MainUtil {
/**
* Get a list of names given a list of uuids.<br>
* - Uses the format {@link C#PLOT_USER_LIST} for the returned string
* - Uses the format {@link Captions#PLOT_USER_LIST} for the returned string
*
* @param uuids
* @return
@ -823,11 +823,11 @@ public class MainUtil {
public static String getPlayerList(Collection<UUID> uuids) {
ArrayList<UUID> l = new ArrayList<>(uuids);
if (l.size() < 1) {
return C.NONE.s();
return Captions.NONE.s();
}
List<String> users =
l.stream().map(MainUtil::getName).sorted().collect(Collectors.toList());
String c = C.PLOT_USER_LIST.s();
String c = Captions.PLOT_USER_LIST.s();
StringBuilder list = new StringBuilder();
for (int x = 0; x < users.size(); x++) {
if (x + 1 == l.size()) {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -14,18 +14,18 @@ import java.util.HashMap;
*/
public class Permissions {
public static boolean hasPermission(PlotPlayer player, C caption, boolean notify) {
public static boolean hasPermission(PlotPlayer player, Captions caption, boolean notify) {
return hasPermission(player, caption.s(), notify);
}
/**
* Check if a player has a permission (C class helps keep track of permissions).
* Check if a player has a permission (Captions class helps keep track of permissions).
*
* @param player
* @param caption
* @return
*/
public static boolean hasPermission(PlotPlayer player, C caption) {
public static boolean hasPermission(PlotPlayer player, Captions caption) {
return hasPermission(player, caption.s());
}
@ -68,7 +68,7 @@ public class Permissions {
} else if (caller.isPermissionSet(permission)) {
return false;
}
if (caller.hasPermission(C.PERMISSION_ADMIN.s())) {
if (caller.hasPermission(Captions.PERMISSION_ADMIN.s())) {
return true;
}
permission = permission.toLowerCase().replaceAll("^[^a-z|0-9|\\.|_|-]", "");
@ -76,7 +76,7 @@ public class Permissions {
StringBuilder n = new StringBuilder();
for (int i = 0; i <= (nodes.length - 1); i++) {
n.append(nodes[i] + ".");
String combined = n + C.PERMISSION_STAR.s();
String combined = n + Captions.PERMISSION_STAR.s();
if (!permission.equals(combined)) {
if (caller.hasPermission(combined)) {
return true;
@ -99,14 +99,14 @@ public class Permissions {
public static boolean hasPermission(PlotPlayer player, String permission, boolean notify) {
if (!hasPermission(player, permission)) {
if (notify) {
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT, permission);
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT, permission);
}
return false;
}
return true;
}
public static int hasPermissionRange(PlotPlayer player, C perm, int range) {
public static int hasPermissionRange(PlotPlayer player, Captions perm, int range) {
return hasPermissionRange(player, perm.s(), range);
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -81,7 +81,8 @@ public abstract class UUIDHandlerImplementation {
}
this.uuidMap.put(name, uuid);
}
PlotSquared.debug(C.PREFIX + "&6Cached a total of: " + this.uuidMap.size() + " UUIDs");
PlotSquared
.debug(Captions.PREFIX + "&6Cached a total of: " + this.uuidMap.size() + " UUIDs");
}
public boolean add(final StringWrapper name, final UUID uuid) {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.util.expiry;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
@ -351,13 +351,13 @@ public class ExpireManager {
for (UUID helper : plot.getTrusted()) {
PlotPlayer player = UUIDHandler.getPlayer(helper);
if (player != null) {
MainUtil.sendMessage(player, C.PLOT_REMOVED_USER, plot.toString());
MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString());
}
}
for (UUID helper : plot.getMembers()) {
PlotPlayer player = UUIDHandler.getPlayer(helper);
if (player != null) {
MainUtil.sendMessage(player, C.PLOT_REMOVED_USER, plot.toString());
MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString());
}
}
Set<Plot> plots = plot.getConnectedPlots();

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
public class HelpObject {
@ -10,7 +10,7 @@ public class HelpObject {
private final String _rendered;
public HelpObject(final Command command, final String label) {
_rendered = StringMan.replaceAll(C.HELP_ITEM.s(), "%usage%",
_rendered = StringMan.replaceAll(Captions.HELP_ITEM.s(), "%usage%",
command.getUsage().replaceAll("\\{label\\}", label), "[%alias%]",
!command.getAliases().isEmpty() ?
"(" + StringMan.join(command.getAliases(), "|") + ")" :

Some files were not shown because too many files have changed in this diff Show More