mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Doc Updates, Renaming, Reformatting, and a Test
Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
parent
bfc6b62213
commit
25530ed7f0
@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.bukkit.uuid.*;
|
|||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
|
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
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) {
|
if (Settings.Enabled_Components.METRICS) {
|
||||||
this.startMetrics();
|
this.startMetrics();
|
||||||
} else {
|
} else {
|
||||||
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
PlotSquared.log(Captions.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
||||||
}
|
}
|
||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
TaskManager.IMP.taskRepeat(this::unload, 20);
|
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) {
|
@Override public void log(@NonNull String message) {
|
||||||
try {
|
try {
|
||||||
message = C.color(message);
|
message = Captions.color(message);
|
||||||
if (!Settings.Chat.CONSOLE_COLOR) {
|
if (!Settings.Chat.CONSOLE_COLOR) {
|
||||||
message = ChatColor.stripColor(message);
|
message = ChatColor.stripColor(message);
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
||||||
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
|
PlotSquared.log(Captions.PREFIX + "KillAllEntities started.");
|
||||||
TaskManager.runTaskRepeat(() -> PlotSquared.get().forEachPlotArea(plotArea -> {
|
TaskManager.runTaskRepeat(() -> PlotSquared.get().forEachPlotArea(plotArea -> {
|
||||||
final World world = Bukkit.getWorld(plotArea.worldname);
|
final World world = Bukkit.getWorld(plotArea.worldname);
|
||||||
try {
|
try {
|
||||||
@ -621,55 +621,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
return new BukkitSetupUtils();
|
return new BukkitSetupUtils();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public UUIDHandlerImplementation initUUIDHandler() {
|
@Override public void startMetrics() {
|
||||||
boolean checkVersion = false;
|
if (this.metricsStarted) {
|
||||||
try {
|
return;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
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() {
|
@Override public ChunkManager initChunkManager() {
|
||||||
@ -700,15 +660,55 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
return new BukkitInventoryUtil();
|
return new BukkitInventoryUtil();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void startMetrics() {
|
@Override public UUIDHandlerImplementation initUUIDHandler() {
|
||||||
if (this.metricsStarted) {
|
boolean checkVersion = false;
|
||||||
return;
|
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) {
|
@Override public void setGenerator(@NonNull final String worldName) {
|
||||||
|
@ -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.CommandCategory;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.SubCommand;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -55,14 +55,15 @@ import java.util.Map.Entry;
|
|||||||
Class<?> clazz = Class.forName(args[0]);
|
Class<?> clazz = Class.forName(args[0]);
|
||||||
newWrapper = (UUIDWrapper) clazz.newInstance();
|
newWrapper = (UUIDWrapper) clazz.newInstance();
|
||||||
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) {
|
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot uuidconvert <lower|offline|online>");
|
"/plot uuidconvert <lower|offline|online>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length != 2 || !"-o".equals(args[1])) {
|
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, "&cBe aware of the following!");
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"&8 - &cUse the database command or another method to backup your plots beforehand");
|
"&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);
|
UUID uuid = UUID.fromString(s);
|
||||||
uuids.add(uuid);
|
uuids.add(uuid);
|
||||||
} catch (Exception ignored) {
|
} 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) {
|
} catch (Throwable ignored) {
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
Captions.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -227,8 +227,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
|||||||
if (!chunk.isLoaded()) {
|
if (!chunk.isLoaded()) {
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(currentIndex);
|
TaskManager.tasks.remove(currentIndex);
|
||||||
PlotSquared
|
PlotSquared.debug(
|
||||||
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||||
chunk.unload(true, true);
|
chunk.unload(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -236,8 +236,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
|||||||
if (tiles.length == 0) {
|
if (tiles.length == 0) {
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(currentIndex);
|
TaskManager.tasks.remove(currentIndex);
|
||||||
PlotSquared
|
PlotSquared.debug(
|
||||||
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||||
chunk.unload(true, true);
|
chunk.unload(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -247,8 +247,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
|||||||
if (i >= tiles.length) {
|
if (i >= tiles.length) {
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(currentIndex);
|
TaskManager.tasks.remove(currentIndex);
|
||||||
PlotSquared
|
PlotSquared.debug(
|
||||||
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||||
chunk.unload(true, true);
|
chunk.unload(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -273,13 +273,15 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotSquared.debug(
|
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));
|
+ "," + (chunk.getX() << 4));
|
||||||
}
|
}
|
||||||
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
||||||
if (unload) {
|
if (unload) {
|
||||||
PlotSquared.debug(
|
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));
|
chunk.getX() << 4));
|
||||||
cleanChunk(chunk);
|
cleanChunk(chunk);
|
||||||
return true;
|
return true;
|
||||||
|
@ -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.object.BukkitPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
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.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -85,7 +85,8 @@ import java.util.UUID;
|
|||||||
if (plot.isAdded(uuid)) {
|
if (plot.isAdded(uuid)) {
|
||||||
Set<PlotPlayer> players = getNearbyPlayers(player, plot);
|
Set<PlotPlayer> players = getNearbyPlayers(player, plot);
|
||||||
for (PlotPlayer oPlayer : players) {
|
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
|
((BukkitPlayer) oPlayer).player
|
||||||
.setVelocity(calculateVelocity(plotPlayer, oPlayer));
|
.setVelocity(calculateVelocity(plotPlayer, oPlayer));
|
||||||
}
|
}
|
||||||
@ -95,7 +96,8 @@ import java.util.UUID;
|
|||||||
if (oPlayer == null) {
|
if (oPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
|
if (!Permissions
|
||||||
|
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
|
||||||
player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
|
player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.object.BukkitPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType;
|
import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType;
|
||||||
@ -453,14 +453,14 @@ import java.util.regex.Pattern;
|
|||||||
if (shooter instanceof Player) {
|
if (shooter instanceof Player) {
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_PROJECTILE_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_PROJECTILE_UNOWNED)) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
if (plot.isAdded(pp.getUUID()) || Permissions
|
||||||
.hasPermission(pp, C.PERMISSION_PROJECTILE_OTHER)) {
|
.hasPermission(pp, Captions.PERMISSION_PROJECTILE_OTHER)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
entity.remove();
|
entity.remove();
|
||||||
@ -508,7 +508,7 @@ import java.util.regex.Pattern;
|
|||||||
case "worldedit:up":
|
case "worldedit:up":
|
||||||
case "worldedit:/up":
|
case "worldedit:/up":
|
||||||
if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions
|
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);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -519,7 +519,7 @@ import java.util.regex.Pattern;
|
|||||||
}
|
}
|
||||||
Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS);
|
Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS);
|
||||||
if (flag.isPresent() && !Permissions
|
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();
|
List<String> blocked_cmds = flag.get();
|
||||||
String part = parts[0];
|
String part = parts[0];
|
||||||
if (parts[0].contains(":")) {
|
if (parts[0].contains(":")) {
|
||||||
@ -569,7 +569,7 @@ import java.util.regex.Pattern;
|
|||||||
perm = "plots.admin.command.blocked-cmds.other";
|
perm = "plots.admin.command.blocked-cmds.other";
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, perm)) {
|
if (!Permissions.hasPermission(pp, perm)) {
|
||||||
MainUtil.sendMessage(pp, C.COMMAND_BLOCKED);
|
MainUtil.sendMessage(pp, Captions.COMMAND_BLOCKED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -637,8 +637,8 @@ import java.util.regex.Pattern;
|
|||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot);
|
final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_ENTRY_DENIED);
|
Captions.PERMISSION_ADMIN_ENTRY_DENIED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (lastLoc != null) {
|
if (lastLoc != null) {
|
||||||
pp.setMeta(PlotPlayer.META_LOCATION, lastLoc);
|
pp.setMeta(PlotPlayer.META_LOCATION, lastLoc);
|
||||||
@ -760,7 +760,8 @@ import java.util.regex.Pattern;
|
|||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
|
||||||
.getMeta("kick", false)) {
|
.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;
|
this.tmpTeleport = false;
|
||||||
if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) {
|
if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) {
|
||||||
player.teleport(from);
|
player.teleport(from);
|
||||||
@ -774,7 +775,8 @@ import java.util.regex.Pattern;
|
|||||||
} else if (now.equals(lastPlot)) {
|
} else if (now.equals(lastPlot)) {
|
||||||
ForceFieldListener.handleForcefield(player, pp, now);
|
ForceFieldListener.handleForcefield(player, pp, now);
|
||||||
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
|
} 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;
|
this.tmpTeleport = false;
|
||||||
to.setX(from.getBlockX());
|
to.setX(from.getBlockX());
|
||||||
to.setY(from.getBlockY());
|
to.setY(from.getBlockY());
|
||||||
@ -789,14 +791,14 @@ import java.util.regex.Pattern;
|
|||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
MainUtil.sendMessage(pp, C.BORDER);
|
MainUtil.sendMessage(pp, Captions.BORDER);
|
||||||
}
|
}
|
||||||
if (x2 < -border && this.tmpTeleport) {
|
if (x2 < -border && this.tmpTeleport) {
|
||||||
to.setX(-border + 1);
|
to.setX(-border + 1);
|
||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
MainUtil.sendMessage(pp, C.BORDER);
|
MainUtil.sendMessage(pp, Captions.BORDER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int z2;
|
int z2;
|
||||||
@ -818,7 +820,8 @@ import java.util.regex.Pattern;
|
|||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
|
||||||
.getMeta("kick", false)) {
|
.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;
|
this.tmpTeleport = false;
|
||||||
if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) {
|
if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) {
|
||||||
player.teleport(from);
|
player.teleport(from);
|
||||||
@ -832,7 +835,8 @@ import java.util.regex.Pattern;
|
|||||||
} else if (now.equals(lastPlot)) {
|
} else if (now.equals(lastPlot)) {
|
||||||
ForceFieldListener.handleForcefield(player, pp, now);
|
ForceFieldListener.handleForcefield(player, pp, now);
|
||||||
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
|
} 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;
|
this.tmpTeleport = false;
|
||||||
player.teleport(from);
|
player.teleport(from);
|
||||||
to.setX(from.getBlockX());
|
to.setX(from.getBlockX());
|
||||||
@ -848,13 +852,13 @@ import java.util.regex.Pattern;
|
|||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
MainUtil.sendMessage(pp, C.BORDER);
|
MainUtil.sendMessage(pp, Captions.BORDER);
|
||||||
} else if (z2 < -border && this.tmpTeleport) {
|
} else if (z2 < -border && this.tmpTeleport) {
|
||||||
to.setZ(-border + 1);
|
to.setZ(-border + 1);
|
||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
this.tmpTeleport = true;
|
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);
|
event.setCancelled(true);
|
||||||
String message = event.getMessage();
|
String message = event.getMessage();
|
||||||
String format = C.PLOT_CHAT_FORMAT.s();
|
String format = Captions.PLOT_CHAT_FORMAT.s();
|
||||||
String sender = event.getPlayer().getDisplayName();
|
String sender = event.getPlayer().getDisplayName();
|
||||||
PlotId id = plot.getId();
|
PlotId id = plot.getId();
|
||||||
Set<Player> recipients = event.getRecipients();
|
Set<Player> recipients = event.getRecipients();
|
||||||
@ -896,14 +900,15 @@ import java.util.regex.Pattern;
|
|||||||
String partial = ChatColor.translateAlternateColorCodes('&',
|
String partial = ChatColor.translateAlternateColorCodes('&',
|
||||||
format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender));
|
format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender));
|
||||||
if (plotPlayer.hasPermission("plots.chat.color")) {
|
if (plotPlayer.hasPermission("plots.chat.color")) {
|
||||||
message = C.color(message);
|
message = Captions.color(message);
|
||||||
}
|
}
|
||||||
String full = partial.replace("%msg%", message);
|
String full = partial.replace("%msg%", message);
|
||||||
for (Player receiver : recipients) {
|
for (Player receiver : recipients) {
|
||||||
receiver.sendMessage(full);
|
receiver.sendMessage(full);
|
||||||
}
|
}
|
||||||
if (!spies.isEmpty()) {
|
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);
|
.replace("%sender%", sender).replace("%msg%", message);
|
||||||
for (Player player : spies) {
|
for (Player player : spies) {
|
||||||
player.sendMessage(spyMessage);
|
player.sendMessage(spyMessage);
|
||||||
@ -924,26 +929,27 @@ import java.util.regex.Pattern;
|
|||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
if (event.getBlock().getY() == 0) {
|
if (event.getBlock().getY() == 0) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL);
|
Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
(location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
|
(location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
|
||||||
&& !Permissions
|
&& !Permissions
|
||||||
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
|
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
MainUtil.sendMessage(plotPlayer,
|
MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.s()
|
||||||
C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
if (Permissions
|
||||||
|
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -954,16 +960,17 @@ import java.util.regex.Pattern;
|
|||||||
.contains(PlotBlock.get(block.getType().name()))) {
|
.contains(PlotBlock.get(block.getType().name()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
if (Permissions
|
||||||
|
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_OTHER);
|
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_BUILD_OTHER);
|
Captions.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -971,7 +978,7 @@ import java.util.regex.Pattern;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||||
@ -980,7 +987,8 @@ import java.util.regex.Pattern;
|
|||||||
return;
|
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,7 +1059,7 @@ import java.util.regex.Pattern;
|
|||||||
plotExit(pp, plot);
|
plotExit(pp, plot);
|
||||||
}
|
}
|
||||||
if (PlotSquared.get().worldedit != null) {
|
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")) {
|
if (pp.getAttribute("worldedit")) {
|
||||||
pp.removeAttribute("worldedit");
|
pp.removeAttribute("worldedit");
|
||||||
}
|
}
|
||||||
@ -1224,7 +1232,8 @@ import java.util.regex.Pattern;
|
|||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
if (Permissions
|
||||||
|
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1236,7 +1245,7 @@ import java.util.regex.Pattern;
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (destroy.isPresent() && destroy.get()
|
if (destroy.isPresent() && destroy.get()
|
||||||
.contains(PlotBlock.get(block.getType().name())) || Permissions
|
.contains(PlotBlock.get(block.getType().name())) || Permissions
|
||||||
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1245,7 +1254,7 @@ import java.util.regex.Pattern;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1612,19 +1621,21 @@ import java.util.regex.Pattern;
|
|||||||
boolean cancelled = false;
|
boolean cancelled = false;
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
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;
|
cancelled = true;
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
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;
|
cancelled = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UUID uuid = pp.getUUID();
|
UUID uuid = pp.getUUID();
|
||||||
if (!plot.isAdded(uuid)) {
|
if (!plot.isAdded(uuid)) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
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;
|
cancelled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1672,12 +1683,13 @@ import java.util.regex.Pattern;
|
|||||||
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
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);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
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);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1687,7 +1699,8 @@ import java.util.regex.Pattern;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
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);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2161,19 +2174,21 @@ import java.util.regex.Pattern;
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (Flags.BLOCK_IGNITION.isFalse(plot)) {
|
} else if (Flags.BLOCK_IGNITION.isFalse(plot)) {
|
||||||
@ -2237,29 +2252,33 @@ import java.util.regex.Pattern;
|
|||||||
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
|
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
return;
|
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);
|
event.setCancelled(true);
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
return;
|
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);
|
event.setCancelled(true);
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (Flags.USE.contains(plot, PlotBlock.get(event.getBucket().getId(), 0))) {
|
if (Flags.USE.contains(plot, PlotBlock.get(event.getBucket().getId(), 0))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
return;
|
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);
|
event.setCancelled(true);
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2293,17 +2312,18 @@ import java.util.regex.Pattern;
|
|||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
return;
|
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);
|
event.setCancelled(true);
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
|
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()))) {
|
if (use.isPresent() && use.get().contains(PlotBlock.get(block.getType().name()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
return;
|
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);
|
event.setCancelled(true);
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
Captions.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2356,24 +2377,25 @@ import java.util.regex.Pattern;
|
|||||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.isAdded(pp.getUUID())) {
|
if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (!plot.getFlag(Flags.HANGING_PLACE, false)) {
|
if (!plot.getFlag(Flags.HANGING_PLACE, false)) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
Captions.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -2399,24 +2421,24 @@ import java.util.regex.Pattern;
|
|||||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
|
Captions.PERMISSION_ADMIN_DESTROY_ROAD);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (plot.getFlag(Flags.HANGING_BREAK, false)) {
|
if (plot.getFlag(Flags.HANGING_BREAK, false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
|
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2434,17 +2456,17 @@ import java.util.regex.Pattern;
|
|||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(player.getUUID())) {
|
} else if (!plot.isAdded(player.getUUID())) {
|
||||||
if (!plot.getFlag(Flags.HANGING_BREAK, false)) {
|
if (!plot.getFlag(Flags.HANGING_BREAK, false)) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_OTHER);
|
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2467,14 +2489,15 @@ import java.util.regex.Pattern;
|
|||||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_ROAD);
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
|
Captions.PERMISSION_ADMIN_INTERACT_ROAD);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_UNOWNED);
|
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} 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)) {
|
if (entity instanceof ItemFrame && plot.getFlag(Flags.MISC_INTERACT, false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_OTHER);
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
|
Captions.PERMISSION_ADMIN_INTERACT_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2522,14 +2546,14 @@ import java.util.regex.Pattern;
|
|||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
|
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.road");
|
"plots.admin.vehicle.break.road");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
|
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");
|
"plots.admin.vehicle.break.unowned");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -2541,7 +2565,7 @@ import java.util.regex.Pattern;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
|
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");
|
"plots.admin.vehicle.break.other");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -2680,7 +2704,7 @@ import java.util.regex.Pattern;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
|
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);
|
"plots.admin.destroy." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2690,7 +2714,7 @@ import java.util.regex.Pattern;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
|
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);
|
"plots.admin.destroy." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2701,8 +2725,8 @@ import java.util.regex.Pattern;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
"plots.admin.pve." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Tameable) { // victim is tameable
|
} else if (victim instanceof Tameable) { // victim is tameable
|
||||||
@ -2711,15 +2735,15 @@ import java.util.regex.Pattern;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
"plots.admin.pve." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Player) {
|
} else if (victim instanceof Player) {
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (Flags.PVP.isFalse(plot) && !Permissions
|
if (Flags.PVP.isFalse(plot) && !Permissions
|
||||||
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.pvp." + stub);
|
"plots.admin.pvp." + stub);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -2727,8 +2751,8 @@ import java.util.regex.Pattern;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub);
|
"plots.admin.pvp." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Creature) { // victim is animal
|
} else if (victim instanceof Creature) { // victim is animal
|
||||||
@ -2737,8 +2761,8 @@ import java.util.regex.Pattern;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
"plots.admin.pve." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Vehicle) { // Vehicles are managed in vehicle destroy event
|
} else if (victim instanceof Vehicle) { // Vehicles are managed in vehicle destroy event
|
||||||
@ -2749,8 +2773,8 @@ import java.util.regex.Pattern;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
"plots.admin.pve." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2775,20 +2799,20 @@ import java.util.regex.Pattern;
|
|||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) {
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road");
|
"plots.admin.projectile.road");
|
||||||
event.setHatching(false);
|
event.setHatching(false);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) {
|
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");
|
"plots.admin.projectile.unowned");
|
||||||
event.setHatching(false);
|
event.setHatching(false);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) {
|
||||||
MainUtil
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other");
|
"plots.admin.projectile.other");
|
||||||
event.setHatching(false);
|
event.setHatching(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2806,15 +2830,15 @@ import java.util.regex.Pattern;
|
|||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
|
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);
|
event.setCancelled(true);
|
||||||
MainUtil.sendMessage(pp,
|
MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.s()
|
||||||
C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2826,14 +2850,16 @@ import java.util.regex.Pattern;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
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);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
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);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2844,8 +2870,9 @@ import java.util.regex.Pattern;
|
|||||||
sendBlockChange(block.getLocation(), block.getBlockData());
|
sendBlockChange(block.getLocation(), block.getBlockData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
} else if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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) {
|
@Override public int hasPermissionRange(String stub, int range) {
|
||||||
if (hasPermission(C.PERMISSION_ADMIN.s())) {
|
if (hasPermission(Captions.PERMISSION_ADMIN.s())) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
String[] nodes = stub.split("\\.");
|
String[] nodes = stub.split("\\.");
|
||||||
StringBuilder n = new StringBuilder();
|
StringBuilder n = new StringBuilder();
|
||||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||||
n.append(nodes[i]).append(".");
|
n.append(nodes[i]).append(".");
|
||||||
if (!stub.equals(n + C.PERMISSION_STAR.s())) {
|
if (!stub.equals(n + Captions.PERMISSION_STAR.s())) {
|
||||||
if (hasPermission(n + C.PERMISSION_STAR.s())) {
|
if (hasPermission(n + Captions.PERMISSION_STAR.s())) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.bukkit.util.BukkitUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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 com.sk89q.jnbt.*;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -132,7 +132,7 @@ public class StateWrapper {
|
|||||||
.replace("\"underlined\":true,", "&n").replace("\"italic\":true,", "&o")
|
.replace("\"underlined\":true,", "&n").replace("\"italic\":true,", "&o")
|
||||||
.replace("[{\"text\":\"", "&0").replace("{\"text\":\"", "&0").replace("\"},", "")
|
.replace("[{\"text\":\"", "&0").replace("{\"text\":\"", "&0").replace("\"},", "")
|
||||||
.replace("\"}]", "").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());
|
str = str.replace(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
|
@ -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.chat.FancyMessage;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
|
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) {
|
@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) {
|
@Override public void tooltip(PlotMessage message, PlotMessage... tooltips) {
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem;
|
import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||||
@ -174,9 +174,9 @@ import java.util.*;
|
|||||||
*
|
*
|
||||||
* @param player the recipient of the message
|
* @param player the recipient of the message
|
||||||
* @param caption 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);
|
MainUtil.sendMessage(BukkitUtil.getPlayer(player), caption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory;
|
import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||||
@ -48,7 +48,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
world = worlds.get(0).getName();
|
world = worlds.get(0).getName();
|
||||||
}
|
}
|
||||||
TaskManager.runTaskAsync(() -> {
|
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");
|
File uuidFile = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt");
|
||||||
if (uuidFile.exists()) {
|
if (uuidFile.exists()) {
|
||||||
try {
|
try {
|
||||||
@ -115,7 +115,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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);
|
UUID uuid = UUID.fromString(s);
|
||||||
uuids.add(uuid);
|
uuids.add(uuid);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
PlotSquared.debug(C.PREFIX + "Invalid PlayerData: " + current);
|
PlotSquared.debug(Captions.PREFIX + "Invalid PlayerData: " + current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -199,8 +199,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
PlotSquared
|
PlotSquared.debug(
|
||||||
.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
Captions.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
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) {
|
@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!");
|
+ "' was null. We'll cache this from the Mojang servers!");
|
||||||
if (ifFetch == null) {
|
if (ifFetch == null) {
|
||||||
return;
|
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
|
* This is useful for name changes
|
||||||
*/
|
*/
|
||||||
@ -226,14 +207,34 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
statement.setString(1, name.value);
|
statement.setString(1, name.value);
|
||||||
statement.setString(2, uuid.toString());
|
statement.setString(2, uuid.toString());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
PlotSquared
|
PlotSquared.debug(
|
||||||
.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
Captions.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
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 {
|
private class SQLUUIDHandlerException extends RuntimeException {
|
||||||
|
|
||||||
SQLUUIDHandlerException(String s, Throwable c) {
|
SQLUUIDHandlerException(String s, Throwable c) {
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.api;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Flag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
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
|
* @param plotArea Plot World Object
|
||||||
* @see PlotSquared#addPlotArea(PlotArea)
|
* @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
|
* @return the configuration file for PlotSquared
|
||||||
* @see PlotSquared#config
|
* =
|
||||||
*/
|
*/
|
||||||
public YamlConfiguration getConfig() {
|
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.
|
* Send a message to the console. The message supports color codes.
|
||||||
*
|
*
|
||||||
* @param message the message
|
* @param message the message
|
||||||
* @see MainUtil#sendConsoleMessage(C, String...)
|
* @see MainUtil#sendConsoleMessage(Captions, String...)
|
||||||
*/
|
*/
|
||||||
public void sendConsoleMessage(String message) {
|
public void sendConsoleMessage(String message) {
|
||||||
PlotSquared.log(message);
|
PlotSquared.log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to the console.
|
* Sends a message to the console.
|
||||||
*
|
*
|
||||||
* @param caption the message
|
* @param caption the message
|
||||||
* @see #sendConsoleMessage(String)
|
* @see #sendConsoleMessage(String)
|
||||||
* @see C
|
* @see Captions
|
||||||
*/
|
*/
|
||||||
public void sendConsoleMessage(C caption) {
|
public void sendConsoleMessage(Captions caption) {
|
||||||
sendConsoleMessage(caption.s());
|
sendConsoleMessage(caption.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.CommandCategory;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
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.PlotMessage;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||||
@ -239,18 +239,19 @@ public abstract class Command {
|
|||||||
if (page < totalPages && page > 0) { // Back | Next
|
if (page < totalPages && page > 0) { // Back | Next
|
||||||
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ")
|
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ")
|
||||||
.color("$3").text("->").color("$1").command(baseCommand + " " + (page + 2))
|
.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;
|
return;
|
||||||
}
|
}
|
||||||
if (page == 0 && totalPages != 0) { // Next
|
if (page == 0 && totalPages != 0) { // Next
|
||||||
new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1")
|
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);
|
.send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (page == totalPages && totalPages != 0) { // Back
|
if (page == totalPages && totalPages != 0) { // Back
|
||||||
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ")
|
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) {
|
if (this.parent == null) {
|
||||||
MainCommand.getInstance().help.displayHelp(player, null, 0);
|
MainCommand.getInstance().help.displayHelp(player, null, 0);
|
||||||
} else {
|
} else {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -279,7 +280,7 @@ public abstract class Command {
|
|||||||
Command cmd = getCommand(args[0]);
|
Command cmd = getCommand(args[0]);
|
||||||
if (cmd == null) {
|
if (cmd == null) {
|
||||||
if (this.parent != null) {
|
if (this.parent != null) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Help command
|
// Help command
|
||||||
@ -294,11 +295,11 @@ public abstract class Command {
|
|||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
}
|
}
|
||||||
// Command recommendation
|
// Command recommendation
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_SUBCOMMAND);
|
||||||
List<Command> commands = getCommands(player);
|
List<Command> commands = getCommands(player);
|
||||||
if (commands.isEmpty()) {
|
if (commands.isEmpty()) {
|
||||||
MainUtil
|
MainUtil.sendMessage(player, Captions.DID_YOU_MEAN,
|
||||||
.sendMessage(player, C.DID_YOU_MEAN, MainCommand.getInstance().help.getUsage());
|
MainCommand.getInstance().help.getUsage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String[] allargs =
|
String[] allargs =
|
||||||
@ -313,7 +314,7 @@ public abstract class Command {
|
|||||||
if (cmd == null) {
|
if (cmd == null) {
|
||||||
cmd = new StringComparison<>(args[0], this.allCommands).getMatchObject();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
String[] newArgs = Arrays.copyOfRange(args, 1, args.length);
|
String[] newArgs = Arrays.copyOfRange(args, 1, args.length);
|
||||||
@ -344,7 +345,7 @@ public abstract class Command {
|
|||||||
failed = failed || reqArgs[i].parse(args[i]) == null;
|
failed = failed || reqArgs[i].parse(args[i]) == null;
|
||||||
}
|
}
|
||||||
if (failed) {
|
if (failed) {
|
||||||
C.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " "));
|
Captions.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " "));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -426,12 +427,13 @@ public abstract class Command {
|
|||||||
}
|
}
|
||||||
if (!this.required.allows(player)) {
|
if (!this.required.allows(player)) {
|
||||||
if (message) {
|
if (message) {
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player, this.required == RequiredType.PLAYER ?
|
||||||
this.required == RequiredType.PLAYER ? C.IS_CONSOLE : C.NOT_CONSOLE);
|
Captions.IS_CONSOLE :
|
||||||
|
Captions.NOT_CONSOLE);
|
||||||
}
|
}
|
||||||
} else if (!Permissions.hasPermission(player, getPermission())) {
|
} else if (!Permissions.hasPermission(player, getPermission())) {
|
||||||
if (message) {
|
if (message) {
|
||||||
C.NO_PERMISSION.send(player, getPermission());
|
Captions.NO_PERMISSION.send(player, getPermission());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -548,13 +550,13 @@ public abstract class Command {
|
|||||||
return this.getFullId().hashCode();
|
return this.getFullId().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkTrue(boolean mustBeTrue, C message, Object... args) {
|
public void checkTrue(boolean mustBeTrue, Captions message, Object... args) {
|
||||||
if (!mustBeTrue) {
|
if (!mustBeTrue) {
|
||||||
throw new CommandException(message, args);
|
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) {
|
if (object == null) {
|
||||||
throw new CommandException(message, args);
|
throw new CommandException(message, args);
|
||||||
}
|
}
|
||||||
@ -568,9 +570,9 @@ public abstract class Command {
|
|||||||
|
|
||||||
public static class CommandException extends RuntimeException {
|
public static class CommandException extends RuntimeException {
|
||||||
private final Object[] args;
|
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.message = message;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
}
|
}
|
||||||
|
@ -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.file.YamlConfiguration;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization;
|
import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.WE_Anywhere;
|
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.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Storage;
|
import com.github.intellectualsites.plotsquared.plot.config.Storage;
|
||||||
@ -42,6 +42,7 @@ import java.util.*;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
@ -64,13 +65,13 @@ import java.util.zip.ZipInputStream;
|
|||||||
public File commandsFile;
|
public File commandsFile;
|
||||||
public File translationFile;
|
public File translationFile;
|
||||||
public YamlConfiguration style;
|
public YamlConfiguration style;
|
||||||
public YamlConfiguration config;
|
|
||||||
public YamlConfiguration worlds;
|
public YamlConfiguration worlds;
|
||||||
public YamlConfiguration storage;
|
public YamlConfiguration storage;
|
||||||
public YamlConfiguration commands;
|
public YamlConfiguration commands;
|
||||||
// Temporary hold the plots/clusters before the worlds load
|
// Temporary hold the plots/clusters before the worlds load
|
||||||
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
||||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||||
|
private YamlConfiguration config;
|
||||||
// Implementation logger
|
// Implementation logger
|
||||||
@Setter @Getter private ILogger logger;
|
@Setter @Getter private ILogger logger;
|
||||||
// Platform / Version / Update URL
|
// Platform / Version / Update URL
|
||||||
@ -129,7 +130,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
this.translationFile = MainUtil.getFile(this.IMP.getDirectory(),
|
this.translationFile = MainUtil.getFile(this.IMP.getDirectory(),
|
||||||
Settings.Paths.TRANSLATIONS + File.separator + IMP.getPluginName()
|
Settings.Paths.TRANSLATIONS + File.separator + IMP.getPluginName()
|
||||||
+ ".use_THIS.yml");
|
+ ".use_THIS.yml");
|
||||||
C.load(this.translationFile);
|
Captions.load(this.translationFile);
|
||||||
|
|
||||||
// Setup plotAreaManager
|
// Setup plotAreaManager
|
||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
@ -158,7 +159,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
if (Settings.Enabled_Components.METRICS) {
|
if (Settings.Enabled_Components.METRICS) {
|
||||||
this.IMP.startMetrics();
|
this.IMP.startMetrics();
|
||||||
} else {
|
} 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) {
|
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||||
this.IMP.registerChunkProcessor();
|
this.IMP.registerChunkProcessor();
|
||||||
@ -285,7 +286,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
e.printStackTrace();
|
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() {
|
public Set<Plot> getPlots() {
|
||||||
int size = getPlotCount();
|
int size = getPlotCount();
|
||||||
@ -886,12 +887,9 @@ import java.util.zip.ZipInputStream;
|
|||||||
* @return Set of plot
|
* @return Set of plot
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(String world, UUID uuid) {
|
public Set<Plot> getPlots(String world, UUID uuid) {
|
||||||
final Set<Plot> plots = new HashSet<>();
|
final Set<Plot> plots =
|
||||||
for (final Plot plot : getPlots(world)) {
|
getPlots(world).stream().filter(plot -> plot.hasOwner() && plot.isOwnerAbs(uuid))
|
||||||
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
|
.collect(Collectors.toSet());
|
||||||
plots.add(plot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Collections.unmodifiableSet(plots);
|
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 plot the plot to remove
|
||||||
* @param callEvent If to call an event about the plot being removed
|
* @param callEvent If to call an event about the plot being removed
|
||||||
@ -1091,11 +1089,12 @@ import java.util.zip.ZipInputStream;
|
|||||||
// Conventional plot generator
|
// Conventional plot generator
|
||||||
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
||||||
PlotManager plotManager = plotGenerator.getNewPlotManager();
|
PlotManager plotManager = plotGenerator.getNewPlotManager();
|
||||||
PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
PlotSquared.log(Captions.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
|
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)) {
|
if (!this.worlds.contains(path)) {
|
||||||
this.worlds.createSection(path);
|
this.worlds.createSection(path);
|
||||||
worldSection = this.worlds.getConfigurationSection(path);
|
worldSection = this.worlds.getConfigurationSection(path);
|
||||||
@ -1120,7 +1119,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
debug("World possibly already loaded: " + world);
|
debug("World possibly already loaded: " + world);
|
||||||
return;
|
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());
|
String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName());
|
||||||
if (type == 2) {
|
if (type == 2) {
|
||||||
Set<PlotCluster> clusters =
|
Set<PlotCluster> clusters =
|
||||||
@ -1137,7 +1136,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
worldSection.createSection("areas." + fullId);
|
worldSection.createSection("areas." + fullId);
|
||||||
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
|
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);
|
GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string);
|
||||||
if (areaGen == null) {
|
if (areaGen == null) {
|
||||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||||
@ -1151,11 +1150,13 @@ import java.util.zip.ZipInputStream;
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
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
|
PlotSquared
|
||||||
.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
.log(Captions.PREFIX + "&cNote: &7Area created for cluster:" + name
|
||||||
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
|
|
||||||
+ " (invalid or old configuration?)");
|
+ " (invalid or old configuration?)");
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
@ -1178,9 +1179,10 @@ import java.util.zip.ZipInputStream;
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
PlotSquared
|
||||||
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + pa);
|
.log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||||
PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager());
|
PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + pa);
|
||||||
|
PlotSquared.log(Captions.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
@ -1191,7 +1193,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
"Invalid type for multi-area world. Expected `2`, got `" + 1 + "`");
|
"Invalid type for multi-area world. Expected `2`, got `" + 1 + "`");
|
||||||
}
|
}
|
||||||
for (String areaId : areasSection.getKeys(false)) {
|
for (String areaId : areasSection.getKeys(false)) {
|
||||||
PlotSquared.log(C.PREFIX + "&3 - " + areaId);
|
PlotSquared.log(Captions.PREFIX + "&3 - " + areaId);
|
||||||
String[] split = areaId.split("(?<=[^;-])-");
|
String[] split = areaId.split("(?<=[^;-])-");
|
||||||
if (split.length != 3) {
|
if (split.length != 3) {
|
||||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
||||||
@ -1253,10 +1255,11 @@ import java.util.zip.ZipInputStream;
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
PlotSquared.log(C.PREFIX + "&aDetected area load for '" + world + "'");
|
PlotSquared.log(Captions.PREFIX + "&aDetected area load for '" + world + "'");
|
||||||
PlotSquared.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
PlotSquared
|
||||||
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
.log(Captions.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||||
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
|
PlotSquared.log(Captions.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||||
|
PlotSquared.log(Captions.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
@ -1403,20 +1406,16 @@ import java.util.zip.ZipInputStream;
|
|||||||
|
|
||||||
public String normalisedVersion(@NonNull final String version) {
|
public String normalisedVersion(@NonNull final String version) {
|
||||||
final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
|
final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
|
||||||
final StringBuilder sb = new StringBuilder();
|
return Arrays.stream(split).map(s -> String.format("%4s", s)).collect(Collectors.joining());
|
||||||
for (final String s : split) {
|
|
||||||
sb.append(String.format("%" + 4 + 's', s));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean update(PlotPlayer sender, URL url) {
|
private boolean update(PlotPlayer sender, URL url) {
|
||||||
try {
|
try {
|
||||||
String name = this.jarFile.getName();
|
String name = this.jarFile.getName();
|
||||||
File newJar = new File("plugins/update/" + name);
|
|
||||||
MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url);
|
MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url);
|
||||||
URLConnection con = url.openConnection();
|
URLConnection con = url.openConnection();
|
||||||
try (InputStream stream = con.getInputStream()) {
|
try (InputStream stream = con.getInputStream()) {
|
||||||
|
File newJar = new File("plugins/update/" + name);
|
||||||
File parent = newJar.getParentFile();
|
File parent = newJar.getParentFile();
|
||||||
if (!parent.exists()) {
|
if (!parent.exists()) {
|
||||||
parent.mkdirs();
|
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 file Name of the file inside PlotSquared.jar
|
||||||
* @param folder The output location relative to /plugins/PlotSquared/
|
* @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() {
|
public void disable() {
|
||||||
try {
|
try {
|
||||||
@ -1548,7 +1547,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
|
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
|
||||||
database = new SQLite(file);
|
database = new SQLite(file);
|
||||||
} else {
|
} 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
|
this.IMP.shutdown(); //shutdown used instead of disable because no database is set
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1566,8 +1565,8 @@ import java.util.zip.ZipInputStream;
|
|||||||
}
|
}
|
||||||
this.clusters_tmp = DBFunc.getClusters();
|
this.clusters_tmp = DBFunc.getClusters();
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
PlotSquared.log(
|
PlotSquared.log(Captions.PREFIX
|
||||||
C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
|
+ "&cFailed to open DATABASE connection. The plugin will disable itself.");
|
||||||
if (Storage.MySQL.USE) {
|
if (Storage.MySQL.USE) {
|
||||||
PlotSquared.log("$4MYSQL");
|
PlotSquared.log("$4MYSQL");
|
||||||
} else if (Storage.SQLite.USE) {
|
} else if (Storage.SQLite.USE) {
|
||||||
@ -1589,15 +1588,16 @@ import java.util.zip.ZipInputStream;
|
|||||||
* @throws IOException if the config failed to save
|
* @throws IOException if the config failed to save
|
||||||
*/
|
*/
|
||||||
public void setupConfig() throws IOException {
|
public void setupConfig() throws IOException {
|
||||||
String lastVersionString = this.config.getString("version");
|
String lastVersionString = this.getConfig().getString("version");
|
||||||
if (lastVersionString != null) {
|
if (lastVersionString != null) {
|
||||||
String[] split = lastVersionString.split("\\.");
|
String[] split = lastVersionString.split("\\.");
|
||||||
int[] lastVersion = new int[] {Integer.parseInt(split[0]), Integer.parseInt(split[1]),
|
int[] lastVersion = new int[] {Integer.parseInt(split[0]), Integer.parseInt(split[1]),
|
||||||
Integer.parseInt(split[2])};
|
Integer.parseInt(split[2])};
|
||||||
if (checkVersion(new int[] {3, 4, 0}, lastVersion)) {
|
if (checkVersion(new int[] {3, 4, 0}, lastVersion)) {
|
||||||
Settings.convertLegacy(configFile);
|
Settings.convertLegacy(configFile);
|
||||||
if (config.contains("worlds")) {
|
if (getConfig().contains("worlds")) {
|
||||||
ConfigurationSection worldSection = config.getConfigurationSection("worlds");
|
ConfigurationSection worldSection =
|
||||||
|
getConfig().getConfigurationSection("worlds");
|
||||||
worlds.set("worlds", worldSection);
|
worlds.set("worlds", worldSection);
|
||||||
try {
|
try {
|
||||||
worlds.save(worldsFile);
|
worlds.save(worldsFile);
|
||||||
@ -1639,7 +1639,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
public boolean setupConfigs() {
|
public boolean setupConfigs() {
|
||||||
File folder = new File(this.IMP.getDirectory(), "config");
|
File folder = new File(this.IMP.getDirectory(), "config");
|
||||||
if (!folder.exists() && !folder.mkdirs()) {
|
if (!folder.exists() && !folder.mkdirs()) {
|
||||||
PlotSquared.log(C.PREFIX
|
PlotSquared.log(Captions.PREFIX
|
||||||
+ "&cFailed to create the /plugins/config folder. Please create it manually.");
|
+ "&cFailed to create the /plugins/config folder. Please create it manually.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -1655,11 +1655,11 @@ import java.util.zip.ZipInputStream;
|
|||||||
.getString("configuration_version")
|
.getString("configuration_version")
|
||||||
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION)) {
|
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION)) {
|
||||||
// Conversion needed
|
// Conversion needed
|
||||||
log(C.LEGACY_CONFIG_FOUND.s());
|
log(Captions.LEGACY_CONFIG_FOUND.s());
|
||||||
try {
|
try {
|
||||||
com.google.common.io.Files
|
com.google.common.io.Files
|
||||||
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
|
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
|
||||||
log(C.LEGACY_CONFIG_BACKUP.s());
|
log(Captions.LEGACY_CONFIG_BACKUP.s());
|
||||||
final ConfigurationSection worlds =
|
final ConfigurationSection worlds =
|
||||||
this.worlds.getConfigurationSection("worlds");
|
this.worlds.getConfigurationSection("worlds");
|
||||||
final LegacyConverter converter = new LegacyConverter(worlds);
|
final LegacyConverter converter = new LegacyConverter(worlds);
|
||||||
@ -1668,9 +1668,9 @@ import java.util.zip.ZipInputStream;
|
|||||||
.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
|
.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
|
||||||
this.worlds.set("worlds", worlds); // Redundant, but hey... ¯\_(ツ)_/¯
|
this.worlds.set("worlds", worlds); // Redundant, but hey... ¯\_(ツ)_/¯
|
||||||
this.worlds.save(this.worldsFile);
|
this.worlds.save(this.worldsFile);
|
||||||
log(C.LEGACY_CONFIG_DONE.s());
|
log(Captions.LEGACY_CONFIG_DONE.s());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
log(C.LEGACY_CONFIG_CONVERSION_FAILED.s());
|
log(Captions.LEGACY_CONFIG_CONVERSION_FAILED.s());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// Disable plugin
|
// Disable plugin
|
||||||
@ -1759,7 +1759,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
||||||
for (Entry<String, Object> component : components.entrySet()) {
|
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(),
|
.format("&cKey: &6%s&c, Value: &6%s", component.getKey(),
|
||||||
component.getValue()));
|
component.getValue()));
|
||||||
}
|
}
|
||||||
@ -1790,7 +1790,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
*
|
*
|
||||||
* @return the java version
|
* @return the java version
|
||||||
*/
|
*/
|
||||||
public double getJavaVersion() {
|
private double getJavaVersion() {
|
||||||
return Double.parseDouble(System.getProperty("java.specification.version"));
|
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);
|
final PlotArea[] array = this.plotAreaManager.getPlotAreas(world, null);
|
||||||
if (array == null) {
|
if (array == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (final PlotArea area : array) {
|
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()) {
|
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()) {
|
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||||
area.getPlots().forEach(runnable);
|
area.getPlots().forEach(consumer);
|
||||||
}
|
}
|
||||||
if (this.plots_tmp != null) {
|
if (this.plots_tmp != null) {
|
||||||
for (final HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
|
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()) {
|
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);
|
return Collections.unmodifiableSet(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public YamlConfiguration getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
public enum SortType {
|
public enum SortType {
|
||||||
CREATION_DATE, CREATION_DATE_TIMESTAMP, LAST_MODIFIED, DISTANCE_FROM_ORIGIN
|
CREATION_DATE, CREATION_DATE_TIMESTAMP, LAST_MODIFIED, DISTANCE_FROM_ORIGIN
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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,
|
@Override public void execute(final PlotPlayer player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||||
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
|
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||||
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
|
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
|
||||||
checkTrue(plot.isOwner(player.getUUID()) || Permissions
|
checkTrue(plot.isOwner(player.getUUID()) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
|
||||||
checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage());
|
Captions.NO_PLOT_PERMS);
|
||||||
|
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
|
||||||
final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
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();
|
Iterator<UUID> iter = uuids.iterator();
|
||||||
int size = plot.getTrusted().size() + plot.getMembers().size();
|
int size = plot.getTrusted().size() + plot.getMembers().size();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
UUID uuid = iter.next();
|
UUID uuid = iter.next();
|
||||||
if (uuid == DBFunc.EVERYONE && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
|
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid));
|
||||||
iter.remove();
|
iter.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plot.isOwner(uuid)) {
|
if (plot.isOwner(uuid)) {
|
||||||
MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid));
|
||||||
iter.remove();
|
iter.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plot.getMembers().contains(uuid)) {
|
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();
|
iter.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -60,7 +61,8 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
checkTrue(!uuids.isEmpty(), null);
|
checkTrue(!uuids.isEmpty(), null);
|
||||||
checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions
|
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() {
|
confirm.run(this, new Runnable() {
|
||||||
@Override // Success
|
@Override // Success
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -74,7 +76,7 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
plot.addMember(uuid);
|
plot.addMember(uuid);
|
||||||
EventUtil.manager.callMember(player, plot, uuid, true);
|
EventUtil.manager.callMember(player, plot, uuid, true);
|
||||||
MainUtil.sendMessage(player, C.MEMBER_ADDED);
|
MainUtil.sendMessage(player, Captions.MEMBER_ADDED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
|
|
||||||
if (args.length == 0) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
Plot plot = loc.getPlotAbs();
|
Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(player, C.PLOT_NOT_CLAIMED);
|
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plot.isOwner(player.getUUID())) {
|
if (!plot.isOwner(player.getUUID())) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,25 +46,25 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
|||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "set":
|
case "set":
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
|
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canExecuteCommand(player, C.PERMISSION_ALIAS_SET, false) || canExecuteCommand(
|
if (canExecuteCommand(player, Captions.PERMISSION_ALIAS_SET, false)
|
||||||
player, C.PERMISSION_ALIAS_SET_OBSOLETE, false)) {
|
|| canExecuteCommand(player, Captions.PERMISSION_ALIAS_SET_OBSOLETE, false)) {
|
||||||
result = setAlias(player, plot, args[1]);
|
result = setAlias(player, plot, args[1]);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "remove":
|
case "remove":
|
||||||
if (canExecuteCommand(player, C.PERMISSION_ALIAS_REMOVE, true)) {
|
if (canExecuteCommand(player, Captions.PERMISSION_ALIAS_REMOVE, true)) {
|
||||||
result = removeAlias(player, plot);
|
result = removeAlias(player, plot);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot alias <set|remove> <alias>");
|
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set|remove> <alias>");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,47 +74,47 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
|||||||
|
|
||||||
private boolean setAlias(PlotPlayer player, Plot plot, String alias) {
|
private boolean setAlias(PlotPlayer player, Plot plot, String alias) {
|
||||||
if (alias.isEmpty()) {
|
if (alias.isEmpty()) {
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
|
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (alias.length() >= 50) {
|
if (alias.length() >= 50) {
|
||||||
MainUtil.sendMessage(player, C.ALIAS_TOO_LONG);
|
MainUtil.sendMessage(player, Captions.ALIAS_TOO_LONG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (alias.contains(" ")) {
|
if (alias.contains(" ")) {
|
||||||
C.NOT_VALID_VALUE.send(player);
|
Captions.NOT_VALID_VALUE.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (MathMan.isInteger(alias)) {
|
if (MathMan.isInteger(alias)) {
|
||||||
C.NOT_VALID_VALUE.send(player);
|
Captions.NOT_VALID_VALUE.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Plot p : PlotSquared.get().getPlots(plot.getArea())) {
|
for (Plot p : PlotSquared.get().getPlots(plot.getArea())) {
|
||||||
if (p.getAlias().equalsIgnoreCase(alias)) {
|
if (p.getAlias().equalsIgnoreCase(alias)) {
|
||||||
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
|
MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (UUIDHandler.nameExists(new StringWrapper(alias)) || PlotSquared.get()
|
if (UUIDHandler.nameExists(new StringWrapper(alias)) || PlotSquared.get()
|
||||||
.hasPlotArea(alias)) {
|
.hasPlotArea(alias)) {
|
||||||
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
|
MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.setAlias(alias);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean removeAlias(PlotPlayer player, Plot plot) {
|
private boolean removeAlias(PlotPlayer player, Plot plot) {
|
||||||
plot.setAlias(null);
|
plot.setAlias(null);
|
||||||
MainUtil.sendMessage(player, C.ALIAS_REMOVED.s());
|
MainUtil.sendMessage(player, Captions.ALIAS_REMOVED.s());
|
||||||
return true;
|
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 (!Permissions.hasPermission(player, caption)) {
|
||||||
if (sendMessage) {
|
if (sendMessage) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
|
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "c":
|
case "c":
|
||||||
case "setup":
|
case "setup":
|
||||||
case "create":
|
case "create":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_CREATE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_CREATE)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_CREATE);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_CREATE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
C.COMMAND_SYNTAX
|
Captions.COMMAND_SYNTAX
|
||||||
.send(player, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
.send(player, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
case 2:
|
case 2:
|
||||||
@ -41,13 +41,13 @@ public class Area extends SubCommand {
|
|||||||
case "pos1": { // Set position 1
|
case "pos1": { // Set position 1
|
||||||
HybridPlotWorld area = player.getMeta("area_create_area");
|
HybridPlotWorld area = player.getMeta("area_create_area");
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.COMMAND_SYNTAX.send(player,
|
Captions.COMMAND_SYNTAX.send(player,
|
||||||
"/plot area create [world[:id]] [<modifier>=<value>]...");
|
"/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
player.setMeta("area_pos1", location);
|
player.setMeta("area_pos1", location);
|
||||||
C.SET_ATTRIBUTE.send(player, "area_pos1",
|
Captions.SET_ATTRIBUTE.send(player, "area_pos1",
|
||||||
location.getX() + "," + location.getZ());
|
location.getX() + "," + location.getZ());
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"You will now set pos2: /plot area create pos2"
|
"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)
|
case "pos2": // Set position 2 and finish creation for type=2 (partial)
|
||||||
final HybridPlotWorld area = player.getMeta("area_create_area");
|
final HybridPlotWorld area = player.getMeta("area_create_area");
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.COMMAND_SYNTAX.send(player,
|
Captions.COMMAND_SYNTAX.send(player,
|
||||||
"/plot area create [world[:id]] [<modifier>=<value>]...");
|
"/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ public class Area extends SubCommand {
|
|||||||
Set<PlotArea> areas =
|
Set<PlotArea> areas =
|
||||||
PlotSquared.get().getPlotAreas(area.worldname, region);
|
PlotSquared.get().getPlotAreas(area.worldname, region);
|
||||||
if (!areas.isEmpty()) {
|
if (!areas.isEmpty()) {
|
||||||
C.CLUSTER_INTERSECTION
|
Captions.CLUSTER_INTERSECTION
|
||||||
.send(player, areas.iterator().next().toString());
|
.send(player, areas.iterator().next().toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ public class Area extends SubCommand {
|
|||||||
final String world = SetupUtils.manager.setupWorld(object);
|
final String world = SetupUtils.manager.setupWorld(object);
|
||||||
if (WorldUtil.IMP.isWorld(world)) {
|
if (WorldUtil.IMP.isWorld(world)) {
|
||||||
PlotSquared.get().loadWorld(world, null);
|
PlotSquared.get().loadWorld(world, null);
|
||||||
C.SETUP_FINISHED.send(player);
|
Captions.SETUP_FINISHED.send(player);
|
||||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||||
if (area.TERRAIN != 3) {
|
if (area.TERRAIN != 3) {
|
||||||
ChunkManager.largeRegionTask(world, region,
|
ChunkManager.largeRegionTask(world, region,
|
||||||
@ -153,7 +153,7 @@ public class Area extends SubCommand {
|
|||||||
PlotSquared.get().IMP.getDefaultGenerator(), null, null);
|
PlotSquared.get().IMP.getDefaultGenerator(), null, null);
|
||||||
PlotArea other = PlotSquared.get().getPlotArea(pa.worldname, id);
|
PlotArea other = PlotSquared.get().getPlotArea(pa.worldname, id);
|
||||||
if (other != null && Objects.equals(pa.id, other.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;
|
return false;
|
||||||
}
|
}
|
||||||
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(pa.worldname);
|
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++) {
|
for (int i = 2; i < args.length; i++) {
|
||||||
String[] pair = args[i].split("=");
|
String[] pair = args[i].split("=");
|
||||||
if (pair.length != 2) {
|
if (pair.length != 2) {
|
||||||
C.COMMAND_SYNTAX.send(player, getCommandString()
|
Captions.COMMAND_SYNTAX.send(player, getCommandString()
|
||||||
+ " create [world[:id]] [<modifier>=<value>]...");
|
+ " create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -213,14 +213,14 @@ public class Area extends SubCommand {
|
|||||||
object.type = pa.TYPE;
|
object.type = pa.TYPE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, getCommandString()
|
Captions.COMMAND_SYNTAX.send(player, getCommandString()
|
||||||
+ " create [world[:id]] [<modifier>=<value>]...");
|
+ " create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pa.TYPE != 2) {
|
if (pa.TYPE != 2) {
|
||||||
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
||||||
C.SETUP_WORLD_TAKEN.send(player, pa.worldname);
|
Captions.SETUP_WORLD_TAKEN.send(player, pa.worldname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
@ -236,7 +236,7 @@ public class Area extends SubCommand {
|
|||||||
object.setupGenerator = PlotSquared.imp().getPluginName();
|
object.setupGenerator = PlotSquared.imp().getPluginName();
|
||||||
String world = SetupUtils.manager.setupWorld(object);
|
String world = SetupUtils.manager.setupWorld(object);
|
||||||
if (WorldUtil.IMP.isWorld(world)) {
|
if (WorldUtil.IMP.isWorld(world)) {
|
||||||
C.SETUP_FINISHED.send(player);
|
Captions.SETUP_FINISHED.send(player);
|
||||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
@ -258,7 +258,7 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (pa.id == null) {
|
if (pa.id == null) {
|
||||||
C.COMMAND_SYNTAX.send(player, getCommandString()
|
Captions.COMMAND_SYNTAX.send(player, getCommandString()
|
||||||
+ " create [world[:id]] [<modifier>=<value>]...");
|
+ " create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -281,8 +281,8 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
case "i":
|
case "i":
|
||||||
case "info": {
|
case "info": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_INFO)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_INFO)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_INFO);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_INFO);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area;
|
PlotArea area;
|
||||||
@ -294,14 +294,14 @@ public class Area extends SubCommand {
|
|||||||
area = PlotSquared.get().getPlotAreaByString(args[1]);
|
area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||||
} else {
|
} else {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -328,13 +328,14 @@ public class Area extends SubCommand {
|
|||||||
+ "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + "\n$1Region: $2"
|
+ "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + "\n$1Region: $2"
|
||||||
+ region + "\n$1Generator: $2" + generator;
|
+ region + "\n$1Generator: $2" + generator;
|
||||||
MainUtil.sendMessage(player,
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
case "l":
|
case "l":
|
||||||
case "list":
|
case "list":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_LIST)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_LIST)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_LIST);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_LIST);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int page;
|
int page;
|
||||||
@ -348,7 +349,7 @@ public class Area extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ArrayList<PlotArea> areas = new ArrayList<>(PlotSquared.get().getPlotAreas());
|
ArrayList<PlotArea> areas = new ArrayList<>(PlotSquared.get().getPlotAreas());
|
||||||
@ -390,19 +391,19 @@ public class Area extends SubCommand {
|
|||||||
.color("$1").text(" - ").color("$2")
|
.color("$1").text(" - ").color("$2")
|
||||||
.text(area.TYPE + ":" + area.TERRAIN).color("$3");
|
.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;
|
return true;
|
||||||
case "regen":
|
case "regen":
|
||||||
case "clear":
|
case "clear":
|
||||||
case "reset":
|
case "reset":
|
||||||
case "regenerate": {
|
case "regenerate": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_REGEN)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_REGEN)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_REGEN);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_REGEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotArea area = player.getApplicablePlotArea();
|
final PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (area.TYPE != 2) {
|
if (area.TYPE != 2) {
|
||||||
@ -423,17 +424,17 @@ public class Area extends SubCommand {
|
|||||||
case "teleport":
|
case "teleport":
|
||||||
case "visit":
|
case "visit":
|
||||||
case "tp":
|
case "tp":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_AREA_TP)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_TP)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_AREA_TP);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_TP);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot visit [area]");
|
Captions.COMMAND_SYNTAX.send(player, "/plot visit [area]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location center;
|
Location center;
|
||||||
@ -459,7 +460,7 @@ public class Area extends SubCommand {
|
|||||||
+ "\n$1Stop the server and delete it from these locations.");
|
+ "\n$1Stop the server and delete it from these locations.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
@ -30,14 +30,14 @@ public class Auto extends SubCommand {
|
|||||||
int diff = currentPlots - allowed_plots;
|
int diff = currentPlots - allowed_plots;
|
||||||
if (diff + size_x * size_z > 0) {
|
if (diff + size_x * size_z > 0) {
|
||||||
if (diff < 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;
|
return false;
|
||||||
} else if (player.hasPersistentMeta("grantedPlots")) {
|
} else if (player.hasPersistentMeta("grantedPlots")) {
|
||||||
int grantedPlots =
|
int grantedPlots =
|
||||||
ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots"));
|
ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots"));
|
||||||
if (grantedPlots - diff < size_x * size_z) {
|
if (grantedPlots - diff < size_x * size_z) {
|
||||||
player.removePersistentMeta("grantedPlots");
|
player.removePersistentMeta("grantedPlots");
|
||||||
MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS);
|
MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int left = grantedPlots - diff - size_x * size_z;
|
int left = grantedPlots - diff - size_x * size_z;
|
||||||
@ -47,11 +47,11 @@ public class Auto extends SubCommand {
|
|||||||
player.setPersistentMeta("grantedPlots",
|
player.setPersistentMeta("grantedPlots",
|
||||||
ByteArrayUtilities.integerToBytes(left));
|
ByteArrayUtilities.integerToBytes(left));
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.REMOVED_GRANTED_PLOT, "" + left,
|
MainUtil.sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "" + left,
|
||||||
"" + (grantedPlots - left));
|
"" + (grantedPlots - left));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS);
|
MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ public class Auto extends SubCommand {
|
|||||||
@Override public void run(Object ignore) {
|
@Override public void run(Object ignore) {
|
||||||
player.deleteMeta(Auto.class.getName());
|
player.deleteMeta(Auto.class.getName());
|
||||||
if (plot == null) {
|
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)) {
|
} else if (checkAllowedPlots(player, area, allowed_plots, 1, 1)) {
|
||||||
plot.claim(player, true, schem, false);
|
plot.claim(player, true, schem, false);
|
||||||
if (area.AUTO_MERGE) {
|
if (area.AUTO_MERGE) {
|
||||||
@ -150,7 +150,7 @@ public class Auto extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (plotarea == null) {
|
if (plotarea == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ public class Auto extends SubCommand {
|
|||||||
int size_z = 1;
|
int size_z = 1;
|
||||||
String schematic = null;
|
String schematic = null;
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_AUTO_MEGA)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_AUTO_MEGA)) {
|
||||||
try {
|
try {
|
||||||
String[] split = args[0].split(",|;");
|
String[] split = args[0].split(",|;");
|
||||||
size_x = Integer.parseInt(split[0]);
|
size_x = Integer.parseInt(split[0]);
|
||||||
@ -179,12 +179,12 @@ public class Auto extends SubCommand {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
schematic = args[0];
|
schematic = args[0];
|
||||||
// PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
// PlayerFunctions.sendMessage(plr, Captions.NO_PERMISSION);
|
||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (size_x * size_z > Settings.Claim.MAX_AUTO_AREA) {
|
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 + "");
|
Settings.Claim.MAX_AUTO_AREA + "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -196,13 +196,14 @@ public class Auto extends SubCommand {
|
|||||||
|
|
||||||
if (schematic != null && !schematic.isEmpty()) {
|
if (schematic != null && !schematic.isEmpty()) {
|
||||||
if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) {
|
if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||||
sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
|
||||||
&& !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
&& !Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||||
C.PERMISSION_CLAIM_SCHEMATIC.f(schematic));
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,11 +215,11 @@ public class Auto extends SubCommand {
|
|||||||
cost = (size_x * size_z) * cost;
|
cost = (size_x * size_z) * cost;
|
||||||
if (cost > 0d) {
|
if (cost > 0d) {
|
||||||
if (EconHandler.manager.getMoney(player) < cost) {
|
if (EconHandler.manager.getMoney(player) < cost) {
|
||||||
sendMessage(player, C.CANNOT_AFFORD_PLOT, "" + cost);
|
sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
EconHandler.manager.withdrawMoney(player, cost);
|
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!
|
// TODO handle type 2 the same as normal worlds!
|
||||||
@ -227,7 +228,7 @@ public class Auto extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (plotarea.TYPE == 2) {
|
if (plotarea.TYPE == 2) {
|
||||||
MainUtil.sendMessage(player, C.NO_FREE_PLOTS);
|
MainUtil.sendMessage(player, Captions.NO_FREE_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
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);
|
int biome = WorldUtil.IMP.getBiomeFromString(value);
|
||||||
if (biome == -1) {
|
if (biome == -1) {
|
||||||
String biomes =
|
String biomes =
|
||||||
StringMan.join(WorldUtil.IMP.getBiomeList(), C.BLOCK_LIST_SEPARATER.s());
|
StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s());
|
||||||
C.NEED_BIOME.send(player);
|
Captions.NEED_BIOME.send(player);
|
||||||
MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes);
|
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
plot.setBiome(value.toUpperCase(), new Runnable() {
|
plot.setBiome(value.toUpperCase(), new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
MainUtil.sendMessage(player, C.BIOME_SET_TO.s() + value.toLowerCase());
|
MainUtil.sendMessage(player, Captions.BIOME_SET_TO.s() + value.toLowerCase());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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,
|
@Override public void execute(final PlotPlayer player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
final RunnableVal2<Command, CommandResult> whenDone) {
|
final RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
check(EconHandler.manager, C.ECON_DISABLED);
|
check(EconHandler.manager, Captions.ECON_DISABLED);
|
||||||
final Plot plot;
|
final Plot plot;
|
||||||
if (args.length != 0) {
|
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);
|
plot = check(MainUtil.getPlotFromString(player, args[0], true), null);
|
||||||
} else {
|
} 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.hasOwner(), Captions.PLOT_UNOWNED);
|
||||||
checkTrue(!plot.isOwner(player.getUUID()), C.CANNOT_BUY_OWN);
|
checkTrue(!plot.isOwner(player.getUUID()), Captions.CANNOT_BUY_OWN);
|
||||||
Set<Plot> plots = plot.getConnectedPlots();
|
Set<Plot> plots = plot.getConnectedPlots();
|
||||||
checkTrue(player.getPlotCount() + plots.size() <= player.getAllowedPlots(),
|
checkTrue(player.getPlotCount() + plots.size() <= player.getAllowedPlots(),
|
||||||
C.CANT_CLAIM_MORE_PLOTS);
|
Captions.CANT_CLAIM_MORE_PLOTS);
|
||||||
Optional<Double> flag = plot.getFlag(Flags.PRICE);
|
Optional<Double> flag = plot.getFlag(Flags.PRICE);
|
||||||
if (!flag.isPresent()) {
|
if (!flag.isPresent()) {
|
||||||
throw new CommandException(C.NOT_FOR_SALE);
|
throw new CommandException(Captions.NOT_FOR_SALE);
|
||||||
}
|
}
|
||||||
final double price = flag.get();
|
final double price = flag.get();
|
||||||
checkTrue(player.getMoney() >= price, C.CANNOT_AFFORD_PLOT);
|
checkTrue(player.getMoney() >= price, Captions.CANNOT_AFFORD_PLOT);
|
||||||
player.withdraw(price);
|
player.withdraw(price);
|
||||||
// Failure
|
// Failure
|
||||||
// Success
|
// Success
|
||||||
confirm.run(this, () -> {
|
confirm.run(this, () -> {
|
||||||
C.REMOVED_BALANCE.send(player, price);
|
Captions.REMOVED_BALANCE.send(player, price);
|
||||||
EconHandler.manager
|
EconHandler.manager
|
||||||
.depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.owner), price);
|
.depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.owner), price);
|
||||||
PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
|
PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
|
||||||
if (owner != null) {
|
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.removeFlag(Flags.PRICE);
|
||||||
plot.setOwner(player.getUUID());
|
plot.setOwner(player.getUUID());
|
||||||
C.CLAIMED.send(player);
|
Captions.CLAIMED.send(player);
|
||||||
whenDone.run(Buy.this, CommandResult.SUCCESS);
|
whenDone.run(Buy.this, CommandResult.SUCCESS);
|
||||||
}, () -> {
|
}, () -> {
|
||||||
player.deposit(price);
|
player.deposit(price);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
@ -23,7 +23,7 @@ public class Claim extends SubCommand {
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
final Plot plot = loc.getPlotAbs();
|
final Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(player, C.NOT_IN_PLOT);
|
return sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
int currentPlots =
|
int currentPlots =
|
||||||
Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
|
Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
|
||||||
@ -34,40 +34,43 @@ public class Claim extends SubCommand {
|
|||||||
ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots"));
|
ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots"));
|
||||||
if (grants <= 0) {
|
if (grants <= 0) {
|
||||||
player.removePersistentMeta("grantedPlots");
|
player.removePersistentMeta("grantedPlots");
|
||||||
return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS);
|
return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS);
|
return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!plot.canClaim(player)) {
|
if (!plot.canClaim(player)) {
|
||||||
return sendMessage(player, C.PLOT_IS_CLAIMED);
|
return sendMessage(player, Captions.PLOT_IS_CLAIMED);
|
||||||
}
|
}
|
||||||
final PlotArea area = plot.getArea();
|
final PlotArea area = plot.getArea();
|
||||||
if (!schematic.isEmpty()) {
|
if (!schematic.isEmpty()) {
|
||||||
if (area.SCHEMATIC_CLAIM_SPECIFY) {
|
if (area.SCHEMATIC_CLAIM_SPECIFY) {
|
||||||
if (!area.SCHEMATICS.contains(schematic.toLowerCase())) {
|
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))
|
if (!Permissions
|
||||||
&& !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
|
||||||
return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic);
|
&& !Permissions
|
||||||
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||||
|
return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int border = area.getBorder();
|
int border = area.getBorder();
|
||||||
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border) {
|
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) {
|
if ((EconHandler.manager != null) && area.USE_ECONOMY) {
|
||||||
Expression<Double> costExr = area.PRICES.get("claim");
|
Expression<Double> costExr = area.PRICES.get("claim");
|
||||||
double cost = costExr.evaluate((double) currentPlots);
|
double cost = costExr.evaluate((double) currentPlots);
|
||||||
if (cost > 0d) {
|
if (cost > 0d) {
|
||||||
if (EconHandler.manager.getMoney(player) < cost) {
|
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);
|
EconHandler.manager.withdrawMoney(player, cost);
|
||||||
sendMessage(player, C.REMOVED_BALANCE, cost + "");
|
sendMessage(player, Captions.REMOVED_BALANCE, cost + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (grants > 0) {
|
if (grants > 0) {
|
||||||
@ -77,7 +80,7 @@ public class Claim extends SubCommand {
|
|||||||
player.setPersistentMeta("grantedPlots",
|
player.setPersistentMeta("grantedPlots",
|
||||||
ByteArrayUtilities.integerToBytes(grants - 1));
|
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)) {
|
if (plot.canClaim(player)) {
|
||||||
plot.owner = player.getUUID();
|
plot.owner = player.getUUID();
|
||||||
@ -89,10 +92,10 @@ public class Claim extends SubCommand {
|
|||||||
plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
|
plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}), () -> sendMessage(player, C.PLOT_NOT_CLAIMED));
|
}), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, C.PLOT_NOT_CLAIMED);
|
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
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,
|
@Override public void execute(final PlotPlayer player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||||
checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage());
|
checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage());
|
||||||
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
|
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||||
checkTrue(plot.isOwner(player.getUUID()) || Permissions
|
checkTrue(plot.isOwner(player.getUUID()) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CLEAR), C.NO_PLOT_PERMS);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CLEAR),
|
||||||
checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER);
|
Captions.NO_PLOT_PERMS);
|
||||||
|
checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER);
|
||||||
checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions
|
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() {
|
confirm.run(this, new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
@ -51,14 +52,14 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
|
|||||||
if (plot.getFlag(Flags.ANALYSIS).isPresent()) {
|
if (plot.getFlag(Flags.ANALYSIS).isPresent()) {
|
||||||
FlagManager.removePlotFlag(plot, Flags.ANALYSIS);
|
FlagManager.removePlotFlag(plot, Flags.ANALYSIS);
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.CLEARING_DONE,
|
MainUtil.sendMessage(player, Captions.CLEARING_DONE,
|
||||||
"" + (System.currentTimeMillis() - start));
|
"" + (System.currentTimeMillis() - start));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
} else {
|
} else {
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
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
|
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
// return arguments
|
// return arguments
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_AVAILABLE_ARGS);
|
MainUtil.sendMessage(player, Captions.CLUSTER_AVAILABLE_ARGS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String sub = args[0].toLowerCase();
|
String sub = args[0].toLowerCase();
|
||||||
switch (sub) {
|
switch (sub) {
|
||||||
case "l":
|
case "l":
|
||||||
case "list": {
|
case "list": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LIST)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LIST)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LIST);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_LIST);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster list");
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster list");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<PlotCluster> clusters = area.getClusters();
|
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) {
|
for (PlotCluster cluster : clusters) {
|
||||||
// Ignore unmanaged clusters
|
// Ignore unmanaged clusters
|
||||||
String name = "'" + cluster.getName() + "' : " + cluster.toString();
|
String name = "'" + cluster.getName() + "' : " + cluster.toString();
|
||||||
if (player.getUUID().equals(cluster.owner)) {
|
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())) {
|
} 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())) {
|
} 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 {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, cluster.toString());
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, cluster.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "c":
|
case "c":
|
||||||
case "create": {
|
case "create": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_CREATE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_CREATE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 4) {
|
if (args.length != 4) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot cluster create <name> <id-bot> <id-top>");
|
"/plot cluster create <name> <id-bot> <id-top>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -82,7 +85,7 @@ import java.util.UUID;
|
|||||||
player.getClusterCount() :
|
player.getClusterCount() :
|
||||||
player.getPlotCount(player.getLocation().getWorld());
|
player.getPlotCount(player.getLocation().getWorld());
|
||||||
if (currentClusters >= player.getAllowedPlots()) {
|
if (currentClusters >= player.getAllowedPlots()) {
|
||||||
return sendMessage(player, C.CANT_CLAIM_MORE_CLUSTERS);
|
return sendMessage(player, Captions.CANT_CLAIM_MORE_CLUSTERS);
|
||||||
}
|
}
|
||||||
PlotId pos1;
|
PlotId pos1;
|
||||||
PlotId pos2;
|
PlotId pos2;
|
||||||
@ -91,13 +94,13 @@ import java.util.UUID;
|
|||||||
pos1 = PlotId.fromString(args[2]);
|
pos1 = PlotId.fromString(args[2]);
|
||||||
pos2 = PlotId.fromString(args[3]);
|
pos2 = PlotId.fromString(args[3]);
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if name is taken
|
// check if name is taken
|
||||||
String name = args[1];
|
String name = args[1];
|
||||||
if (area.getCluster(name) != null) {
|
if (area.getCluster(name) != null) {
|
||||||
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
|
MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pos2.x < pos1.x || pos2.y < pos1.y) {
|
if (pos2.x < pos1.x || pos2.y < pos1.y) {
|
||||||
@ -108,22 +111,23 @@ import java.util.UUID;
|
|||||||
//check if overlap
|
//check if overlap
|
||||||
PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2);
|
PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2);
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_INTERSECTION, cluster.getName());
|
MainUtil.sendMessage(player, Captions.CLUSTER_INTERSECTION, cluster.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check if it occupies existing plots
|
// Check if it occupies existing plots
|
||||||
if (!area.contains(pos1) || !area.contains(pos2)) {
|
if (!area.contains(pos1) || !area.contains(pos2)) {
|
||||||
C.CLUSTER_OUTSIDE.send(player, area);
|
Captions.CLUSTER_OUTSIDE.send(player, area);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
|
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
|
||||||
if (!plots.isEmpty()) {
|
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();
|
UUID uuid = player.getUUID();
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
if (!plot.isOwner(uuid)) {
|
if (!plot.isOwner(uuid)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_CLUSTER_CREATE_OTHER);
|
Captions.PERMISSION_CLUSTER_CREATE_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,11 +141,12 @@ import java.util.UUID;
|
|||||||
} else {
|
} else {
|
||||||
current = player.getPlayerClusterCount(player.getLocation().getWorld());
|
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);
|
Settings.Limit.MAX_PLOTS);
|
||||||
if (current + cluster.getArea() > allowed) {
|
if (current + cluster.getArea() > allowed) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()));
|
Captions.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// create cluster
|
// create cluster
|
||||||
@ -157,58 +162,62 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_ADDED);
|
MainUtil.sendMessage(player, Captions.CLUSTER_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "disband":
|
case "disband":
|
||||||
case "del":
|
case "del":
|
||||||
case "delete": {
|
case "delete": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_DELETE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_DELETE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1 && args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = area.getCluster(args[1]);
|
cluster = area.getCluster(args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]);
|
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = area.getCluster(player.getLocation());
|
cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
|
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cluster.owner.equals(player.getUUID())) {
|
if (!cluster.owner.equals(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE_OTHER)) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE_OTHER)) {
|
||||||
C.PERMISSION_CLUSTER_DELETE_OTHER);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_DELETE_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBFunc.delete(cluster);
|
DBFunc.delete(cluster);
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_DELETED);
|
MainUtil.sendMessage(player, Captions.CLUSTER_DELETED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "res":
|
case "res":
|
||||||
case "resize": {
|
case "resize": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_RESIZE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot cluster resize <pos1> <pos2>");
|
"/plot cluster resize <pos1> <pos2>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -219,7 +228,7 @@ import java.util.UUID;
|
|||||||
pos1 = PlotId.fromString(args[2]);
|
pos1 = PlotId.fromString(args[2]);
|
||||||
pos2 = PlotId.fromString(args[3]);
|
pos2 = PlotId.fromString(args[3]);
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pos2.x < pos1.x || pos2.y < pos1.y) {
|
if (pos2.x < pos1.x || pos2.y < pos1.y) {
|
||||||
@ -229,25 +238,27 @@ import java.util.UUID;
|
|||||||
// check if in cluster
|
// check if in cluster
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
|
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_OTHER)) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_OTHER)) {
|
||||||
C.PERMISSION_CLUSTER_RESIZE_OTHER);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_RESIZE_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//check if overlap
|
//check if overlap
|
||||||
PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2);
|
PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2);
|
||||||
if (intersect != null) {
|
if (intersect != null) {
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_INTERSECTION, intersect.getName());
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.CLUSTER_INTERSECTION, intersect.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Plot> existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2());
|
Set<Plot> existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2());
|
||||||
@ -258,17 +269,19 @@ import java.util.UUID;
|
|||||||
removed.removeAll(newPlots);
|
removed.removeAll(newPlots);
|
||||||
// Check expand / shrink
|
// Check expand / shrink
|
||||||
if (!removed.isEmpty()) {
|
if (!removed.isEmpty()) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
|
||||||
C.PERMISSION_CLUSTER_RESIZE_SHRINK);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_RESIZE_SHRINK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newPlots.removeAll(existing);
|
newPlots.removeAll(existing);
|
||||||
if (!newPlots.isEmpty()) {
|
if (!newPlots.isEmpty()) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
|
||||||
C.PERMISSION_CLUSTER_RESIZE_EXPAND);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_RESIZE_EXPAND);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,50 +293,53 @@ import java.util.UUID;
|
|||||||
current = player.getPlayerClusterCount(player.getLocation().getWorld());
|
current = player.getPlayerClusterCount(player.getLocation().getWorld());
|
||||||
}
|
}
|
||||||
current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y);
|
current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y);
|
||||||
int allowed = Permissions
|
int allowed = Permissions.hasPermissionRange(player, Captions.PERMISSION_CLUSTER,
|
||||||
.hasPermissionRange(player, C.PERMISSION_CLUSTER, Settings.Limit.MAX_PLOTS);
|
Settings.Limit.MAX_PLOTS);
|
||||||
if (current + cluster.getArea() > allowed) {
|
if (current + cluster.getArea() > allowed) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea()));
|
Captions.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// resize cluster
|
// resize cluster
|
||||||
DBFunc.resizeCluster(cluster, pos1, pos2);
|
DBFunc.resizeCluster(cluster, pos1, pos2);
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_RESIZED);
|
MainUtil.sendMessage(player, Captions.CLUSTER_RESIZED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "add":
|
case "add":
|
||||||
case "inv":
|
case "inv":
|
||||||
case "invite": {
|
case "invite": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INVITE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_INVITE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
// check if in cluster
|
// check if in cluster
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
|
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE_OTHER)) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE_OTHER)) {
|
||||||
C.PERMISSION_CLUSTER_INVITE_OTHER);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_INVITE_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check uuid
|
// check uuid
|
||||||
UUID uuid = UUIDHandler.getUUID(args[1], null);
|
UUID uuid = UUIDHandler.getUUID(args[1], null);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[2]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[2]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.isAdded(uuid)) {
|
if (!cluster.isAdded(uuid)) {
|
||||||
@ -332,49 +348,52 @@ import java.util.UUID;
|
|||||||
DBFunc.setInvited(cluster, uuid);
|
DBFunc.setInvited(cluster, uuid);
|
||||||
PlotPlayer player2 = UUIDHandler.getPlayer(uuid);
|
PlotPlayer player2 = UUIDHandler.getPlayer(uuid);
|
||||||
if (player2 != null) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
case "k":
|
case "k":
|
||||||
case "remove":
|
case "remove":
|
||||||
case "kick": {
|
case "kick": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_KICK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
|
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK_OTHER)) {
|
if (!Permissions
|
||||||
MainUtil
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK_OTHER)) {
|
||||||
.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK_OTHER);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_KICK_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check uuid
|
// check uuid
|
||||||
UUID uuid = UUIDHandler.getUUID(args[1], null);
|
UUID uuid = UUIDHandler.getUUID(args[1], null);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[1]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Can't kick if the player is yourself, the owner, or not added to the cluster
|
// 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
|
if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner) || !cluster
|
||||||
.isAdded(uuid)) {
|
.isAdded(uuid)) {
|
||||||
MainUtil.sendMessage(player, C.CANNOT_KICK_PLAYER, cluster.getName());
|
MainUtil.sendMessage(player, Captions.CANNOT_KICK_PLAYER, cluster.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cluster.helpers.contains(uuid)) {
|
if (cluster.helpers.contains(uuid)) {
|
||||||
@ -385,7 +404,7 @@ import java.util.UUID;
|
|||||||
DBFunc.removeInvited(cluster, uuid);
|
DBFunc.removeInvited(cluster, uuid);
|
||||||
PlotPlayer player2 = UUIDHandler.getPlayer(uuid);
|
PlotPlayer player2 = UUIDHandler.getPlayer(uuid);
|
||||||
if (player2 != null) {
|
if (player2 != null) {
|
||||||
MainUtil.sendMessage(player2, C.CLUSTER_REMOVED, cluster.getName());
|
MainUtil.sendMessage(player2, Captions.CLUSTER_REMOVED, cluster.getName());
|
||||||
}
|
}
|
||||||
for (Plot plot : new ArrayList<>(
|
for (Plot plot : new ArrayList<>(
|
||||||
PlotSquared.get().getPlots(player2.getLocation().getWorld(), uuid))) {
|
PlotSquared.get().getPlots(player2.getLocation().getWorld(), uuid))) {
|
||||||
@ -394,44 +413,46 @@ import java.util.UUID;
|
|||||||
plot.unclaim();
|
plot.unclaim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player2, C.CLUSTER_KICKED_USER);
|
MainUtil.sendMessage(player2, Captions.CLUSTER_KICKED_USER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "quit":
|
case "quit":
|
||||||
case "leave": {
|
case "leave": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LEAVE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LEAVE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LEAVE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_LEAVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1 && args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = area.getCluster(args[1]);
|
cluster = area.getCluster(args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]);
|
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = area.getCluster(player.getLocation());
|
cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
|
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
if (!cluster.isAdded(uuid)) {
|
if (!cluster.isAdded(uuid)) {
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_NOT_ADDED);
|
MainUtil.sendMessage(player, Captions.CLUSTER_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (uuid.equals(cluster.owner)) {
|
if (uuid.equals(cluster.owner)) {
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_CANNOT_LEAVE);
|
MainUtil.sendMessage(player, Captions.CLUSTER_CANNOT_LEAVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cluster.helpers.contains(uuid)) {
|
if (cluster.helpers.contains(uuid)) {
|
||||||
@ -440,7 +461,7 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
cluster.invited.remove(uuid);
|
cluster.invited.remove(uuid);
|
||||||
DBFunc.removeInvited(cluster, 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<>(
|
for (Plot plot : new ArrayList<>(
|
||||||
PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) {
|
PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) {
|
||||||
PlotCluster current = plot.getCluster();
|
PlotCluster current = plot.getCluster();
|
||||||
@ -455,102 +476,107 @@ import java.util.UUID;
|
|||||||
case "admin":
|
case "admin":
|
||||||
case "helper":
|
case "helper":
|
||||||
case "helpers": {
|
case "helpers": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_HELPERS)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_HELPERS)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_HELPERS);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_HELPERS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot cluster helpers <add|remove> <player>");
|
"/plot cluster helpers <add|remove> <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
|
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UUID uuid = UUIDHandler.getUUID(args[2], null);
|
UUID uuid = UUIDHandler.getUUID(args[2], null);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[2]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[2]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args[1].equalsIgnoreCase("add")) {
|
if (args[1].equalsIgnoreCase("add")) {
|
||||||
cluster.helpers.add(uuid);
|
cluster.helpers.add(uuid);
|
||||||
DBFunc.setHelper(cluster, 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")) {
|
if (args[1].equalsIgnoreCase("remove")) {
|
||||||
cluster.helpers.remove(uuid);
|
cluster.helpers.remove(uuid);
|
||||||
DBFunc.removeHelper(cluster, 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>");
|
"/plot cluster helpers <add|remove> <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case "spawn":
|
case "spawn":
|
||||||
case "home":
|
case "home":
|
||||||
case "tp": {
|
case "tp": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_TP);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(args[1]);
|
PlotCluster cluster = area.getCluster(args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]);
|
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
if (!cluster.isAdded(uuid)) {
|
if (!cluster.isAdded(uuid)) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP_OTHER)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP_OTHER)) {
|
||||||
MainUtil
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP_OTHER);
|
Captions.PERMISSION_CLUSTER_TP_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.teleport(cluster.getHome());
|
player.teleport(cluster.getHome());
|
||||||
return MainUtil.sendMessage(player, C.CLUSTER_TELEPORTING);
|
return MainUtil.sendMessage(player, Captions.CLUSTER_TELEPORTING);
|
||||||
}
|
}
|
||||||
case "i":
|
case "i":
|
||||||
case "info":
|
case "info":
|
||||||
case "show":
|
case "show":
|
||||||
case "information": {
|
case "information": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INFO)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INFO)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INFO);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_INFO);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1 && args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = area.getCluster(args[1]);
|
cluster = area.getCluster(args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]);
|
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = area.getCluster(player.getLocation());
|
cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
|
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -563,7 +589,7 @@ import java.util.UUID;
|
|||||||
String size = (cluster.getP2().x - cluster.getP1().x + 1) + "x" + (
|
String size = (cluster.getP2().x - cluster.getP1().x + 1) + "x" + (
|
||||||
cluster.getP2().y - cluster.getP1().y + 1);
|
cluster.getP2().y - cluster.getP1().y + 1);
|
||||||
String rights = cluster.isAdded(player.getUUID()) + "";
|
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("%id%", id);
|
||||||
message = message.replaceAll("%owner%", owner);
|
message = message.replaceAll("%owner%", owner);
|
||||||
message = message.replaceAll("%name%", name);
|
message = message.replaceAll("%name%", name);
|
||||||
@ -575,27 +601,29 @@ import java.util.UUID;
|
|||||||
case "sh":
|
case "sh":
|
||||||
case "setspawn":
|
case "setspawn":
|
||||||
case "sethome":
|
case "sethome":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SETHOME);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_SETHOME);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1 && args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_IN_PLOT_WORLD.send(player);
|
Captions.NOT_IN_PLOT_WORLD.send(player);
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_CLUSTER);
|
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME_OTHER)) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME_OTHER)) {
|
||||||
C.PERMISSION_CLUSTER_SETHOME_OTHER);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_CLUSTER_SETHOME_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -605,9 +633,9 @@ import java.util.UUID;
|
|||||||
cluster.settings.setPosition(blockloc);
|
cluster.settings.setPosition(blockloc);
|
||||||
DBFunc.setPosition(cluster,
|
DBFunc.setPosition(cluster,
|
||||||
relative.getX() + "," + relative.getY() + "," + relative.getZ());
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
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) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
sendMessage(player, C.COMMENT_SYNTAX,
|
sendMessage(player, Captions.COMMENT_SYNTAX,
|
||||||
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
|
CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
|
||||||
if (inbox == null) {
|
if (inbox == null) {
|
||||||
sendMessage(player, C.COMMENT_SYNTAX,
|
sendMessage(player, Captions.COMMENT_SYNTAX,
|
||||||
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ public class Comment extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
id = PlotId.fromString(args[1]);
|
id = PlotId.fromString(args[1]);
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot plot = MainUtil.getPlotFromString(player, args[1], false);
|
Plot plot = MainUtil.getPlotFromString(player, args[1], false);
|
||||||
@ -47,14 +47,14 @@ public class Comment extends SubCommand {
|
|||||||
plot = loc.getPlotAbs();
|
plot = loc.getPlotAbs();
|
||||||
} else {
|
} else {
|
||||||
if (args.length < 4) {
|
if (args.length < 4) {
|
||||||
sendMessage(player, C.COMMENT_SYNTAX,
|
sendMessage(player, Captions.COMMENT_SYNTAX,
|
||||||
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
index = 2;
|
index = 2;
|
||||||
}
|
}
|
||||||
if (!inbox.canWrite(plot, player)) {
|
if (!inbox.canWrite(plot, player)) {
|
||||||
sendMessage(player, C.NO_PERM_INBOX, "");
|
sendMessage(player, Captions.NO_PERM_INBOX, "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " ");
|
String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " ");
|
||||||
@ -63,8 +63,8 @@ public class Comment extends SubCommand {
|
|||||||
System.currentTimeMillis());
|
System.currentTimeMillis());
|
||||||
boolean result = inbox.addComment(plot, comment);
|
boolean result = inbox.addComment(plot, comment);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
sendMessage(player, C.NO_PLOT_INBOX, "");
|
sendMessage(player, Captions.NO_PLOT_INBOX, "");
|
||||||
sendMessage(player, C.COMMENT_SYNTAX,
|
sendMessage(player, Captions.COMMENT_SYNTAX,
|
||||||
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ public class Comment extends SubCommand {
|
|||||||
MainUtil.sendMessage(pp, "/plot comment " + StringMan.join(args, " "));
|
MainUtil.sendMessage(pp, "/plot comment " + StringMan.join(args, " "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendMessage(player, C.COMMENT_ADDED);
|
sendMessage(player, Captions.COMMENT_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.CmdInstance;
|
import com.github.intellectualsites.plotsquared.plot.object.CmdInstance;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
CmdInstance command = CmdConfirm.getPending(player);
|
CmdInstance command = CmdConfirm.getPending(player);
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
MainUtil.sendMessage(player, C.FAILED_CONFIRM);
|
MainUtil.sendMessage(player, Captions.FAILED_CONFIRM);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CmdConfirm.removePending(player);
|
CmdConfirm.removePending(player);
|
||||||
if ((System.currentTimeMillis() - command.timestamp)
|
if ((System.currentTimeMillis() - command.timestamp)
|
||||||
> Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS * 1000) {
|
> Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS * 1000) {
|
||||||
MainUtil.sendMessage(player, C.EXPIRED_CONFIRM);
|
MainUtil.sendMessage(player, Captions.EXPIRED_CONFIRM);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TaskManager.runTask(command.command);
|
TaskManager.runTask(command.command);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
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) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
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
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasFlag(Flags.DONE)) {
|
if (!plot.hasFlag(Flags.DONE)) {
|
||||||
MainUtil.sendMessage(player, C.DONE_NOT_DONE);
|
MainUtil.sendMessage(player, Captions.DONE_NOT_DONE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int size = plot.getConnectedPlots().size();
|
int size = plot.getConnectedPlots().size();
|
||||||
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots()
|
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots()
|
||||||
< player.getPlotCount() + size)) {
|
< 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;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.removeFlag(Flags.DONE);
|
plot.removeFlag(Flags.DONE);
|
||||||
MainUtil.sendMessage(player, C.DONE_REMOVED);
|
MainUtil.sendMessage(player, Captions.DONE_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -16,15 +16,15 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
Plot plot1 = loc.getPlotAbs();
|
Plot plot1 = loc.getPlotAbs();
|
||||||
if (plot1 == null) {
|
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
|
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN.s())) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN.s())) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
||||||
@ -32,22 +32,22 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot1.equals(plot2)) {
|
if (plot1.equals(plot2)) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
||||||
C.PLOTWORLD_INCOMPATIBLE.send(player);
|
Captions.PLOTWORLD_INCOMPATIBLE.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot1.copy(plot2, new Runnable() {
|
if (plot1.copy(plot2, new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
MainUtil.sendMessage(player, C.COPY_SUCCESS);
|
MainUtil.sendMessage(player, Captions.COPY_SUCCESS);
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.REQUIRES_UNOWNED);
|
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.HybridPlotWorld;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
@ -19,10 +19,10 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
Plot plot = loc.getPlotAbs();
|
Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(player, C.NOT_IN_PLOT);
|
return sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!(loc.getPlotArea() instanceof HybridPlotWorld)) {
|
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);
|
HybridUtils.manager.setupRoadSchematic(plot);
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
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) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
for (C caption : C.values()) {
|
for (Captions caption : Captions.values()) {
|
||||||
msg.append(caption.s()).append("\n");
|
msg.append(caption.s()).append("\n");
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, msg.toString());
|
MainUtil.sendMessage(player, msg.toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
StringBuilder information = new StringBuilder();
|
StringBuilder information = new StringBuilder();
|
||||||
String header = C.DEBUG_HEADER.s();
|
String header = Captions.DEBUG_HEADER.s();
|
||||||
String line = C.DEBUG_LINE.s();
|
String line = Captions.DEBUG_LINE.s();
|
||||||
String section = C.DEBUG_SECTION.s();
|
String section = Captions.DEBUG_SECTION.s();
|
||||||
information.append(header);
|
information.append(header);
|
||||||
information.append(getSection(section, "PlotArea"));
|
information.append(getSection(section, "PlotArea"));
|
||||||
information.append(
|
information.append(
|
||||||
getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", ")));
|
getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", ")));
|
||||||
information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size()));
|
information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size()));
|
||||||
information.append(getSection(section, "Messages"));
|
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"));
|
information.append(getLine(line, "View all captions", "/plot debug msg"));
|
||||||
MainUtil.sendMessage(player, information.toString());
|
MainUtil.sendMessage(player, information.toString());
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.PlotPlayer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -19,10 +19,10 @@ import java.util.UUID;
|
|||||||
|
|
||||||
if (unsafeAllowed.contains(player.getUUID())) {
|
if (unsafeAllowed.contains(player.getUUID())) {
|
||||||
unsafeAllowed.remove(player.getUUID());
|
unsafeAllowed.remove(player.getUUID());
|
||||||
sendMessage(player, C.DEBUGALLOWUNSAFE_OFF);
|
sendMessage(player, Captions.DEBUGALLOWUNSAFE_OFF);
|
||||||
} else {
|
} else {
|
||||||
unsafeAllowed.add(player.getUUID());
|
unsafeAllowed.add(player.getUUID());
|
||||||
sendMessage(player, C.DEBUGALLOWUNSAFE_ON);
|
sendMessage(player, Captions.DEBUGALLOWUNSAFE_ON);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||||
@ -29,7 +29,7 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||||
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
PlotId min, max;
|
PlotId min, max;
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
@ -111,7 +111,7 @@ import java.util.*;
|
|||||||
this.scope.put("MainCommand", MainCommand.getInstance());
|
this.scope.put("MainCommand", MainCommand.getInstance());
|
||||||
|
|
||||||
// enums
|
// enums
|
||||||
for (Enum<?> value : C.values()) {
|
for (Enum<?> value : Captions.values()) {
|
||||||
this.scope.put("C_" + value.name(), value);
|
this.scope.put("C_" + value.name(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ import java.util.*;
|
|||||||
case "analyze": {
|
case "analyze": {
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotAnalysis analysis = plot.getComplexity(null);
|
PlotAnalysis analysis = plot.getComplexity(null);
|
||||||
@ -148,7 +148,7 @@ import java.util.*;
|
|||||||
}
|
}
|
||||||
case "calibrate-analysis":
|
case "calibrate-analysis":
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot debugexec analyze <threshold>");
|
"/plot debugexec analyze <threshold>");
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"$1<threshold> $2= $1The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating "
|
"$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.");
|
return MainUtil.sendMessage(player, "Cancelled task.");
|
||||||
case "remove-flag":
|
case "remove-flag":
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot debugexec remove-flag <flag>");
|
"/plot debugexec remove-flag <flag>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ import java.util.*;
|
|||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
boolean result;
|
boolean result;
|
||||||
@ -274,15 +274,15 @@ import java.util.*;
|
|||||||
DebugExec.this.engine.eval(cmd, DebugExec.this.scope);
|
DebugExec.this.engine.eval(cmd, DebugExec.this.scope);
|
||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil.sendMessage(player, C.COMMAND_WENT_WRONG);
|
MainUtil.sendMessage(player, Captions.COMMAND_WENT_WRONG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
.sendMessage(player, C.COMMAND_SYNTAX, "/plot debugexec addcmd <file>");
|
"/plot debugexec addcmd <file>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case "runasync":
|
case "runasync":
|
||||||
@ -322,7 +322,8 @@ import java.util.*;
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot debugexec list-scripts [#]");
|
Captions.COMMAND_SYNTAX
|
||||||
|
.send(player, "/plot debugexec list-scripts [#]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +340,7 @@ import java.util.*;
|
|||||||
return true;
|
return true;
|
||||||
case "allcmd":
|
case "allcmd":
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
C.COMMAND_SYNTAX
|
Captions.COMMAND_SYNTAX
|
||||||
.send(player, "/plot debugexec allcmd <condition> <command>");
|
.send(player, "/plot debugexec allcmd <condition> <command>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -379,7 +380,8 @@ import java.util.*;
|
|||||||
break;
|
break;
|
||||||
case "all":
|
case "all":
|
||||||
if (args.length < 3) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
script =
|
script =
|
||||||
@ -392,7 +394,7 @@ import java.util.*;
|
|||||||
script = StringMan.join(args, " ");
|
script = StringMan.join(args, " ");
|
||||||
}
|
}
|
||||||
if (!(player instanceof ConsolePlayer)) {
|
if (!(player instanceof ConsolePlayer)) {
|
||||||
MainUtil.sendMessage(player, C.NOT_CONSOLE);
|
MainUtil.sendMessage(player, Captions.NOT_CONSOLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
init();
|
init();
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
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) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||||
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, "&8--- &6Starting task &8 ---");
|
MainUtil.sendMessage(player, "&8--- &6Starting task &8 ---");
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.IncendoPaster;
|
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 pasteId = jsonObject.get("paste_id").getAsString();
|
||||||
final String link =
|
final String link =
|
||||||
String.format("https://incendo.org/paste/view/%s", pasteId);
|
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 {
|
} else {
|
||||||
final String responseMessage = jsonObject.get("response").getAsString();
|
final String responseMessage = jsonObject.get("response").getAsString();
|
||||||
MainUtil.sendMessage(player, String
|
MainUtil.sendMessage(player, String
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.HybridPlotManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
@ -20,13 +20,13 @@ public class DebugRoadRegen extends SubCommand {
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
PlotArea plotArea = loc.getPlotArea();
|
PlotArea plotArea = loc.getPlotArea();
|
||||||
if (!(plotArea instanceof HybridPlotWorld)) {
|
if (!(plotArea instanceof HybridPlotWorld)) {
|
||||||
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
C.NOT_IN_PLOT.send(player);
|
Captions.NOT_IN_PLOT.send(player);
|
||||||
} else if (plot.isMerged()) {
|
} else if (plot.isMerged()) {
|
||||||
C.REQUIRES_UNMERGED.send(player);
|
Captions.REQUIRES_UNMERGED.send(player);
|
||||||
} else {
|
} else {
|
||||||
HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager();
|
HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager();
|
||||||
manager.createRoadEast(plotArea, plot);
|
manager.createRoadEast(plotArea, plot);
|
||||||
|
@ -16,14 +16,10 @@ import java.util.ArrayList;
|
|||||||
public class DebugSaveTest extends SubCommand {
|
public class DebugSaveTest extends SubCommand {
|
||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
ArrayList<Plot> plots = new ArrayList<Plot>();
|
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||||
plots.addAll(PlotSquared.get().getPlots());
|
|
||||||
MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`");
|
MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`");
|
||||||
DBFunc.createPlotsAndData(plots, new Runnable() {
|
DBFunc.createPlotsAndData(plots,
|
||||||
@Override public void run() {
|
() -> MainUtil.sendMessage(player, "&6Database sync finished!"));
|
||||||
MainUtil.sendMessage(player, "&6Database sync finished!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||||
@ -19,14 +19,14 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
final Plot plot = loc.getPlotAbs();
|
final Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return !sendMessage(player, C.PLOT_UNOWNED);
|
return !sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DELETE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DELETE)) {
|
||||||
return !sendMessage(player, C.NO_PLOT_PERMS);
|
return !sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
}
|
}
|
||||||
final PlotArea plotArea = plot.getArea();
|
final PlotArea plotArea = plot.getArea();
|
||||||
final java.util.Set<Plot> plots = plot.getConnectedPlots();
|
final java.util.Set<Plot> plots = plot.getConnectedPlots();
|
||||||
@ -35,7 +35,7 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
|
|||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
@ -47,17 +47,17 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
|
|||||||
double value = plots.size() * valueExr.evaluate((double) currentPlots);
|
double value = plots.size() * valueExr.evaluate((double) currentPlots);
|
||||||
if (value > 0d) {
|
if (value > 0d) {
|
||||||
EconHandler.manager.depositMoney(player, value);
|
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);
|
System.currentTimeMillis() - start);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (result) {
|
if (result) {
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -28,38 +28,38 @@ import java.util.UUID;
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
||||||
if (uuids.isEmpty()) {
|
if (uuids.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Iterator<UUID> iter = uuids.iterator();
|
Iterator<UUID> iter = uuids.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
UUID uuid = iter.next();
|
UUID uuid = iter.next();
|
||||||
if (uuid == DBFunc.EVERYONE && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, C.PERMISSION_DENY_EVERYONE) || Permissions
|
Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY))) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plot.isOwner(uuid)) {
|
if (plot.isOwner(uuid)) {
|
||||||
MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plot.getDenied().contains(uuid)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (uuid != DBFunc.EVERYONE) {
|
if (uuid != DBFunc.EVERYONE) {
|
||||||
@ -77,7 +77,7 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!uuids.isEmpty()) {
|
if (!uuids.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, C.DENIED_ADDED);
|
MainUtil.sendMessage(player, Captions.DENIED_ADDED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -97,13 +97,13 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
Location spawn = WorldUtil.IMP.getSpawn(loc.getWorld());
|
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())) {
|
if (plot.equals(spawn.getPlot())) {
|
||||||
Location newSpawn =
|
Location newSpawn =
|
||||||
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
|
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
|
||||||
if (plot.equals(newSpawn.getPlot())) {
|
if (plot.equals(newSpawn.getPlot())) {
|
||||||
// Kick from server if you can't be teleported to spawn
|
// 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 {
|
} else {
|
||||||
player.teleport(newSpawn);
|
player.teleport(newSpawn);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.FlagManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
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) {
|
@Override public boolean set(PlotPlayer player, Plot plot, String desc) {
|
||||||
if (desc.isEmpty()) {
|
if (desc.isEmpty()) {
|
||||||
plot.removeFlag(Flags.DESCRIPTION);
|
plot.removeFlag(Flags.DESCRIPTION);
|
||||||
MainUtil.sendMessage(player, C.DESC_UNSET);
|
MainUtil.sendMessage(player, Captions.DESC_UNSET);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean result = FlagManager.addPlotFlag(plot, Flags.DESCRIPTION, desc);
|
boolean result = FlagManager.addPlotFlag(plot, Flags.DESCRIPTION, desc);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, C.FLAG_NOT_ADDED);
|
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.DESC_SET);
|
MainUtil.sendMessage(player, Captions.DESC_SET);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
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();
|
Location loc = player.getLocation();
|
||||||
final Plot plot = loc.getPlotAbs();
|
final Plot plot = loc.getPlotAbs();
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
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
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DONE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DONE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.hasFlag(Flags.DONE)) {
|
if (plot.hasFlag(Flags.DONE)) {
|
||||||
MainUtil.sendMessage(player, C.DONE_ALREADY_DONE);
|
MainUtil.sendMessage(player, Captions.DONE_ALREADY_DONE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
MainUtil.sendMessage(player, C.GENERATING_LINK);
|
MainUtil.sendMessage(player, Captions.GENERATING_LINK);
|
||||||
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
|
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
|
||||||
if (ExpireManager.IMP == null || doneRequirements == null) {
|
if (ExpireManager.IMP == null || doneRequirements == null) {
|
||||||
finish(plot, player, true);
|
finish(plot, player, true);
|
||||||
@ -60,9 +60,9 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
|
|||||||
if (success) {
|
if (success) {
|
||||||
long flagValue = System.currentTimeMillis() / 1000;
|
long flagValue = System.currentTimeMillis() / 1000;
|
||||||
plot.setFlag(Flags.DONE, flagValue);
|
plot.setFlag(Flags.DONE, flagValue);
|
||||||
MainUtil.sendMessage(pp, C.DONE_SUCCESS);
|
MainUtil.sendMessage(pp, Captions.DONE_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(pp, C.DONE_INSUFFICIENT_COMPLEXITY);
|
MainUtil.sendMessage(pp, Captions.DONE_INSUFFICIENT_COMPLEXITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
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();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent()))
|
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent()))
|
||||||
&& !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
|
&& !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
|
||||||
MainUtil.sendMessage(player, C.DONE_NOT_DONE);
|
MainUtil.sendMessage(player, Captions.DONE_NOT_DONE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((!plot.isOwner(player.getUUID())) && !Permissions
|
if ((!plot.isOwner(player.getUUID())) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN.s())) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN.s())) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 0 || (args.length == 1 && StringMan
|
if (args.length == 0 || (args.length == 1 && StringMan
|
||||||
.isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) {
|
.isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) {
|
||||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||||
C.SCHEMATIC_TOO_LARGE.send(player);
|
Captions.SCHEMATIC_TOO_LARGE.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
@ -58,7 +58,7 @@ import java.net.URL;
|
|||||||
SchematicHandler.manager.upload(value, null, null, new RunnableVal<URL>() {
|
SchematicHandler.manager.upload(value, null, null, new RunnableVal<URL>() {
|
||||||
@Override public void run(URL url) {
|
@Override public void run(URL url) {
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED);
|
MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, url.toString());
|
MainUtil.sendMessage(player, url.toString());
|
||||||
@ -68,8 +68,8 @@ import java.net.URL;
|
|||||||
});
|
});
|
||||||
} else if (args.length == 1 && StringMan
|
} else if (args.length == 1 && StringMan
|
||||||
.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
|
.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_DOWNLOAD_WORLD)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_DOWNLOAD_WORLD)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_DOWNLOAD_WORLD);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_DOWNLOAD_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512");
|
MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512");
|
||||||
@ -79,17 +79,17 @@ import java.net.URL;
|
|||||||
@Override public void run(URL url) {
|
@Override public void run(URL url) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED);
|
MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, url.toString());
|
MainUtil.sendMessage(player, url.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.GENERATING_LINK);
|
MainUtil.sendMessage(player, Captions.GENERATING_LINK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.*;
|
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) {
|
private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) {
|
||||||
key = key.toLowerCase();
|
key = key.toLowerCase();
|
||||||
value = value.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)) {
|
if (flag instanceof IntegerFlag && MathMan.isInteger(value)) {
|
||||||
try {
|
try {
|
||||||
int numeric = Integer.parseInt(value);
|
int numeric = Integer.parseInt(value);
|
||||||
@ -33,8 +34,8 @@ import java.util.*;
|
|||||||
Settings.Limit.MAX_PLOTS;
|
Settings.Limit.MAX_PLOTS;
|
||||||
final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric;
|
final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_SET_FLAG_KEY_VALUE
|
Captions.PERMISSION_SET_FLAG_KEY_VALUE
|
||||||
.f(key.toLowerCase(), value.toLowerCase()));
|
.f(key.toLowerCase(), value.toLowerCase()));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -46,12 +47,13 @@ import java.util.*;
|
|||||||
final PlotBlockListFlag blockListFlag = (PlotBlockListFlag) flag;
|
final PlotBlockListFlag blockListFlag = (PlotBlockListFlag) flag;
|
||||||
final HashSet<PlotBlock> parsedBlocks = blockListFlag.parseValue(value);
|
final HashSet<PlotBlock> parsedBlocks = blockListFlag.parseValue(value);
|
||||||
for (final PlotBlock block : parsedBlocks) {
|
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());
|
.f(key.toLowerCase(), block.getRawId().toString().toLowerCase());
|
||||||
final boolean result = Permissions.hasPermission(player, permission);
|
final boolean result = Permissions.hasPermission(player, permission);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()));
|
Captions.PERMISSION_SET_FLAG_KEY_VALUE
|
||||||
|
.f(key.toLowerCase(), value.toLowerCase()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,8 +61,8 @@ import java.util.*;
|
|||||||
}
|
}
|
||||||
final boolean result = Permissions.hasPermission(player, perm);
|
final boolean result = Permissions.hasPermission(player, perm);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()));
|
Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -75,22 +77,24 @@ import java.util.*;
|
|||||||
* plot flag list
|
* plot flag list
|
||||||
*/
|
*/
|
||||||
if (args.length == 0) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
Plot plot = loc.getPlotAbs();
|
Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(player, C.PLOT_NOT_CLAIMED);
|
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_SET_FLAG_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_OTHER);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Flag<?> flag = null;
|
Flag<?> flag = null;
|
||||||
@ -103,41 +107,43 @@ import java.util.*;
|
|||||||
new StringComparison<>(args[1], Flags.getFlags());
|
new StringComparison<>(args[1], Flags.getFlags());
|
||||||
String best = stringComparison.getBestMatch();
|
String best = stringComparison.getBestMatch();
|
||||||
if (best != null) {
|
if (best != null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_FLAG_SUGGESTED, best);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG_SUGGESTED, best);
|
||||||
suggested = true;
|
suggested = true;
|
||||||
}
|
}
|
||||||
} catch (final Exception ignored) { /* Happens sometimes because of mean code */ }
|
} catch (final Exception ignored) { /* Happens sometimes because of mean code */ }
|
||||||
if (!suggested) {
|
if (!suggested) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_FLAG);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "info": {
|
case "info": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.info");
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.flag.info");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
// flag key
|
// flag key
|
||||||
MainUtil.sendMessage(player, C.FLAG_KEY, flag.getName());
|
MainUtil.sendMessage(player, Captions.FLAG_KEY, flag.getName());
|
||||||
// flag type
|
// flag type
|
||||||
MainUtil.sendMessage(player, C.FLAG_TYPE, flag.getClass().getSimpleName());
|
MainUtil.sendMessage(player, Captions.FLAG_TYPE, flag.getClass().getSimpleName());
|
||||||
// Flag type description
|
// Flag type description
|
||||||
MainUtil.sendMessage(player, C.FLAG_DESC, flag.getValueDescription());
|
MainUtil.sendMessage(player, Captions.FLAG_DESC, flag.getValueDescription());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "set": {
|
case "set": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 3) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||||
@ -151,27 +157,28 @@ import java.util.*;
|
|||||||
}
|
}
|
||||||
boolean result = plot.setFlag(flag, parsed);
|
boolean result = plot.setFlag(flag, parsed);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, C.FLAG_NOT_ADDED);
|
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.FLAG_ADDED);
|
MainUtil.sendMessage(player, Captions.FLAG_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "remove": {
|
case "remove": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_REMOVE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_REMOVE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_REMOVE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_FLAG_REMOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2 && args.length != 3) {
|
if (args.length != 2 && args.length != 3) {
|
||||||
MainUtil
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
|
"/plot flag remove <flag> [values]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions
|
if (!Permissions.hasPermission(player,
|
||||||
.hasPermission(player, C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) {
|
Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) {
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()));
|
Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (String entry : args[2].split(",")) {
|
for (String entry : args[2].split(",")) {
|
||||||
@ -190,16 +197,16 @@ import java.util.*;
|
|||||||
if (flag1.get().isEmpty()) {
|
if (flag1.get().isEmpty()) {
|
||||||
final boolean result = plot.removeFlag(flag);
|
final boolean result = plot.removeFlag(flag);
|
||||||
if (result) {
|
if (result) {
|
||||||
MainUtil.sendMessage(player, C.FLAG_REMOVED);
|
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED);
|
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.FLAG_REMOVED);
|
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED);
|
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,7 +215,7 @@ import java.util.*;
|
|||||||
} else {
|
} else {
|
||||||
boolean result = plot.removeFlag(flag);
|
boolean result = plot.removeFlag(flag);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED);
|
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,17 +224,18 @@ import java.util.*;
|
|||||||
} else if (flag == Flags.WEATHER) {
|
} else if (flag == Flags.WEATHER) {
|
||||||
player.setWeather(PlotWeather.RESET);
|
player.setWeather(PlotWeather.RESET);
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.FLAG_REMOVED);
|
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "add":
|
case "add":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_ADD)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_ADD)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_ADD);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_ADD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
MainUtil
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag add <flag> <values>");
|
"/plot flag add <flag> <values>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (String entry : args[2].split(",")) {
|
for (String entry : args[2].split(",")) {
|
||||||
@ -248,28 +256,29 @@ import java.util.*;
|
|||||||
if (flag1.isPresent()) {
|
if (flag1.isPresent()) {
|
||||||
boolean o = flag1.get().addAll((Collection) parsed);
|
boolean o = flag1.get().addAll((Collection) parsed);
|
||||||
if (o) {
|
if (o) {
|
||||||
MainUtil.sendMessage(player, C.FLAG_ADDED);
|
MainUtil.sendMessage(player, Captions.FLAG_ADDED);
|
||||||
val = flag1.get();
|
val = flag1.get();
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.FLAG_NOT_ADDED);
|
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean result = plot.setFlag(flag, val);
|
boolean result = plot.setFlag(flag, val);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, C.FLAG_NOT_ADDED);
|
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.FLAG_ADDED);
|
MainUtil.sendMessage(player, Captions.FLAG_ADDED);
|
||||||
return true;
|
return true;
|
||||||
case "list":
|
case "list":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_LIST)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_LIST)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_LIST);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_LIST);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag list");
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag list");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
HashMap<String, ArrayList<String>> flags = new HashMap<>();
|
HashMap<String, ArrayList<String>> flags = new HashMap<>();
|
||||||
@ -293,7 +302,8 @@ import java.util.*;
|
|||||||
MainUtil.sendMessage(player, message.toString());
|
MainUtil.sendMessage(player, message.toString());
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
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 com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -142,7 +142,7 @@ public class GenerateDocs {
|
|||||||
|
|
||||||
Matcher m2 = p2.matcher(line);
|
Matcher m2 = p2.matcher(line);
|
||||||
while (m2.find()) {
|
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(")) {
|
if (line.contains("Permissions.hasPermission(")) {
|
||||||
String[] split = line.split("Permissions.hasPermission");
|
String[] split = line.split("Permissions.hasPermission");
|
||||||
@ -151,7 +151,7 @@ public class GenerateDocs {
|
|||||||
String perm = method.split("[,|)]")[1].trim();
|
String perm = method.split("[,|)]")[1].trim();
|
||||||
if (!perm.equalsIgnoreCase(perm)) {
|
if (!perm.equalsIgnoreCase(perm)) {
|
||||||
if (perm.startsWith("C.")) {
|
if (perm.startsWith("C.")) {
|
||||||
perm = C.valueOf(perm.split("\\.")[1]).s();
|
perm = Captions.valueOf(perm.split("\\.")[1]).s();
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ public class GenerateDocs {
|
|||||||
String perm = method.split("[,|)]")[1].trim();
|
String perm = method.split("[,|)]")[1].trim();
|
||||||
if (!perm.equalsIgnoreCase(perm)) {
|
if (!perm.equalsIgnoreCase(perm)) {
|
||||||
if (perm.startsWith("C.")) {
|
if (perm.startsWith("C.")) {
|
||||||
perm = C.valueOf(perm.split("\\.")[1]).s();
|
perm = Captions.valueOf(perm.split("\\.")[1]).s();
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
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,
|
@Override public void execute(final PlotPlayer player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
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();
|
final String arg0 = args[0].toLowerCase();
|
||||||
switch (arg0) {
|
switch (arg0) {
|
||||||
case "add":
|
case "add":
|
||||||
case "check":
|
case "check":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_GRANT.f(arg0))) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_GRANT.f(arg0))) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_GRANT.f(arg0));
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_GRANT.f(arg0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.length > 2) {
|
if (args.length > 2) {
|
||||||
@ -41,7 +41,7 @@ import java.util.UUID;
|
|||||||
final UUID uuid =
|
final UUID uuid =
|
||||||
args.length == 2 ? UUIDHandler.getUUIDFromString(args[1]) : player.getUUID();
|
args.length == 2 ? UUIDHandler.getUUIDFromString(args[1]) : player.getUUID();
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
C.INVALID_PLAYER.send(player, args[1]);
|
Captions.INVALID_PLAYER.send(player, args[1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal<byte[]>() {
|
MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal<byte[]>() {
|
||||||
@ -49,7 +49,7 @@ import java.util.UUID;
|
|||||||
if (arg0.equals("check")) { // check
|
if (arg0.equals("check")) { // check
|
||||||
int granted =
|
int granted =
|
||||||
array == null ? 0 : ByteArrayUtilities.bytesToInteger(array);
|
array == null ? 0 : ByteArrayUtilities.bytesToInteger(array);
|
||||||
C.GRANTED_PLOTS.send(player, granted);
|
Captions.GRANTED_PLOTS.send(player, granted);
|
||||||
} else { // add
|
} else { // add
|
||||||
int amount =
|
int amount =
|
||||||
1 + (array == null ? 0 : ByteArrayUtilities.bytesToInteger(array));
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||||
@ -50,7 +50,7 @@ public class Help extends Command {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
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) {
|
if (cat == null && page == 0) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(C.HELP_HEADER.s());
|
builder.append(Captions.HELP_HEADER.s());
|
||||||
for (CommandCategory c : CommandCategory.values()) {
|
for (CommandCategory c : CommandCategory.values()) {
|
||||||
builder.append("\n" + StringMan
|
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()));
|
"%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"));
|
.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);
|
MainUtil.sendMessage(player, builder.toString(), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
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) {
|
public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
|
||||||
if (oldComments == null || oldComments.isEmpty()) {
|
if (oldComments == null || oldComments.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, C.INBOX_EMPTY);
|
MainUtil.sendMessage(player, Captions.INBOX_EMPTY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotComment[] comments = oldComments.toArray(new PlotComment[oldComments.size()]);
|
PlotComment[] comments = oldComments.toArray(new PlotComment[oldComments.size()]);
|
||||||
@ -40,7 +40,7 @@ import java.util.List;
|
|||||||
}
|
}
|
||||||
StringBuilder string = new StringBuilder();
|
StringBuilder string = new StringBuilder();
|
||||||
string.append(StringMan
|
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');
|
page + 1, "%max", totalPages + 1, "%word", "all") + '\n');
|
||||||
|
|
||||||
// This might work xD
|
// This might work xD
|
||||||
@ -62,15 +62,15 @@ import java.util.List;
|
|||||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
sendMessage(player, C.NOT_IN_PLOT);
|
sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(player, C.PLOT_UNOWNED);
|
sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
sendMessage(player, C.COMMAND_SYNTAX,
|
sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot inbox [inbox] [delete <index>|clear|page]");
|
"/plot inbox [inbox] [delete <index>|clear|page]");
|
||||||
for (final CommentInbox inbox : CommentManager.inboxes.values()) {
|
for (final CommentInbox inbox : CommentManager.inboxes.values()) {
|
||||||
if (inbox.canRead(plot, player)) {
|
if (inbox.canRead(plot, player)) {
|
||||||
@ -93,16 +93,16 @@ import java.util.List;
|
|||||||
} else {
|
} else {
|
||||||
color = "";
|
color = "";
|
||||||
}
|
}
|
||||||
sendMessage(player, C.INBOX_ITEM,
|
sendMessage(player, Captions.INBOX_ITEM,
|
||||||
color + inbox.toString() + " (" + total + '/' + unread
|
color + inbox.toString() + " (" + total + '/' + unread
|
||||||
+ ')');
|
+ ')');
|
||||||
return;
|
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());
|
final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
|
||||||
if (inbox == null) {
|
if (inbox == null) {
|
||||||
sendMessage(player, C.INVALID_INBOX,
|
sendMessage(player, Captions.INVALID_INBOX,
|
||||||
StringMan.join(CommentManager.inboxes.keySet(), ", "));
|
StringMan.join(CommentManager.inboxes.keySet(), ", "));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -120,22 +120,22 @@ import java.util.List;
|
|||||||
switch (args[1].toLowerCase()) {
|
switch (args[1].toLowerCase()) {
|
||||||
case "delete":
|
case "delete":
|
||||||
if (!inbox.canModify(plot, player)) {
|
if (!inbox.canModify(plot, player)) {
|
||||||
sendMessage(player, C.NO_PERM_INBOX_MODIFY);
|
sendMessage(player, Captions.NO_PERM_INBOX_MODIFY);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
sendMessage(player, C.COMMAND_SYNTAX,
|
sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot inbox " + inbox.toString() + " delete <index>");
|
"/plot inbox " + inbox.toString() + " delete <index>");
|
||||||
}
|
}
|
||||||
final int index;
|
final int index;
|
||||||
try {
|
try {
|
||||||
index = Integer.parseInt(args[2]);
|
index = Integer.parseInt(args[2]);
|
||||||
if (index < 1) {
|
if (index < 1) {
|
||||||
sendMessage(player, C.NOT_VALID_INBOX_INDEX, index + "");
|
sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
sendMessage(player, C.COMMAND_SYNTAX,
|
sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot inbox " + inbox.toString() + " delete <index>");
|
"/plot inbox " + inbox.toString() + " delete <index>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -143,35 +143,35 @@ import java.util.List;
|
|||||||
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
||||||
@Override public void run(List<PlotComment> value) {
|
@Override public void run(List<PlotComment> value) {
|
||||||
if (index > value.size()) {
|
if (index > value.size()) {
|
||||||
sendMessage(player, C.NOT_VALID_INBOX_INDEX, index + "");
|
sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotComment comment = value.get(index - 1);
|
PlotComment comment = value.get(index - 1);
|
||||||
inbox.removeComment(plot, comment);
|
inbox.removeComment(plot, comment);
|
||||||
plot.removeComment(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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case "clear":
|
case "clear":
|
||||||
if (!inbox.canModify(plot, player)) {
|
if (!inbox.canModify(plot, player)) {
|
||||||
sendMessage(player, C.NO_PERM_INBOX_MODIFY);
|
sendMessage(player, Captions.NO_PERM_INBOX_MODIFY);
|
||||||
}
|
}
|
||||||
inbox.clearInbox(plot);
|
inbox.clearInbox(plot);
|
||||||
List<PlotComment> comments = plot.getComments(inbox.toString());
|
List<PlotComment> comments = plot.getComments(inbox.toString());
|
||||||
if (!comments.isEmpty()) {
|
if (!comments.isEmpty()) {
|
||||||
plot.removeComments(comments);
|
plot.removeComments(comments);
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.COMMENT_REMOVED, "*");
|
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, "*");
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
try {
|
try {
|
||||||
page = Integer.parseInt(args[1]);
|
page = Integer.parseInt(args[1]);
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
sendMessage(player, C.COMMAND_SYNTAX,
|
sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot inbox [inbox] [delete <index>|clear|page]");
|
"/plot inbox [inbox] [delete <index>|clear|page]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ import java.util.List;
|
|||||||
page = 1;
|
page = 1;
|
||||||
}
|
}
|
||||||
if (!inbox.canRead(plot, player)) {
|
if (!inbox.canRead(plot, player)) {
|
||||||
sendMessage(player, C.NO_PERM_INBOX);
|
sendMessage(player, Captions.NO_PERM_INBOX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
||||||
@ -188,7 +188,7 @@ import java.util.List;
|
|||||||
displayComments(player, value, page);
|
displayComments(player, value, page);
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
sendMessage(player, C.PLOT_UNOWNED);
|
sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
@ -50,7 +50,7 @@ import java.util.UUID;
|
|||||||
plot = player.getCurrentPlot();
|
plot = player.getCurrentPlot();
|
||||||
}
|
}
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT.s());
|
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.s());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg != null) {
|
if (arg != null) {
|
||||||
@ -97,11 +97,11 @@ import java.util.UUID;
|
|||||||
boolean trustedEveryone = plot.getMembers().contains(DBFunc.EVERYONE);
|
boolean trustedEveryone = plot.getMembers().contains(DBFunc.EVERYONE);
|
||||||
// Unclaimed?
|
// Unclaimed?
|
||||||
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
||||||
MainUtil
|
MainUtil.sendMessage(player, Captions.PLOT_INFO_UNCLAIMED,
|
||||||
.sendMessage(player, C.PLOT_INFO_UNCLAIMED, plot.getId().x + ";" + plot.getId().y);
|
plot.getId().x + ";" + plot.getId().y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String info = C.PLOT_INFO.s();
|
String info = Captions.PLOT_INFO.s();
|
||||||
boolean full;
|
boolean full;
|
||||||
if (arg != null) {
|
if (arg != null) {
|
||||||
info = getCaption(arg);
|
info = getCaption(arg);
|
||||||
@ -118,7 +118,8 @@ import java.util.UUID;
|
|||||||
MainUtil.format(info, plot, player, full, new RunnableVal<String>() {
|
MainUtil.format(info, plot, player, full, new RunnableVal<String>() {
|
||||||
@Override public void run(String value) {
|
@Override public void run(String value) {
|
||||||
MainUtil.sendMessage(player,
|
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;
|
return true;
|
||||||
@ -127,27 +128,27 @@ import java.util.UUID;
|
|||||||
private String getCaption(String string) {
|
private String getCaption(String string) {
|
||||||
switch (string) {
|
switch (string) {
|
||||||
case "trusted":
|
case "trusted":
|
||||||
return C.PLOT_INFO_TRUSTED.s();
|
return Captions.PLOT_INFO_TRUSTED.s();
|
||||||
case "alias":
|
case "alias":
|
||||||
return C.PLOT_INFO_ALIAS.s();
|
return Captions.PLOT_INFO_ALIAS.s();
|
||||||
case "biome":
|
case "biome":
|
||||||
return C.PLOT_INFO_BIOME.s();
|
return Captions.PLOT_INFO_BIOME.s();
|
||||||
case "denied":
|
case "denied":
|
||||||
return C.PLOT_INFO_DENIED.s();
|
return Captions.PLOT_INFO_DENIED.s();
|
||||||
case "flags":
|
case "flags":
|
||||||
return C.PLOT_INFO_FLAGS.s();
|
return Captions.PLOT_INFO_FLAGS.s();
|
||||||
case "id":
|
case "id":
|
||||||
return C.PLOT_INFO_ID.s();
|
return Captions.PLOT_INFO_ID.s();
|
||||||
case "size":
|
case "size":
|
||||||
return C.PLOT_INFO_SIZE.s();
|
return Captions.PLOT_INFO_SIZE.s();
|
||||||
case "members":
|
case "members":
|
||||||
return C.PLOT_INFO_MEMBERS.s();
|
return Captions.PLOT_INFO_MEMBERS.s();
|
||||||
case "owner":
|
case "owner":
|
||||||
return C.PLOT_INFO_OWNER.s();
|
return Captions.PLOT_INFO_OWNER.s();
|
||||||
case "rating":
|
case "rating":
|
||||||
return C.PLOT_INFO_RATING.s();
|
return Captions.PLOT_INFO_RATING.s();
|
||||||
case "seen":
|
case "seen":
|
||||||
return C.PLOT_INFO_SEEN.s();
|
return Captions.PLOT_INFO_SEEN.s();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -29,16 +29,16 @@ import java.util.UUID;
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlot();
|
Plot plot = location.getPlot();
|
||||||
if (plot == null) {
|
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
|
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_KICK)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_KICK)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
||||||
if (uuids.isEmpty()) {
|
if (uuids.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<PlotPlayer> players = new HashSet<>();
|
Set<PlotPlayer> players = new HashSet<>();
|
||||||
@ -46,7 +46,7 @@ import java.util.UUID;
|
|||||||
if (uuid == DBFunc.EVERYONE) {
|
if (uuid == DBFunc.EVERYONE) {
|
||||||
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
||||||
if (pp == player || Permissions
|
if (pp == player || Permissions
|
||||||
.hasPermission(pp, C.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
.hasPermission(pp, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
players.add(pp);
|
players.add(pp);
|
||||||
@ -60,26 +60,26 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
players.remove(player); // Don't ever kick the calling player
|
players.remove(player); // Don't ever kick the calling player
|
||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (PlotPlayer player2 : players) {
|
for (PlotPlayer player2 : players) {
|
||||||
if (!plot.equals(player2.getCurrentPlot())) {
|
if (!plot.equals(player2.getCurrentPlot())) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player2, C.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
if (Permissions.hasPermission(player2, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
||||||
C.CANNOT_KICK_PLAYER.send(player, player2.getName());
|
Captions.CANNOT_KICK_PLAYER.send(player, player2.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location spawn = WorldUtil.IMP.getSpawn(location.getWorld());
|
Location spawn = WorldUtil.IMP.getSpawn(location.getWorld());
|
||||||
C.YOU_GOT_KICKED.send(player2);
|
Captions.YOU_GOT_KICKED.send(player2);
|
||||||
if (plot.equals(spawn.getPlot())) {
|
if (plot.equals(spawn.getPlot())) {
|
||||||
Location newSpawn = WorldUtil.IMP
|
Location newSpawn = WorldUtil.IMP
|
||||||
.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
|
.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
|
||||||
if (plot.equals(newSpawn.getPlot())) {
|
if (plot.equals(newSpawn.getPlot())) {
|
||||||
// Kick from server if you can't be teleported to spawn
|
// 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 {
|
} else {
|
||||||
player2.plotkick(newSpawn);
|
player2.plotkick(newSpawn);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||||
@ -23,12 +23,12 @@ import java.util.UUID;
|
|||||||
@Override public void execute(PlotPlayer player, String[] args,
|
@Override public void execute(PlotPlayer player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||||
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
|
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||||
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
|
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
|
||||||
checkTrue(plot.isAdded(player.getUUID()), C.NO_PLOT_PERMS);
|
checkTrue(plot.isAdded(player.getUUID()), Captions.NO_PLOT_PERMS);
|
||||||
checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage());
|
checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage());
|
||||||
if (plot.isOwner(player.getUUID())) {
|
if (plot.isOwner(player.getUUID())) {
|
||||||
checkTrue(plot.hasOwner(), C.ALREADY_OWNER);
|
checkTrue(plot.hasOwner(), Captions.ALREADY_OWNER);
|
||||||
// TODO setowner, other
|
// TODO setowner, other
|
||||||
} else {
|
} else {
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
@ -39,9 +39,9 @@ import java.util.UUID;
|
|||||||
if (plot.removeMember(uuid)) {
|
if (plot.removeMember(uuid)) {
|
||||||
EventUtil.manager.callMember(player, plot, uuid, false);
|
EventUtil.manager.callMember(player, plot, uuid, false);
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.REMOVED_PLAYERS, 1);
|
MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType;
|
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.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||||
@ -20,43 +20,43 @@ public class ListCmd extends SubCommand {
|
|||||||
private String[] getArgumentList(PlotPlayer player) {
|
private String[] getArgumentList(PlotPlayer player) {
|
||||||
List<String> args = new ArrayList<>();
|
List<String> args = new ArrayList<>();
|
||||||
if (EconHandler.manager != null && Permissions
|
if (EconHandler.manager != null && Permissions
|
||||||
.hasPermission(player, C.PERMISSION_LIST_FORSALE)) {
|
.hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) {
|
||||||
args.add("forsale");
|
args.add("forsale");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
|
||||||
args.add("mine");
|
args.add("mine");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) {
|
||||||
args.add("shared");
|
args.add("shared");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||||
args.add("world");
|
args.add("world");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) {
|
||||||
args.add("top");
|
args.add("top");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) {
|
||||||
args.add("all");
|
args.add("all");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) {
|
||||||
args.add("unowned");
|
args.add("unowned");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNKNOWN)) {
|
||||||
args.add("unknown");
|
args.add("unknown");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) {
|
||||||
args.add("<player>");
|
args.add("<player>");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||||
args.add("<world>");
|
args.add("<world>");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) {
|
||||||
args.add("done");
|
args.add("done");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) {
|
||||||
args.add("expired");
|
args.add("expired");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) {
|
||||||
args.add("fuzzy <search...>");
|
args.add("fuzzy <search...>");
|
||||||
}
|
}
|
||||||
return args.toArray(new String[args.size()]);
|
return args.toArray(new String[args.size()]);
|
||||||
@ -64,7 +64,7 @@ public class ListCmd extends SubCommand {
|
|||||||
|
|
||||||
public void noArgs(PlotPlayer player) {
|
public void noArgs(PlotPlayer player) {
|
||||||
MainUtil.sendMessage(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) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
@ -93,16 +93,18 @@ public class ListCmd extends SubCommand {
|
|||||||
boolean sort = true;
|
boolean sort = true;
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case "mine":
|
case "mine":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_MINE);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_MINE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sort = false;
|
sort = false;
|
||||||
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getBasePlots(player));
|
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getBasePlots(player));
|
||||||
break;
|
break;
|
||||||
case "shared":
|
case "shared":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_SHARED);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_SHARED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
@ -114,20 +116,23 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "world":
|
case "world":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) {
|
||||||
C.PERMISSION_LIST_WORLD_NAME.f(world));
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_WORLD_NAME.f(world));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
|
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
|
||||||
break;
|
break;
|
||||||
case "expired":
|
case "expired":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_EXPIRED);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_EXPIRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = ExpireManager.IMP == null ?
|
plots = ExpireManager.IMP == null ?
|
||||||
@ -135,27 +140,31 @@ public class ListCmd extends SubCommand {
|
|||||||
new ArrayList<>(ExpireManager.IMP.getPendingExpired());
|
new ArrayList<>(ExpireManager.IMP.getPendingExpired());
|
||||||
break;
|
break;
|
||||||
case "area":
|
case "area":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_AREA)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_AREA)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_AREA);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_AREA);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) {
|
||||||
C.PERMISSION_LIST_WORLD_NAME.f(world));
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_WORLD_NAME.f(world));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = area == null ? new ArrayList<Plot>() : new ArrayList<>(area.getPlots());
|
plots = area == null ? new ArrayList<Plot>() : new ArrayList<>(area.getPlots());
|
||||||
break;
|
break;
|
||||||
case "all":
|
case "all":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_ALL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>(PlotSquared.get().getPlots());
|
plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||||
break;
|
break;
|
||||||
case "done":
|
case "done":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_DONE);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_DONE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
@ -179,8 +188,9 @@ public class ListCmd extends SubCommand {
|
|||||||
sort = false;
|
sort = false;
|
||||||
break;
|
break;
|
||||||
case "top":
|
case "top":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP);
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_TOP);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>(PlotSquared.get().getPlots());
|
plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||||
@ -212,8 +222,9 @@ public class ListCmd extends SubCommand {
|
|||||||
sort = false;
|
sort = false;
|
||||||
break;
|
break;
|
||||||
case "forsale":
|
case "forsale":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FORSALE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FORSALE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_FORSALE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (EconHandler.manager == null) {
|
if (EconHandler.manager == null) {
|
||||||
@ -228,8 +239,9 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "unowned":
|
case "unowned":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNOWNED);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
@ -240,8 +252,9 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "unknown":
|
case "unknown":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNKNOWN)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNKNOWN);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_UNKNOWN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
@ -255,12 +268,13 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "fuzzy":
|
case "fuzzy":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FUZZY);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_FUZZY);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < (page == -1 ? 2 : 3)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
String term;
|
String term;
|
||||||
@ -274,14 +288,15 @@ public class ListCmd extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (PlotSquared.get().hasPlotArea(args[0])) {
|
if (PlotSquared.get().hasPlotArea(args[0])) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(args[0]))) {
|
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]))) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_LIST_WORLD_NAME.f(args[0]));
|
Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>(PlotSquared.get().getPlots(args[0]));
|
plots = new ArrayList<>(PlotSquared.get().getPlots(args[0]));
|
||||||
@ -295,8 +310,9 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_PLAYER);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_LIST_PLAYER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sort = false;
|
sort = false;
|
||||||
@ -306,14 +322,14 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plots == null) {
|
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"})
|
new StringComparison<>(args[0], new String[] {"mine", "shared", "world", "all"})
|
||||||
.getBestMatch());
|
.getBestMatch());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plots.isEmpty()) {
|
if (plots.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, C.FOUND_NO_PLOTS);
|
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
displayPlots(player, plots, 12, page, area, args, sort);
|
displayPlots(player, plots, 12, page, area, args, sort);
|
||||||
@ -347,18 +363,20 @@ public class ListCmd extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
color = "$1";
|
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()))))
|
.replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted()))))
|
||||||
.color("$1");
|
.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()))))
|
.replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers()))))
|
||||||
.color("$1");
|
.color("$1");
|
||||||
String strFlags = StringMan.join(plot.getFlags().values(), ",");
|
String strFlags = StringMan.join(plot.getFlags().values(), ",");
|
||||||
if (strFlags.isEmpty()) {
|
if (strFlags.isEmpty()) {
|
||||||
strFlags = C.NONE.s();
|
strFlags = Captions.NONE.s();
|
||||||
}
|
}
|
||||||
PlotMessage flags = new PlotMessage()
|
PlotMessage flags = new PlotMessage().text(Captions
|
||||||
.text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags)))
|
.color(Captions.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags)))
|
||||||
.color("$1");
|
.color("$1");
|
||||||
message.text("[").color("$3").text(i + "")
|
message.text("[").color("$3").text(i + "")
|
||||||
.command("/plot visit " + plot.getArea() + ";" + plot.getId())
|
.command("/plot visit " + plot.getArea() + ";" + plot.getId())
|
||||||
@ -386,7 +404,7 @@ public class ListCmd extends SubCommand {
|
|||||||
prefix = ", ";
|
prefix = ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "/plot list " + args[0], C.PLOT_LIST_HEADER_PAGED.s());
|
}, "/plot list " + args[0], Captions.PLOT_LIST_HEADER_PAGED.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
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();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_LOAD)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_LOAD)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ import java.util.List;
|
|||||||
List<String> schematics = player.getMeta("plot_schematics");
|
List<String> schematics = player.getMeta("plot_schematics");
|
||||||
if (schematics == null) {
|
if (schematics == null) {
|
||||||
// No schematics found:
|
// No schematics found:
|
||||||
MainUtil.sendMessage(player, C.LOAD_NULL);
|
MainUtil.sendMessage(player, Captions.LOAD_NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String schem;
|
String schem;
|
||||||
@ -55,8 +55,8 @@ import java.util.List;
|
|||||||
schem = schematics.get(Integer.parseInt(args[0]) - 1);
|
schem = schematics.get(Integer.parseInt(args[0]) - 1);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
// use /plot load <index>
|
// use /plot load <index>
|
||||||
MainUtil
|
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER,
|
||||||
.sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')');
|
"(1, " + schematics.size() + ')');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final URL url;
|
final URL url;
|
||||||
@ -64,16 +64,16 @@ import java.util.List;
|
|||||||
url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schem);
|
url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schem);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil.sendMessage(player, C.LOAD_FAILED);
|
MainUtil.sendMessage(player, Captions.LOAD_FAILED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
MainUtil.sendMessage(player, C.GENERATING_COMPONENT);
|
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT);
|
||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
Schematic schematic = SchematicHandler.manager.getSchematic(url);
|
Schematic schematic = SchematicHandler.manager.getSchematic(url);
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
sendMessage(player, C.SCHEMATIC_INVALID,
|
sendMessage(player, Captions.SCHEMATIC_INVALID,
|
||||||
"non-existent or not in gzip format");
|
"non-existent or not in gzip format");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -84,9 +84,9 @@ import java.util.List;
|
|||||||
@Override public void run(Boolean value) {
|
@Override public void run(Boolean value) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
if (value) {
|
if (value) {
|
||||||
sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS);
|
sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, C.SCHEMATIC_PASTE_FAILED);
|
sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -94,7 +94,7 @@ import java.util.List;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot load <index>");
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot load <index>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ import java.util.List;
|
|||||||
List<String> schematics1 = SchematicHandler.manager.getSaves(player.getUUID());
|
List<String> schematics1 = SchematicHandler.manager.getSaves(player.getUUID());
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
if ((schematics1 == null) || schematics1.isEmpty()) {
|
if ((schematics1 == null) || schematics1.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, C.LOAD_FAILED);
|
MainUtil.sendMessage(player, Captions.LOAD_FAILED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.setMeta("plot_schematics", schematics1);
|
player.setMeta("plot_schematics", schematics1);
|
||||||
@ -141,7 +141,7 @@ import java.util.List;
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.LOAD_LIST);
|
MainUtil.sendMessage(player, Captions.LOAD_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String secToTime(long time) {
|
public String secToTime(long time) {
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||||
@ -200,7 +200,8 @@ public class MainCommand extends Command {
|
|||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
Plot newPlot = Plot.fromString(area, args[0]);
|
Plot newPlot = Plot.fromString(area, args[0]);
|
||||||
if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea()
|
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())) {
|
.isDenied(player.getUUID())) {
|
||||||
Location newLoc = newPlot.getCenter();
|
Location newLoc = newPlot.getCenter();
|
||||||
if (player.canTeleport(newLoc)) {
|
if (player.canTeleport(newLoc)) {
|
||||||
@ -212,7 +213,7 @@ public class MainCommand extends Command {
|
|||||||
player.setMeta(PlotPlayer.META_LOCATION, newLoc);
|
player.setMeta(PlotPlayer.META_LOCATION, newLoc);
|
||||||
player.setMeta(PlotPlayer.META_LAST_PLOT, newPlot);
|
player.setMeta(PlotPlayer.META_LAST_PLOT, newPlot);
|
||||||
} else {
|
} else {
|
||||||
C.BORDER.send(player);
|
Captions.BORDER.send(player);
|
||||||
}
|
}
|
||||||
// Trim command
|
// Trim command
|
||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
@ -247,7 +248,7 @@ public class MainCommand extends Command {
|
|||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
C.INVALID_COMMAND_FLAG.send(player);
|
Captions.INVALID_COMMAND_FLAG.send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,9 +261,9 @@ public class MainCommand extends Command {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
String message = e.getLocalizedMessage();
|
String message = e.getLocalizedMessage();
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
C.ERROR.send(player, message);
|
Captions.ERROR.send(player, message);
|
||||||
} else {
|
} else {
|
||||||
C.ERROR.send(player);
|
Captions.ERROR.send(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Reset command scope //
|
// Reset command scope //
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||||
@ -43,16 +43,16 @@ public class Merge extends SubCommand {
|
|||||||
Location loc = player.getLocationFull();
|
Location loc = player.getLocationFull();
|
||||||
final Plot plot = loc.getPlotAbs();
|
final Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
if (!plot.isOwner(uuid)) {
|
if (!plot.isOwner(uuid)) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
uuid = plot.guessOwner();
|
uuid = plot.guessOwner();
|
||||||
@ -65,13 +65,13 @@ public class Merge extends SubCommand {
|
|||||||
final double price = priceExr == null ? 0d : priceExr.evaluate((double) size);
|
final double price = priceExr == null ? 0d : priceExr.evaluate((double) size);
|
||||||
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d
|
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d
|
||||||
&& EconHandler.manager.getMoney(player) < price) {
|
&& 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;
|
return false;
|
||||||
}
|
}
|
||||||
final int maxSize =
|
final int maxSize =
|
||||||
Permissions.hasPermissionRange(player, "plots.merge", Settings.Limit.MAX_PLOTS);
|
Permissions.hasPermissionRange(player, "plots.merge", Settings.Limit.MAX_PLOTS);
|
||||||
if (size - 1 > maxSize) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
int direction = -1;
|
int direction = -1;
|
||||||
@ -96,19 +96,21 @@ public class Merge extends SubCommand {
|
|||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
terrain = "true".equalsIgnoreCase(args[1]);
|
terrain = "true".equalsIgnoreCase(args[1]);
|
||||||
}
|
}
|
||||||
if (!terrain && !Permissions.hasPermission(player, C.PERMISSION_MERGE_KEEPROAD)) {
|
if (!terrain && !Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_KEEPROAD.s());
|
.hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) {
|
||||||
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_MERGE_KEEPROAD.s());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.autoMerge(-1, maxSize, uuid, terrain)) {
|
if (plot.autoMerge(-1, maxSize, uuid, terrain)) {
|
||||||
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
|
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
|
||||||
EconHandler.manager.withdrawMoney(player, price);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE);
|
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -120,10 +122,10 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction == -1) {
|
if (direction == -1) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot merge <" + StringMan.join(values, "|") + "> [removeroads]");
|
"/plot merge <" + StringMan.join(values, "|") + "> [removeroads]");
|
||||||
MainUtil
|
MainUtil.sendMessage(player,
|
||||||
.sendMessage(player, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
|
Captions.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final boolean terrain;
|
final boolean terrain;
|
||||||
@ -132,26 +134,27 @@ public class Merge extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
terrain = true;
|
terrain = true;
|
||||||
}
|
}
|
||||||
if (!terrain && !Permissions.hasPermission(player, C.PERMISSION_MERGE_KEEPROAD)) {
|
if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_KEEPROAD.s());
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_MERGE_KEEPROAD.s());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) {
|
if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) {
|
||||||
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
|
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
|
||||||
EconHandler.manager.withdrawMoney(player, price);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
Plot adjacent = plot.getRelative(direction);
|
Plot adjacent = plot.getRelative(direction);
|
||||||
if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4)
|
if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4)
|
||||||
|| adjacent.isOwner(uuid)) {
|
|| adjacent.isOwner(uuid)) {
|
||||||
MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE);
|
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_MERGE_OTHER)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_MERGE_OTHER)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_MERGE_OTHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
java.util.Set<UUID> uuids = adjacent.getOwners();
|
java.util.Set<UUID> uuids = adjacent.getOwners();
|
||||||
@ -164,35 +167,35 @@ public class Merge extends SubCommand {
|
|||||||
isOnline = true;
|
isOnline = true;
|
||||||
final int dir = direction;
|
final int dir = direction;
|
||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED);
|
MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED);
|
||||||
plot.autoMerge(dir, maxSize - size, owner, terrain);
|
plot.autoMerge(dir, maxSize - size, owner, terrain);
|
||||||
PlotPlayer plotPlayer = UUIDHandler.getPlayer(player.getUUID());
|
PlotPlayer plotPlayer = UUIDHandler.getPlayer(player.getUUID());
|
||||||
if (plotPlayer == null) {
|
if (plotPlayer == null) {
|
||||||
sendMessage(accepter, C.MERGE_NOT_VALID);
|
sendMessage(accepter, Captions.MERGE_NOT_VALID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
|
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
|
||||||
if (EconHandler.manager.getMoney(player) < price) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
EconHandler.manager.withdrawMoney(player, price);
|
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)) {
|
if (hasConfirmation(player)) {
|
||||||
CmdConfirm.addPending(accepter,
|
CmdConfirm.addPending(accepter,
|
||||||
C.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run);
|
Captions.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run);
|
||||||
} else {
|
} else {
|
||||||
run.run();
|
run.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isOnline) {
|
if (!isOnline) {
|
||||||
MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE);
|
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.MERGE_REQUESTED);
|
MainUtil.sendMessage(player, Captions.MERGE_REQUESTED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -18,10 +18,10 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlot();
|
Plot plot = location.getPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(player, C.NOT_IN_PLOT);
|
return sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return sendMessage(player, C.PLOT_UNOWNED);
|
return sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
}
|
}
|
||||||
player.teleport(plot.getCenter());
|
player.teleport(plot.getCenter());
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
@ -18,11 +18,11 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
Plot plot1 = loc.getPlotAbs();
|
Plot plot1 = loc.getPlotAbs();
|
||||||
if (plot1 == null) {
|
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
|
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN.s())) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN.s())) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean override = false;
|
boolean override = false;
|
||||||
@ -31,7 +31,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
|||||||
override = true;
|
override = true;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||||
@ -45,19 +45,19 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
|||||||
plot2 = area.getPlotAbs(plot1.getId());
|
plot2 = area.getPlotAbs(plot1.getId());
|
||||||
}
|
}
|
||||||
if (plot1.equals(plot2)) {
|
if (plot1.equals(plot2)) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy <X;Z>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions
|
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN.s()))) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN.s()))) {
|
||||||
C.PLOTWORLD_INCOMPATIBLE.send(player);
|
Captions.PLOTWORLD_INCOMPATIBLE.send(player);
|
||||||
return false;
|
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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.REQUIRES_UNOWNED);
|
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
|
|
||||||
@ -23,10 +23,10 @@ import java.util.Locale;
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
final Plot plot = loc.getPlotAbs();
|
final Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.isAdded(player.getUUID())) {
|
if (!plot.isAdded(player.getUUID())) {
|
||||||
sendMessage(player, C.NO_PLOT_PERMS);
|
sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlotInventory inv = new PlotInventory(player, 2, "Plot Jukebox") {
|
PlotInventory inv = new PlotInventory(player, 2, "Plot Jukebox") {
|
||||||
@ -37,12 +37,12 @@ import java.util.Locale;
|
|||||||
}
|
}
|
||||||
if (item.getPlotBlock().equalsAny(7, "bedrock")) {
|
if (item.getPlotBlock().equalsAny(7, "bedrock")) {
|
||||||
plot.removeFlag(Flags.MUSIC);
|
plot.removeFlag(Flags.MUSIC);
|
||||||
C.FLAG_REMOVED.send(player);
|
Captions.FLAG_REMOVED.send(player);
|
||||||
} else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) {
|
} else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) {
|
||||||
plot.setFlag(Flags.MUSIC, item.getPlotBlock().getRawId());
|
plot.setFlag(Flags.MUSIC, item.getPlotBlock().getRawId());
|
||||||
C.FLAG_ADDED.send(player);
|
Captions.FLAG_ADDED.send(player);
|
||||||
} else {
|
} else {
|
||||||
C.FLAG_NOT_ADDED.send(player);
|
Captions.FLAG_NOT_ADDED.send(player);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
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,
|
@Override public void execute(PlotPlayer player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||||
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
|
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||||
C.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", "));
|
Captions.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -34,7 +34,7 @@ import java.util.UUID;
|
|||||||
if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value
|
if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value
|
||||||
.equalsIgnoreCase("-")) {
|
.equalsIgnoreCase("-")) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Plot> connected = plot.getConnectedPlots();
|
Set<Plot> connected = plot.getConnectedPlots();
|
||||||
@ -43,20 +43,20 @@ import java.util.UUID;
|
|||||||
current.unclaim();
|
current.unclaim();
|
||||||
current.removeSign();
|
current.removeSign();
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.SET_OWNER);
|
MainUtil.sendMessage(player, Captions.SET_OWNER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
C.INVALID_PLAYER.send(player, value);
|
Captions.INVALID_PLAYER.send(player, value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotPlayer other = UUIDHandler.getPlayer(uuid);
|
final PlotPlayer other = UUIDHandler.getPlayer(uuid);
|
||||||
if (plot.isOwner(uuid)) {
|
if (plot.isOwner(uuid)) {
|
||||||
C.ALREADY_OWNER.send(player, MainUtil.getName(uuid));
|
Captions.ALREADY_OWNER.send(player, MainUtil.getName(uuid));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER)) {
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
C.INVALID_PLAYER_OFFLINE.send(player, value);
|
Captions.INVALID_PLAYER_OFFLINE.send(player, value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int size = plots.size();
|
int size = plots.size();
|
||||||
@ -64,7 +64,7 @@ import java.util.UUID;
|
|||||||
other.getPlotCount() :
|
other.getPlotCount() :
|
||||||
other.getPlotCount(plot.getWorldName())) + size;
|
other.getPlotCount(plot.getWorldName())) + size;
|
||||||
if (currentPlots > other.getAllowedPlots()) {
|
if (currentPlots > other.getAllowedPlots()) {
|
||||||
sendMessage(player, C.CANT_TRANSFER_MORE_PLOTS);
|
sendMessage(player, Captions.CANT_TRANSFER_MORE_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,13 +77,14 @@ import java.util.UUID;
|
|||||||
if (removeDenied)
|
if (removeDenied)
|
||||||
plot.removeDenied(finalUUID);
|
plot.removeDenied(finalUUID);
|
||||||
plot.setSign(finalName);
|
plot.setSign(finalName);
|
||||||
MainUtil.sendMessage(player, C.SET_OWNER);
|
MainUtil.sendMessage(player, Captions.SET_OWNER);
|
||||||
if (other != null) {
|
if (other != null) {
|
||||||
MainUtil
|
MainUtil.sendMessage(other, Captions.NOW_OWNER,
|
||||||
.sendMessage(other, C.NOW_OWNER, plot.getArea() + ";" + plot.getId());
|
plot.getArea() + ";" + plot.getId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED);
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
MainUtil.sendMessage(player, C.SET_OWNER_CANCELLED);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -38,7 +38,7 @@ import java.util.UUID;
|
|||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
String[] split = arg.split(":");
|
String[] split = arg.split(":");
|
||||||
if (split.length != 2) {
|
if (split.length != 2) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (split[0].toLowerCase()) {
|
switch (split[0].toLowerCase()) {
|
||||||
@ -50,7 +50,7 @@ import java.util.UUID;
|
|||||||
case "a":
|
case "a":
|
||||||
area = PlotSquared.get().getPlotAreaByString(split[1]);
|
area = PlotSquared.get().getPlotAreaByString(split[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, split[1]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, split[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -59,7 +59,7 @@ import java.util.UUID;
|
|||||||
try {
|
try {
|
||||||
id = PlotId.fromString(split[1]);
|
id = PlotId.fromString(split[1]);
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
C.NOT_VALID_PLOT_ID.send(player, split[1]);
|
Captions.NOT_VALID_PLOT_ID.send(player, split[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -67,7 +67,7 @@ import java.util.UUID;
|
|||||||
case "o":
|
case "o":
|
||||||
owner = UUIDHandler.getUUID(split[1], null);
|
owner = UUIDHandler.getUUID(split[1], null);
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
C.INVALID_PLAYER.send(player, split[1]);
|
Captions.INVALID_PLAYER.send(player, split[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -75,7 +75,7 @@ import java.util.UUID;
|
|||||||
case "s":
|
case "s":
|
||||||
added = UUIDHandler.getUUID(split[1], null);
|
added = UUIDHandler.getUUID(split[1], null);
|
||||||
if (added == null) {
|
if (added == null) {
|
||||||
C.INVALID_PLAYER.send(player, split[1]);
|
Captions.INVALID_PLAYER.send(player, split[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -85,7 +85,7 @@ import java.util.UUID;
|
|||||||
unknown = Boolean.parseBoolean(split[1]);
|
unknown = Boolean.parseBoolean(split[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toDelete.isEmpty()) {
|
if (toDelete.isEmpty()) {
|
||||||
C.FOUND_NO_PLOTS.send(player);
|
Captions.FOUND_NO_PLOTS.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String cmd =
|
String cmd =
|
||||||
@ -156,7 +156,7 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBFunc.purgeIds(ids);
|
DBFunc.purgeIds(ids);
|
||||||
C.PURGE_SUCCESS.send(player, ids.size() + "/" + toDelete.size());
|
Captions.PURGE_SUCCESS.send(player, ids.size() + "/" + toDelete.size());
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
CmdConfirm.addPending(player, cmd, run);
|
CmdConfirm.addPending(player, cmd, run);
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
@ -48,48 +48,50 @@ import java.util.UUID;
|
|||||||
.isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p
|
.isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p
|
||||||
.isAdded(uuid)) {
|
.isAdded(uuid)) {
|
||||||
p.teleportPlayer(player);
|
p.teleportPlayer(player);
|
||||||
MainUtil.sendMessage(player, C.RATE_THIS);
|
MainUtil.sendMessage(player, Captions.RATE_THIS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.FOUND_NO_PLOTS);
|
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case "purge": {
|
case "purge": {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
plot.clearRatings();
|
plot.clearRatings();
|
||||||
C.RATINGS_PURGED.send(player);
|
Captions.RATINGS_PURGED.send(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(player, C.RATING_NOT_OWNED);
|
sendMessage(player, Captions.RATING_NOT_OWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.isOwner(player.getUUID())) {
|
if (plot.isOwner(player.getUUID())) {
|
||||||
sendMessage(player, C.RATING_NOT_YOUR_OWN);
|
sendMessage(player, Captions.RATING_NOT_YOUR_OWN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Settings.Done.REQUIRED_FOR_RATINGS && !plot.hasFlag(Flags.DONE)) {
|
if (Settings.Done.REQUIRED_FOR_RATINGS && !plot.hasFlag(Flags.DONE)) {
|
||||||
sendMessage(player, C.RATING_NOT_DONE);
|
sendMessage(player, Captions.RATING_NOT_DONE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
|
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
|
||||||
final Runnable run = new Runnable() {
|
final Runnable run = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (plot.getRatings().containsKey(player.getUUID())) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
final MutableInt index = new MutableInt(0);
|
final MutableInt index = new MutableInt(0);
|
||||||
@ -105,14 +107,14 @@ import java.util.UUID;
|
|||||||
EventUtil.manager.callRating(this.player, plot, new Rating(rV));
|
EventUtil.manager.callRating(this.player, plot, new Rating(rV));
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
plot.addRating(this.player.getUUID(), result);
|
plot.addRating(this.player.getUUID(), result);
|
||||||
sendMessage(this.player, C.RATING_APPLIED,
|
sendMessage(this.player, Captions.RATING_APPLIED,
|
||||||
plot.getId().toString());
|
plot.getId().toString());
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(this.player, C.PERMISSION_COMMENT)) {
|
.hasPermission(this.player, Captions.PERMISSION_COMMENT)) {
|
||||||
Command command =
|
Command command =
|
||||||
MainCommand.getInstance().getCommand(Comment.class);
|
MainCommand.getInstance().getCommand(Comment.class);
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
MainUtil.sendMessage(this.player, C.COMMENT_THIS,
|
MainUtil.sendMessage(this.player, Captions.COMMENT_THIS,
|
||||||
command.getUsage());
|
command.getUsage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,7 +151,7 @@ import java.util.UUID;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
sendMessage(player, C.RATING_NOT_VALID);
|
sendMessage(player, Captions.RATING_NOT_VALID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String arg = args[0];
|
String arg = args[0];
|
||||||
@ -157,23 +159,23 @@ import java.util.UUID;
|
|||||||
if (MathMan.isInteger(arg) && arg.length() < 3 && !arg.isEmpty()) {
|
if (MathMan.isInteger(arg) && arg.length() < 3 && !arg.isEmpty()) {
|
||||||
rating = Integer.parseInt(arg);
|
rating = Integer.parseInt(arg);
|
||||||
if (rating > 10 || rating < 1) {
|
if (rating > 10 || rating < 1) {
|
||||||
sendMessage(player, C.RATING_NOT_VALID);
|
sendMessage(player, Captions.RATING_NOT_VALID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, C.RATING_NOT_VALID);
|
sendMessage(player, Captions.RATING_NOT_VALID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final UUID uuid = player.getUUID();
|
final UUID uuid = player.getUUID();
|
||||||
final Runnable run = () -> {
|
final Runnable run = () -> {
|
||||||
if (plot.getRatings().containsKey(uuid)) {
|
if (plot.getRatings().containsKey(uuid)) {
|
||||||
sendMessage(player, C.RATING_ALREADY_EXISTS, plot.getId().toString());
|
sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Rating result = EventUtil.manager.callRating(player, plot, new Rating(rating));
|
Rating result = EventUtil.manager.callRating(player, plot, new Rating(rating));
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
plot.addRating(uuid, result);
|
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) {
|
if (plot.getSettings().ratings == null) {
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.HybridPlotManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
@ -22,24 +22,25 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
|||||||
try {
|
try {
|
||||||
height = Integer.parseInt(args[1]);
|
height = Integer.parseInt(args[1]);
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(0, 256)");
|
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)");
|
||||||
MainUtil
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
"/plot regenallroads <world> [height]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (args.length != 1) {
|
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String name = args[0];
|
String name = args[0];
|
||||||
PlotManager manager = area.getPlotManager();
|
PlotManager manager = area.getPlotManager();
|
||||||
if (!(manager instanceof HybridPlotManager)) {
|
if (!(manager instanceof HybridPlotManager)) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//Set<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
|
//Set<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||||
@ -20,7 +20,7 @@ import java.util.HashSet;
|
|||||||
RunnableVal2<Command, CommandResult> whenDone) {
|
RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
C.NOT_IN_PLOT.send(player);
|
Captions.NOT_IN_PLOT.send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HashSet<RegionWrapper> regions = plot.getRegions();
|
HashSet<RegionWrapper> regions = plot.getRegions();
|
||||||
@ -32,7 +32,7 @@ import java.util.HashSet;
|
|||||||
}, new Runnable() {
|
}, new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
plot.refreshChunks();
|
plot.refreshChunks();
|
||||||
C.SET_BLOCK_ACTION_FINISHED.send(player);
|
Captions.SET_BLOCK_ACTION_FINISHED.send(player);
|
||||||
}
|
}
|
||||||
}, 5);
|
}, 5);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti
|
|||||||
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
|
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
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
|
// The following won't affect world generation, as that has to be
|
||||||
// loaded during startup unfortunately.
|
// loaded during startup unfortunately.
|
||||||
PlotSquared.get().setupConfigs();
|
PlotSquared.get().setupConfigs();
|
||||||
C.load(PlotSquared.get().translationFile);
|
Captions.load(PlotSquared.get().translationFile);
|
||||||
PlotSquared.get().forEachPlotArea(area -> {
|
PlotSquared.get().forEachPlotArea(area -> {
|
||||||
ConfigurationSection worldSection =
|
ConfigurationSection worldSection =
|
||||||
PlotSquared.get().worlds.getConfigurationSection("worlds." + area.worldname);
|
PlotSquared.get().worlds.getConfigurationSection("worlds." + area.worldname);
|
||||||
@ -70,10 +70,10 @@ import java.util.Objects;
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||||
MainUtil.sendMessage(player, C.RELOADED_CONFIGS);
|
MainUtil.sendMessage(player, Captions.RELOADED_CONFIGS);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil.sendMessage(player, C.RELOAD_FAILED);
|
MainUtil.sendMessage(player, Captions.RELOAD_FAILED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -30,15 +30,15 @@ import java.util.UUID;
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_REMOVE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_REMOVE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -98,10 +98,10 @@ import java.util.UUID;
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.REMOVED_PLAYERS, count + "");
|
MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, count + "");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
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();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SAVE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SAVE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
@ -58,10 +58,10 @@ import java.util.UUID;
|
|||||||
@Override public void run(URL url) {
|
@Override public void run(URL url) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
MainUtil.sendMessage(player, C.SAVE_FAILED);
|
MainUtil.sendMessage(player, Captions.SAVE_FAILED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.SAVE_SUCCESS);
|
MainUtil.sendMessage(player, Captions.SAVE_SUCCESS);
|
||||||
List<String> schematics = player.getMeta("plot_schematics");
|
List<String> schematics = player.getMeta("plot_schematics");
|
||||||
if (schematics != null) {
|
if (schematics != null) {
|
||||||
schematics.add(file + ".schematic");
|
schematics.add(file + ".schematic");
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
sendMessage(player, C.SCHEMATIC_MISSING_ARG);
|
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String arg = args[0].toLowerCase();
|
String arg = args[0].toLowerCase();
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case "paste": {
|
case "paste": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_PASTE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_PASTE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_PASTE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_SCHEMATIC_PASTE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
sendMessage(player, C.SCHEMATIC_MISSING_ARG);
|
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
final Plot plot = loc.getPlotAbs();
|
final Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
@ -66,7 +67,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
schematic = SchematicHandler.manager.getSchematic(url);
|
schematic = SchematicHandler.manager.getSchematic(url);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
sendMessage(player, C.SCHEMATIC_INVALID,
|
sendMessage(player, Captions.SCHEMATIC_INVALID,
|
||||||
"non-existent url: " + location);
|
"non-existent url: " + location);
|
||||||
SchematicCmd.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
return;
|
return;
|
||||||
@ -80,7 +81,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
SchematicCmd.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
sendMessage(player, C.SCHEMATIC_INVALID,
|
sendMessage(player, Captions.SCHEMATIC_INVALID,
|
||||||
"non-existent or not in gzip format");
|
"non-existent or not in gzip format");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -89,9 +90,9 @@ public class SchematicCmd extends SubCommand {
|
|||||||
@Override public void run(Boolean value) {
|
@Override public void run(Boolean value) {
|
||||||
SchematicCmd.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
if (value) {
|
if (value) {
|
||||||
sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS);
|
sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, C.SCHEMATIC_PASTE_FAILED);
|
sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -101,39 +102,39 @@ public class SchematicCmd extends SubCommand {
|
|||||||
// TODO test
|
// TODO test
|
||||||
// case "test": {
|
// case "test": {
|
||||||
// if (!Permissions.hasPermission(plr, "plots.schematic.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;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// if (args.length < 2) {
|
// if (args.length < 2) {
|
||||||
// sendMessage(plr, C.SCHEMATIC_MISSING_ARG);
|
// sendMessage(plr, Captions.SCHEMATIC_MISSING_ARG);
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// final Location loc = plr.getLocation();
|
// final Location loc = plr.getLocation();
|
||||||
// final Plot plot = MainUtil.getPlot(loc);
|
// final Plot plot = MainUtil.getPlot(loc);
|
||||||
// if (plot == null) {
|
// if (plot == null) {
|
||||||
// sendMessage(plr, C.NOT_IN_PLOT);
|
// sendMessage(plr, Captions.NOT_IN_PLOT);
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// file = args[1];
|
// file = args[1];
|
||||||
// schematic = SchematicHandler.manager.getSchematic(file);
|
// schematic = SchematicHandler.manager.getSchematic(file);
|
||||||
// if (schematic == null) {
|
// if (schematic == null) {
|
||||||
// sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
// sendMessage(plr, Captions.SCHEMATIC_INVALID, "non-existent");
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// final int l1 = schematic.getSchematicDimension().getX();
|
// final int l1 = schematic.getSchematicDimension().getX();
|
||||||
// final int l2 = schematic.getSchematicDimension().getZ();
|
// final int l2 = schematic.getSchematicDimension().getZ();
|
||||||
// final int length = MainUtil.getPlotWidth(loc.getWorld(), plot.id);
|
// final int length = MainUtil.getPlotWidth(loc.getWorld(), plot.id);
|
||||||
// if ((l1 < length) || (l2 < length)) {
|
// 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;
|
// break;
|
||||||
// }
|
// }
|
||||||
// sendMessage(plr, C.SCHEMATIC_VALID);
|
// sendMessage(plr, Captions.SCHEMATIC_VALID);
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
case "saveall":
|
case "saveall":
|
||||||
case "exportall": {
|
case "exportall": {
|
||||||
if (!(player instanceof ConsolePlayer)) {
|
if (!(player instanceof ConsolePlayer)) {
|
||||||
MainUtil.sendMessage(player, C.NOT_CONSOLE);
|
MainUtil.sendMessage(player, Captions.NOT_CONSOLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
@ -143,7 +144,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Collection<Plot> plots = area.getPlots();
|
Collection<Plot> plots = area.getPlots();
|
||||||
@ -167,8 +168,9 @@ public class SchematicCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
case "export":
|
case "export":
|
||||||
case "save":
|
case "save":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_SAVE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_SAVE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_SAVE);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_SCHEMATIC_SAVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
@ -178,15 +180,15 @@ public class SchematicCmd extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
location.getWorld();
|
location.getWorld();
|
||||||
@ -204,17 +206,18 @@ public class SchematicCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "list": {
|
case "list": {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_LIST)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_LIST)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_LIST);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
|
Captions.PERMISSION_SCHEMATIC_LIST);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String string =
|
final String string =
|
||||||
StringMan.join(SchematicHandler.manager.getShematicNames(), "$2, $1");
|
StringMan.join(SchematicHandler.manager.getShematicNames(), "$2, $1");
|
||||||
C.SCHEMATIC_LIST.send(player, string);
|
Captions.SCHEMATIC_LIST.send(player, string);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sendMessage(player, C.SCHEMATIC_MISSING_ARG);
|
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration.UnknownBlockException;
|
import com.github.intellectualsites.plotsquared.plot.config.Configuration.UnknownBlockException;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
@ -47,17 +47,17 @@ import java.util.stream.IntStream;
|
|||||||
|
|
||||||
for (String component : components) {
|
for (String component : components) {
|
||||||
if (component.equalsIgnoreCase(args[0])) {
|
if (component.equalsIgnoreCase(args[0])) {
|
||||||
if (!Permissions
|
if (!Permissions.hasPermission(player,
|
||||||
.hasPermission(player, C.PERMISSION_SET_COMPONENT.f(component))) {
|
Captions.PERMISSION_SET_COMPONENT.f(component))) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
C.PERMISSION_SET_COMPONENT.f(component));
|
Captions.PERMISSION_SET_COMPONENT.f(component));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// PlotBlock[] blocks;
|
// PlotBlock[] blocks;
|
||||||
BlockBucket bucket;
|
BlockBucket bucket;
|
||||||
try {
|
try {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MainUtil.sendMessage(player, C.NEED_BLOCK);
|
MainUtil.sendMessage(player, Captions.NEED_BLOCK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String[] split = material.split(",");
|
String[] split = material.split(",");
|
||||||
@ -67,14 +67,14 @@ import java.util.stream.IntStream;
|
|||||||
bucket = Configuration.BLOCK_BUCKET.parseString(material);
|
bucket = Configuration.BLOCK_BUCKET.parseString(material);
|
||||||
} catch (final UnknownBlockException unknownBlockException) {
|
} catch (final UnknownBlockException unknownBlockException) {
|
||||||
final String unknownBlock = unknownBlockException.getUnknownValue();
|
final String unknownBlock = unknownBlockException.getUnknownValue();
|
||||||
C.NOT_VALID_BLOCK.send(player, unknownBlock);
|
Captions.NOT_VALID_BLOCK.send(player, unknownBlock);
|
||||||
StringComparison<PlotBlock>.ComparisonResult match =
|
StringComparison<PlotBlock>.ComparisonResult match =
|
||||||
WorldUtil.IMP.getClosestBlock(unknownBlock);
|
WorldUtil.IMP.getClosestBlock(unknownBlock);
|
||||||
if (match != null) {
|
if (match != null) {
|
||||||
final String found =
|
final String found =
|
||||||
WorldUtil.IMP.getClosestMatchingName(match.best);
|
WorldUtil.IMP.getClosestMatchingName(match.best);
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
MainUtil.sendMessage(player, C.DID_YOU_MEAN,
|
MainUtil.sendMessage(player, Captions.DID_YOU_MEAN,
|
||||||
found.toLowerCase());
|
found.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,24 +84,24 @@ import java.util.stream.IntStream;
|
|||||||
if (!allowUnsafe) {
|
if (!allowUnsafe) {
|
||||||
for (final PlotBlock block : bucket.getBlocks()) {
|
for (final PlotBlock block : bucket.getBlocks()) {
|
||||||
if (!block.isAir() && !WorldUtil.IMP.isBlockSolid(block)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_BLOCK, material);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_BLOCK, material);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
for (Plot current : plot.getConnectedPlots()) {
|
for (Plot current : plot.getConnectedPlots()) {
|
||||||
current.setComponent(component, bucket);
|
current.setComponent(component, bucket);
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.GENERATING_COMPONENT);
|
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT);
|
||||||
GlobalBlockQueue.IMP.addTask(plot::removeRunning);
|
GlobalBlockQueue.IMP.addTask(plot::removeRunning);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -119,8 +119,8 @@ import java.util.stream.IntStream;
|
|||||||
newValues.addAll(
|
newValues.addAll(
|
||||||
Arrays.asList(plot.getManager().getPlotComponents(plot.getArea(), plot.getId())));
|
Arrays.asList(plot.getManager().getPlotComponents(plot.getArea(), plot.getId())));
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan
|
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan
|
||||||
.join(newValues, C.BLOCK_LIST_SEPARATER.formatted()));
|
.join(newValues, Captions.BLOCK_LIST_SEPARATER.formatted()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ import java.util.stream.IntStream;
|
|||||||
// Additional checks
|
// Additional checks
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// components
|
// components
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -14,21 +14,23 @@ public abstract class SetCommand extends SubCommand {
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
Plot plot = loc.getPlotAbs();
|
Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
|
||||||
C.PERMISSION_ADMIN_COMMAND.f(getFullId()));
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
MainUtil.sendMessage(player, C.PLOT_NOT_CLAIMED);
|
Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()));
|
||||||
|
MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID())) {
|
if (!plot.isOwner(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
|
if (!Permissions
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION,
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
|
||||||
C.PERMISSION_ADMIN_COMMAND.f(getFullId()));
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()));
|
||||||
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.BlockLoc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -21,7 +21,7 @@ public class SetHome extends SetCommand {
|
|||||||
case "none": {
|
case "none": {
|
||||||
Plot base = plot.getBasePlot(false);
|
Plot base = plot.getBasePlot(false);
|
||||||
base.setHome(null);
|
base.setHome(null);
|
||||||
return MainUtil.sendMessage(player, C.POSITION_UNSET);
|
return MainUtil.sendMessage(player, Captions.POSITION_UNSET);
|
||||||
}
|
}
|
||||||
case "":
|
case "":
|
||||||
Plot base = plot.getBasePlot(false);
|
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(),
|
new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(),
|
||||||
loc.getYaw(), loc.getPitch());
|
loc.getYaw(), loc.getPitch());
|
||||||
base.setHome(rel);
|
base.setHome(rel);
|
||||||
return MainUtil.sendMessage(player, C.POSITION_SET);
|
return MainUtil.sendMessage(player, Captions.POSITION_SET);
|
||||||
default:
|
default:
|
||||||
MainUtil.sendMessage(player, C.HOME_ARGUMENT);
|
MainUtil.sendMessage(player, Captions.HOME_ARGUMENT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||||
@ -43,7 +43,7 @@ import java.util.Map.Entry;
|
|||||||
object = new SetupObject();
|
object = new SetupObject();
|
||||||
player.setMeta("setup", object);
|
player.setMeta("setup", object);
|
||||||
SetupUtils.manager.updateGenerators();
|
SetupUtils.manager.updateGenerators();
|
||||||
sendMessage(player, C.SETUP_INIT);
|
sendMessage(player, Captions.SETUP_INIT);
|
||||||
displayGenerators(player);
|
displayGenerators(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -57,7 +57,8 @@ import java.util.Map.Entry;
|
|||||||
if (object.setup_index > 0) {
|
if (object.setup_index > 0) {
|
||||||
object.setup_index--;
|
object.setup_index--;
|
||||||
ConfigurationNode node = object.step[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()));
|
node.getType().getType(), String.valueOf(node.getDefaultValue()));
|
||||||
return false;
|
return false;
|
||||||
} else if (object.current > 0) {
|
} else if (object.current > 0) {
|
||||||
@ -75,7 +76,7 @@ import java.util.Map.Entry;
|
|||||||
.join(SetupUtils.generators.keySet(), prefix)
|
.join(SetupUtils.generators.keySet(), prefix)
|
||||||
.replaceAll(PlotSquared.imp().getPluginName(),
|
.replaceAll(PlotSquared.imp().getPluginName(),
|
||||||
"&2" + PlotSquared.imp().getPluginName()));
|
"&2" + PlotSquared.imp().getPluginName()));
|
||||||
sendMessage(player, C.SETUP_INIT);
|
sendMessage(player, Captions.SETUP_INIT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
object.setupGenerator = args[0];
|
object.setupGenerator = args[0];
|
||||||
@ -129,7 +130,8 @@ import java.util.Map.Entry;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ConfigurationNode step = object.step[object.setup_index];
|
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()));
|
step.getType().getType(), String.valueOf(step.getDefaultValue()));
|
||||||
} else {
|
} else {
|
||||||
if (gen.isFull()) {
|
if (gen.isFull()) {
|
||||||
@ -231,7 +233,8 @@ import java.util.Map.Entry;
|
|||||||
.getSettingNodes();
|
.getSettingNodes();
|
||||||
}
|
}
|
||||||
ConfigurationNode step = object.step[object.setup_index];
|
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()));
|
step.getType().getType(), String.valueOf(step.getDefaultValue()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -244,7 +247,8 @@ import java.util.Map.Entry;
|
|||||||
}
|
}
|
||||||
ConfigurationNode step = object.step[object.setup_index];
|
ConfigurationNode step = object.step[object.setup_index];
|
||||||
if (args.length < 1) {
|
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()));
|
step.getType().getType(), String.valueOf(step.getDefaultValue()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -253,10 +257,10 @@ import java.util.Map.Entry;
|
|||||||
try {
|
try {
|
||||||
valid = step.isValid(args[0]);
|
valid = step.isValid(args[0]);
|
||||||
} catch (final Configuration.UnsafeBlockException e) {
|
} 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) {
|
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]);
|
step.setValue(args[0]);
|
||||||
object.setup_index++;
|
object.setup_index++;
|
||||||
if (object.setup_index == object.step.length) {
|
if (object.setup_index == object.step.length) {
|
||||||
@ -264,12 +268,14 @@ import java.util.Map.Entry;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
step = object.step[object.setup_index];
|
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()));
|
step.getType().getType(), String.valueOf(step.getDefaultValue()));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, C.SETUP_INVALID_ARG, args[0], step.getConstant());
|
sendMessage(player, Captions.SETUP_INVALID_ARG, args[0], step.getConstant());
|
||||||
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()));
|
step.getType().getType(), String.valueOf(step.getDefaultValue()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -302,7 +308,7 @@ import java.util.Map.Entry;
|
|||||||
player.sendMessage("&cAn error occurred. See console for more information");
|
player.sendMessage("&cAn error occurred. See console for more information");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
sendMessage(player, C.SETUP_FINISHED, object.world);
|
sendMessage(player, Captions.SETUP_FINISHED, object.world);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
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.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
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 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);
|
message.send(player, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -16,15 +16,15 @@ public class Swap extends SubCommand {
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
Plot plot1 = loc.getPlotAbs();
|
Plot plot1 = loc.getPlotAbs();
|
||||||
if (plot1 == null) {
|
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
|
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN.s())) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN.s())) {
|
||||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
||||||
@ -32,22 +32,22 @@ public class Swap extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot1.equals(plot2)) {
|
if (plot1.equals(plot2)) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy <X;Z>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
||||||
C.PLOTWORLD_INCOMPATIBLE.send(player);
|
Captions.PLOTWORLD_INCOMPATIBLE.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot1.move(plot2, new Runnable() {
|
if (plot1.move(plot2, new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
MainUtil.sendMessage(player, C.SWAP_SUCCESS);
|
MainUtil.sendMessage(player, Captions.SWAP_SUCCESS);
|
||||||
}
|
}
|
||||||
}, true)) {
|
}, true)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.SWAP_OVERLAP);
|
MainUtil.sendMessage(player, Captions.SWAP_OVERLAP);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
if (!location.isPlotArea()) {
|
if (!location.isPlotArea()) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot target = null;
|
Plot target = null;
|
||||||
@ -36,14 +36,14 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
MainUtil.sendMessage(player, C.FOUND_NO_PLOTS);
|
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if ((target = MainUtil.getPlotFromString(player, args[0], true)) == null) {
|
} else if ((target = MainUtil.getPlotFromString(player, args[0], true)) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.setCompassTarget(target.getCenter());
|
player.setCompassTarget(target.getCenter());
|
||||||
MainUtil.sendMessage(player, C.COMPASS_TARGET);
|
MainUtil.sendMessage(player, Captions.COMPASS_TARGET);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti
|
|||||||
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
|
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
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 != 2 && args.length != 3) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (args[0].equalsIgnoreCase("export")) {
|
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;
|
return true;
|
||||||
} else if (args[0].equalsIgnoreCase("import")) {
|
} else if (args[0].equalsIgnoreCase("import")) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot template import <world> <template>");
|
"/plot template import <world> <template>");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot template <import|export> <world> [template]");
|
"/plot template <import|export> <world> [template]");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -123,12 +124,12 @@ import java.util.zip.ZipOutputStream;
|
|||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "import": {
|
case "import": {
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX,
|
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||||
"/plot template import <world> <template>");
|
"/plot template import <world> <template>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (PlotSquared.get().hasPlotArea(world)) {
|
if (PlotSquared.get().hasPlotArea(world)) {
|
||||||
MainUtil.sendMessage(player, C.SETUP_WORLD_TAKEN, world);
|
MainUtil.sendMessage(player, Captions.SETUP_WORLD_TAKEN, world);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean result = extractAllFiles(world, args[2]);
|
boolean result = extractAllFiles(world, args[2]);
|
||||||
@ -171,12 +172,13 @@ import java.util.zip.ZipOutputStream;
|
|||||||
}
|
}
|
||||||
case "export":
|
case "export":
|
||||||
if (args.length != 2) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotArea area = PlotSquared.get().getPlotAreaByString(world);
|
final PlotArea area = PlotSquared.get().getPlotAreaByString(world);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotManager manager = area.getPlotManager();
|
final PlotManager manager = area.getPlotManager();
|
||||||
@ -194,7 +196,7 @@ import java.util.zip.ZipOutputStream;
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.PlotArea;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
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,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) {
|
RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
if (toggle(player, "chatspy")) {
|
if (toggle(player, "chatspy")) {
|
||||||
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
|
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
|
||||||
} else {
|
} 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,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) {
|
RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
if (toggle(player, "worldedit")) {
|
if (toggle(player, "worldedit")) {
|
||||||
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
|
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
|
||||||
} else {
|
} 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,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) {
|
RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
if (toggle(player, "chat")) {
|
if (toggle(player, "chat")) {
|
||||||
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
|
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
|
||||||
} else {
|
} 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,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) {
|
RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
if (toggle(player, "ignoreExpireTask")) {
|
if (toggle(player, "ignoreExpireTask")) {
|
||||||
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
|
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
|
||||||
} else {
|
} 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();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
boolean chat = area != null && area.PLOT_CHAT;
|
boolean chat = area != null && area.PLOT_CHAT;
|
||||||
if (toggle(player, "disabletitles") != chat) {
|
if (toggle(player, "disabletitles") != chat) {
|
||||||
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
|
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
|
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String world = args[0];
|
final String world = args[0];
|
||||||
if (!WorldUtil.IMP.isWorld(world) || !PlotSquared.get().hasPlotArea(world)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (Trim.TASK) {
|
if (Trim.TASK) {
|
||||||
C.TRIM_IN_PROGRESS.send(player);
|
Captions.TRIM_IN_PROGRESS.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Trim.TASK = true;
|
Trim.TASK = true;
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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,
|
@Override public void execute(final PlotPlayer player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||||
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
|
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||||
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
|
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
|
||||||
checkTrue(plot.isOwner(player.getUUID()) || Permissions
|
checkTrue(plot.isOwner(player.getUUID()) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
|
||||||
checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage());
|
Captions.NO_PLOT_PERMS);
|
||||||
|
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
|
||||||
final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
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();
|
Iterator<UUID> iter = uuids.iterator();
|
||||||
int size = plot.getTrusted().size() + plot.getMembers().size();
|
int size = plot.getTrusted().size() + plot.getMembers().size();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
UUID uuid = iter.next();
|
UUID uuid = iter.next();
|
||||||
if (uuid == DBFunc.EVERYONE && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
|
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid));
|
||||||
iter.remove();
|
iter.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plot.isOwner(uuid)) {
|
if (plot.isOwner(uuid)) {
|
||||||
MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid));
|
||||||
iter.remove();
|
iter.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plot.getTrusted().contains(uuid)) {
|
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();
|
iter.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -60,7 +61,8 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
checkTrue(!uuids.isEmpty(), null);
|
checkTrue(!uuids.isEmpty(), null);
|
||||||
checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions
|
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
|
// Success
|
||||||
confirm.run(this, () -> {
|
confirm.run(this, () -> {
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
@ -73,7 +75,7 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
plot.addTrusted(uuid);
|
plot.addTrusted(uuid);
|
||||||
EventUtil.manager.callTrusted(player, plot, uuid, true);
|
EventUtil.manager.callTrusted(player, plot, uuid, true);
|
||||||
MainUtil.sendMessage(player, C.TRUSTED_ADDED);
|
MainUtil.sendMessage(player, Captions.TRUSTED_ADDED);
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -17,22 +17,22 @@ public class Unlink extends SubCommand {
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
final Plot plot = loc.getPlotAbs();
|
final Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return !sendMessage(player, C.PLOT_UNOWNED);
|
return !sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_UNLINK)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_UNLINK)) {
|
||||||
return sendMessage(player, C.NO_PLOT_PERMS);
|
return sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
}
|
}
|
||||||
if (!plot.isMerged()) {
|
if (!plot.isMerged()) {
|
||||||
return sendMessage(player, C.UNLINK_IMPOSSIBLE);
|
return sendMessage(player, Captions.UNLINK_IMPOSSIBLE);
|
||||||
}
|
}
|
||||||
final boolean createRoad;
|
final boolean createRoad;
|
||||||
if (args.length != 0) {
|
if (args.length != 0) {
|
||||||
if (args.length != 1 || !StringMan.isEqualIgnoreCaseToAny(args[0], "true", "false")) {
|
if (args.length != 1 || !StringMan.isEqualIgnoreCaseToAny(args[0], "true", "false")) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
createRoad = Boolean.parseBoolean(args[0]);
|
createRoad = Boolean.parseBoolean(args[0]);
|
||||||
@ -45,7 +45,7 @@ public class Unlink extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, "&cUnlink has been cancelled");
|
MainUtil.sendMessage(player, "&cUnlink has been cancelled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.UNLINK_SUCCESS);
|
MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
@ -39,8 +39,8 @@ import java.util.*;
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 3:
|
case 3:
|
||||||
if (!MathMan.isInteger(args[1])) {
|
if (!MathMan.isInteger(args[1])) {
|
||||||
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
Captions.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
page = Integer.parseInt(args[2]);
|
page = Integer.parseInt(args[2]);
|
||||||
@ -48,13 +48,13 @@ import java.util.*;
|
|||||||
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
|
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
|
||||||
sortByArea = PlotSquared.get().getPlotAreaByString(args[1]);
|
sortByArea = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
if (sortByArea == null) {
|
if (sortByArea == null) {
|
||||||
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
Captions.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UUID user = UUIDHandler.getUUIDFromString(args[0]);
|
UUID user = UUIDHandler.getUUIDFromString(args[0]);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsorted = PlotSquared.get().getBasePlots(user);
|
unsorted = PlotSquared.get().getBasePlots(user);
|
||||||
@ -92,13 +92,13 @@ import java.util.*;
|
|||||||
page = 1;
|
page = 1;
|
||||||
}
|
}
|
||||||
if (unsorted == null || unsorted.isEmpty()) {
|
if (unsorted == null || unsorted.isEmpty()) {
|
||||||
C.FOUND_NO_PLOTS.send(player);
|
Captions.FOUND_NO_PLOTS.send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsorted = new ArrayList<>(unsorted);
|
unsorted = new ArrayList<>(unsorted);
|
||||||
unsorted.removeIf(plot -> !plot.isBasePlot());
|
unsorted.removeIf(plot -> !plot.isBasePlot());
|
||||||
if (page < 1 || page > unsorted.size()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
List<Plot> plots;
|
List<Plot> plots;
|
||||||
@ -110,24 +110,24 @@ import java.util.*;
|
|||||||
}
|
}
|
||||||
final Plot plot = plots.get(page - 1);
|
final Plot plot = plots.get(page - 1);
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_UNOWNED)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_UNOWNED)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_UNOWNED);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_UNOWNED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (plot.isOwner(player.getUUID())) {
|
} else if (plot.isOwner(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OWNED) && !Permissions
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OWNED) && !Permissions
|
||||||
.hasPermission(player, C.PERMISSION_HOME)) {
|
.hasPermission(player, Captions.PERMISSION_HOME)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OWNED);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OWNED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (plot.isAdded(player.getUUID())) {
|
} else if (plot.isAdded(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_SHARED)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_SHARED)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_SHARED);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_SHARED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OTHER)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OTHER)) {
|
||||||
C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OTHER);
|
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OTHER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import java.util.*;
|
|||||||
/**
|
/**
|
||||||
* Captions class.
|
* Captions class.
|
||||||
*/
|
*/
|
||||||
public enum C {
|
public enum Captions {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Static flags
|
* Static flags
|
||||||
@ -896,7 +896,7 @@ public enum C {
|
|||||||
* @param def default
|
* @param def default
|
||||||
* @param prefix use prefix
|
* @param prefix use prefix
|
||||||
*/
|
*/
|
||||||
C(String def, boolean prefix, String category) {
|
Captions(String def, boolean prefix, String category) {
|
||||||
this.def = def;
|
this.def = def;
|
||||||
this.s = def;
|
this.s = def;
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
@ -908,7 +908,7 @@ public enum C {
|
|||||||
*
|
*
|
||||||
* @param def default
|
* @param def default
|
||||||
*/
|
*/
|
||||||
C(String def, String category) {
|
Captions(String def, String category) {
|
||||||
this(def, true, category.toLowerCase());
|
this(def, true, category.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,7 +923,7 @@ public enum C {
|
|||||||
if (arg == null || arg.isEmpty()) {
|
if (arg == null || arg.isEmpty()) {
|
||||||
map.put("%s" + i, "");
|
map.put("%s" + i, "");
|
||||||
} else {
|
} else {
|
||||||
arg = C.color(arg);
|
arg = Captions.color(arg);
|
||||||
map.put("%s" + i, arg);
|
map.put("%s" + i, arg);
|
||||||
}
|
}
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@ -935,9 +935,9 @@ public enum C {
|
|||||||
return m;
|
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) {
|
if (caption.usePrefix() && caption.s.length() > 0) {
|
||||||
return C.PREFIX.s() + format(caption.s, args);
|
return Captions.PREFIX.s() + format(caption.s, args);
|
||||||
} else {
|
} else {
|
||||||
return format(caption.s, args);
|
return format(caption.s, args);
|
||||||
}
|
}
|
||||||
@ -955,15 +955,15 @@ public enum C {
|
|||||||
}
|
}
|
||||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
|
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
|
||||||
Set<String> keys = yml.getKeys(true);
|
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> allNames = new HashSet<>();
|
||||||
HashSet<String> categories = new HashSet<>();
|
HashSet<String> categories = new HashSet<>();
|
||||||
HashSet<String> toRemove = new HashSet<>();
|
HashSet<String> toRemove = new HashSet<>();
|
||||||
for (C caption : allEnums) {
|
for (Captions caption : allEnums) {
|
||||||
allNames.add(caption.name());
|
allNames.add(caption.name());
|
||||||
categories.add(caption.category.toLowerCase());
|
categories.add(caption.category.toLowerCase());
|
||||||
}
|
}
|
||||||
HashSet<C> captions = new HashSet<>();
|
HashSet<Captions> captions = new HashSet<>();
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
if (!yml.isString(key)) {
|
if (!yml.isString(key)) {
|
||||||
@ -974,7 +974,7 @@ public enum C {
|
|||||||
}
|
}
|
||||||
String[] split = key.split("\\.");
|
String[] split = key.split("\\.");
|
||||||
String node = split[split.length - 1].toUpperCase();
|
String node = split[split.length - 1].toUpperCase();
|
||||||
C caption;
|
Captions caption;
|
||||||
if (allNames.contains(node)) {
|
if (allNames.contains(node)) {
|
||||||
caption = valueOf(node);
|
caption = valueOf(node);
|
||||||
} else {
|
} else {
|
||||||
@ -1013,7 +1013,7 @@ public enum C {
|
|||||||
replacements.put("\\\\n", "\n");
|
replacements.put("\\\\n", "\n");
|
||||||
replacements.put("\\n", "\n");
|
replacements.put("\\n", "\n");
|
||||||
replacements.put("&-", "\n");
|
replacements.put("&-", "\n");
|
||||||
for (C caption : allEnums) {
|
for (Captions caption : allEnums) {
|
||||||
if (!captions.contains(caption)) {
|
if (!captions.contains(caption)) {
|
||||||
if (caption.getCategory().startsWith("static")) {
|
if (caption.getCategory().startsWith("static")) {
|
||||||
continue;
|
continue;
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.generator;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
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) {
|
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
|
||||||
PlotSquared.debug(C.PREFIX + "&3 - schematic: &7false");
|
PlotSquared.debug(Captions.PREFIX + "&3 - schematic: &7false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.ROAD_SCHEMATIC_ENABLED = true;
|
this.ROAD_SCHEMATIC_ENABLED = true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.FlagManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.listener.WEExtent;
|
import com.github.intellectualsites.plotsquared.plot.listener.WEExtent;
|
||||||
@ -153,7 +153,7 @@ public abstract class HybridUtils {
|
|||||||
}
|
}
|
||||||
if (regions.isEmpty() && chunks.isEmpty()) {
|
if (regions.isEmpty() && chunks.isEmpty()) {
|
||||||
HybridUtils.UPDATE = false;
|
HybridUtils.UPDATE = false;
|
||||||
PlotSquared.debug(C.PREFIX.s() + "Finished road conversion");
|
PlotSquared.debug(Captions.PREFIX.s() + "Finished road conversion");
|
||||||
// CANCEL TASK
|
// CANCEL TASK
|
||||||
} else {
|
} else {
|
||||||
final Runnable task = this;
|
final Runnable task = this;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||||
@ -52,7 +52,7 @@ public class PlotListener {
|
|||||||
Optional<String> greetingFlag = plot.getFlag(Flags.GREETING);
|
Optional<String> greetingFlag = plot.getFlag(Flags.GREETING);
|
||||||
if (greetingFlag.isPresent()) {
|
if (greetingFlag.isPresent()) {
|
||||||
greeting = greetingFlag.get();
|
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>() {
|
new RunnableVal<String>() {
|
||||||
@Override public void run(String value) {
|
@Override public void run(String value) {
|
||||||
MainUtil.sendMessage(player, value);
|
MainUtil.sendMessage(player, value);
|
||||||
@ -68,7 +68,7 @@ public class PlotListener {
|
|||||||
PlotPlayer owner = UUIDHandler.getPlayer(uuid);
|
PlotPlayer owner = UUIDHandler.getPlayer(uuid);
|
||||||
if (owner != null && !owner.getUUID().equals(player.getUUID())) {
|
if (owner != null && !owner.getUUID().equals(player.getUUID())) {
|
||||||
MainUtil.sendMessage(owner,
|
MainUtil.sendMessage(owner,
|
||||||
C.NOTIFY_ENTER.s().replace("%player", player.getName())
|
Captions.NOTIFY_ENTER.s().replace("%player", player.getName())
|
||||||
.replace("%plot", plot.getId().toString()));
|
.replace("%plot", plot.getId().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +94,8 @@ public class PlotListener {
|
|||||||
player.setGameMode(gamemodeFlag.get());
|
player.setGameMode(gamemodeFlag.get());
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, StringMan
|
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()));
|
"{gamemode}", gamemodeFlag.get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +108,8 @@ public class PlotListener {
|
|||||||
player.setGameMode(guestGamemodeFlag.get());
|
player.setGameMode(guestGamemodeFlag.get());
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, StringMan
|
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()));
|
"{gamemode}", guestGamemodeFlag.get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +157,8 @@ public class PlotListener {
|
|||||||
CommentManager.sendTitle(player, plot);
|
CommentManager.sendTitle(player, plot);
|
||||||
}
|
}
|
||||||
if (titles) {
|
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()) {
|
.isEmpty()) {
|
||||||
TaskManager.runTaskLaterAsync(() -> {
|
TaskManager.runTaskLaterAsync(() -> {
|
||||||
Plot lastPlot = player.getMeta(PlotPlayer.META_LAST_PLOT);
|
Plot lastPlot = player.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
@ -167,10 +170,10 @@ public class PlotListener {
|
|||||||
replacements.put("%greeting%", greeting);
|
replacements.put("%greeting%", greeting);
|
||||||
replacements.put("%alias", plot.toString());
|
replacements.put("%alias", plot.toString());
|
||||||
replacements.put("%s", MainUtil.getName(plot.owner));
|
replacements.put("%s", MainUtil.getName(plot.owner));
|
||||||
String main =
|
String main = StringMan
|
||||||
StringMan.replaceFromMap(C.TITLE_ENTERED_PLOT.s(), replacements);
|
.replaceFromMap(Captions.TITLE_ENTERED_PLOT.s(), replacements);
|
||||||
String sub = StringMan
|
String sub = StringMan
|
||||||
.replaceFromMap(C.TITLE_ENTERED_PLOT_SUB.s(), replacements);
|
.replaceFromMap(Captions.TITLE_ENTERED_PLOT_SUB.s(), replacements);
|
||||||
AbstractTitle.sendTitle(player, main, sub);
|
AbstractTitle.sendTitle(player, main, sub);
|
||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
@ -202,14 +205,16 @@ public class PlotListener {
|
|||||||
player.setGameMode(pw.GAMEMODE);
|
player.setGameMode(pw.GAMEMODE);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, StringMan
|
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()));
|
"{gamemode}", pw.GAMEMODE.name().toLowerCase()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Optional<String> farewell = plot.getFlag(Flags.FAREWELL);
|
Optional<String> farewell = plot.getFlag(Flags.FAREWELL);
|
||||||
farewell.ifPresent(s -> MainUtil
|
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) {
|
@Override public void run(String value) {
|
||||||
MainUtil.sendMessage(player, value);
|
MainUtil.sendMessage(player, value);
|
||||||
}
|
}
|
||||||
@ -221,7 +226,7 @@ public class PlotListener {
|
|||||||
PlotPlayer owner = UUIDHandler.getPlayer(uuid);
|
PlotPlayer owner = UUIDHandler.getPlayer(uuid);
|
||||||
if ((owner != null) && !owner.getUUID().equals(player.getUUID())) {
|
if ((owner != null) && !owner.getUUID().equals(player.getUUID())) {
|
||||||
MainUtil.sendMessage(owner,
|
MainUtil.sendMessage(owner,
|
||||||
C.NOTIFY_LEAVE.s().replace("%player", player.getName())
|
Captions.NOTIFY_LEAVE.s().replace("%player", player.getName())
|
||||||
.replace("%plot", plot.getId().toString()));
|
.replace("%plot", plot.getId().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
package com.github.intellectualsites.plotsquared.plot.listener;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
@ -107,7 +107,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
|
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
|
||||||
this.BSblocked = true;
|
this.BSblocked = true;
|
||||||
PlotSquared.debug(
|
PlotSquared.debug(
|
||||||
C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getX() + ","
|
Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getX() + ","
|
||||||
+ location.getZ());
|
+ location.getZ());
|
||||||
}
|
}
|
||||||
if (WEManager
|
if (WEManager
|
||||||
@ -162,7 +162,8 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
|
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||||
this.Eblocked = true;
|
this.Eblocked = true;
|
||||||
PlotSquared.debug(
|
PlotSquared.debug(
|
||||||
C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location
|
Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + ","
|
||||||
|
+ location
|
||||||
.getBlockZ());
|
.getBlockZ());
|
||||||
}
|
}
|
||||||
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),
|
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
package com.github.intellectualsites.plotsquared.plot.listener;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -54,7 +54,7 @@ public class WESubscriber {
|
|||||||
mask = WEManager.getMask(pp);
|
mask = WEManager.getMask(pp);
|
||||||
if (mask.isEmpty()) {
|
if (mask.isEmpty()) {
|
||||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
MainUtil.sendMessage(pp, Captions.WORLDEDIT_BYPASS);
|
||||||
}
|
}
|
||||||
if (PlotSquared.get().hasPlotArea(world)) {
|
if (PlotSquared.get().hasPlotArea(world)) {
|
||||||
event.setExtent(new NullExtent());
|
event.setExtent(new NullExtent());
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
package com.github.intellectualsites.plotsquared.plot.object;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable;
|
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.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -159,7 +159,7 @@ import java.util.Map.Entry;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!unassigned.isEmpty()) {
|
} 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
|
// If the sum adds up to more than 100, divide all values
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
package com.github.intellectualsites.plotsquared.plot.object;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
@ -967,10 +967,14 @@ public class Plot {
|
|||||||
if (this.area.ALLOW_SIGNS) {
|
if (this.area.ALLOW_SIGNS) {
|
||||||
Location loc = manager.getSignLoc(this.area, this);
|
Location loc = manager.getSignLoc(this.area, this);
|
||||||
String id = this.id.x + ";" + this.id.y;
|
String id = this.id.x + ";" + this.id.y;
|
||||||
String[] lines = new String[] {C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
|
String[] lines =
|
||||||
C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
|
new String[] {Captions.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
|
||||||
C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
|
Captions.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll(
|
||||||
C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", name)};
|
"%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);
|
WorldUtil.IMP.setSign(this.getWorldName(), loc.getX(), loc.getY(), loc.getZ(), lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1428,7 +1432,7 @@ public class Plot {
|
|||||||
area.addPlot(this);
|
area.addPlot(this);
|
||||||
}
|
}
|
||||||
setSign(player.getName());
|
setSign(player.getName());
|
||||||
MainUtil.sendMessage(player, C.CLAIMED);
|
MainUtil.sendMessage(player, Captions.CLAIMED);
|
||||||
if (teleport) {
|
if (teleport) {
|
||||||
teleportPlayer(player);
|
teleportPlayer(player);
|
||||||
}
|
}
|
||||||
@ -1452,9 +1456,9 @@ public class Plot {
|
|||||||
new RunnableVal<Boolean>() {
|
new RunnableVal<Boolean>() {
|
||||||
@Override public void run(Boolean value) {
|
@Override public void run(Boolean value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
MainUtil.sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS);
|
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, C.SCHEMATIC_PASTE_FAILED);
|
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -2093,7 +2097,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
loop:
|
loop:
|
||||||
for (int i = 4; i > 0; i--) {
|
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%");
|
int index = caption.indexOf("%plr%");
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
continue;
|
continue;
|
||||||
@ -2681,21 +2685,22 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
if (Settings.Teleport.DELAY == 0 || Permissions
|
if (Settings.Teleport.DELAY == 0 || Permissions
|
||||||
.hasPermission(player, "plots.teleport.delay.bypass")) {
|
.hasPermission(player, "plots.teleport.delay.bypass")) {
|
||||||
MainUtil.sendMessage(player, C.TELEPORTED_TO_PLOT);
|
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
|
||||||
player.teleport(location);
|
player.teleport(location);
|
||||||
return true;
|
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();
|
final String name = player.getName();
|
||||||
TaskManager.TELEPORT_QUEUE.add(name);
|
TaskManager.TELEPORT_QUEUE.add(name);
|
||||||
TaskManager.runTaskLater(() -> {
|
TaskManager.runTaskLater(() -> {
|
||||||
if (!TaskManager.TELEPORT_QUEUE.contains(name)) {
|
if (!TaskManager.TELEPORT_QUEUE.contains(name)) {
|
||||||
MainUtil.sendMessage(player, C.TELEPORT_FAILED);
|
MainUtil.sendMessage(player, Captions.TELEPORT_FAILED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TaskManager.TELEPORT_QUEUE.remove(name);
|
TaskManager.TELEPORT_QUEUE.remove(name);
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
MainUtil.sendMessage(player, C.TELEPORTED_TO_PLOT);
|
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
|
||||||
player.teleport(location);
|
player.teleport(location);
|
||||||
}
|
}
|
||||||
}, Settings.Teleport.DELAY * 20);
|
}, Settings.Teleport.DELAY * 20);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
package com.github.intellectualsites.plotsquared.plot.object;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.object.chat.PlainChatManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ public class PlotMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PlotMessage color(String color) {
|
public PlotMessage color(String color) {
|
||||||
ChatManager.manager.color(this, C.color(color));
|
ChatManager.manager.color(this, Captions.color(color));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.object;
|
|||||||
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
|
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
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) {
|
public int hasPermissionRange(String stub, int range) {
|
||||||
if (hasPermission(C.PERMISSION_ADMIN.s())) {
|
if (hasPermission(Captions.PERMISSION_ADMIN.s())) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
String[] nodes = stub.split("\\.");
|
String[] nodes = stub.split("\\.");
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||||
builder.append(nodes[i]).append(".");
|
builder.append(nodes[i]).append(".");
|
||||||
if (!stub.equals(builder + C.PERMISSION_STAR.s())) {
|
if (!stub.equals(builder + Captions.PERMISSION_STAR.s())) {
|
||||||
if (hasPermission(builder + C.PERMISSION_STAR.s())) {
|
if (hasPermission(builder + Captions.PERMISSION_STAR.s())) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -563,7 +563,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
TaskManager.runTask(() -> {
|
TaskManager.runTask(() -> {
|
||||||
if (getMeta("teleportOnLogin", true)) {
|
if (getMeta("teleportOnLogin", true)) {
|
||||||
teleport(loc);
|
teleport(loc);
|
||||||
sendMessage(C.TELEPORTED_TO_PLOT.f()
|
sendMessage(
|
||||||
|
Captions.TELEPORTED_TO_PLOT.f()
|
||||||
+ " (quitLoc) (" + plotX + ","
|
+ " (quitLoc) (" + plotX + ","
|
||||||
+ plotZ + ")");
|
+ plotZ + ")");
|
||||||
}
|
}
|
||||||
@ -577,7 +578,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
true)) {
|
true)) {
|
||||||
teleport(loc);
|
teleport(loc);
|
||||||
sendMessage(
|
sendMessage(
|
||||||
C.TELEPORTED_TO_PLOT.f()
|
Captions.TELEPORTED_TO_PLOT
|
||||||
|
.f()
|
||||||
+ " (quitLoc-unloaded) ("
|
+ " (quitLoc-unloaded) ("
|
||||||
+ plotX + "," + plotZ
|
+ plotX + "," + plotZ
|
||||||
+ ")");
|
+ ")");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object.chat;
|
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.PlotMessage;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
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) {
|
@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) {
|
@Override public void send(PlotMessage plotMessage, PlotPlayer player) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object.worlds;
|
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.flag.Flag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ public class SinglePlot extends Plot {
|
|||||||
if (isLoaded()) {
|
if (isLoaded()) {
|
||||||
return super.teleportPlayer(player);
|
return super.teleportPlayer(player);
|
||||||
} else {
|
} else {
|
||||||
C.NOT_LOADED.send(player);
|
Captions.NOT_LOADED.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
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.CmdInstance;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class CmdConfirm {
|
|||||||
final Runnable runnable) {
|
final Runnable runnable) {
|
||||||
removePending(player);
|
removePending(player);
|
||||||
if (commandStr != null) {
|
if (commandStr != null) {
|
||||||
MainUtil.sendMessage(player, C.REQUIRES_CONFIRM, commandStr);
|
MainUtil.sendMessage(player, Captions.REQUIRES_CONFIRM, commandStr);
|
||||||
}
|
}
|
||||||
TaskManager.runTaskLater(new Runnable() {
|
TaskManager.runTaskLater(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -41,7 +41,7 @@ public class CommentManager {
|
|||||||
}
|
}
|
||||||
if ((size.decrementAndGet() == 0) && (total > 0)) {
|
if ((size.decrementAndGet() == 0) && (total > 0)) {
|
||||||
AbstractTitle.sendTitle(player, "",
|
AbstractTitle.sendTitle(player, "",
|
||||||
C.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total));
|
Captions.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
package com.github.intellectualsites.plotsquared.plot.util;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
@ -71,7 +71,7 @@ public abstract class EventUtil {
|
|||||||
}
|
}
|
||||||
if (PlotSquared.get().worldedit != null) {
|
if (PlotSquared.get().worldedit != null) {
|
||||||
if (player.getAttribute("worldedit")) {
|
if (player.getAttribute("worldedit")) {
|
||||||
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASSED);
|
MainUtil.sendMessage(player, Captions.WORLDEDIT_BYPASSED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
@ -82,7 +82,7 @@ public abstract class EventUtil {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
MainUtil.sendMessage(player,
|
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 + ")");
|
.getId().y + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ public abstract class EventUtil {
|
|||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (Settings.Teleport.ON_DEATH && plot != null) {
|
if (Settings.Teleport.ON_DEATH && plot != null) {
|
||||||
TaskManager.runTask(() -> plot.teleportPlayer(player));
|
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:
|
case BREAK_BLOCK:
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
notifyPerms);
|
notifyPerms);
|
||||||
}
|
}
|
||||||
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
|
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
|
||||||
@ -144,69 +145,80 @@ public abstract class EventUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
|
return !(!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
C.FLAG_USE.s() + '/' + C.FLAG_BREAK.s()));
|
Captions.FLAG_USE.s() + '/' + Captions.FLAG_BREAK.s()));
|
||||||
case BREAK_HANGING:
|
case BREAK_HANGING:
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
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)) {
|
if (plot.getFlag(Flags.HANGING_BREAK).orElse(false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)
|
||||||
!notifyPerms || MainUtil
|
|| !(
|
||||||
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_HANGING_BREAK.s()));
|
!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_HANGING_BREAK.s()));
|
||||||
}
|
}
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
|
notifyPerms);
|
||||||
case BREAK_MISC:
|
case BREAK_MISC:
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
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)) {
|
if (plot.getFlag(Flags.MISC_BREAK).orElse(false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)
|
||||||
!notifyPerms || MainUtil
|
|| !(
|
||||||
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_BREAK.s()));
|
!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_MISC_BREAK.s()));
|
||||||
}
|
}
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
|
notifyPerms);
|
||||||
case BREAK_VEHICLE:
|
case BREAK_VEHICLE:
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
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)) {
|
if (plot.getFlag(Flags.VEHICLE_BREAK).orElse(false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
|
||||||
|
false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil
|
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
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
|
notifyPerms);
|
||||||
case INTERACT_BLOCK: {
|
case INTERACT_BLOCK: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
notifyPerms);
|
notifyPerms);
|
||||||
}
|
}
|
||||||
Optional<HashSet<PlotBlock>> flagValue = plot.getFlag(Flags.USE);
|
Optional<HashSet<PlotBlock>> flagValue = plot.getFlag(Flags.USE);
|
||||||
@ -214,42 +226,47 @@ public abstract class EventUtil {
|
|||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)
|
||||||
!notifyPerms || MainUtil
|
|| !(
|
||||||
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s()));
|
!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_USE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case PLACE_BLOCK: {
|
case PLACE_BLOCK: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_BUILD_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
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);
|
Optional<HashSet<PlotBlock>> flagValue = plot.getFlag(Flags.PLACE);
|
||||||
HashSet<PlotBlock> value = flagValue.orElse(null);
|
HashSet<PlotBlock> value = flagValue.orElse(null);
|
||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_BUILD_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_OTHER.s(), false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
case TRIGGER_PHYSICAL: {
|
case TRIGGER_PHYSICAL: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), false);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), false);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
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)) {
|
if (plot.getFlag(Flags.DEVICE_INTERACT).orElse(false)) {
|
||||||
return true;
|
return true;
|
||||||
@ -259,7 +276,8 @@ public abstract class EventUtil {
|
|||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
|
||||||
|
false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -269,11 +287,12 @@ public abstract class EventUtil {
|
|||||||
case INTERACT_HANGING: {
|
case INTERACT_HANGING: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
notifyPerms);
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) {
|
if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) {
|
||||||
@ -284,22 +303,25 @@ public abstract class EventUtil {
|
|||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
|
||||||
|
false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
|
return !(!notifyPerms || MainUtil
|
||||||
C.FLAG_USE.s() + '/' + C.FLAG_HANGING_INTERACT.s()));
|
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_USE.s() + '/' + Captions.FLAG_HANGING_INTERACT.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case INTERACT_MISC: {
|
case INTERACT_MISC: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
notifyPerms);
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) {
|
if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) {
|
||||||
@ -310,22 +332,25 @@ public abstract class EventUtil {
|
|||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
|
||||||
|
false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
|
return !(!notifyPerms || MainUtil
|
||||||
C.FLAG_USE.s() + '/' + C.FLAG_MISC_INTERACT.s()));
|
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_USE.s() + '/' + Captions.FLAG_MISC_INTERACT.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case INTERACT_VEHICLE: {
|
case INTERACT_VEHICLE: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
notifyPerms);
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) {
|
if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) {
|
||||||
@ -336,22 +361,25 @@ public abstract class EventUtil {
|
|||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
|
||||||
|
false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
|
return !(!notifyPerms || MainUtil
|
||||||
C.FLAG_USE.s() + '/' + C.FLAG_VEHICLE_USE.s()));
|
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_USE.s() + '/' + Captions.FLAG_VEHICLE_USE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case SPAWN_MOB: {
|
case SPAWN_MOB: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
notifyPerms);
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) {
|
if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) {
|
||||||
@ -362,11 +390,13 @@ public abstract class EventUtil {
|
|||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
|
||||||
|
false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
|
return !(!notifyPerms || MainUtil
|
||||||
C.FLAG_MOB_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_MOB_PLACE.s() + '/' + Captions.FLAG_PLACE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -375,11 +405,12 @@ public abstract class EventUtil {
|
|||||||
case PLACE_MISC: {
|
case PLACE_MISC: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
notifyPerms);
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) {
|
if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) {
|
||||||
@ -390,11 +421,13 @@ public abstract class EventUtil {
|
|||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
|
||||||
|
false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
|
return !(!notifyPerms || MainUtil
|
||||||
C.FLAG_MISC_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_MISC_PLACE.s() + '/' + Captions.FLAG_PLACE.s()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -402,11 +435,12 @@ public abstract class EventUtil {
|
|||||||
case PLACE_VEHICLE:
|
case PLACE_VEHICLE:
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(),
|
||||||
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions
|
return Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(),
|
||||||
notifyPerms);
|
notifyPerms);
|
||||||
}
|
}
|
||||||
if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) {
|
if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) {
|
||||||
@ -417,11 +451,13 @@ public abstract class EventUtil {
|
|||||||
if (value == null || !PlotBlock.containsEverything(value) && !value
|
if (value == null || !PlotBlock.containsEverything(value) && !value
|
||||||
.contains(block.getPlotBlock())) {
|
.contains(block.getPlotBlock())) {
|
||||||
if (Permissions
|
if (Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(),
|
||||||
|
false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE,
|
return !(!notifyPerms || MainUtil
|
||||||
C.FLAG_VEHICLE_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||||
|
Captions.FLAG_VEHICLE_PLACE.s() + '/' + Captions.FLAG_PLACE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.util;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.BlockBucket;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
@ -84,7 +84,7 @@ import java.util.Map;
|
|||||||
@NonNull final String key, @NonNull final String block) {
|
@NonNull final String key, @NonNull final String block) {
|
||||||
final BlockBucket bucket = this.blockToBucket(block);
|
final BlockBucket bucket = this.blockToBucket(block);
|
||||||
this.setString(section, key, bucket);
|
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,
|
private void convertBlockList(@NonNull final ConfigurationSection section,
|
||||||
@ -92,8 +92,8 @@ import java.util.Map;
|
|||||||
final PlotBlock[] blocks = this.splitBlockList(blockList);
|
final PlotBlock[] blocks = this.splitBlockList(blockList);
|
||||||
final BlockBucket bucket = this.blockListToBucket(blocks);
|
final BlockBucket bucket = this.blockListToBucket(blocks);
|
||||||
this.setString(section, key, bucket);
|
this.setString(section, key, bucket);
|
||||||
PlotSquared
|
PlotSquared.log(
|
||||||
.log(C.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString()));
|
Captions.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String plotBlockArrayString(@NonNull final PlotBlock[] blocks) {
|
private String plotBlockArrayString(@NonNull final PlotBlock[] blocks) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
package com.github.intellectualsites.plotsquared.plot.util;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.DoubleFlag;
|
import com.github.intellectualsites.plotsquared.plot.flag.DoubleFlag;
|
||||||
@ -86,8 +86,8 @@ public class MainUtil {
|
|||||||
|
|
||||||
public static void sendAdmin(final String s) {
|
public static void sendAdmin(final String s) {
|
||||||
for (final PlotPlayer player : UUIDHandler.getPlayers().values()) {
|
for (final PlotPlayer player : UUIDHandler.getPlayers().values()) {
|
||||||
if (player.hasPermission(C.PERMISSION_ADMIN.s())) {
|
if (player.hasPermission(Captions.PERMISSION_ADMIN.s())) {
|
||||||
player.sendMessage(C.color(s));
|
player.sendMessage(Captions.color(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotSquared.debug(s);
|
PlotSquared.debug(s);
|
||||||
@ -329,14 +329,14 @@ public class MainUtil {
|
|||||||
*/
|
*/
|
||||||
@Nonnull public static String getName(UUID owner) {
|
@Nonnull public static String getName(UUID owner) {
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
return C.NONE.s();
|
return Captions.NONE.s();
|
||||||
}
|
}
|
||||||
if (owner.equals(DBFunc.EVERYONE)) {
|
if (owner.equals(DBFunc.EVERYONE)) {
|
||||||
return C.EVERYONE.s();
|
return Captions.EVERYONE.s();
|
||||||
}
|
}
|
||||||
String name = UUIDHandler.getName(owner);
|
String name = UUIDHandler.getName(owner);
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
return C.UNKNOWN.s();
|
return Captions.UNKNOWN.s();
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -457,7 +457,7 @@ public class MainUtil {
|
|||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
if (message) {
|
if (message) {
|
||||||
PlotSquared.log(C.NOT_VALID_PLOT_WORLD);
|
PlotSquared.log(Captions.NOT_VALID_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -496,13 +496,13 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message) {
|
if (message) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (message) {
|
if (message) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -564,7 +564,7 @@ public class MainUtil {
|
|||||||
* @param caption
|
* @param caption
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void sendConsoleMessage(C caption, String... args) {
|
public static void sendConsoleMessage(Captions caption, String... args) {
|
||||||
sendMessage(null, caption, args);
|
sendMessage(null, caption, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,10 +579,10 @@ public class MainUtil {
|
|||||||
public static boolean sendMessage(PlotPlayer player, String msg, boolean prefix) {
|
public static boolean sendMessage(PlotPlayer player, String msg, boolean prefix) {
|
||||||
if (!msg.isEmpty()) {
|
if (!msg.isEmpty()) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
String message = (prefix ? C.PREFIX.s() : "") + msg;
|
String message = (prefix ? Captions.PREFIX.s() : "") + msg;
|
||||||
PlotSquared.log(message);
|
PlotSquared.log(message);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage((prefix ? C.PREFIX.s() : "") + C.color(msg));
|
player.sendMessage((prefix ? Captions.PREFIX.s() : "") + Captions.color(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -595,7 +595,7 @@ public class MainUtil {
|
|||||||
* @param caption the message to send
|
* @param caption the message to send
|
||||||
* @return boolean success
|
* @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);
|
return sendMessage(player, caption, (Object[]) args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,14 +606,14 @@ public class MainUtil {
|
|||||||
* @param caption the message to send
|
* @param caption the message to send
|
||||||
* @return boolean success
|
* @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) {
|
final Object... args) {
|
||||||
if (caption.s().isEmpty()) {
|
if (caption.s().isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
String m = C.format(caption, args);
|
String m = Captions.format(caption, args);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
PlotSquared.log(m);
|
PlotSquared.log(m);
|
||||||
} else {
|
} else {
|
||||||
@ -706,7 +706,7 @@ public class MainUtil {
|
|||||||
public static void format(String info, final Plot plot, PlotPlayer player, final boolean full,
|
public static void format(String info, final Plot plot, PlotPlayer player, final boolean full,
|
||||||
final RunnableVal<String> whenDone) {
|
final RunnableVal<String> whenDone) {
|
||||||
int num = plot.getConnectedPlots().size();
|
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];
|
Location bot = plot.getCorners()[0];
|
||||||
String biome = WorldUtil.IMP.getBiome(plot.getWorldName(), bot.getX(), bot.getZ());
|
String biome = WorldUtil.IMP.getBiome(plot.getWorldName(), bot.getX(), bot.getZ());
|
||||||
String trusted = getPlayerList(plot.getTrusted());
|
String trusted = getPlayerList(plot.getTrusted());
|
||||||
@ -715,28 +715,27 @@ public class MainUtil {
|
|||||||
String seen;
|
String seen;
|
||||||
if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
|
if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
|
||||||
if (plot.isOnline()) {
|
if (plot.isOnline()) {
|
||||||
seen = C.NOW.s();
|
seen = Captions.NOW.s();
|
||||||
} else {
|
} else {
|
||||||
int time = (int) (ExpireManager.IMP.getAge(plot) / 1000);
|
int time = (int) (ExpireManager.IMP.getAge(plot) / 1000);
|
||||||
if (time != 0) {
|
if (time != 0) {
|
||||||
seen = MainUtil.secToTime(time);
|
seen = MainUtil.secToTime(time);
|
||||||
} else {
|
} else {
|
||||||
seen = C.UNKNOWN.s();
|
seen = Captions.UNKNOWN.s();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seen = C.NEVER.s();
|
seen = Captions.NEVER.s();
|
||||||
}
|
}
|
||||||
Optional<String> descriptionFlag = plot.getFlag(Flags.DESCRIPTION);
|
Optional<String> descriptionFlag = plot.getFlag(Flags.DESCRIPTION);
|
||||||
String description = !descriptionFlag.isPresent() ?
|
String description = !descriptionFlag.isPresent() ? Captions.NONE.s() :
|
||||||
C.NONE.s() :
|
|
||||||
Flags.DESCRIPTION.valueToString(descriptionFlag.get());
|
Flags.DESCRIPTION.valueToString(descriptionFlag.get());
|
||||||
|
|
||||||
StringBuilder flags = new StringBuilder();
|
StringBuilder flags = new StringBuilder();
|
||||||
HashMap<Flag<?>, Object> flagMap =
|
HashMap<Flag<?>, Object> flagMap =
|
||||||
FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true);
|
FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true);
|
||||||
if (flagMap.isEmpty()) {
|
if (flagMap.isEmpty()) {
|
||||||
flags.append(C.NONE.s());
|
flags.append(Captions.NONE.s());
|
||||||
} else {
|
} else {
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
for (Entry<Flag<?>, Object> entry : flagMap.entrySet()) {
|
for (Entry<Flag<?>, Object> entry : flagMap.entrySet()) {
|
||||||
@ -746,7 +745,8 @@ public class MainUtil {
|
|||||||
df.setMaximumFractionDigits(340);
|
df.setMaximumFractionDigits(340);
|
||||||
value = df.format(value);
|
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 = ", ";
|
prefix = ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -815,7 +815,7 @@ public class MainUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of names given a list of uuids.<br>
|
* 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
|
* @param uuids
|
||||||
* @return
|
* @return
|
||||||
@ -823,11 +823,11 @@ public class MainUtil {
|
|||||||
public static String getPlayerList(Collection<UUID> uuids) {
|
public static String getPlayerList(Collection<UUID> uuids) {
|
||||||
ArrayList<UUID> l = new ArrayList<>(uuids);
|
ArrayList<UUID> l = new ArrayList<>(uuids);
|
||||||
if (l.size() < 1) {
|
if (l.size() < 1) {
|
||||||
return C.NONE.s();
|
return Captions.NONE.s();
|
||||||
}
|
}
|
||||||
List<String> users =
|
List<String> users =
|
||||||
l.stream().map(MainUtil::getName).sorted().collect(Collectors.toList());
|
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();
|
StringBuilder list = new StringBuilder();
|
||||||
for (int x = 0; x < users.size(); x++) {
|
for (int x = 0; x < users.size(); x++) {
|
||||||
if (x + 1 == l.size()) {
|
if (x + 1 == l.size()) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
package com.github.intellectualsites.plotsquared.plot.util;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
|
|
||||||
@ -14,18 +14,18 @@ import java.util.HashMap;
|
|||||||
*/
|
*/
|
||||||
public class Permissions {
|
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);
|
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 player
|
||||||
* @param caption
|
* @param caption
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean hasPermission(PlotPlayer player, C caption) {
|
public static boolean hasPermission(PlotPlayer player, Captions caption) {
|
||||||
return hasPermission(player, caption.s());
|
return hasPermission(player, caption.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public class Permissions {
|
|||||||
} else if (caller.isPermissionSet(permission)) {
|
} else if (caller.isPermissionSet(permission)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (caller.hasPermission(C.PERMISSION_ADMIN.s())) {
|
if (caller.hasPermission(Captions.PERMISSION_ADMIN.s())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
permission = permission.toLowerCase().replaceAll("^[^a-z|0-9|\\.|_|-]", "");
|
permission = permission.toLowerCase().replaceAll("^[^a-z|0-9|\\.|_|-]", "");
|
||||||
@ -76,7 +76,7 @@ public class Permissions {
|
|||||||
StringBuilder n = new StringBuilder();
|
StringBuilder n = new StringBuilder();
|
||||||
for (int i = 0; i <= (nodes.length - 1); i++) {
|
for (int i = 0; i <= (nodes.length - 1); i++) {
|
||||||
n.append(nodes[i] + ".");
|
n.append(nodes[i] + ".");
|
||||||
String combined = n + C.PERMISSION_STAR.s();
|
String combined = n + Captions.PERMISSION_STAR.s();
|
||||||
if (!permission.equals(combined)) {
|
if (!permission.equals(combined)) {
|
||||||
if (caller.hasPermission(combined)) {
|
if (caller.hasPermission(combined)) {
|
||||||
return true;
|
return true;
|
||||||
@ -99,14 +99,14 @@ public class Permissions {
|
|||||||
public static boolean hasPermission(PlotPlayer player, String permission, boolean notify) {
|
public static boolean hasPermission(PlotPlayer player, String permission, boolean notify) {
|
||||||
if (!hasPermission(player, permission)) {
|
if (!hasPermission(player, permission)) {
|
||||||
if (notify) {
|
if (notify) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT, permission);
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT, permission);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
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);
|
return hasPermissionRange(player, perm.s(), range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
package com.github.intellectualsites.plotsquared.plot.util;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
@ -81,7 +81,8 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
this.uuidMap.put(name, uuid);
|
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) {
|
public boolean add(final StringWrapper name, final UUID uuid) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util.expiry;
|
package com.github.intellectualsites.plotsquared.plot.util.expiry;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||||
@ -351,13 +351,13 @@ public class ExpireManager {
|
|||||||
for (UUID helper : plot.getTrusted()) {
|
for (UUID helper : plot.getTrusted()) {
|
||||||
PlotPlayer player = UUIDHandler.getPlayer(helper);
|
PlotPlayer player = UUIDHandler.getPlayer(helper);
|
||||||
if (player != null) {
|
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()) {
|
for (UUID helper : plot.getMembers()) {
|
||||||
PlotPlayer player = UUIDHandler.getPlayer(helper);
|
PlotPlayer player = UUIDHandler.getPlayer(helper);
|
||||||
if (player != null) {
|
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();
|
Set<Plot> plots = plot.getConnectedPlots();
|
||||||
|
@ -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.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
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 com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||||
|
|
||||||
public class HelpObject {
|
public class HelpObject {
|
||||||
@ -10,7 +10,7 @@ public class HelpObject {
|
|||||||
private final String _rendered;
|
private final String _rendered;
|
||||||
|
|
||||||
public HelpObject(final Command command, final String label) {
|
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.getUsage().replaceAll("\\{label\\}", label), "[%alias%]",
|
||||||
!command.getAliases().isEmpty() ?
|
!command.getAliases().isEmpty() ?
|
||||||
"(" + StringMan.join(command.getAliases(), "|") + ")" :
|
"(" + StringMan.join(command.getAliases(), "|") + ")" :
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user