From 237b10a2a2bc83cd493b71ef08ae807298d62a37 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 29 Apr 2019 10:49:58 -0400 Subject: [PATCH] Tidying up the code --- Bukkit/build.gradle | 4 +- .../bukkit/listeners/PlayerEvents.java | 139 ++++++-- .../bukkit/util/BukkitSetupUtils.java | 26 +- Bukkit/src/main/resources/plugin.yml | 5 - Core/build.gradle | 18 +- .../plotsquared/plot/commands/Alias.java | 2 +- .../plotsquared/plot/commands/Comment.java | 2 +- .../plotsquared/plot/commands/Copy.java | 6 +- .../plotsquared/plot/commands/Desc.java | 2 +- .../plotsquared/plot/commands/Template.java | 31 +- .../plotsquared/plot/config/Captions.java | 306 +++++++++--------- build.gradle | 3 +- 12 files changed, 306 insertions(+), 238 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index e7c0e90ce..ef26dbb05 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -3,13 +3,15 @@ repositories { maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "http://nexus.hc.to/content/repositories/pub_releases" } maven { url = "https://repo.codemc.org/repository/maven-public" } + maven { url 'http://repo.onarandombox.com/content/groups/public'} mavenLocal() } dependencies { implementation project(':Core') compile project(':Core') - compile 'org.spigotmc:spigot-api:1.14-pre5-SNAPSHOT' + implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' + implementation 'org.spigotmc:spigot-api:1.14-pre5-SNAPSHOT' compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT') compile(group: 'org.bstats', name: 'bstats-bukkit', version: '1.4') compile("net.milkbowl.vault:VaultAPI:1.7") { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 144afd98e..d31703ad4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -10,8 +10,36 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; -import com.github.intellectualsites.plotsquared.plot.object.*; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotHandler; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; +import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.StringWrapper; +import com.github.intellectualsites.plotsquared.plot.util.EntityUtil; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.RegExUtil; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.regex.Pattern; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.FluidCollisionMode; @@ -22,18 +50,82 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; import org.bukkit.command.PluginCommand; -import org.bukkit.entity.*; +import org.bukkit.entity.Ageable; +import org.bukkit.entity.Animals; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Fireball; +import org.bukkit.entity.Hanging; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.ItemFrame; +import org.bukkit.entity.LingeringPotion; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Monster; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.entity.Tameable; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.entity.Vehicle; +import org.bukkit.entity.Villager; +import org.bukkit.entity.WaterMob; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.block.*; -import org.bukkit.event.entity.*; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.block.BlockDispenseEvent; +import org.bukkit.event.block.BlockExplodeEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonRetractEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.BlockRedstoneEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.EntityBlockFormEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityCombustByEntityEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.LingeringPotionSplashEvent; +import org.bukkit.event.entity.PotionSplashEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.player.*; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerChangedWorldEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerEggThrowEvent; +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; @@ -51,11 +143,6 @@ import org.bukkit.projectiles.BlockProjectileSource; import org.bukkit.projectiles.ProjectileSource; import org.bukkit.util.Vector; -import java.lang.reflect.Field; -import java.util.*; -import java.util.Map.Entry; -import java.util.regex.Pattern; - /** * Player Events involving plots. */ @@ -151,16 +238,19 @@ import java.util.regex.Pattern; return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.VEHICLE_CAP); case BAT: case CHICKEN: + case CAT: case COD: case COW: case DOLPHIN: case DONKEY: + case FOX: case HORSE: case IRON_GOLEM: case LLAMA: case MULE: case MUSHROOM_COW: case OCELOT: + case PANDA: case PARROT: case PIG: case POLAR_BEAR: @@ -171,6 +261,7 @@ import java.util.regex.Pattern; case SKELETON_HORSE: case SNOWMAN: case SQUID: + case TRADER_LLAMA: case TROPICAL_FISH: case TURTLE: case VILLAGER: @@ -208,6 +299,9 @@ import java.util.regex.Pattern; case WITHER_SKELETON: case ZOMBIE: case ZOMBIE_VILLAGER: + case PILLAGER: + case PHANTOM: + case RAVAGER: // monster return EntityUtil .checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP); @@ -524,18 +618,17 @@ import java.util.regex.Pattern; } String[] parts = msg.split(" "); Plot plot = pp.getCurrentPlot(); - if (BukkitMain.getWorldEdit() != null) { // Check WorldEdit - switch (parts[0].toLowerCase()) { - case "up": - case "/up": - case "worldedit:up": - case "worldedit:/up": - if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions - .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { - event.setCancelled(true); - return; - } - } + // Check WorldEdit + switch (parts[0].toLowerCase()) { + case "up": + case "/up": + case "worldedit:up": + case "worldedit:/up": + if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions + .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { + event.setCancelled(true); + return; + } } if (plot == null) { return; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java index 2e90b4de0..6237f0ba3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -9,6 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.SetupObject; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig; import org.bukkit.*; import org.bukkit.World.Environment; import org.bukkit.entity.Player; @@ -171,9 +173,9 @@ public class BukkitSetupUtils extends SetupUtils { } catch (IOException e) { e.printStackTrace(); } + Plugin plugin = Bukkit.getPluginManager().getPlugin("Multiverse-Core"); if (object.setupGenerator != null) { - if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null && Bukkit - .getPluginManager().getPlugin("Multiverse-Core").isEnabled()) { + if (plugin != null && plugin.isEnabled()) { Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create " + world + " normal -g " + object.setupGenerator); setGenerator(world, object.setupGenerator); @@ -181,15 +183,6 @@ public class BukkitSetupUtils extends SetupUtils { return world; } } - if (Bukkit.getPluginManager().getPlugin("MultiWorld") != null && Bukkit - .getPluginManager().getPlugin("MultiWorld").isEnabled()) { - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), - "mw create " + world + " plugin:" + object.setupGenerator); - setGenerator(world, object.setupGenerator); - if (Bukkit.getWorld(world) != null) { - return world; - } - } WorldCreator wc = new WorldCreator(object.world); wc.generator(object.setupGenerator); wc.environment(Environment.NORMAL); @@ -197,22 +190,13 @@ public class BukkitSetupUtils extends SetupUtils { Bukkit.createWorld(wc); setGenerator(world, object.setupGenerator); } else { - if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null && Bukkit - .getPluginManager().getPlugin("Multiverse-Core").isEnabled()) { + if (plugin != null && plugin.isEnabled()) { Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create " + world + " normal"); if (Bukkit.getWorld(world) != null) { return world; } } - if (Bukkit.getPluginManager().getPlugin("MultiWorld") != null && Bukkit - .getPluginManager().getPlugin("MultiWorld").isEnabled()) { - Bukkit.getServer() - .dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world); - if (Bukkit.getWorld(world) != null) { - return world; - } - } World bw = Bukkit.createWorld(new WorldCreator(object.world).environment(Environment.NORMAL)); } diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 41714aeb6..d9cd4e9d4 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -62,7 +62,6 @@ permissions: plots.set.flag.vehicle-use.*: true plots.set.flag.vehicle-place.*: true plots.set.flag.vehicle-break.*: true - plots.set.flag.player-interact.*: true plots.set.flag.place.*: true plots.set.flag.break.*: true plots.set.flag.use.*: true @@ -75,16 +74,12 @@ permissions: comments.notifications.enabled: true plots.inbox.read.public: true plots.inbox.modify.public: true - plots.inbox.modify.public: true plots.inbox.write.public: true - plots.inbox.read.public: true plots.inbox.read.report: true plots.inbox.write.report: true - plots.inbox.read.report: true plots.inbox.read.owner: true plots.inbox.modify.owner: true plots.inbox.write.owner: true - plots.inbox.read.owner: true plots.comment: true plots.inbox: true plots.permpack.wilderness: diff --git a/Core/build.gradle b/Core/build.gradle index 71a24b237..82f6abd3a 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -3,19 +3,19 @@ repositories { } dependencies { - testCompile 'junit:junit:4.12' - compile 'org.yaml:snakeyaml:1.23' - compile 'com.google.code.gson:gson:2.8.5' - compile("org.projectlombok:lombok:1.18.6") + implementation 'org.yaml:snakeyaml:1.23' + //keep inline with Minecraft which uses gson 2.8.0 + implementation 'com.google.code.gson:gson:2.8.0' + implementation("org.projectlombok:lombok:1.18.6") compileOnly("org.projectlombok:lombok:1.18.6") testCompileOnly("org.projectlombok:lombok:1.18.6") annotationProcessor("org.projectlombok:lombok:1.18.6") testAnnotationProcessor("org.projectlombok:lombok:1.18.6") - compile 'com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT' - compile 'com.squareup.okhttp3:okhttp:3.14.0' - compile 'com.squareup.okio:okio:2.2.2' - compile 'org.jetbrains.kotlin:kotlin-stdlib:1.3.30' + implementation 'com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT' + implementation 'com.squareup.okhttp3:okhttp:3.14.0' + implementation 'com.squareup.okio:okio:2.2.2' + implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.30' } sourceCompatibility = 1.8 @@ -33,7 +33,7 @@ processResources { } } -jar.archiveName = "PlotSquared-API-${project.parent.version}.jar" +jar.setArchiveName("PlotSquared-API-${project.parent.version}.jar") jar.destinationDir = file '../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/' + project.parent.version task createPom { doLast { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 3602bda5e..8e0847f57 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -15,7 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; @CommandDeclaration(command = "setalias", permission = "plots.alias", description = "Set the plot name", usage = "/plot alias ", aliases = {"alias", "sa", "name", "rename", "setname", "seta", "nameplot"}, - category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) public class Alias + category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Alias extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java index a4441658b..048047bb6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java @@ -17,7 +17,7 @@ import java.util.Arrays; import java.util.Map.Entry; @CommandDeclaration(command = "comment", aliases = {"msg"}, description = "Comment on a plot", - category = CommandCategory.CHAT, requiredType = RequiredType.NONE, permission = "plots.comment") + category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER, permission = "plots.comment") public class Comment extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index f925720f1..dd95a8c2f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -40,11 +40,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; Captions.PLOTWORLD_INCOMPATIBLE.send(player); return false; } - if (plot1.copy(plot2, new Runnable() { - @Override public void run() { - MainUtil.sendMessage(player, Captions.COPY_SUCCESS); - } - })) { + if (plot1.copy(plot2, () -> MainUtil.sendMessage(player, Captions.COPY_SUCCESS))) { return true; } else { MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java index ec62e299c..d3b261ba8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @CommandDeclaration(command = "setdescription", permission = "plots.set.desc", description = "Set the plot description", usage = "/plot desc ", aliases = {"desc", "setdesc", "setd", "description"}, category = CommandCategory.SETTINGS, - requiredType = RequiredType.NONE) public class Desc extends SetCommand { + requiredType = RequiredType.PLAYER) public class Desc extends SetCommand { @Override public boolean set(PlotPlayer player, Plot plot, String desc) { if (desc.isEmpty()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java index 424878e27..472542523 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java @@ -33,11 +33,11 @@ import java.util.zip.ZipOutputStream; if (!folder.exists()) { return false; } - File input = new File(folder + File.separator + template + ".template"); File output = PlotSquared.get().IMP.getDirectory(); if (!output.exists()) { output.mkdirs(); } + File input = new File(folder + File.separator + template + ".template"); try (ZipInputStream zis = new ZipInputStream(new FileInputStream(input))) { ZipEntry ze = zis.getNextEntry(); byte[] buffer = new byte[2048]; @@ -63,9 +63,6 @@ import java.util.zip.ZipOutputStream; zis.closeEntry(); } return true; - } catch (FileNotFoundException e) { - e.printStackTrace(); - return false; } catch (IOException e) { e.printStackTrace(); return false; @@ -162,11 +159,9 @@ import java.util.zip.ZipOutputStream; setup.step = new ConfigurationNode[0]; setup.world = world; SetupUtils.manager.setupWorld(setup); - GlobalBlockQueue.IMP.addTask(new Runnable() { - @Override public void run() { - MainUtil.sendMessage(player, "Done!"); - player.teleport(WorldUtil.IMP.getSpawn(world)); - } + GlobalBlockQueue.IMP.addTask(() -> { + MainUtil.sendMessage(player, "Done!"); + player.teleport(WorldUtil.IMP.getSpawn(world)); }); return true; } @@ -182,17 +177,15 @@ import java.util.zip.ZipOutputStream; return false; } final PlotManager manager = area.getPlotManager(); - TaskManager.runTaskAsync(new Runnable() { - @Override public void run() { - try { - manager.exportTemplate(area); - } catch (Exception e) { // Must recover from any exception thrown a third party template manager - e.printStackTrace(); - MainUtil.sendMessage(player, "Failed: " + e.getMessage()); - return; - } - MainUtil.sendMessage(player, "Done!"); + TaskManager.runTaskAsync(() -> { + try { + manager.exportTemplate(area); + } catch (Exception e) { // Must recover from any exception thrown a third party template manager + e.printStackTrace(); + MainUtil.sendMessage(player, "Failed: " + e.getMessage()); + return; } + MainUtil.sendMessage(player, "Done!"); }); return true; default: diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index ddd72e9f8..a5a1c559c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -5,160 +5,165 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.StringMan; - import java.io.File; import java.io.IOException; -import java.util.*; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; /** * Captions class. */ public enum Captions { + //@formatter:off /* * Static flags */ - FLAG_USE("use", "static.flags"), FLAG_BREAK("break", "static.flags"), FLAG_PLACE("place", - "static.flags"), FLAG_PVP("pvp", "static.flags"), FLAG_HANGING_PLACE("hanging-place", - "static.flags"), FLAG_HANGING_BREAK("hanging-break", "static.flags"), FLAG_HANGING_INTERACT( - "hanging-interact", "static.flags"), FLAG_MISC_INTERACT("misc-interact", - "static.flags"), FLAG_MISC_BREAK("misc-break", "static.flags"), FLAG_MISC_PLACE( - "misc-place", "static.flags"), FLAG_VEHICLE_BREAK("vehicle-break", - "static.flags"), FLAG_HOSTILE_INTERACT("hostile-interact", - "static.flags"), FLAG_DEVICE_INTERACT("device-interact", - "static.flags"), FLAG_ANIMAL_INTERACT("animal-interact", "static.flags"), FLAG_VEHICLE_USE( - "vehicle-use", "static.flags"), FLAG_VEHICLE_PLACE("vehicle-place", - "static.flags"), FLAG_PLAYER_INTERACT("player-interact", - "static.flags"), FLAG_TAMED_INTERACT("tamed-interact", - "static.flags"), FLAG_DISABLE_PHYSICS("disable-physics", "static.flags"), FLAG_MOB_PLACE( - "mob-place", "static.flags"), /* + FLAG_USE("use", "static.flags"), + FLAG_BREAK("break", "static.flags"), + FLAG_PLACE("place", "static.flags"), + FLAG_PVP("pvp", "static.flags"), + FLAG_HANGING_PLACE("hanging-place", "static.flags"), + FLAG_HANGING_BREAK("hanging-break", "static.flags"), + FLAG_HANGING_INTERACT("hanging-interact", "static.flags"), + FLAG_MISC_INTERACT("misc-interact", "static.flags"), + FLAG_MISC_BREAK("misc-break", "static.flags"), + FLAG_MISC_PLACE("misc-place", "static.flags"), + FLAG_VEHICLE_BREAK("vehicle-break", "static.flags"), + FLAG_HOSTILE_INTERACT("hostile-interact", "static.flags"), + FLAG_DEVICE_INTERACT("device-interact", "static.flags"), + FLAG_ANIMAL_INTERACT("animal-interact", "static.flags"), FLAG_VEHICLE_USE("vehicle-use", "static.flags"), + FLAG_VEHICLE_PLACE("vehicle-place", "static.flags"), + FLAG_PLAYER_INTERACT("player-interact", "static.flags"), + FLAG_TAMED_INTERACT("tamed-interact", "static.flags"), + FLAG_DISABLE_PHYSICS("disable-physics", "static.flags"), + FLAG_MOB_PLACE("mob-place", "static.flags"), + /* * Static permission */ - PERMISSION_STAR("*", "static.permissions"), PERMISSION_ADMIN("plots.admin", - "static.permissions"), PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned", - "static.permissions"), PERMISSION_PROJECTILE_OTHER("plots.projectile.other", - "static.permissions"), PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS( - "plots.admin.interact.blockedcommands", "static.permissions"), PERMISSION_WORLDEDIT_BYPASS( - "plots.worldedit.bypass", "static.permissions"), PERMISSION_PLOT_TOGGLE_TITLES( - "plots.toggle.titles", "static.permissions"), PERMISSION_PLOT_TOGGLE_CHAT( - "plots.toggle.chat", "static.permissions"), PERMISSION_ADMIN_UPDATE_NOTIFICATION( - "plots.admin.update.notify", "static.permissions"), PERMISSION_ADMIN_EXIT_DENIED( - "plots.admin.exit.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_DENIED( - "plots.admin.entry.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_FORCEFIELD( - "plots.admin.entry.forcefield", "static.permissions"), PERMISSION_COMMANDS_CHAT( - "plots.admin.command.chat", "static.permissions"), PERMISSION_MERGE_OTHER( - "plots.merge.other", "static.permissions"), PERMISSION_MERGE_KEEPROAD( - "plots.merge.keeproad", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED( - "plots.admin.destroy.unowned", "static.permissions"), PERMISSION_ADMIN_DESTROY_GROUNDLEVEL( - "plots.admin.destroy.groundlevel", "static.permissions"), PERMISSION_ADMIN_DESTROY_OTHER( - "plots.admin.destroy.other", "static.permissions"), PERMISSION_ADMIN_DESTROY_ROAD( - "plots.admin.destroy.road", "static.permissions"), PERMISSION_ADMIN_BUILD_ROAD( - "plots.admin.build.road", "static.permissions"), PERMISSION_ADMIN_BUILD_UNOWNED( - "plots.admin.build.unowned", "static.permissions"), PERMISSION_ADMIN_BUILD_OTHER( - "plots.admin.build.other", "static.permissions"), PERMISSION_ADMIN_INTERACT_ROAD( - "plots.admin.interact.road", "static.permissions"), PERMISSION_ADMIN_INTERACT_UNOWNED( - "plots.admin.interact.unowned", "static.permissions"), 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_RATE( - "plots.admin.command.rate", "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_INFO_FORCE("plots.admin.info.force", - "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.auto.mega", - "static.permissions"), PERMISSION_CLAIM_SCHEMATIC("plots.claim.%s0", - "static.permissions"), PERMISSION_ADMIN_COMMAND_SCHEMATIC("plots.admin.command.schematic", - "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_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_LIST( - "plots.schematic.list", "static.permissions"), + PERMISSION_STAR("*", "static.permissions"), + PERMISSION_ADMIN("plots.admin", "static.permissions"), + PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned", "static.permissions"), + PERMISSION_PROJECTILE_OTHER("plots.projectile.other", "static.permissions"), + PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS("plots.admin.interact.blockedcommands", "static.permissions"), + PERMISSION_WORLDEDIT_BYPASS("plots.worldedit.bypass", "static.permissions"), + PERMISSION_PLOT_TOGGLE_TITLES("plots.toggle.titles", "static.permissions"), + PERMISSION_PLOT_TOGGLE_CHAT("plots.toggle.chat", "static.permissions"), + PERMISSION_ADMIN_UPDATE_NOTIFICATION("plots.admin.update.notify", "static.permissions"), + PERMISSION_ADMIN_EXIT_DENIED("plots.admin.exit.denied", "static.permissions"), + PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"), + PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"), + PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"), + PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), + PERMISSION_MERGE_KEEPROAD("plots.merge.keeproad", "static.permissions"), + PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"), + PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"), + PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"), + PERMISSION_ADMIN_DESTROY_ROAD("plots.admin.destroy.road", "static.permissions"), + PERMISSION_ADMIN_BUILD_ROAD("plots.admin.build.road", "static.permissions"), + PERMISSION_ADMIN_BUILD_UNOWNED("plots.admin.build.unowned", "static.permissions"), + PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"), + PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"), + PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"), + 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_RATE("plots.admin.command.rate", "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_INFO_FORCE("plots.admin.info.force", "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.auto.mega", "static.permissions"), + PERMISSION_CLAIM_SCHEMATIC("plots.claim.%s0", "static.permissions"), + PERMISSION_ADMIN_COMMAND_SCHEMATIC("plots.admin.command.schematic", "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_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_LIST("plots.schematic.list", "static.permissions"), - PERMISSION_SCHEMATIC_SAVE("plots.schematic.save", - "static.permissions"), PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE( - "plots.admin.command.schematic.save", "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( + PERMISSION_SET_COMPONENT("plots.set.%s0", "static.permissions"), + PERMISSION_ADMIN_COMMAND( "plots.admin.command.%s0", "static.permissions"), + PERMISSION_ADMIN_COMMAND_UNLINK("plots.ad2min.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"), - PERMISSION_ADMIN_COMMAND_UNLINK("plots.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"), - - PERMISSION_ALIAS_SET_OBSOLETE("plots.set.alias", - "static.permissions"), // Note this is for backwards compatibility - - PERMISSION_ALIAS_SET("plots.alias.set", "static.permissions"), PERMISSION_ALIAS_REMOVE( - "plots.alias.remove", "static.permissions"), + PERMISSION_ALIAS_SET_OBSOLETE("plots.set.alias", "static.permissions"), // Note this is for backwards compatibility + PERMISSION_ALIAS_SET("plots.alias.set", "static.permissions"), + PERMISSION_ALIAS_REMOVE("plots.alias.remove", "static.permissions"), /* * Static console @@ -894,6 +899,7 @@ public enum Captions { "LegacyConfig"), CUSTOM_STRING("-", "-"); + //@formatter:on public static final HashMap replacements = new HashMap<>(); @@ -917,7 +923,7 @@ public enum Captions { /** * Constructor. * - * @param def default + * @param def default * @param prefix use prefix */ Captions(String def, boolean prefix, String category) { @@ -941,18 +947,16 @@ public enum Captions { return m; } Map map = new LinkedHashMap<>(); - if (args.length > 0) { - for (int i = args.length - 1; i >= 0; i--) { - String arg = "" + args[i]; - if (arg == null || arg.isEmpty()) { - map.put("%s" + i, ""); - } else { - arg = Captions.color(arg); - map.put("%s" + i, arg); - } - if (i == 0) { - map.put("%s", arg); - } + for (int i = args.length - 1; i >= 0; i--) { + String arg = "" + args[i]; + if (arg.isEmpty()) { + map.put("%s" + i, ""); + } else { + arg = Captions.color(arg); + map.put("%s" + i, arg); + } + if (i == 0) { + map.put("%s", arg); } } m = StringMan.replaceFromMap(m, map); @@ -982,13 +986,13 @@ public enum Captions { EnumSet allEnums = EnumSet.allOf(Captions.class); HashSet allNames = new HashSet<>(); HashSet categories = new HashSet<>(); - HashSet toRemove = new HashSet<>(); for (Captions caption : allEnums) { allNames.add(caption.name()); categories.add(caption.category.toLowerCase()); } HashSet captions = new HashSet<>(); boolean changed = false; + HashSet toRemove = new HashSet<>(); for (String key : keys) { if (!yml.isString(key)) { if (!categories.contains(key)) { diff --git a/build.gradle b/build.gradle index b99c5bbdc..3c4acbdec 100644 --- a/build.gradle +++ b/build.gradle @@ -62,13 +62,14 @@ subprojects { } dependencies { - compile(group: 'com.sk89q.worldedit', name: 'worldedit-core', version: '7.0.0-SNAPSHOT') { + implementation('com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT') { exclude(module: 'bukkit-classloader-check') exclude(module: 'mockito-core') exclude(module: 'dummypermscompat') } //Minecraft uses Guava 21 as of 1.13. compile 'com.google.guava:guava:21.0' + compileOnly 'org.jetbrains:annotations:17.0.0' compile("org.projectlombok:lombok:1.18.6") compileOnly("org.projectlombok:lombok:1.18.6") testCompileOnly("org.projectlombok:lombok:1.18.6")