From 12f8861d07864ce58bd38a89ab7ec8dfa188c067 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 26 Sep 2016 18:31:08 +1000 Subject: [PATCH] Various externalize strings plotme conversion fixes --- .../com/plotsquared/bukkit/BukkitMain.java | 47 +++--- .../bukkit/commands/DebugUUID.java | 4 +- .../database/plotme/LikePlotMeConverter.java | 146 ++++++++-------- .../bukkit/listeners/ChunkListener.java | 13 +- .../bukkit/listeners/PlayerEvents.java | 16 -- .../bukkit/object/BukkitPlayer.java | 5 +- Bukkit/src/main/resources/plugin.yml | 157 +++++++++++++++++- Core/build.gradle | 2 +- .../intellectualcrafters/json/JSONObject.java | 4 +- .../intellectualcrafters/plot/IPlotMain.java | 6 + .../com/intellectualcrafters/plot/PS.java | 45 +++-- .../intellectualcrafters/plot/Updater.java | 14 +- .../plot/commands/Add.java | 6 +- .../plot/commands/Alias.java | 2 +- .../plot/commands/Area.java | 32 ++-- .../plot/commands/Auto.java | 6 +- .../plot/commands/BO3.java | 2 +- .../plot/commands/Claim.java | 2 +- .../plot/commands/Clear.java | 4 +- .../plot/commands/Cluster.java | 88 +++++----- .../plot/commands/CommandPermission.java | 30 ---- .../plot/commands/Continue.java | 4 +- .../plot/commands/DebugClaimTest.java | 8 +- .../plot/commands/DebugExec.java | 2 +- .../plot/commands/Delete.java | 4 +- .../plot/commands/Deny.java | 4 +- .../plot/commands/Done.java | 2 +- .../plot/commands/Download.java | 10 +- .../plot/commands/FlagCmd.java | 38 ++--- .../plot/commands/Grant.java | 4 +- .../plot/commands/Kick.java | 4 +- .../plot/commands/ListCmd.java | 94 +++++------ .../plot/commands/Load.java | 2 +- .../plot/commands/Merge.java | 2 +- .../plot/commands/Owner.java | 2 +- .../plot/commands/PluginCmd.java | 2 +- .../plot/commands/Rate.java | 2 +- .../plot/commands/Remove.java | 2 +- .../plot/commands/Save.java | 2 +- .../plot/commands/SchematicCmd.java | 16 +- .../plot/commands/Set.java | 4 +- .../plot/commands/SetCommand.java | 8 +- .../plot/commands/Setup.java | 8 +- .../plot/commands/Template.java | 2 +- .../plot/commands/Trust.java | 6 +- .../plot/commands/Unlink.java | 2 +- .../plot/commands/Update.java | 2 +- .../plot/commands/Visit.java | 16 +- .../intellectualcrafters/plot/config/C.java | 97 ++++++++++- .../plot/config/Settings.java | 9 +- .../plot/generator/HybridGen.java | 3 +- .../plot/object/PlotMessage.java | 2 +- .../plot/util/EventUtil.java | 4 +- .../plot/util/Permissions.java | 6 +- .../plot/util/UUIDHandlerImplementation.java | 19 ++- .../listener/ProcessedWEExtent.java | 5 +- Core/src/main/resources/plugin.properties | 1 + .../com/plotsquared/nukkit/NukkitMain.java | 11 +- .../nukkit/object/NukkitPlayer.java | 5 +- .../nukkit/util/NukkitCommand.java | 2 +- .../nukkit/util/NukkitSetupUtils.java | 5 +- .../com/plotsquared/sponge/SpongeMain.java | 5 + .../sponge/listener/MainListener.java | 21 +-- .../sponge/util/SpongeSetupUtils.java | 16 +- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 66 files changed, 655 insertions(+), 445 deletions(-) delete mode 100644 Core/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java create mode 100644 Core/src/main/resources/plugin.properties diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index b50b1cf47..683b7342b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -72,6 +72,12 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.sk89q.worldedit.WorldEdit; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -87,18 +93,12 @@ import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; - public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public static WorldEdit worldEdit; private int[] version; + private String name; @Override public int[] getServerVersion() { @@ -123,13 +123,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public void onEnable() { + this.name = getDescription().getName(); getServer().getName(); new PS(this, "Bukkit"); if (Settings.Enabled_Components.METRICS) { new Metrics(this).start(); PS.log(C.PREFIX + "&6Metrics enabled."); } else { - PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS); + PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName())); } } @@ -171,6 +172,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return getDescription().getVersion(); } + @Override + public String getPluginName() { + return name; + } + @Override public void registerCommands() { BukkitCommand bukkitCommand = new BukkitCommand(); @@ -463,18 +469,13 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public boolean initPlotMeConverter() { - TaskManager.runTaskLaterAsync(new Runnable() { - @Override - public void run() { - if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) { - return; - } - if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) { - return; - } - } - }, 20); - return Bukkit.getPluginManager().getPlugin("PlotMe") != null; + if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) { + return true; + } + else if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) { + return true; + } + return false; } @Override @@ -537,10 +538,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } if (Settings.UUID.OFFLINE) { PS.log(C.PREFIX - + " &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + + " &6" + getPluginName() + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + "Bukkit"); } else { - PS.log(C.PREFIX + " &6PlotSquared is using online UUIDs"); + PS.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs"); } if (Settings.UUID.USE_SQLUUIDHANDLER) { return new SQLUUIDHandler(wrapper); @@ -596,7 +597,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain if (world == null) { // create world ConfigurationSection worldConfig = PS.get().worlds.getConfigurationSection("worlds." + worldName); - String manager = worldConfig.getString("generator.plugin", "PlotSquared"); + String manager = worldConfig.getString("generator.plugin", getPluginName()); SetupObject setup = new SetupObject(); setup.plotManager = manager; setup.setupGenerator = worldConfig.getString("generator.init", manager); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/commands/DebugUUID.java b/Bukkit/src/main/java/com/plotsquared/bukkit/commands/DebugUUID.java index 96048f393..b3934109a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/commands/DebugUUID.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/commands/DebugUUID.java @@ -91,7 +91,7 @@ public class DebugUUID extends SubCommand { MainUtil.sendMessage(player, "&6Beginning UUID mode conversion"); MainUtil.sendMessage(player, "&7 - Disconnecting players"); for (Entry entry : UUIDHandler.getPlayers().entrySet()) { - entry.getValue().kick("PlotSquared UUID conversion has been initiated. You may reconnect when finished."); + entry.getValue().kick("UUID conversion has been initiated. You may reconnect when finished."); } MainUtil.sendMessage(player, "&7 - Initializing map"); @@ -155,7 +155,7 @@ public class DebugUUID extends SubCommand { MainUtil.sendMessage(player, "&c - Error! Attempting to repopulate"); for (OfflinePlotPlayer op : currentUUIDWrapper.getOfflinePlayers()) { if (op.getLastPlayed() != 0) { - // String name = op.getName(); + // String name = op.getPluginName(); // StringWrapper wrap = new StringWrapper(name); UUID uuid = currentUUIDWrapper.getUUID(op); uuid2 = newWrapper.getUUID(op); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java index f20bf20f7..13dbc496d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java @@ -1,22 +1,17 @@ package com.plotsquared.bukkit.database.plotme; +import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.MemorySection; import com.intellectualcrafters.configuration.file.FileConfiguration; import com.intellectualcrafters.configuration.file.YamlConfiguration; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.generator.HybridGen; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.util.TaskManager; import com.plotsquared.bukkit.generator.BukkitPlotGenerator; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.WorldCreator; -import org.bukkit.command.CommandException; - import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -28,9 +23,14 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.command.CommandException; public class LikePlotMeConverter { @@ -50,7 +50,7 @@ public class LikePlotMeConverter { } private void sendMessage(String message) { - PS.debug("&3PlotMe&8->&3PlotSquared&8: &7" + message); + PS.debug("&3PlotMe&8->&3" + PS.imp().getPluginName() + "&8: &7" + message); } public String getPlotMePath() { @@ -97,14 +97,40 @@ public class LikePlotMeConverter { return; } String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); - content = content.replace("PlotMe-DefaultGenerator", "PlotSquared"); - content = content.replace("PlotMe", "PlotSquared"); - content = content.replace("AthionPlots", "PlotSquared"); - content = content.replace("PlotZWorld", "PlotSquared"); + String pluginName = PS.imp().getPluginName(); + content = content.replace("PlotMe-DefaultGenerator", pluginName); + content = content.replace("PlotMe", pluginName); + content = content.replace("AthionPlots", pluginName); + content = content.replace("PlotZWorld", pluginName); Files.write(path, content.getBytes(StandardCharsets.UTF_8)); } catch (IOException ignored) {} } + private void copyConfig(ConfigurationSection plotmeDgYml, String world) throws IOException { + String actualWorldName = getWorld(world); + String plotMeWorldName = world.toLowerCase(); + Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); // + PS.get().worlds.set("worlds." + world + ".road.width", pathWidth); + int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight", plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64)); // + PS.get().worlds.set("worlds." + world + ".road.height", height); + PS.get().worlds.set("worlds." + world + ".wall.height", height); + PS.get().worlds.set("worlds." + world + ".plot.height", height); + int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); // + PS.get().worlds.set("worlds." + world + ".plot.size", plotSize); + String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44"); // + PS.get().worlds.set("worlds." + world + ".wall.block", wallblock); + String floor = plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); // + PS.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor)); + String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); // + PS.get().worlds.set("worlds." + world + ".plot.filling", Collections.singletonList(filling)); + String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5"); + PS.get().worlds.set("worlds." + world + ".road.block", road); + PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height); + PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height); + PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height); + PS.get().worlds.save(PS.get().worldsFile); + } + public boolean run(APlotMeConnector connector) { try { String dataFolder = getPlotMePath(); @@ -177,36 +203,16 @@ public class LikePlotMeConverter { if (plotmeDgFile.exists()) { YamlConfiguration plotmeDgYml = YamlConfiguration.loadConfiguration(plotmeDgFile); try { - for (String world : plots.keySet()) { - String actualWorldName = getWorld(world); - String plotMeWorldName = world.toLowerCase(); - Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); // - PS.get().worlds.set("worlds." + world + ".road.width", pathWidth); - - int pathHeight = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight", 64); // - PS.get().worlds.set("worlds." + world + ".road.height", pathHeight); - PS.get().worlds.set("worlds." + world + ".wall.height", pathHeight); - PS.get().worlds.set("worlds." + world + ".plot.height", pathHeight); - int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); // - PS.get().worlds.set("worlds." + world + ".plot.size", plotSize); - String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44"); // - PS.get().worlds.set("worlds." + world + ".wall.block", wallblock); - String floor = plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); // - PS.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor)); - String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); // - PS.get().worlds.set("worlds." + world + ".plot.filling", Collections.singletonList(filling)); - String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5"); - PS.get().worlds.set("worlds." + world + ".road.block", road); - int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // - if (height == 0) { - height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64); // - } - PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height); - PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height); - PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height); - PS.get().worlds.save(PS.get().worldsFile); + HashSet allWorlds = new HashSet<>(plots.keySet()); + allWorlds.addAll(worlds); + for (String world : allWorlds) { + copyConfig(plotmeDgYml, world); } - } catch (IOException ignored) {} + } catch (IOException ignored) { + ignored.printStackTrace(); + } + } else { + System.out.println("FILE NOT EXIST " + plotmeDgFile.getAbsolutePath()); } for (Entry> entry : plots.entrySet()) { String world = entry.getKey(); @@ -291,35 +297,39 @@ public class LikePlotMeConverter { } String actualWorldName = world.getName(); sendMessage("Reloading generator for world: '" + actualWorldName + "'..."); - PS.get().removePlotAreas(actualWorldName); - if (mv) { - // unload world with MV - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName); - try { - Thread.sleep(1000); - } catch (InterruptedException ignored) { - Thread.currentThread().interrupt(); - } - // load world with MV - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), - "mv import " + actualWorldName + " normal -g PlotSquared"); - } else if (mw) { - // unload world with MW - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName); - try { - Thread.sleep(1000); - } catch (InterruptedException ignored) { - Thread.currentThread().interrupt(); - } - // load world with MW - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), - "mw create " + actualWorldName + " plugin:PlotSquared"); + if (!Bukkit.getWorlds().isEmpty() && Bukkit.getWorlds().get(0).getName().equals(worldName)) { + sendMessage("&cYou need to stop the server to reload this world properly"); } else { - // Load using Bukkit API - // - User must set generator manually - Bukkit.getServer().unloadWorld(world, true); - World myWorld = WorldCreator.name(actualWorldName).generator(new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator())).createWorld(); - myWorld.save(); + PS.get().removePlotAreas(actualWorldName); + if (mv) { + // unload world with MV + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName); + try { + Thread.sleep(1000); + } catch (InterruptedException ignored) { + Thread.currentThread().interrupt(); + } + // load world with MV + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), + "mv import " + actualWorldName + " normal -g " + PS.imp().getPluginName()); + } else if (mw) { + // unload world with MW + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName); + try { + Thread.sleep(1000); + } catch (InterruptedException ignored) { + Thread.currentThread().interrupt(); + } + // load world with MW + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), + "mw create " + actualWorldName + " plugin:" + PS.imp().getPluginName()); + } else { + // Load using Bukkit API + // - User must set generator manually + Bukkit.getServer().unloadWorld(world, true); + World myWorld = WorldCreator.name(actualWorldName).generator(new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator())).createWorld(); + myWorld.save(); + } } } } catch (CommandException e) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java index ef9efb221..e2ecb41ea 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java @@ -1,6 +1,7 @@ package com.plotsquared.bukkit.listeners; import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; @@ -46,7 +47,7 @@ public class ChunkListener implements Listener { this.mustSave = classChunk.getField("mustSave"); this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); } catch (Throwable ignored) { - PS.debug("PlotSquared/Server not compatible for chunk processor trim/gc"); + PS.debug(PS.imp().getPluginName() + "/Server not compatible for chunk processor trim/gc"); Settings.Chunk_Processor.AUTO_TRIM = false; } } @@ -228,7 +229,7 @@ public class ChunkListener implements Listener { if (!chunk.isLoaded()) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!"); + PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -236,7 +237,7 @@ public class ChunkListener implements Listener { if (tiles.length == 0) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!"); + PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -246,7 +247,7 @@ public class ChunkListener implements Listener { if (i >= tiles.length) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!"); + PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -270,11 +271,11 @@ public class ChunkListener implements Listener { ent.remove(); } } - PS.debug("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); + PS.debug(C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); } if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { - PS.debug("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); + PS.debug(C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); cleanChunk(chunk); return true; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 3b628621d..e776a19e1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -20,7 +20,6 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.RegExUtil; -import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.bukkit.object.BukkitLazyBlock; @@ -29,7 +28,6 @@ import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.listener.PlayerBlockEventType; import com.plotsquared.listener.PlotListener; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -347,20 +345,6 @@ public class PlayerEvents extends PlotListener implements Listener { if (msg.isEmpty()) { return; } - String[] split = msg.split(" "); - PluginCommand cmd = Bukkit.getServer().getPluginCommand(split[0]); - if (cmd == null) { - if (split[0].equals("plotme") || split[0].equals("ap")) { - Player player = event.getPlayer(); - if (Settings.PlotMe.ALIAS) { - player.performCommand("plots " + StringMan.join(Arrays.copyOfRange(split, 1, split.length), " ")); - } else { - MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME); - } - event.setCancelled(true); - return; - } - } Player player = event.getPlayer(); PlotPlayer pp = BukkitUtil.getPlayer(player); Plot plot = pp.getCurrentPlot(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java index 18db247fd..94892dda9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java @@ -1,5 +1,6 @@ package com.plotsquared.bukkit.object; +import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.EconHandler; @@ -67,7 +68,7 @@ public class BukkitPlayer extends PlotPlayer { PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (RegisteredListener listener : listeners) { - if (listener.getPlugin().getName().equals("PlotSquared")) { + if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) { continue; } try { @@ -81,7 +82,7 @@ public class BukkitPlayer extends PlotPlayer { } event = new PlayerTeleportEvent(player, to, from); for (RegisteredListener listener : listeners) { - if (listener.getPlugin().getName().equals("PlotSquared")) { + if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) { continue; } try { diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 7bf700a61..713162f37 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -10,8 +10,8 @@ loadbefore: [MultiWorld, Multiverse-Core] database: false commands: plots: - description: PlotSquared PlotSquared command. - aliases: [p,plot,ps,plotsquared,p2,2] + description: Plot command. + aliases: [p,plot,ps,plotsquared,p2,2,plotme] permission: plots.use permission-message: "You are lacking the permission node 'plots.use'" permissions: @@ -153,3 +153,156 @@ permissions: default: op plots.confirm.bypass: default: false + plotme.use: + description: Gives default user commands + children: + plots.permpack.basic: true + plots.plot.1: true + plotme.admin: + description: Gives default administrator commands + children: + plots.admin: true + plotme.use.middle: + children: + plots.middle: true + plotme.use.buy: + children: + plots.buy: true + plotme.use.sell: + children: + plots.set: true + plots.flag: true + plots.set.flag: true + plots.set.price.*: true + plotme.use.dispose: + children: + plots.delete: true + plotme.use.done: + children: + plots.done: true + plotme.use.claim: + children: + plots.claim: true + plotme.use.auto: + children: + plots.auto: true + plotme.use.reset: + children: + plots.delete: true + plotme.use.home: + children: + plots.home: true + plotme.use.info: + children: + plots.info: true + plotme.use.biome: + children: + plots.set: true + plots.set.biome: true + plotme.use.clear: + children: + plots.clear: true + plotme.use.list: + children: + plots.list: true + plots.list.forsale: true + plots.list.mine: true + plots.list.shared: true + plotme.use.add: + children: + plots.add: true + plots.trust: true + plots.add.everyone: true + plots.trust.everyone: true + plotme.use.deny: + children: + plots.deny: true + plots.deny.everyone: true + plotme.use.remove: + children: + plots.remove: true + plotme.use.undeny: + children: + plots.remove: true + plotme.use.protect: + children: + plots.set: true + plots.flag: true + plots.set.flag: true + plots.set.keep.*: true + plotme.use.nameplot: + children: + plots.set.alias: true + plotme.limit.*: + children: + plots.plot.*: true + plotme.limit.1: + children: + plots.plot.1: true + plotme.limit.5: + children: + plots.plot.5: true + plotme.limit.10: + children: + plots.plot.10: true + plotme.admin.home.other: + children: + plots.plot.: true + plotme.admin.clear: + children: + plots.admin.command.clear: true + plotme.admin.reset: + children: + plots.admin.command.delete: true + plotme.admin.add: + children: + plots.admin.command.add: true + plotme.admin.deny: + children: + plots.admin.command.deny: true + plotme.admin.remove: + children: + plots.admin.command.remove: true + plotme.admin.undeny: + children: + plots.admin.command.remove: true + plotme.admin.bypassdeny: + children: + plots.admin.entry.denied: true + plotme.admin.setowner: + children: + plots.admin.command.setowner: true + plotme.admin.move: + children: + plots.admin.command.move: true + plotme.admin.weanywhere: + children: + plots.worldedit.bypass: true + plotme.admin.list: + children: + plots.list.world: true + plots.list.world.*: true + plots.list.top: true + plots.list.all: true + plots.list.unowned: true + plots.list.unknown: true + plots.list.player: true + plots.list.done: true + plots.list.expired: true + plots.list.fuzzy: true + plots.list.area: true + plotme.admin.dispose: + children: + plots.admin.command.delete: true + plotme.admin.done: + children: + plots.admin.command.done: true + plotme.admin.expired: + children: + plots.list.expired: true + plotme.admin.buildanywhere: + children: + plots.admin.vehicle.*: true + plots.admin.interact.*: true + plots.admin.build.*: true + plots.admin.destroy.*: true \ No newline at end of file diff --git a/Core/build.gradle b/Core/build.gradle index a559e4c91..d5203cb39 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -7,5 +7,5 @@ dependencies { sourceCompatibility = 1.7 targetCompatibility = 1.7 -jar.archiveName = "PlotSquared-Core-${parent.version}.jar" +jar.archiveName = rootProject.name + "-Core-${parent.version}.jar" jar.destinationDir = file '../target' \ No newline at end of file diff --git a/Core/src/main/java/com/intellectualcrafters/json/JSONObject.java b/Core/src/main/java/com/intellectualcrafters/json/JSONObject.java index cb7b79aa6..685e15fd8 100644 --- a/Core/src/main/java/com/intellectualcrafters/json/JSONObject.java +++ b/Core/src/main/java/com/intellectualcrafters/json/JSONObject.java @@ -168,8 +168,8 @@ public class JSONObject { * The key is formed by removing the "get" or "is" prefix. If the second remaining * character is not upper case, then the first character is converted to lower case. * - * For example, if an object has a method named "getName", and if the result of calling - * object.getName() is "Larry Fine", then the JSONObject will contain "name": "Larry + * For example, if an object has a method named "getPluginName", and if the result of calling + * object.getPluginName() is "Larry Fine", then the JSONObject will contain "name": "Larry * Fine". * * @param bean An object that has getter methods that should be used to make a JSONObject. diff --git a/Core/src/main/java/com/intellectualcrafters/plot/IPlotMain.java b/Core/src/main/java/com/intellectualcrafters/plot/IPlotMain.java index f9aecdccc..5ce7beb64 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/IPlotMain.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/IPlotMain.java @@ -69,6 +69,12 @@ public interface IPlotMain extends ILogger { */ String getPluginVersionString(); + /** + * Usually PlotSquared + * @return + */ + String getPluginName(); + /** * Get the version of Minecraft that is running. * @return diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 0f858dc7e..3dfc3917c 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -149,12 +149,12 @@ public class PS { } } if (getJavaVersion() < 1.8) { - PS.log(C.CONSOLE_JAVA_OUTDATED_1_8); + PS.log(C.CONSOLE_JAVA_OUTDATED_1_8.f(IMP.getPluginName())); } TaskManager.IMP = this.IMP.getTaskManager(); setupConfigs(); this.translationFile = - MainUtil.getFile(this.IMP.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + "PlotSquared.use_THIS.yml"); + MainUtil.getFile(this.IMP.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + IMP.getPluginName() + ".use_THIS.yml"); C.load(this.translationFile); // Database @@ -177,7 +177,7 @@ public class PS { if (Settings.Enabled_Components.METRICS) { this.IMP.startMetrics(); } else { - PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS); + PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName())); } if (Settings.Enabled_Components.CHUNK_PROCESSOR) { this.IMP.registerChunkProcessor(); @@ -221,7 +221,7 @@ public class PS { if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { try { if (this.IMP.initWorldEdit()) { - PS.debug("PlotSquared hooked into WorldEdit."); + PS.debug(IMP.getPluginName() + " hooked into WorldEdit."); this.worldedit = WorldEdit.getInstance(); WorldEdit.getInstance().getEventBus().register(new WESubscriber()); if (Settings.Enabled_Components.COMMANDS) { @@ -252,7 +252,7 @@ public class PS { if (url != null) { PS.this.update = url; } else if (PS.this.lastVersion == null) { - PS.log("&aThanks for installing PlotSquared!"); + PS.log("&aThanks for installing " + IMP.getPluginName() + "!"); } else if (!get().checkVersion(PS.this.lastVersion, PS.this.version)) { PS.log("&aThanks for updating from " + StringMan.join(PS.this.lastVersion, ".") + " to " + StringMan .join(PS.this.version, ".") + "!"); @@ -281,7 +281,7 @@ public class PS { continue; } if (!WorldUtil.IMP.isWorld(world)) { - debug("&c`" + world + "` was not properly loaded - PlotSquared will now try to load it properly: "); + debug("&c`" + world + "` was not properly loaded - " + IMP.getPluginName() + " will now try to load it properly: "); debug( "&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and " + "multiverse worlds.yml"); @@ -305,9 +305,7 @@ public class PS { } catch (Throwable e) { e.printStackTrace(); } - if (!C.ENABLED.s().isEmpty()) { - PS.log(C.ENABLED); - } + PS.log(C.ENABLED.f(IMP.getPluginName())); } /** @@ -319,6 +317,13 @@ public class PS { return PS.instance; } + public static IPlotMain imp() { + if (instance != null) { + return instance.IMP; + } + return null; + } + /** * Log a message to the IPlotMain logger. * @@ -326,6 +331,9 @@ public class PS { * @see IPlotMain#log(String) */ public static void log(Object message) { + if (message == null || message.toString().isEmpty()) { + return; + } PS.get().getLogger().log(StringMan.getString(message)); } @@ -400,7 +408,7 @@ public class PS { private void startPlotMeConversion() { if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) { - TaskManager.runTaskLater(new Runnable() { + TaskManager.IMP.taskAsync(new Runnable() { @Override public void run() { if (PS.this.IMP.initPlotMeConverter()) { @@ -411,8 +419,9 @@ public class PS { PS.log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the " + "'settings.yml'"); } + Settings.Enabled_Components.PLOTME_CONVERTER = false; } - }, 20); + }); } } @@ -737,7 +746,7 @@ public class PS { * @param area the {@code PlotArea} to remove */ public void removePlotArea(PlotArea area) { - Set areas = getPlotAreas(area.worldname); + Set areas = getPlotAreas(); areas.remove(area); this.plotAreas = areas.toArray(new PlotArea[areas.size()]); if (areas.isEmpty()) { @@ -1460,7 +1469,7 @@ public class PS { return; } PS.log(C.PREFIX + "&aDetected world load for '" + world + "'"); - String gen_string = worldSection.getString("generator.plugin", "PlotSquared"); + String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName()); if (type == 2) { Set clusters = this.clusters_tmp != null ? this.clusters_tmp.get(world) : new HashSet(); if (clusters == null) { @@ -1557,7 +1566,7 @@ public class PS { clone.set(key, worldSection.get(key)); } } - String gen_string = clone.getString("generator.plugin", "PlotSquared"); + String gen_string = clone.getString("generator.plugin", IMP.getPluginName()); GeneratorWrapper areaGen = this.IMP.getGenerator(world, gen_string); if (areaGen == null) { throw new IllegalArgumentException("Invalid Generator: " + gen_string); @@ -1705,7 +1714,7 @@ public class PS { } MainUtil.sendMessage(sender, "$2 - Output: " + newJar); if (!newJar.delete()) { - MainUtil.sendMessage(sender, "Failed to update PlotSquared"); + MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + ""); MainUtil.sendMessage(sender, "Jar file failed to delete."); MainUtil.sendMessage(sender, " - Please update manually"); } @@ -1714,7 +1723,7 @@ public class PS { MainUtil.sendMessage(sender, "$1The update will take effect when the server is restarted next"); return true; } catch (IOException e) { - MainUtil.sendMessage(sender, "Failed to update PlotSquared"); + MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + ""); MainUtil.sendMessage(sender, " - Please update manually"); PS.log("============ Stacktrace ============"); e.printStackTrace(); @@ -1845,7 +1854,7 @@ public class PS { PS.log("&d==== Here is an ugly stacktrace, if you are interested in those things ==="); e.printStackTrace(); PS.log("&d==== End of stacktrace ===="); - PS.log("&6Please go to the PlotSquared 'storage.yml' and configure the database correctly."); + PS.log("&6Please go to the " + IMP.getPluginName() + " 'storage.yml' and configure the database correctly."); this.IMP.disable(); } } @@ -1868,7 +1877,7 @@ public class PS { try { worlds.save(worldsFile); } catch (IOException e) { - PS.debug("Failed to save PlotSquared worlds.yml"); + PS.debug("Failed to save " + IMP.getPluginName() + " worlds.yml"); e.printStackTrace(); } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/Updater.java b/Core/src/main/java/com/intellectualcrafters/plot/Updater.java index c0005876d..f4c163169 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/Updater.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/Updater.java @@ -1,23 +1,23 @@ package com.intellectualcrafters.plot; -import static com.intellectualcrafters.plot.PS.log; - import com.intellectualcrafters.json.JSONArray; import com.intellectualcrafters.json.JSONObject; import com.intellectualcrafters.plot.util.HttpUtil; import com.intellectualcrafters.plot.util.StringMan; - import java.net.MalformedURLException; import java.net.URL; import java.util.Arrays; + +import static com.intellectualcrafters.plot.PS.log; + public class Updater { public static URL getUpdate() { String str = HttpUtil.readUrl("https://api.github.com/repos/IntellectualSites/PlotSquared/releases/latest"); JSONObject release = new JSONObject(str); JSONArray assets = (JSONArray) release.get("assets"); - String downloadURL = String.format("PlotSquared-%s.jar", PS.get().getPlatform()); + String downloadURL = String.format(PS.imp().getPluginName() + "-%s.jar", PS.get().getPlatform()); for (int i = 0; i < assets.length(); i++) { JSONObject asset = assets.getJSONObject(i); String name = asset.getString("name"); @@ -33,11 +33,11 @@ public class Updater { // If current version >= update if (PS.get().checkVersion(PS.get().getVersion(), version)) { if (!PS.get().IMP.getPluginVersionString().contains("-SNAPSHOT") || !Arrays.equals(PS.get().getVersion(), version)) { - PS.debug("&7PlotSquared is already up to date!"); + PS.debug("&7" + PS.imp().getPluginName() + " is already up to date!"); return null; } } - log("&6PlotSquared " + StringMan.join(split, ".") + " is available:"); + log("&6" + PS.imp().getPluginName() + " " + StringMan.join(split, ".") + " is available:"); log("&8 - &3Use: &7/plot update"); log("&8 - &3Or: &7" + downloadURL); return new URL(asset.getString("browser_download_url")); @@ -48,7 +48,7 @@ public class Updater { } } } - log("You are running the latest version of PlotSquared"); + log("You are running the latest version of " + PS.imp().getPluginName() + "!"); return null; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java index e3ab2f428..3fb4aa03f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -34,7 +34,7 @@ public class Add extends Command { public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); checkTrue(plot.hasOwner(), C.PLOT_UNOWNED); - checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.trust"), C.NO_PLOT_PERMS); + checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS); checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage()); final Set uuids = MainUtil.getUUIDsFromString(args[0]); checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]); @@ -42,7 +42,7 @@ public class Add extends Command { int size = plot.getTrusted().size() + plot.getMembers().size(); while (iter.hasNext()) { UUID uuid = iter.next(); - if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, "plots.trust.everyone") || Permissions.hasPermission(player, "plots.admin.command.trust"))) { + if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) { MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); iter.remove(); continue; @@ -60,7 +60,7 @@ public class Add extends Command { size += plot.getTrusted().contains(uuid) ? 0 : 1; } checkTrue(!uuids.isEmpty(), null); - checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions.hasPermission(player, "plots.admin.command.trust"), C.PLOT_MAX_MEMBERS); + checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS); confirm.run(this, new Runnable() { @Override // Success public void run() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Alias.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Alias.java index 5a28761c8..7af984792 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Alias.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Alias.java @@ -15,7 +15,7 @@ import com.plotsquared.general.commands.CommandDeclaration; permission = "plots.set.alias", description = "Set the plot name", usage = "/plot alias ", - aliases = {"alias", "sa", "name", "rename", "setname", "seta"}, + aliases = {"alias", "sa", "name", "rename", "setname", "seta", "nameplot"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) public class Alias extends SetCommand { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java index 81241e8f5..16fbf5b8d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java @@ -5,7 +5,6 @@ import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.generator.AugmentedUtils; -import com.intellectualcrafters.plot.generator.HybridGen; import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Location; @@ -26,7 +25,6 @@ import com.intellectualcrafters.plot.util.SetupUtils; import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.WorldUtil; import com.plotsquared.general.commands.CommandDeclaration; - import java.io.IOException; import java.util.ArrayList; import java.util.Objects; @@ -52,8 +50,8 @@ public class Area extends SubCommand { case "c": case "setup": case "create": - if (!Permissions.hasPermission(player, "plots.area.create")) { - C.NO_PERMISSION.send(player, "plots.area.create"); + if (!Permissions.hasPermission(player, C.PERMISSION_AREA_CREATE)) { + C.NO_PERMISSION.send(player, C.PERMISSION_AREA_CREATE); return false; } switch (args.length) { @@ -109,8 +107,8 @@ public class Area extends SubCommand { object.type = area.TYPE; object.min = new PlotId(1, 1); object.max = new PlotId(numX, numZ); - object.plotManager = "PlotSquared"; - object.setupGenerator = "PlotSquared"; + object.plotManager = PS.imp().getPluginName(); + object.setupGenerator = PS.imp().getPluginName(); object.step = area.getSettingNodes(); final String path = "worlds." + area.worldname + ".areas." + area.id + '-' + object.min + '-' + object.max; Runnable run = new Runnable() { @@ -237,8 +235,8 @@ public class Area extends SubCommand { ConfigurationSection section = PS.get().worlds.getConfigurationSection(path); pa.saveConfiguration(section); pa.loadConfiguration(section); - object.plotManager = "PlotSquared"; - object.setupGenerator = "PlotSquared"; + object.plotManager = PS.imp().getPluginName(); + object.setupGenerator = PS.imp().getPluginName(); String world = SetupUtils.manager.setupWorld(object); if (WorldUtil.IMP.isWorld(world)) { C.SETUP_FINISHED.send(player); @@ -281,8 +279,8 @@ public class Area extends SubCommand { return true; case "i": case "info": { - if (!Permissions.hasPermission(player, "plots.area.info")) { - C.NO_PERMISSION.send(player, "plots.area.info"); + if (!Permissions.hasPermission(player, C.PERMISSION_AREA_INFO)) { + C.NO_PERMISSION.send(player, C.PERMISSION_AREA_INFO); return false; } PlotArea area; @@ -336,8 +334,8 @@ public class Area extends SubCommand { } case "l": case "list": - if (!Permissions.hasPermission(player, "plots.area.list")) { - C.NO_PERMISSION.send(player, "plots.area.list"); + if (!Permissions.hasPermission(player, C.PERMISSION_AREA_LIST)) { + C.NO_PERMISSION.send(player, C.PERMISSION_AREA_LIST); return false; } int page; @@ -398,8 +396,8 @@ public class Area extends SubCommand { case "clear": case "reset": case "regenerate": { - if (!Permissions.hasPermission(player, "plots.area.regen")) { - C.NO_PERMISSION.send(player, "plots.area.regen"); + if (!Permissions.hasPermission(player, C.PERMISSION_AREA_REGEN)) { + C.NO_PERMISSION.send(player, C.PERMISSION_AREA_REGEN); return false; } final PlotArea area = player.getApplicablePlotArea(); @@ -424,8 +422,8 @@ public class Area extends SubCommand { case "teleport": case "visit": case "tp": - if (!Permissions.hasPermission(player, "plots.area.tp")) { - C.NO_PERMISSION.send(player, "plots.area.tp"); + if (!Permissions.hasPermission(player, C.PERMISSION_AREA_TP)) { + C.NO_PERMISSION.send(player, C.PERMISSION_AREA_TP); return false; } if (args.length != 2) { @@ -452,7 +450,7 @@ public class Area extends SubCommand { case "remove": MainUtil.sendMessage(player, "$1World creation settings may be stored in multiple locations:" + "\n$3 - $2Bukkit bukkit.yml" - + "\n$3 - $2PlotSquared settings.yml" + + "\n$3 - $2" + PS.imp().getPluginName() + " settings.yml" + "\n$3 - $2Multiverse worlds.yml (or any world management plugin)" + "\n$1Stop the server and delete it from these locations."); return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 5a9d19d05..3cf2490ab 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -62,7 +62,7 @@ public class Auto extends SubCommand { int size_z = 1; String schematic = null; if (args.length > 0) { - if (Permissions.hasPermission(player, "plots.auto.mega")) { + if (Permissions.hasPermission(player, C.PERMISSION_AUTO_MEGA)) { try { String[] split = args[0].split(",|;"); size_x = Integer.parseInt(split[0]); @@ -134,8 +134,8 @@ public class Auto extends SubCommand { sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic); return true; } - if (!Permissions.hasPermission(player, "plots.claim." + schematic) && !Permissions.hasPermission(player, "plots.admin.command.schematic")) { - MainUtil.sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic); + if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)); return true; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/BO3.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/BO3.java index cf92211e1..e9ec94e91 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/BO3.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/BO3.java @@ -29,7 +29,7 @@ public class BO3 extends SubCommand { if (plot == null || !plot.hasOwner()) { return !sendMessage(player, C.NOT_IN_PLOT); } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.bo3")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_BO3)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 52d072cd6..37c3b3108 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -72,7 +72,7 @@ public class Claim extends SubCommand { if (!world.SCHEMATICS.contains(schematic.toLowerCase())) { return sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic); } - if (!Permissions.hasPermission(player, "plots.claim." + schematic) && !Permissions.hasPermission(player, "plots.admin.command.schematic")) { + if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic); } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 4f0117edd..375d408c6 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -34,9 +34,9 @@ public class Clear extends Command { public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage()); final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); - checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.clear"), C.NO_PLOT_PERMS); + checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CLEAR), C.NO_PLOT_PERMS); checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER); - checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions.hasPermission(player, "plots.continue"), C.DONE_ALREADY_DONE); + checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions.hasPermission(player, C.PERMISSION_CONTINUE), C.DONE_ALREADY_DONE); confirm.run(this, new Runnable() { @Override public void run() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 711a897ca..28572b8f5 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -41,8 +41,8 @@ public class Cluster extends SubCommand { switch (sub) { case "l": case "list": { - if (!Permissions.hasPermission(player, "plots.cluster.list")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.list"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LIST)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LIST); return false; } if (args.length != 1) { @@ -73,8 +73,8 @@ public class Cluster extends SubCommand { } case "c": case "create": { - if (!Permissions.hasPermission(player, "plots.cluster.create")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.create"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_CREATE); return false; } PlotArea area = player.getApplicablePlotArea(); @@ -121,11 +121,11 @@ public class Cluster extends SubCommand { } Set plots = area.getPlotSelectionOwned(pos1, pos2); if (!plots.isEmpty()) { - if (!Permissions.hasPermission(player, "plots.cluster.create.other")) { + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE_OTHER)) { UUID uuid = player.getUUID(); for (Plot plot : plots) { if (!plot.isOwner(uuid)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.create.other"); + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_CREATE_OTHER); return false; } } @@ -139,9 +139,9 @@ public class Cluster extends SubCommand { } else { current = player.getPlayerClusterCount(player.getLocation().getWorld()); } - int allowed = Permissions.hasPermissionRange(player, "plots.cluster.size", Settings.Limit.MAX_PLOTS); + int allowed = Permissions.hasPermissionRange(player, C.PERMISSION_CLUSTER_SIZE, Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.size." + (current + cluster.getArea())); + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea())); return false; } // create cluster @@ -163,8 +163,8 @@ public class Cluster extends SubCommand { case "disband": case "del": case "delete": { - if (!Permissions.hasPermission(player, "plots.cluster.delete")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.delete"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_DELETE); return false; } if (args.length != 1 && args.length != 2) { @@ -191,8 +191,8 @@ public class Cluster extends SubCommand { } } if (!cluster.owner.equals(player.getUUID())) { - if (!Permissions.hasPermission(player, "plots.cluster.delete.other")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.delete.other"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE_OTHER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_DELETE_OTHER); return false; } } @@ -202,8 +202,8 @@ public class Cluster extends SubCommand { } case "res": case "resize": { - if (!Permissions.hasPermission(player, "plots.cluster.resize")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE); return false; } if (args.length != 3) { @@ -233,8 +233,8 @@ public class Cluster extends SubCommand { return false; } if (!cluster.hasHelperRights(player.getUUID())) { - if (!Permissions.hasPermission(player, "plots.cluster.resize.other")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.other"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_OTHER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE_OTHER); return false; } } @@ -250,15 +250,15 @@ public class Cluster extends SubCommand { removed.removeAll(newPlots); // Check expand / shrink if (!removed.isEmpty()) { - if (!Permissions.hasPermission(player, "plots.cluster.resize.shrink")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.shrink"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_SHRINK)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE_SHRINK); return false; } } newPlots.removeAll(existing); if (!newPlots.isEmpty()) { - if (!Permissions.hasPermission(player, "plots.cluster.resize.expand")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.expand"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_EXPAND)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE_EXPAND); return false; } } @@ -270,9 +270,9 @@ public class Cluster extends SubCommand { current = player.getPlayerClusterCount(player.getLocation().getWorld()); } current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); - int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.Limit.MAX_PLOTS); + int allowed = Permissions.hasPermissionRange(player, C.PERMISSION_CLUSTER, Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea())); + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea())); return false; } // resize cluster @@ -283,8 +283,8 @@ public class Cluster extends SubCommand { case "add": case "inv": case "invite": { - if (!Permissions.hasPermission(player, "plots.cluster.invite")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.invite"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INVITE); return false; } if (args.length != 2) { @@ -302,8 +302,8 @@ public class Cluster extends SubCommand { return false; } if (!cluster.hasHelperRights(player.getUUID())) { - if (!Permissions.hasPermission(player, "plots.cluster.invite.other")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.invite.other"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE_OTHER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INVITE_OTHER); return false; } } @@ -328,8 +328,8 @@ public class Cluster extends SubCommand { case "k": case "remove": case "kick": { - if (!Permissions.hasPermission(player, "plots.cluster.kick")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.kick"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK); return false; } if (args.length != 2) { @@ -346,8 +346,8 @@ public class Cluster extends SubCommand { return false; } if (!cluster.hasHelperRights(player.getUUID())) { - if (!Permissions.hasPermission(player, "plots.cluster.kick.other")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.kick.other"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK_OTHER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK_OTHER); return false; } } @@ -383,8 +383,8 @@ public class Cluster extends SubCommand { } case "quit": case "leave": { - if (!Permissions.hasPermission(player, "plots.cluster.leave")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.leave"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LEAVE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LEAVE); return false; } if (args.length != 1 && args.length != 2) { @@ -438,8 +438,8 @@ public class Cluster extends SubCommand { case "admin": case "helper": case "helpers": { - if (!Permissions.hasPermission(player, "plots.cluster.helpers")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.helpers"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_HELPERS)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_HELPERS); return false; } if (args.length != 3) { @@ -476,8 +476,8 @@ public class Cluster extends SubCommand { case "spawn": case "home": case "tp": { - if (!Permissions.hasPermission(player, "plots.cluster.tp")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.tp"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP); return false; } if (args.length != 2) { @@ -496,8 +496,8 @@ public class Cluster extends SubCommand { } UUID uuid = player.getUUID(); if (!cluster.isAdded(uuid)) { - if (!Permissions.hasPermission(player, "plots.cluster.tp.other")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.tp.other"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP_OTHER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP_OTHER); return false; } } @@ -508,8 +508,8 @@ public class Cluster extends SubCommand { case "info": case "show": case "information": { - if (!Permissions.hasPermission(player, "plots.cluster.info")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.info"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INFO)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INFO); return false; } if (args.length != 1 && args.length != 2) { @@ -554,8 +554,8 @@ public class Cluster extends SubCommand { case "sh": case "setspawn": case "sethome": - if (!Permissions.hasPermission(player, "plots.cluster.sethome")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.sethome"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SETHOME); return false; } if (args.length != 1 && args.length != 2) { @@ -572,8 +572,8 @@ public class Cluster extends SubCommand { return false; } if (!cluster.hasHelperRights(player.getUUID())) { - if (!Permissions.hasPermission(player, "plots.cluster.sethome.other")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.sethome.other"); + if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME_OTHER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SETHOME_OTHER); return false; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java deleted file mode 100644 index 229ff61e4..000000000 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.intellectualcrafters.plot.commands; - -import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.util.Permissions; - -public class CommandPermission { - - /** - * Permission Node. - */ - public final String permission; - - /** - * Command Permission - * @param permission Command Permission - */ - public CommandPermission(String permission) { - this.permission = permission.toLowerCase(); - } - - /** - * Check the permissions of a player. - * @param player The player to check permissions for - * - * @return true of player has the required permission node - */ - public boolean hasPermission(PlotPlayer player) { - return Permissions.hasPermission(player, this.permission); - } -} diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java index 995e72759..60a5da47b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java @@ -23,7 +23,7 @@ public class Continue extends SubCommand { if ((plot == null) || !plot.hasOwner()) { return !sendMessage(player, C.NOT_IN_PLOT); } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.continue")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CONTINUE)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } @@ -33,7 +33,7 @@ public class Continue extends SubCommand { } int size = plot.getConnectedPlots().size(); if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command.continue"); + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_ADMIN_COMMAND_CONTINUE); return false; } if (plot.getRunning() > 0) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java index 66e8da6ae..3e00d0be5 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -56,8 +56,8 @@ public class DebugClaimTest extends SubCommand { "&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X;Y are the plot coords\nThe conversion " + "will only check the plots in the selected area."); } - MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while..."); - MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)"); + MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: &7Beginning sign to plot conversion. This may take a while..."); + MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)"); PlotManager manager = area.getPlotManager(); ArrayList plots = new ArrayList<>(); for (PlotId id : MainUtil.getPlotSelectionIds(min, max)) { @@ -101,7 +101,7 @@ public class DebugClaimTest extends SubCommand { } } if (!plots.isEmpty()) { - MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!"); + MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: &7Updating '" + plots.size() + "' plots!"); DBFunc.createPlotsAndData(plots, new Runnable() { @Override public void run() { @@ -111,7 +111,7 @@ public class DebugClaimTest extends SubCommand { for (Plot plot : plots) { plot.create(); } - MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Complete!"); + MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: &7Complete!"); } else { MainUtil.sendMessage(player, "No plots were found for the given search."); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index 8ddd4a64d..83a254856 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -196,7 +196,7 @@ public class DebugExec extends SubCommand { PlotAnalysis.calcOptimalModifiers(new Runnable() { @Override public void run() { - MainUtil.sendMessage(player, "$1Thank you for calibrating PlotSquared plot expiry"); + MainUtil.sendMessage(player, "$1Thank you for calibrating plot expiry"); } }, threshold); return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index b26897149..e3f9b8da0 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -19,7 +19,7 @@ import com.plotsquared.general.commands.CommandDeclaration; permission = "plots.delete", description = "Delete a plot", usage = "/plot delete", - aliases = {"dispose", "del"}, + aliases = {"dispose", "del", "reset"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, confirmation = true) @@ -36,7 +36,7 @@ public class Delete extends SubCommand { if (!plot.hasOwner()) { return !sendMessage(player, C.PLOT_UNOWNED); } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.delete")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DELETE)) { return !sendMessage(player, C.NO_PLOT_PERMS); } final PlotArea plotArea = plot.getArea(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java index 713064743..e1e4c36e4 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java @@ -42,7 +42,7 @@ public class Deny extends SubCommand { MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.deny")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return true; } @@ -54,7 +54,7 @@ public class Deny extends SubCommand { Iterator iter = uuids.iterator(); while (iter.hasNext()) { UUID uuid = iter.next(); - if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, "plots.deny.everyone") || Permissions.hasPermission(player, "plots.admin.command.deny"))) { + if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, C.PERMISSION_DENY_EVERYONE) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY))) { MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); continue; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java index 6399b1327..41294b4a4 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java @@ -29,7 +29,7 @@ public class Done extends SubCommand { if ((plot == null) || !plot.hasOwner()) { return !sendMessage(player, C.NOT_IN_PLOT); } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.done")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DONE)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java index a79500751..513377aec 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java @@ -42,7 +42,7 @@ public class Download extends SubCommand { return false; } if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent())) && !Permissions - .hasPermission(player, "plots.admin.command.download")) { + .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) { MainUtil.sendMessage(player, C.DONE_NOT_DONE); return false; } @@ -73,8 +73,8 @@ public class Download extends SubCommand { } }); } else if (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "bo3", "bo2", "b03", "b02")) { - if (!Permissions.hasPermission(player, "plots.download.bo3")) { - C.NO_PERMISSION.send(player, "plots.download.bo3"); + if (!Permissions.hasPermission(player, C.PERMISSION_DOWNLOAD_BO3)) { + C.NO_PERMISSION.send(player, C.PERMISSION_DOWNLOAD_BO3); } if (plot.getVolume() > 128d * 128d * 256) { C.SCHEMATIC_TOO_LARGE.send(player); @@ -93,8 +93,8 @@ public class Download extends SubCommand { } }); } else if (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) { - if (!Permissions.hasPermission(player, "plots.download.world")) { - C.NO_PERMISSION.send(player, "plots.download.world"); + if (!Permissions.hasPermission(player, C.PERMISSION_DOWNLOAD_WORLD)) { + C.NO_PERMISSION.send(player, C.PERMISSION_DOWNLOAD_WORLD); } MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512"); plot.addRunning(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index 613b47f25..a07e96477 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -56,8 +56,8 @@ public class FlagCmd extends SubCommand { sendMessage(player, C.PLOT_NOT_CLAIMED); return false; } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.set.flag.other")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other"); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_OTHER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_OTHER); return false; } Flag flag = null; @@ -81,7 +81,7 @@ public class FlagCmd extends SubCommand { } switch (args[0].toLowerCase()) { case "info": { - if (!Permissions.hasPermission(player, "plots.set.flag")) { + if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) { MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.info"); return false; } @@ -98,8 +98,8 @@ public class FlagCmd extends SubCommand { return true; } case "set": { - if (!Permissions.hasPermission(player, "plots.set.flag")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag"); + if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG); return false; } if (args.length < 3) { @@ -107,8 +107,8 @@ public class FlagCmd extends SubCommand { return false; } String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " "); - if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + value.toLowerCase())) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + value.toLowerCase()); + if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), value.toLowerCase()))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), value.toLowerCase())); return false; } Object parsed = flag.parseValue(value); @@ -125,22 +125,22 @@ public class FlagCmd extends SubCommand { return true; } case "remove": { - if (!Permissions.hasPermission(player, "plots.flag.remove")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.remove"); + if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_REMOVE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_REMOVE); return false; } if (args.length != 2 && args.length != 3) { MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove [values]"); return false; } - if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { + if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) { if (args.length != 3) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase())); return false; } for (String entry : args[2].split(",")) { - if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + entry)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + entry); + if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), entry))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), entry)); return false; } } @@ -173,8 +173,8 @@ public class FlagCmd extends SubCommand { return true; } case "add": - if (!Permissions.hasPermission(player, "plots.flag.add")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.add"); + if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_ADD)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_ADD); return false; } if (args.length < 3) { @@ -182,8 +182,8 @@ public class FlagCmd extends SubCommand { return false; } for (String entry : args[2].split(",")) { - if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + entry)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + entry); + if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), entry))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), entry)); return false; } } @@ -215,8 +215,8 @@ public class FlagCmd extends SubCommand { MainUtil.sendMessage(player, C.FLAG_ADDED); return true; case "list": - if (!Permissions.hasPermission(player, "plots.flag.list")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.list"); + if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_LIST)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_LIST); return false; } if (args.length > 1) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Grant.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Grant.java index 98b615297..89dba90a6 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Grant.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Grant.java @@ -33,8 +33,8 @@ public class Grant extends Command { switch (arg0) { case "add": case "check": - if (!Permissions.hasPermission(player, "plots.grant." + arg0)) { - C.NO_PERMISSION.send(player, "plots.grant." + arg0); + if (!Permissions.hasPermission(player, C.PERMISSION_GRANT.f(arg0))) { + C.NO_PERMISSION.send(player, C.PERMISSION_GRANT.f(arg0)); return; } if (args.length > 2) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Kick.java index 283ae0828..d2eb27bd0 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Kick.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Kick.java @@ -36,7 +36,7 @@ public class Kick extends SubCommand { if (plot == null) { return !sendMessage(player, C.NOT_IN_PLOT); } - if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions.hasPermission(player, "plots.admin.command.kick")) { + if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_KICK)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } @@ -49,7 +49,7 @@ public class Kick extends SubCommand { for (UUID uuid : uuids) { if (uuid == DBFunc.everyone) { for (PlotPlayer pp : plot.getPlayersInPlot()) { - if (pp == player || pp.hasPermission("plots.admin.entry.denied")) { + if (pp == player || Permissions.hasPermission(pp, C.PERMISSION_ADMIN_ENTRY_DENIED)) { continue; } players.add(pp); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java index a98b265e5..ee2d9f316 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java @@ -41,43 +41,43 @@ public class ListCmd extends SubCommand { private String[] getArgumentList(PlotPlayer player) { List args = new ArrayList<>(); - if (EconHandler.manager != null && Permissions.hasPermission(player, "plots.list.forsale")) { + if (EconHandler.manager != null && Permissions.hasPermission(player, C.PERMISSION_LIST_FORSALE)) { args.add("forsale"); } - if (Permissions.hasPermission(player, "plots.list.mine")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) { args.add("mine"); } - if (Permissions.hasPermission(player, "plots.list.shared")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) { args.add("shared"); } - if (Permissions.hasPermission(player, "plots.list.world")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { args.add("world"); } - if (Permissions.hasPermission(player, "plots.list.top")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) { args.add("top"); } - if (Permissions.hasPermission(player, "plots.list.all")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) { args.add("all"); } - if (Permissions.hasPermission(player, "plots.list.unowned")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) { args.add("unowned"); } - if (Permissions.hasPermission(player, "plots.list.unknown")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) { args.add("unknown"); } - if (Permissions.hasPermission(player, "plots.list.player")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) { args.add(""); } - if (Permissions.hasPermission(player, "plots.list.world")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { args.add(""); } - if (Permissions.hasPermission(player, "plots.list.done")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) { args.add("done"); } - if (Permissions.hasPermission(player, "plots.list.expired")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) { args.add("expired"); } - if (Permissions.hasPermission(player, "plots.list.fuzzy")) { + if (Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) { args.add("fuzzy "); } return args.toArray(new String[args.size()]); @@ -114,16 +114,16 @@ public class ListCmd extends SubCommand { boolean sort = true; switch (arg) { case "mine": - if (!Permissions.hasPermission(player, "plots.list.mine")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.mine"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_MINE); return false; } sort = false; plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(player)); break; case "shared": - if (!Permissions.hasPermission(player, "plots.list.shared")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.shared"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_SHARED); return false; } plots = new ArrayList<>(); @@ -134,44 +134,44 @@ public class ListCmd extends SubCommand { } break; case "world": - if (!Permissions.hasPermission(player, "plots.list.world")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD); return false; } - if (!Permissions.hasPermission(player, "plots.list.world." + world)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + world); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD_NAME.f(world)); return false; } plots = new ArrayList<>(PS.get().getPlots(world)); break; case "expired": - if (!Permissions.hasPermission(player, "plots.list.expired")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.expired"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_EXPIRED); return false; } plots = ExpireManager.IMP == null ? new ArrayList() : new ArrayList<>(ExpireManager.IMP.getPendingExpired()); break; case "area": - if (!Permissions.hasPermission(player, "plots.list.area")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.area"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_AREA)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_AREA); return false; } - if (!Permissions.hasPermission(player, "plots.list.world." + world)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + world); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD_NAME.f(world)); return false; } plots = area == null ? new ArrayList() : new ArrayList<>(area.getPlots()); break; case "all": - if (!Permissions.hasPermission(player, "plots.list.all")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.all"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL); return false; } plots = new ArrayList<>(PS.get().getPlots()); break; case "done": - if (!Permissions.hasPermission(player, "plots.list.done")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.done"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_DONE); return false; } plots = new ArrayList<>(); @@ -199,8 +199,8 @@ public class ListCmd extends SubCommand { sort = false; break; case "top": - if (!Permissions.hasPermission(player, "plots.list.top")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.top"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP); return false; } plots = new ArrayList<>(PS.get().getPlots()); @@ -236,8 +236,8 @@ public class ListCmd extends SubCommand { sort = false; break; case "forsale": - if (!Permissions.hasPermission(player, "plots.list.forsale")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.forsale"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FORSALE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FORSALE); return false; } if (EconHandler.manager == null) { @@ -252,8 +252,8 @@ public class ListCmd extends SubCommand { } break; case "unowned": - if (!Permissions.hasPermission(player, "plots.list.unowned")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.unowned"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNOWNED); return false; } plots = new ArrayList<>(); @@ -264,8 +264,8 @@ public class ListCmd extends SubCommand { } break; case "unknown": - if (!Permissions.hasPermission(player, "plots.list.unknown")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.unknown"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNKNOWN); return false; } plots = new ArrayList<>(); @@ -279,8 +279,8 @@ public class ListCmd extends SubCommand { } break; case "fuzzy": - if (!Permissions.hasPermission(player, "plots.list.fuzzy")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.fuzzy"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FUZZY); return false; } if (args.length < (page == -1 ? 2 : 3)) { @@ -298,12 +298,12 @@ public class ListCmd extends SubCommand { break; default: if (PS.get().hasPlotArea(args[0])) { - if (!Permissions.hasPermission(player, "plots.list.world")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD); return false; } - if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + args[0]); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(args[0]))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD_NAME.f(args[0])); return false; } plots = new ArrayList<>(PS.get().getPlots(args[0])); @@ -316,8 +316,8 @@ public class ListCmd extends SubCommand { } catch (Exception ignored) {} } if (uuid != null) { - if (!Permissions.hasPermission(player, "plots.list.player")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.player"); + if (!Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_PLAYER); return false; } sort = false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java index 301f0d87f..508409bb5 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java @@ -47,7 +47,7 @@ public class Load extends SubCommand { MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.load")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_LOAD)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index 55d1161a9..b620fe468 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -64,7 +64,7 @@ public class Merge extends SubCommand { } UUID uuid = player.getUUID(); if (!plot.isOwner(uuid)) { - if (!Permissions.hasPermission(player, "plots.admin.command.merge")) { + if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_MERGE)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } else { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java index ad8cdf861..0c132a3c5 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java @@ -59,7 +59,7 @@ public class Owner extends SetCommand { return false; } final PlotPlayer other = UUIDHandler.getPlayer(uuid); - if (!Permissions.hasPermission(player, "plots.admin.command.setowner")) { + if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER)) { if (other == null) { C.INVALID_PLAYER_OFFLINE.send(player, value); return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java index 3c89c7c01..f77e513ab 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java @@ -17,7 +17,7 @@ public class PluginCmd extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - MainUtil.sendMessage(player, String.format("$2>> $1&lPlotSquared $2($1Version$2: $1%s$2)", StringMan.join(PS.get().getVersion(), "."))); + MainUtil.sendMessage(player, String.format("$2>> $1&l" + PS.imp().getPluginName() + " $2($1Version$2: $1%s$2)", StringMan.join(PS.get().getVersion(), "."))); MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev"); MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki"); MainUtil.sendMessage(player, "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Rate.java index f4d2db06f..f3582c160 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Rate.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Rate.java @@ -110,7 +110,7 @@ public class Rate extends SubCommand { Rating result = EventUtil.manager.callRating(this.player, plot, new Rating(rV)); plot.addRating(this.player.getUUID(), result); sendMessage(this.player, C.RATING_APPLIED, plot.getId().toString()); - if (Permissions.hasPermission(this.player, "plots.comment")) { + if (Permissions.hasPermission(this.player, C.PERMISSION_COMMENT)) { Command command = MainCommand.getInstance().getCommand(Comment.class); if (command != null) { MainUtil.sendMessage(this.player, C.COMMENT_THIS, command.getUsage()); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java index 9e311f743..455e29139 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -42,7 +42,7 @@ public class Remove extends SubCommand { MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.remove")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_REMOVE)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java index 90fb76050..dd4413b9a 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java @@ -47,7 +47,7 @@ public class Save extends SubCommand { MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.save")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SAVE)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java index a423acde0..15aea5742 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java @@ -41,8 +41,8 @@ public class SchematicCmd extends SubCommand { String arg = args[0].toLowerCase(); switch (arg) { case "paste": { - if (!Permissions.hasPermission(player, "plots.schematic.paste")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.schematic.paste"); + if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_PASTE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_PASTE); return false; } if (args.length < 2) { @@ -58,7 +58,7 @@ public class SchematicCmd extends SubCommand { MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.schematic.paste")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } @@ -169,15 +169,15 @@ public class SchematicCmd extends SubCommand { MainUtil.sendMessage(player, "&cTask is already running."); return false; } else { - MainUtil.sendMessage(player, "&3PlotSquared&8->&3Schematic&8: &7Mass export has started. This may take a while."); - MainUtil.sendMessage(player, "&3PlotSquared&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); + MainUtil.sendMessage(player, "&3Plot&8->&3Schematic&8: &7Mass export has started. This may take a while."); + MainUtil.sendMessage(player, "&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); } break; } case "export": case "save": - if (!Permissions.hasPermission(player, "plots.schematic.save")) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.schematic.save"); + if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_SAVE)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_SAVE); return false; } if (this.running) { @@ -193,7 +193,7 @@ public class SchematicCmd extends SubCommand { MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.schematic.save")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java index 07de4b379..7b7b7505d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -58,8 +58,8 @@ public class Set extends SubCommand { for (String component : components) { if (component.equalsIgnoreCase(args[0])) { - if (!Permissions.hasPermission(player, "plots.set." + component)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set." + component); + if (!Permissions.hasPermission(player, C.PERMISSION_SET_COMPONENT.f(component))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_COMPONENT.f(component)); return false; } PlotBlock[] blocks; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/SetCommand.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/SetCommand.java index 601a16ce9..ced109a75 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/SetCommand.java @@ -18,15 +18,15 @@ public abstract class SetCommand extends SubCommand { return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - if (!Permissions.hasPermission(player, "plots.admin.command." + getFullId())) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command." + getFullId()); + if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_ADMIN_COMMAND.f(getFullId())); MainUtil.sendMessage(player, C.PLOT_NOT_CLAIMED); return false; } } if (!plot.isOwner(player.getUUID())) { - if (!Permissions.hasPermission(player, "plots.admin.command." + getFullId())) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command." + getFullId()); + if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_ADMIN_COMMAND.f(getFullId())); MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Setup.java index 15ca30473..6e2019ff6 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Setup.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Setup.java @@ -32,7 +32,7 @@ public class Setup extends SubCommand { StringBuilder message = new StringBuilder(); message.append("&6What generator do you want?"); for (Entry> entry : SetupUtils.generators.entrySet()) { - if (entry.getKey().equals("PlotSquared")) { + if (entry.getKey().equals(PS.imp().getPluginName())) { message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)"); } else if (entry.getValue().isFull()) { message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)"); @@ -79,7 +79,7 @@ public class Setup extends SubCommand { if (args.length != 1 || !SetupUtils.generators.containsKey(args[0])) { String prefix = "\n&8 - &7"; MainUtil.sendMessage(player, "&cYou must choose a generator!" + prefix + StringMan.join(SetupUtils.generators.keySet(), prefix) - .replaceAll("PlotSquared", "&2PlotSquared")); + .replaceAll(PS.imp().getPluginName(), "&2" + PS.imp().getPluginName())); sendMessage(player, C.SETUP_INIT); return false; } @@ -137,7 +137,7 @@ public class Setup extends SubCommand { .getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes(); SetupUtils.generators.get(object.plotManager).getPlotGenerator().processSetup(object); } else { - object.plotManager = "PlotSquared"; + object.plotManager = PS.imp().getPluginName(); MainUtil.sendMessage(player, "&c[WARNING] The specified generator does not identify as BukkitPlotGenerator"); MainUtil.sendMessage(player, "&7 - You may need to manually configure the other plugin"); object.step = SetupUtils.generators.get(object.plotManager).getPlotGenerator() @@ -263,7 +263,7 @@ public class Setup extends SubCommand { return false; } MainUtil.sendMessage(player, - "&cThe world you specified already exists. After restarting, new terrain will use PlotSquared, however you may need to " + "&cThe world you specified already exists. After restarting, new terrain will use " + PS.imp().getPluginName() + ", however you may need to " + "reset the world for it to generate correctly!"); } object.world = args[0]; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 91014ac33..86102a444 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -147,7 +147,7 @@ public class Template extends SubCommand { } catch (InvalidConfigurationException | IOException e) { e.printStackTrace(); } - String manager = worldConfig.getString("generator.plugin", "PlotSquared"); + String manager = worldConfig.getString("generator.plugin", PS.imp().getPluginName()); String generator = worldConfig.getString("generator.init", manager); int type = worldConfig.getInt("generator.type"); int terrain = worldConfig.getInt("generator.terrain"); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index a0ff0a0a1..0a88deeed 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -33,7 +33,7 @@ public class Trust extends Command { public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); checkTrue(plot.hasOwner(), C.PLOT_UNOWNED); - checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.trust"), C.NO_PLOT_PERMS); + checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS); checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage()); final Set uuids = MainUtil.getUUIDsFromString(args[0]); checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]); @@ -41,7 +41,7 @@ public class Trust extends Command { int size = plot.getTrusted().size() + plot.getMembers().size(); while (iter.hasNext()) { UUID uuid = iter.next(); - if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, "plots.trust.everyone") || Permissions.hasPermission(player, "plots.admin.command.trust"))) { + if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) { MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); iter.remove(); continue; @@ -59,7 +59,7 @@ public class Trust extends Command { size += plot.getMembers().contains(uuid) ? 0 : 1; } checkTrue(!uuids.isEmpty(), null); - checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions.hasPermission(player, "plots.admin.command.trust"), C.PLOT_MAX_MEMBERS); + checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS); confirm.run(this, new Runnable() { @Override // Success public void run() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java index 4bdc601ea..25c3a68b6 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java @@ -31,7 +31,7 @@ public class Unlink extends SubCommand { if (!plot.hasOwner()) { return !sendMessage(player, C.PLOT_UNOWNED); } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.unlink")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_UNLINK)) { return sendMessage(player, C.NO_PLOT_PERMS); } if (!plot.isMerged()) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Update.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Update.java index 46378b474..640fad387 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Update.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Update.java @@ -13,7 +13,7 @@ import java.net.URL; @CommandDeclaration( command = "update", permission = "plots.admin.command.update", - description = "Update PlotSquared", + description = "Update the plugin", usage = "/plot update", requiredType = RequiredType.NONE, aliases = {"updateplugin"}, diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index 4e1a73e60..b1fddd228 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -96,23 +96,23 @@ public class Visit extends Command { List plots = PS.get().sortPlotsByTemp(unsorted); final Plot plot = plots.get(page - 1); if (!plot.hasOwner()) { - if (!Permissions.hasPermission(player, "plots.visit.unowned")) { - C.NO_PERMISSION.send(player, "plots.visit.unowned"); + if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_UNOWNED)) { + C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_UNOWNED); return; } } else if (plot.isOwner(player.getUUID())) { - if (!Permissions.hasPermission(player, "plots.visit.owned") && !Permissions.hasPermission(player, "plots.home")) { - C.NO_PERMISSION.send(player, "plots.visit.owned, plots.home"); + if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OWNED) && !Permissions.hasPermission(player, C.PERMISSION_HOME)) { + C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OWNED); return; } } else if (plot.isAdded(player.getUUID())) { - if (!Permissions.hasPermission(player, "plots.visit.shared")) { - C.NO_PERMISSION.send(player, "plots.visit.shared"); + if (!Permissions.hasPermission(player, C.PERMISSION_SHARED)) { + C.NO_PERMISSION.send(player, C.PERMISSION_SHARED); return; } } else { - if (!Permissions.hasPermission(player, "plots.visit.other")) { - C.NO_PERMISSION.send(player, "plots.visit.other"); + if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OTHER)) { + C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OTHER); return; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java index 3c4f93b33..770c57dcb 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -70,12 +70,97 @@ public enum C { PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"), PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"), + PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"), + PERMISSION_TRUST_EVERYONE("plots.trust.everyone", "static.permissions"), + PERMISSION_AREA_CREATE("plots.area.create", "static.permissions"), + PERMISSION_AREA_INFO("plots.area.info", "static.permissions"), + PERMISSION_AREA_LIST("plots.area.list", "static.permissions"), + PERMISSION_AREA_REGEN("plots.area.regen", "static.permissions"), + PERMISSION_AREA_TP("plots.area.tp", "static.permissions"), + PERMISSION_AUTO_MEGA("plots.atuo.mega", "static.permissions"), + PERMISSION_CLAIM_SCHEMATIC("plots.claim.%s0", "static.permissions"), + PERMISSION_ADMIN_COMMAND_SCHEMATIC("plots.admin.command.schematic", "static.permissions"), + PERMISSION_ADMIN_COMMAND_BO3("plots.admin.command.bo3", "static.permissions"), + PERMISSION_ADMIN_COMMAND_CLEAR("plots.admin.command.clear", "static.permissions"), + PERMISSION_CONTINUE("plots.continue", "static.permissions"), + PERMISSION_CLUSTER_LIST("plots.cluster.list", "static.permissions"), + PERMISSION_CLUSTER_CREATE("plots.cluster.create", "static.permissions"), + PERMISSION_CLUSTER_CREATE_OTHER("plots.cluster.create.other", "static.permissions"), + PERMISSION_CLUSTER_SIZE("plots.cluster.size", "static.permissions"), + PERMISSION_CLUSTER_DELETE("plots.cluster.delete", "static.permissions"), + PERMISSION_CLUSTER_DELETE_OTHER("plots.cluster.delete.other", "static.permissions"), + PERMISSION_CLUSTER_RESIZE("plots.cluster.resize", "static.permissions"), + PERMISSION_CLUSTER_RESIZE_OTHER("plots.cluster.resize.other", "static.permissions"), + PERMISSION_CLUSTER_RESIZE_SHRINK("plots.cluster.resize.shrink", "static.permissions"), + PERMISSION_CLUSTER_RESIZE_EXPAND("plots.cluster.resize.expand", "static.permissions"), + PERMISSION_CLUSTER("plots.cluster", "static.permissions"), + PERMISSION_CLUSTER_INVITE("plots.cluster.invite", "static.permissions"), + PERMISSION_CLUSTER_INVITE_OTHER("plots.cluster.invite.other", "static.permissions"), + PERMISSION_CLUSTER_KICK("plots.cluster.kick", "static.permissions"), + PERMISSION_CLUSTER_KICK_OTHER("plots.cluster.kick.other", "static.permissions"), + PERMISSION_CLUSTER_LEAVE("plots.cluster.leave", "static.permissions"), + PERMISSION_CLUSTER_HELPERS("plots.cluster.helpers", "static.permissions"), + PERMISSION_CLUSTER_TP("plots.cluster.tp", "static.permissions"), + PERMISSION_CLUSTER_TP_OTHER("plots.cluster.tp.other", "static.permissions"), + PERMISSION_CLUSTER_INFO("plots.cluster.info", "static.permissions"), + PERMISSION_CLUSTER_SETHOME("plots.cluster.sethome", "static.permissions"), + PERMISSION_CLUSTER_SETHOME_OTHER("plots.cluster.sethome.other", "static.permissions"), + PERMISSION_ADMIN_COMMAND_CONTINUE("plots.admin.command.continue", "static.permissions"), + PERMISSION_ADMIN_COMMAND_DELETE("plots.admin.command.delete", "static.permissions"), + PERMISSION_ADMIN_COMMAND_DENY("plots.admin.command.deny", "static.permissions"), + PERMISSION_DENY_EVERYONE("plots.deny.everyone", "static.permissions"), + PERMISSION_ADMIN_COMMAND_DONE("plots.admin.command.done", "static.permissions"), + PERMISSION_ADMIN_COMMAND_DOWNLOAD("plots.admin.command.download", "static.permissions"), + PERMISSION_DOWNLOAD_BO3("plots.download.bo3", "static.permissions"), + PERMISSION_DOWNLOAD_WORLD("plots.download.world", "static.permissions"), + PERMISSION_SET_FLAG_OTHER("plots.set.flag.other", "static.permissions"), + PERMISSION_SET_FLAG("plots.set.flag", "static.permissions"), + PERMISSION_SET_FLAG_KEY("plots.set.flag.%s0", "static.permissions"), + PERMISSION_SET_FLAG_KEY_VALUE("plots.set.flag.%s0.%s1", "static.permissions"), + PERMISSION_FLAG_REMOVE("plots.flag.remove", "static.permissions"), + PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"), + PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"), + PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"), + PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), + PERMISSION_LIST_FORSALE("plots.list.forsale", "static.permissions"), + PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"), + PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"), + PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"), + PERMISSION_LIST_WORLD_NAME("plots.list.world.%s0", "static.permissions"), + PERMISSION_LIST_TOP("plots.list.top", "static.permissions"), + PERMISSION_LIST_ALL("plots.list.all", "static.permissions"), + PERMISSION_LIST_UNOWNED("plots.list.unowned", "static.permissions"), + PERMISSION_LIST_UNKNOWN("plots.list.unknown", "static.permissions"), + PERMISSION_LIST_PLAYER("plots.list.player", "static.permissions"), + PERMISSION_LIST_DONE("plots.list.done", "static.permissions"), + PERMISSION_LIST_EXPIRED("plots.list.expired", "static.permissions"), + PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"), + PERMISSION_LIST_AREA("plots.list.area", "static.permissions"), + PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"), + PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), + PERMISSION_ADMIN_COMMAND_SETOWNER("plots.admin.command.setowner", "static.permissions"), + PERMISSION_COMMENT("plots.comment", "static.permissions"), + PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"), + PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"), + PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE("plots.admin.command.schematic.paste", "static.permissions"), + PERMISSION_SCHEMATIC_PASTE("plots.schematic.paste", "static.permissions"), + PERMISSION_SCHEMATIC_SAVE("plots.schematic.save", "static.permissions"), + PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE("plots.admin.command.schematic.save", "static.permissions"), + PERMISSION_SET_COMPONENT("plots.set.%s0", "static.permissions"), + PERMISSION_ADMIN_COMMAND("plots.admin.command.%s0", "static.permissions"), + PERMISSION_ADMIN_COMMAND_UNLINK("", "static.permissions"), + PERMISSION_VISIT_UNOWNED("plots.visit.unowned", "static.permissions"), + PERMISSION_VISIT_OWNED("plots.visit.owned", "static.permissions"), + PERMISSION_SHARED("plots.visit.shared", "static.permissions"), + PERMISSION_VISIT_OTHER("plots.visit.other", "static.permissions"), + PERMISSION_HOME("plots.home", "static.permissions"), + /* * Static console */ CONSOLE_JAVA_OUTDATED_1_8("&cYour version of java is outdated. It is highly recommended that you update to Java 8 as it increases performance " - + "and security. PlotSquared will require Java 9 in a future update.", "static.console"), - CONSOLE_PLEASE_ENABLE_METRICS("&dPlease enable metrics for PlotSquared. Using metrics improves plugin stability, performance, and features. " + + "and security. %s0 will require Java 9 in a future update.", "static.console"), + CONSOLE_PLEASE_ENABLE_METRICS("&dPlease enable metrics for %s0. Using metrics improves plugin stability, performance, and features. " + "Bug fixes and new features are influenced on metrics.", "static.console"), /* * Confirm @@ -288,7 +373,7 @@ public enum C { */ TASK_START("Starting task...", "Core"), PREFIX("$3[$1P2$3] $2", "Core"), - ENABLED("$1PlotSquared is now enabled", "Core"), + ENABLED("$1%s0 is now enabled", "Core"), /* * Reload */ @@ -527,12 +612,6 @@ public enum C { * Left */ LEFT_PLOT("$2You left a plot", "Left"), - /* - * PlotMe - */ - NOT_USING_PLOTME( - "$2This server uses the far superior $1PlotSquared $2plot management system. Please use the $1/ps $2or $1/p2 $2or $1/plots $2instead", - "Errors"), /* * Wait */ diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 1c31a1b20..58870f3bb 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -51,7 +51,6 @@ public class Settings extends Config { Redstone.DISABLE_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied", Redstone.DISABLE_UNOCCUPIED); // PlotMe - PlotMe.ALIAS = config.getBoolean("plotme-alias", PlotMe.ALIAS); Enabled_Components.PLOTME_CONVERTER = config.getBoolean("plotme-convert.enabled", Enabled_Components.PLOTME_CONVERTER); PlotMe.CACHE_UUDS = config.getBoolean("plotme-convert.cache-uuids", PlotMe.CACHE_UUDS); @@ -185,9 +184,9 @@ public class Settings extends Config { } public static class UUID { - @Comment("Force PlotSquared to use offline UUIDs (it usually detects the right mode)") + @Comment("Force using offline UUIDs (it usually detects the right mode)") public static boolean OFFLINE = false; - @Comment("Force PlotSquared to use lowercase UUIDs") + @Comment("Force using lowercase UUIDs") public static boolean FORCE_LOWERCASE = false; @Comment("Use a database to store UUID/name info") public static boolean USE_SQLUUIDHANDLER = false; @@ -195,7 +194,7 @@ public class Settings extends Config { public static boolean NATIVE_UUID_PROVIDER = false; } - @Comment("Configure the paths PlotSquared will use") + @Comment("Configure the paths that will be used") public static final class Paths { public static String SCHEMATICS = "schematics"; public static String BO3 = "bo3"; @@ -241,8 +240,6 @@ public class Settings extends Config { public static final class PlotMe { @Comment("Cache the uuids from the PlotMe database") public static boolean CACHE_UUDS = false; - @Comment("Have `/plotme` as a command alias") - public static boolean ALIAS = false; } public static final class Teleport { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java index 0653aaf41..11bd325f9 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java @@ -1,6 +1,7 @@ package com.intellectualcrafters.plot.generator; import com.intellectualcrafters.jnbt.CompoundTag; +import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotBlock; @@ -19,7 +20,7 @@ public class HybridGen extends IndependentPlotGenerator { @Override public String getName() { - return "PlotSquared"; + return PS.imp().getPluginName(); } @Override diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotMessage.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotMessage.java index a1cc545e7..6d0def977 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotMessage.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotMessage.java @@ -13,7 +13,7 @@ public class PlotMessage { try { reset(ChatManager.manager); } catch (Throwable e) { - PS.debug("PlotSquared doesn't support fancy chat for " + PS.get().IMP.getServerVersion()); + PS.debug(PS.imp().getPluginName() + " doesn't support fancy chat for " + PS.get().IMP.getServerVersion()); ChatManager.manager = new PlainChatManager(); reset(ChatManager.manager); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java index adeb69181..61371dc20 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java @@ -68,8 +68,8 @@ public abstract class EventUtil { } } if (PS.get().update != null && Permissions.hasPermission(player, C.PERMISSION_ADMIN_UPDATE) && Settings.Enabled_Components.UPDATER) { - MainUtil.sendMessage(player,C.CONSOLE_JAVA_OUTDATED_1_8.s()); - MainUtil.sendMessage(player, "&6An update for PlotSquared is available: &7/plot update"); + MainUtil.sendMessage(player,C.CONSOLE_JAVA_OUTDATED_1_8.f(PS.get().IMP.getPluginName())); + MainUtil.sendMessage(player, "&6An update for " + PS.imp().getPluginName() + " is available: &7/plot update"); } final Plot plot = player.getCurrentPlot(); if (Settings.Teleport.ON_LOGIN && plot != null) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/Permissions.java b/Core/src/main/java/com/intellectualcrafters/plot/util/Permissions.java index b97c0ed9d..5bd4a15c6 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/Permissions.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/Permissions.java @@ -89,7 +89,11 @@ public class Permissions { } return true; } - + + public static int hasPermissionRange(PlotPlayer player, C perm, int range) { + return hasPermissionRange(player, perm.s(), range); + } + /** * Check the the highest permission a PlotPlayer has within a specified range.
* - Excessively high values will lag
diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java index e2f6a047e..c62d003a4 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java @@ -129,7 +129,7 @@ public abstract class UUIDHandlerImplementation { DBFunc.replaceUUID(offline, uuid); PS.debug("&cDetected invalid UUID stored for: " + name.value); PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?"); - PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database."); + PS.debug("&6" + PS.imp().getPluginName() + " will update incorrect entries when the user logs in, or you can reconstruct your database."); } } } @@ -146,10 +146,7 @@ public abstract class UUIDHandlerImplementation { for (Plot plot : plots) { plot.owner = uuid; } - DBFunc.replaceUUID(offlineUpper, uuid); - PS.debug("&cDetected invalid UUID stored for: " + name.value); - PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?"); - PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database."); + replace(offlineUpper, uuid, name.value); } } } @@ -164,10 +161,7 @@ public abstract class UUIDHandlerImplementation { for (Plot plot : plots) { plot.owner = uuid; } - DBFunc.replaceUUID(offline, uuid); - PS.debug("&cDetected invalid UUID stored for (1): " + name.value); - PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?"); - PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database."); + replace(offline, uuid, name.value); } return true; } @@ -187,6 +181,13 @@ public abstract class UUIDHandlerImplementation { return true; } + private void replace(UUID from, UUID to, String name) { + DBFunc.replaceUUID(from, to); + PS.debug("&cDetected invalid UUID stored for: " + name); + PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?"); + PS.debug("&6" + PS.imp().getPluginName() + " will update incorrect entries when the user logs in, or you can reconstruct your database."); + } + public boolean uuidExists(UUID uuid) { return this.uuidMap.containsValue(uuid); } diff --git a/Core/src/main/java/com/plotsquared/listener/ProcessedWEExtent.java b/Core/src/main/java/com/plotsquared/listener/ProcessedWEExtent.java index 5024f2a77..74f346d45 100644 --- a/Core/src/main/java/com/plotsquared/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/plotsquared/listener/ProcessedWEExtent.java @@ -1,6 +1,7 @@ package com.plotsquared.listener; import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.RegionWrapper; import com.sk89q.worldedit.Vector; @@ -95,7 +96,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { this.BScount++; if (this.BScount > Settings.Chunk_Processor.MAX_TILES) { this.BSblocked = true; - PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); + PS.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); } if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) { if (this.count++ > this.max) { @@ -240,7 +241,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { this.Ecount++; if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) { this.Eblocked = true; - PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); + PS.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); } if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) { return super.createEntity(location, entity); diff --git a/Core/src/main/resources/plugin.properties b/Core/src/main/resources/plugin.properties new file mode 100644 index 000000000..75ac2d200 --- /dev/null +++ b/Core/src/main/resources/plugin.properties @@ -0,0 +1 @@ +version=${version} \ No newline at end of file diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java index 33c4d4449..d5a1c6649 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java @@ -70,6 +70,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain public static WorldEdit worldEdit; private int[] version; + private String name; @Override public int[] getServerVersion() { @@ -92,15 +93,16 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain @Override public void onEnable() { try { + this.name = getDescription().getName(); getServer().getName(); new PS(this, "Nukkit"); if (Settings.Enabled_Components.METRICS) { new Metrics(this).start(); PS.log(C.PREFIX + "&6Metrics enabled."); } else { - PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS); + PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName())); } - Generator.addGenerator(NukkitHybridGen.class, "PlotSquared", 1); + Generator.addGenerator(NukkitHybridGen.class, getPluginName(), 1); } catch (Throwable e) { e.printStackTrace(); } @@ -144,6 +146,11 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain return getDescription().getVersion(); } + @Override + public String getPluginName() { + return name; + } + @Override public void registerCommands() { NukkitCommand bukkitCommand = new NukkitCommand("plot", new String[] {"p","plot","ps","plotsquared","p2","2"}); diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/object/NukkitPlayer.java b/Nukkit/src/main/java/com/plotsquared/nukkit/object/NukkitPlayer.java index db55bb322..d1f63f44a 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/object/NukkitPlayer.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/object/NukkitPlayer.java @@ -4,6 +4,7 @@ import cn.nukkit.Player; import cn.nukkit.event.player.PlayerTeleportEvent; import cn.nukkit.plugin.RegisteredListener; import cn.nukkit.utils.EventException; +import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.EconHandler; @@ -62,7 +63,7 @@ public class NukkitPlayer extends PlotPlayer { PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.PLUGIN); RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (RegisteredListener listener : listeners) { - if (listener.getPlugin().getName().equals("PlotSquared")) { + if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) { continue; } try { @@ -76,7 +77,7 @@ public class NukkitPlayer extends PlotPlayer { } event = new PlayerTeleportEvent(player, to, from, PlayerTeleportEvent.TeleportCause.PLUGIN); for (RegisteredListener listener : listeners) { - if (listener.getPlugin().getName().equals("PlotSquared")) { + if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) { continue; } try { diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitCommand.java b/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitCommand.java index 5805daf6a..a058d0218 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitCommand.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitCommand.java @@ -11,7 +11,7 @@ import com.intellectualcrafters.plot.object.ConsolePlayer; public class NukkitCommand extends Command { public NukkitCommand(String cmd, String[] aliases) { - super(cmd, "PlotSquared command", "/plot", aliases); + super(cmd, "Plot command", "/plot", aliases); } diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitSetupUtils.java b/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitSetupUtils.java index 6ee2dd982..0b919329e 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitSetupUtils.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitSetupUtils.java @@ -7,7 +7,6 @@ import com.intellectualcrafters.configuration.file.YamlConfiguration; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.generator.GeneratorWrapper; -import com.intellectualcrafters.plot.generator.HybridGen; import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.util.SetupUtils; @@ -38,7 +37,7 @@ public class NukkitSetupUtils extends SetupUtils { map.put("world", testWorld); map.put("plot-generator", PS.get().IMP.getDefaultGenerator()); NukkitPlotGenerator gen = new NukkitPlotGenerator(map); - SetupUtils.generators.put("PlotSquared", gen); + SetupUtils.generators.put(PS.imp().getPluginName(), gen); } @Override @@ -160,7 +159,7 @@ public class NukkitSetupUtils extends SetupUtils { return entry.getKey(); } } - return "PlotSquared"; + return PS.imp().getPluginName(); } catch (Throwable e) { e.printStackTrace(); } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java index 5deb23f66..83f3c0713 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java @@ -179,6 +179,11 @@ public class SpongeMain implements IPlotMain { return this.plugin.getVersion().orElse(""); } + @Override + public String getPluginName() { + return "PlotSquared"; + } + @Override public int[] getServerVersion() { PS.log("Checking minecraft version: Sponge: "); diff --git a/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java b/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java index 65f50b923..f74e19605 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java @@ -87,23 +87,6 @@ public class MainListener { * - enderman harvest */ - @Listener - public void onCommand(SendCommandEvent event) { - switch (event.getCommand().toLowerCase()) { - case "plotme": - Player source = SpongeUtil.getCause(event.getCause(), Player.class); - if (source == null) { - return; - } - if (Settings.PlotMe.ALIAS) { - SpongeMain.THIS.getGame().getCommandManager().process(source, ("plots " + event.getArguments()).trim()); - } else { - source.sendMessage(SpongeUtil.getText(C.NOT_USING_PLOTME.s())); - } - event.setCancelled(true); - } - } - @Listener public void onChat(MessageEvent event) { // TODO @@ -295,7 +278,7 @@ public class MainListener { // return true; // } // org.spongepowered.api.world.Location loc = relatives.get(dir); - // com.intellectualcrafters.plot.object.Location plotloc = SpongeUtil.getLocation(loc.getExtent().getName(), loc); + // com.intellectualcrafters.plot.object.Location plotloc = SpongeUtil.getLocation(loc.getExtent().getPluginName(), loc); // if (area == null) { // return true; // } @@ -310,7 +293,7 @@ public class MainListener { // return true; // } // org.spongepowered.api.world.Location relative = loc.getRelative(dir); - // com.intellectualcrafters.plot.object.Location relLoc = SpongeUtil.getLocation(relative.getExtent().getName(), relative); + // com.intellectualcrafters.plot.object.Location relLoc = SpongeUtil.getLocation(relative.getExtent().getPluginName(), relative); // if (plot.equals(MainUtil.getPlot(relLoc))) { // return true; // } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java index 3ef7d2261..bb9c4a2d5 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java @@ -4,11 +4,16 @@ import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.generator.GeneratorWrapper; -import com.intellectualcrafters.plot.generator.HybridGen; import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.util.SetupUtils; import com.plotsquared.sponge.generator.SpongePlotGenerator; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; import org.spongepowered.api.Sponge; import org.spongepowered.api.world.DimensionTypes; import org.spongepowered.api.world.GeneratorTypes; @@ -18,13 +23,6 @@ import org.spongepowered.api.world.gen.WorldGenerator; import org.spongepowered.api.world.gen.WorldGeneratorModifier; import org.spongepowered.api.world.storage.WorldProperties; -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.Optional; - public class SpongeSetupUtils extends SetupUtils { @Override @@ -32,7 +30,7 @@ public class SpongeSetupUtils extends SetupUtils { if (!SetupUtils.generators.isEmpty()) { return; } - SetupUtils.generators.put("PlotSquared", new SpongePlotGenerator(PS.get().IMP.getDefaultGenerator())); + SetupUtils.generators.put(PS.imp().getPluginName(), new SpongePlotGenerator(PS.get().IMP.getDefaultGenerator())); // TODO get external world generators Collection wgms = Sponge.getRegistry().getAllOf(WorldGeneratorModifier.class); for (WorldGeneratorModifier wgm : wgms) { diff --git a/build.gradle b/build.gradle index 2f02607d9..ab20610d6 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ ext { revision = "${git.head().abbreviatedId}" } version = "3.4.6-SNAPSHOT-${revision}" -description = """PlotSquared""" +description = rootProject.name subprojects { apply plugin: 'java' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f335290f..61fb7a4d8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Sep 11 16:39:31 EDT 2016 +#Mon Sep 26 17:20:41 AEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-all.zip