diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index 93ee1c8ac..3398e18ad 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -31,8 +31,8 @@ import com.sk89q.worldedit.extension.platform.Capability; import lombok.Getter; import lombok.NonNull; import org.bstats.bukkit.Metrics; -import org.bukkit.*; import org.bukkit.Location; +import org.bukkit.*; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -48,7 +48,6 @@ import org.bukkit.plugin.java.JavaPlugin; import javax.annotation.Nullable; import java.io.File; import java.lang.reflect.Method; -import java.net.URL; import java.util.*; import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; @@ -60,7 +59,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain static { try { Settings.load(new File("plugins/PlotSquared/config/settings.yml")); - } catch (Throwable ignored) {} + } catch (Throwable ignored) { + } } private final LegacyMappings legacyMappings = new BukkitLegacyMappings(); @@ -110,8 +110,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS); } catch (final Throwable throwable) { throw new IllegalStateException( - "Failed to force load WorldEdit. Road schematics will fail to generate", - throwable); + "Failed to force load WorldEdit. Road schematics will fail to generate", throwable); } } @@ -145,25 +144,31 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain // Check for updates if (PlotSquared.get().getUpdateUtility() != null) { final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); - updateUtility.checkForUpdate(this.getPluginVersionString(), ((updateDescription, throwable) -> { - Bukkit.getScheduler().runTask(BukkitMain.this, () -> { - getLogger().info("-------- PlotSquared Update Check --------"); - if (throwable != null) { - getLogger().severe(String.format("Could not check for update. Reason: %s", - throwable.getMessage())); - } else { - if (updateDescription == null) { - getLogger().info("You appear to be running the latest version of PlotSquared. Congratulations!"); + updateUtility + .checkForUpdate(this.getPluginVersionString(), ((updateDescription, throwable) -> { + Bukkit.getScheduler().runTask(BukkitMain.this, () -> { + getLogger().info("-------- PlotSquared Update Check --------"); + if (throwable != null) { + getLogger().severe(String + .format("Could not check for update. Reason: %s", + throwable.getMessage())); } else { - getLogger().info("There appears to be a PlotSquared update available!"); - getLogger().info(String.format("You are running version %s," - + " the newest available version is %s", getPluginVersionString(), updateDescription.getVersion())); - getLogger().info(String.format("Update URL: %s", updateDescription.getUrl())); + if (updateDescription == null) { + getLogger().info( + "You appear to be running the latest version of PlotSquared. Congratulations!"); + } else { + getLogger() + .info("There appears to be a PlotSquared update available!"); + getLogger().info(String.format("You are running version %s," + + " the newest available version is %s", + getPluginVersionString(), updateDescription.getVersion())); + getLogger().info( + String.format("Update URL: %s", updateDescription.getUrl())); + } } - } - getLogger().info("-------- PlotSquared Update Check --------"); - }); - })); + getLogger().info("-------- PlotSquared Update Check --------"); + }); + })); } else { getLogger().warning("Update checking disabled. Skipping."); } @@ -246,8 +251,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain continue outer; } } else { - result = world - .unloadChunk(chunkI.getX(), chunkI.getZ(), true); + result = world.unloadChunk(chunkI.getX(), chunkI.getZ(), true); } if (!result) { continue outer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java index 465e8cee9..36482d44c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java @@ -6,8 +6,7 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.player.PlayerEvent; /** - - + * */ public class PlayerLeavePlotEvent extends PlayerEvent { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java index 2773f9b73..573d53ea8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java @@ -7,8 +7,7 @@ import org.bukkit.event.HandlerList; import java.util.UUID; /** - - + * */ public class PlayerPlotHelperEvent extends PlotEvent { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java index 95440056f..6d9805660 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java @@ -7,8 +7,7 @@ import org.bukkit.event.HandlerList; import java.util.UUID; /** - - + * */ public class PlayerPlotTrustedEvent extends PlotEvent { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 14a7e400e..b6a246f0d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -117,10 +117,11 @@ public class BukkitPlotGenerator extends ChunkGenerator return toAdd; } - @Override @NotNull public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, - int x, int z, @NotNull BiomeGrid biome) { + @Override @NotNull + public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, + @NotNull BiomeGrid biome) { - GenChunk result = new GenChunk(); + GenChunk result = new GenChunk(); if (this.getPlotGenerator() instanceof SingleWorldGenerator) { if (result.getCd() != null) { for (int cx = 0; cx < 16; cx++) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java index 36ef53a5a..820a9fa42 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java @@ -32,10 +32,8 @@ import java.util.Random; return this.chunkGenerator.getClass().getName(); } - @Override - public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) { - return PlotSquared.get().IMP.getDefaultGenerator() - .getNewPlotArea(world, id, min, max); + @Override public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) { + return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max); } @Override public BlockBucket[][] generateBlockBucketChunk(PlotArea settings) { @@ -55,15 +53,14 @@ import java.util.Random; for (int y = 1; y < hpw.PLOT_HEIGHT; y++) { blockBuckets[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = hpw.MAIN_BLOCK; } - blockBuckets[hpw.PLOT_HEIGHT >> 4][((hpw.PLOT_HEIGHT & 0xF) << 8) | (z << 4) - | x] = hpw.MAIN_BLOCK; + blockBuckets[hpw.PLOT_HEIGHT >> 4][((hpw.PLOT_HEIGHT & 0xF) << 8) | (z << 4) | x] = + hpw.MAIN_BLOCK; } } return blockBuckets; } - @Override - public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) { + @Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) { World w = BukkitUtil.getWorld(world); Location min = result.getMin(); int cx = min.getX() >> 4; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java index 82dd29531..d15f167b9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java @@ -269,15 +269,13 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils } PlotSquared.debug( Captions.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() - << 4) - + "," + (chunk.getX() << 4)); + << 4) + "," + (chunk.getX() << 4)); } if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { PlotSquared.debug( Captions.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," - + ( - chunk.getX() << 4)); + + (chunk.getX() << 4)); cleanChunk(chunk); return true; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index 8487c6a32..f15663fdb 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -19,33 +19,34 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntityTeleportEvent; -import org.bukkit.event.vehicle.*; +import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; +import org.bukkit.event.vehicle.VehicleCreateEvent; +import org.bukkit.event.vehicle.VehicleMoveEvent; +import org.bukkit.event.vehicle.VehicleUpdateEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.List; public class EntitySpawnListener implements Listener { - private static boolean ignoreTP = false; - private final static String KEY = "P2"; + private static boolean ignoreTP = false; + private static boolean hasPlotArea = false; + private static String areaName = null; public static void testNether(Entity entity) { @NotNull World world = entity.getWorld(); - if (world.getEnvironment() != World.Environment.NETHER && world.getEnvironment() != World.Environment.THE_END) { + if (world.getEnvironment() != World.Environment.NETHER + && world.getEnvironment() != World.Environment.THE_END) { return; } test(entity); } - private static boolean hasPlotArea = false; - private static String areaName = null; - public static void testCreate(Entity entity) { @NotNull World world = entity.getWorld(); if (areaName == world.getName()) { @@ -53,7 +54,8 @@ public class EntitySpawnListener implements Listener { areaName = world.getName(); hasPlotArea = PlotSquared.get().hasPlotArea(areaName); } - if (!hasPlotArea) return; + if (!hasPlotArea) + return; test(entity); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java index 78b3dc269..b103ed7de 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java @@ -132,11 +132,11 @@ import java.util.UUID; Player player = event.getPlayer(); Plot plot = event.getPlot(); Optional feed = plot.getFlag(Flags.FEED); - feed.ifPresent( - value -> feedRunnable.put(player.getUniqueId(), new Interval(value.getVal1(), value.getVal2(), 20))); + feed.ifPresent(value -> feedRunnable + .put(player.getUniqueId(), new Interval(value.getVal1(), value.getVal2(), 20))); Optional heal = plot.getFlag(Flags.HEAL); - heal.ifPresent( - value -> healRunnable.put(player.getUniqueId(), new Interval(value.getVal1(), value.getVal2(), 20))); + heal.ifPresent(value -> healRunnable + .put(player.getUniqueId(), new Interval(value.getVal1(), value.getVal2(), 20))); } @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 71014eb78..1afe93656 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.*; -import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; @@ -17,13 +16,8 @@ import org.bukkit.event.Event; import org.bukkit.event.EventException; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -import org.bukkit.permissions.Permissible; -import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionAttachmentInfo; -import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.RegisteredListener; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; import java.util.Arrays; @@ -33,6 +27,7 @@ import java.util.stream.Collectors; public class BukkitPlayer extends PlotPlayer { + private static boolean CHECK_EFFECTIVE = true; public final Player player; private boolean offline; private UUID uuid; @@ -105,8 +100,6 @@ public class BukkitPlayer extends PlotPlayer { return this.player.hasPermission(permission); } - private static boolean CHECK_EFFECTIVE = true; - @Override public int hasPermissionRange(String stub, int range) { if (hasPermission(Captions.PERMISSION_ADMIN.s())) { return Integer.MAX_VALUE; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/TitleManager_1_11.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/TitleManager_1_11.java index 4832a1eac..fc8bfb7aa 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/TitleManager_1_11.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/TitleManager_1_11.java @@ -408,7 +408,8 @@ public class TitleManager_1_11 { private Method getMethod(Class clazz, String name, Class... args) { for (Method m : clazz.getMethods()) { - if (m.getName().equals(name) && (args.length == 0 || ClassListEqual(args, m.getParameterTypes()))) { + if (m.getName().equals(name) && (args.length == 0 || ClassListEqual(args, + m.getParameterTypes()))) { m.setAccessible(true); return m; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java index 099b5b3fc..54ced2b83 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java @@ -394,8 +394,7 @@ public class BukkitChunkManager extends ChunkManager { public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) { - TaskManager - .runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save)); + TaskManager.runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save)); } else { BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save); } 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 8309203ef..2e90b4de0 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 @@ -128,16 +128,22 @@ public class BukkitSetupUtils extends SetupUtils { PlotSquared.get().worlds.createSection(worldPath); } if (steps.length != 0) { - ConfigurationSection worldSection = PlotSquared.get().worlds.getConfigurationSection(worldPath); + ConfigurationSection worldSection = + PlotSquared.get().worlds.getConfigurationSection(worldPath); for (ConfigurationNode step : steps) { worldSection.set(step.getConstant(), step.getValue()); } } - PlotSquared.get().worlds.set("worlds." + world + ".generator.type", object.type); - PlotSquared.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain); - PlotSquared.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager); - if (object.setupGenerator != null && !object.setupGenerator.equals(object.plotManager)) { - PlotSquared.get().worlds.set("worlds." + world + ".generator.init", object.setupGenerator); + PlotSquared.get().worlds + .set("worlds." + world + ".generator.type", object.type); + PlotSquared.get().worlds + .set("worlds." + world + ".generator.terrain", object.terrain); + PlotSquared.get().worlds + .set("worlds." + world + ".generator.plugin", object.plotManager); + if (object.setupGenerator != null && !object.setupGenerator + .equals(object.plotManager)) { + PlotSquared.get().worlds + .set("worlds." + world + ".generator.init", object.setupGenerator); } } GeneratorWrapper gen = SetupUtils.generators.get(object.setupGenerator); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index 9018a3707..eebac8ef0 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -35,10 +35,6 @@ public class GenChunk extends ScopedLocalBlockQueue { this.biomes = Biome.values(); } - public void setChunk(Chunk chunk) { - this.chunk = chunk; - } - public Chunk getChunk() { if (chunk == null) { World worldObj = BukkitUtil.getWorld(world); @@ -49,6 +45,10 @@ public class GenChunk extends ScopedLocalBlockQueue { return chunk; } + public void setChunk(Chunk chunk) { + this.chunk = chunk; + } + public void setChunk(ChunkWrapper wrap) { chunk = null; world = wrap.world; diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 565ceaf7f..41714aeb6 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -72,7 +72,7 @@ permissions: plots.permpack.basicinbox: default: op children: - comments.notifications.enabled : true + comments.notifications.enabled: true plots.inbox.read.public: true plots.inbox.modify.public: true plots.inbox.modify.public: true diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index 3c15d437c..6252274d7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -1156,9 +1156,9 @@ import java.util.zip.ZipInputStream; + areaGen); PlotSquared.log(Captions.PREFIX + "&c | &9plotworld: &7" + pa); PlotSquared.log(Captions.PREFIX + "&c | &9manager: &7" + pa); - PlotSquared - .log(Captions.PREFIX + "&cNote: &7Area created for cluster:" + name - + " (invalid or old configuration?)"); + PlotSquared.log( + Captions.PREFIX + "&cNote: &7Area created for cluster:" + name + + " (invalid or old configuration?)"); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); toLoad.add(pa); @@ -1613,12 +1613,13 @@ import java.util.zip.ZipInputStream; Settings.load(configFile); try { copyFile("updater.properties", "config"); - try (BufferedReader bufferedReader = - new BufferedReader(new InputStreamReader(new FileInputStream(new File(new File(this.IMP.getDirectory(), - "config"), "updater.properties"))))) { + try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader( + new FileInputStream(new File(new File(this.IMP.getDirectory(), "config"), + "updater.properties"))))) { final Properties properties = new Properties(); properties.load(bufferedReader); - final boolean enabled = Boolean.valueOf(properties.getOrDefault("enabled", true).toString()); + final boolean enabled = + Boolean.valueOf(properties.getOrDefault("enabled", true).toString()); if (enabled) { this.updateUtility = new UpdateUtility(properties.getProperty("path"), properties.getProperty("job"), properties.getProperty("artifact")); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java index 933938e2e..bfd42f36e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java @@ -15,8 +15,11 @@ import java.util.ArrayList; import java.util.Objects; import java.util.Set; -@CommandDeclaration(command = "area", permission = "plots.area", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, description = "Create a new PlotArea", aliases = "world", usage = "/plot area ", confirmation = true) -public class Area extends SubCommand { +@CommandDeclaration(command = "area", permission = "plots.area", + category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, + description = "Create a new PlotArea", aliases = "world", + usage = "/plot area ", confirmation = true) public class Area + extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length == 0) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java index 2b988c85d..c2a3daf84 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java @@ -4,8 +4,8 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @CommandDeclaration(command = "chat", description = "Toggle plot chat on or off", - usage = "/plot chat [on|off]", permission = "plots.chat", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) -public class Chat extends SubCommand { + usage = "/plot chat [on|off]", permission = "plots.chat", category = CommandCategory.CHAT, + requiredType = RequiredType.PLAYER) public class Chat extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { MainCommand.getInstance().toggle.chat(this, player, new String[0], null, null); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java index 50e226c33..a59c65550 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java @@ -141,9 +141,9 @@ import java.util.UUID; } else { current = player.getPlayerClusterCount(player.getLocation().getWorld()); } - int allowed = - Permissions.hasPermissionRange(player, Captions.PERMISSION_CLUSTER_SIZE, - Settings.Limit.MAX_PLOTS); + int allowed = Permissions + .hasPermissionRange(player, Captions.PERMISSION_CLUSTER_SIZE, + Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea())); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java index 97c793be3..bebf77907 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java @@ -11,31 +11,39 @@ import lombok.RequiredArgsConstructor; * Claiming CommandConfig. * Such as: /plot claim */ - CLAIMING(Captions.COMMAND_CATEGORY_CLAIMING), /** + CLAIMING(Captions.COMMAND_CATEGORY_CLAIMING), + /** * Teleportation CommandConfig. * Such as: /plot visit */ - TELEPORT(Captions.COMMAND_CATEGORY_TELEPPORT), /** + TELEPORT(Captions.COMMAND_CATEGORY_TELEPPORT), + /** * Protection. */ - SETTINGS(Captions.COMMAND_CATEGORY_SETTINGS), /** + SETTINGS(Captions.COMMAND_CATEGORY_SETTINGS), + /** * Chat. */ - CHAT(Captions.COMMAND_CATEGORY_CHAT), /** + CHAT(Captions.COMMAND_CATEGORY_CHAT), + /** * Web. */ - SCHEMATIC(Captions.COMMAND_CATEGORY_SCHEMATIC), /** + SCHEMATIC(Captions.COMMAND_CATEGORY_SCHEMATIC), + /** * Cosmetic. */ - APPEARANCE(Captions.COMMAND_CATEGORY_APPEARANCE), /** + APPEARANCE(Captions.COMMAND_CATEGORY_APPEARANCE), + /** * Information CommandConfig. * Such as: /plot info */ - INFO(Captions.COMMAND_CATEGORY_INFO), /** + INFO(Captions.COMMAND_CATEGORY_INFO), + /** * Debug CommandConfig. * Such as: /plot debug */ - DEBUG(Captions.COMMAND_CATEGORY_DEBUG), /** + DEBUG(Captions.COMMAND_CATEGORY_DEBUG), + /** * Administration commands. */ ADMINISTRATION(Captions.COMMAND_CATEGORY_ADMINISTRATION); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index 1245d2cce..478a0cab9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -11,8 +11,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; -import java.util.*; import java.util.Set; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; @CommandDeclaration(command = "condense", permission = "plots.admin", diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index b800932a8..ddac91e4d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -3,7 +3,6 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; @@ -38,7 +37,8 @@ import java.util.UUID; PlotId id = new PlotId(0, 0); File container = PlotSquared.imp().getWorldContainer(); if (container.equals(new File("."))) { - player.sendMessage("World container must be configured to be a separate directory to your base files!"); + player.sendMessage( + "World container must be configured to be a separate directory to your base files!"); return; } for (File folder : container.listFiles()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java index ca807a263..372231481 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java @@ -3,9 +3,10 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -@CommandDeclaration(command = "dislike", permission = "plots.dislike", description = "Dislike the plot", - usage = "/plot dislike [next|purge]", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) -public class Dislike extends SubCommand { +@CommandDeclaration(command = "dislike", permission = "plots.dislike", + description = "Dislike the plot", usage = "/plot dislike [next|purge]", + category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) public class Dislike + extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { return Like.handleLike(player, args, false); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index ab6fb73a3..97c793221 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -79,8 +79,7 @@ public class Help extends Command { for (CommandCategory c : CommandCategory.values()) { builder.append("\n" + StringMan .replaceAll(Captions.HELP_INFO_ITEM.s(), "%category%", - c.toString().toLowerCase(), - "%category_desc%", c.toString())); + c.toString().toLowerCase(), "%category_desc%", c.toString())); } builder.append("\n").append(Captions.HELP_INFO_ITEM.s().replaceAll("%category%", "all") .replaceAll("%category_desc%", Captions.HELP_DISPLAY_ALL_COMMANDS.s())); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java index f93d95a32..51e5cd6c0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java @@ -12,8 +12,8 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import java.util.UUID; @CommandDeclaration(command = "info", aliases = "i", description = "Display plot info", - usage = "/plot info [-f, to force info]", category = CommandCategory.INFO) public class Info - extends SubCommand { + usage = "/plot info [-f, to force info]", category = CommandCategory.INFO) +public class Info extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { Plot plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java index 7f1b57c6d..f839a9b1a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java @@ -17,14 +17,11 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import java.util.*; @CommandDeclaration(command = "like", permission = "plots.like", description = "Like the plot", - usage = "/plot like [next|purge]", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) -public class Like extends SubCommand { + usage = "/plot like [next|purge]", category = CommandCategory.INFO, + requiredType = RequiredType.PLAYER) public class Like extends SubCommand { - @Override public boolean onCommand(PlotPlayer player, String[] args) { - return handleLike(player, args, true); - } - - protected static boolean handleLike(final PlotPlayer player, String[] args, final boolean like) { + protected static boolean handleLike(final PlotPlayer player, String[] args, + final boolean like) { final UUID uuid = player.getUUID(); if (args.length == 1) { switch (args[0].toLowerCase()) { @@ -143,4 +140,8 @@ public class Like extends SubCommand { return numLikes / (numLikes + numDislikes); } + @Override public boolean onCommand(PlotPlayer player, String[] args) { + return handleLike(player, args, true); + } + } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java index ff06a036a..e2951db6a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java @@ -363,13 +363,13 @@ public class ListCmd extends SubCommand { } else { color = "$1"; } - PlotMessage trusted = - new PlotMessage().text(Captions.color(Captions.PLOT_INFO_TRUSTED.s() - .replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted())))) + PlotMessage trusted = new PlotMessage().text(Captions.color( + Captions.PLOT_INFO_TRUSTED.s() + .replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted())))) .color("$1"); - PlotMessage members = - new PlotMessage().text(Captions.color(Captions.PLOT_INFO_MEMBERS.s() - .replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers())))) + PlotMessage members = new PlotMessage().text(Captions.color( + Captions.PLOT_INFO_MEMBERS.s() + .replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers())))) .color("$1"); String strFlags = StringMan.join(plot.getFlags().values(), ","); if (strFlags.isEmpty()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java index 90007b66e..d1daa73cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java @@ -198,8 +198,7 @@ public class MainCommand extends Command { Plot newPlot = Plot.fromString(area, args[0]); if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea() .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN)) - && !newPlot - .isDenied(player.getUUID())) { + && !newPlot.isDenied(player.getUUID())) { Location newLoc = newPlot.getCenter(); if (player.canTeleport(newLoc)) { // Save meta diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 9956b6f2e..e52ec1fcf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -11,8 +11,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; @CommandDeclaration(usage = "/plot move ", command = "move", description = "Move a plot", - aliases = {"debugmove"}, permission = "plots.move", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER) -public class Move extends SubCommand { + aliases = {"debugmove"}, permission = "plots.move", category = CommandCategory.CLAIMING, + requiredType = RequiredType.PLAYER) public class Move extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { Location loc = player.getLocation(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java index 0fa721dff..3d73c7bbe 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java @@ -9,7 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.StringMan; -@CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players", usage = "/plot near", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) +@CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players", + usage = "/plot near", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) public class Near extends Command { public Near() { super(MainCommand.getInstance(), true); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java index 66f4fc06b..9c93925b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java @@ -16,8 +16,8 @@ import java.util.Map.Entry; import java.util.UUID; @CommandDeclaration(command = "rate", permission = "plots.rate", description = "Rate the plot", - usage = "/plot rate [#|next|purge]", aliases = "rt", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) -public class Rate extends SubCommand { + usage = "/plot rate [#|next|purge]", aliases = "rt", category = CommandCategory.INFO, + requiredType = RequiredType.PLAYER) public class Rate extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length == 1) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java index 5dc5973d4..66fbd041a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java @@ -58,8 +58,8 @@ import java.util.Map.Entry; object.setup_index--; ConfigurationNode node = object.step[object.setup_index]; sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, - node.getDescription(), - node.getType().getType(), String.valueOf(node.getDefaultValue())); + node.getDescription(), node.getType().getType(), + String.valueOf(node.getDefaultValue())); return false; } else if (object.current > 0) { object.current--; @@ -131,8 +131,8 @@ import java.util.Map.Entry; } ConfigurationNode step = object.step[object.setup_index]; sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, - step.getDescription(), - step.getType().getType(), String.valueOf(step.getDefaultValue())); + step.getDescription(), step.getType().getType(), + String.valueOf(step.getDefaultValue())); } else { if (gen.isFull()) { object.plotManager = object.setupGenerator; @@ -234,8 +234,8 @@ import java.util.Map.Entry; } ConfigurationNode step = object.step[object.setup_index]; sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, - step.getDescription(), - step.getType().getType(), String.valueOf(step.getDefaultValue())); + step.getDescription(), step.getType().getType(), + String.valueOf(step.getDefaultValue())); break; } case 6: // world setup @@ -248,8 +248,8 @@ import java.util.Map.Entry; ConfigurationNode step = object.step[object.setup_index]; if (args.length < 1) { sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, - step.getDescription(), - step.getType().getType(), String.valueOf(step.getDefaultValue())); + step.getDescription(), step.getType().getType(), + String.valueOf(step.getDefaultValue())); return false; } @@ -269,14 +269,14 @@ import java.util.Map.Entry; } step = object.step[object.setup_index]; sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, - step.getDescription(), - step.getType().getType(), String.valueOf(step.getDefaultValue())); + step.getDescription(), step.getType().getType(), + String.valueOf(step.getDefaultValue())); return false; } else { sendMessage(player, Captions.SETUP_INVALID_ARG, args[0], step.getConstant()); sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, - step.getDescription(), - step.getType().getType(), String.valueOf(step.getDefaultValue())); + step.getDescription(), step.getType().getType(), + String.valueOf(step.getDefaultValue())); return false; } case 7: diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java index 7f36f6a4a..91dd83069 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java @@ -23,17 +23,16 @@ public abstract class SubCommand extends Command { setRequiredArguments(arguments); } + public static boolean sendMessage(PlotPlayer player, Captions message, Object... args) { + message.send(player, args); + return true; + } + @Override public void execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { onCommand(player, args); } - public abstract boolean onCommand(PlotPlayer player, String[] args); - - public static boolean sendMessage(PlotPlayer player, Captions message, Object... args) { - message.send(player, args); - return true; - } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java index dc928c765..9ce6bd5fb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java @@ -7,8 +7,9 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.*; -@CommandDeclaration(command = "unlink", aliases = {"u", - "unmerge"}, description = "Unlink a mega-plot", usage = "/plot unlink [createroads]", requiredType = RequiredType.PLAYER, category = CommandCategory.SETTINGS, confirmation = true) +@CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"}, + description = "Unlink a mega-plot", usage = "/plot unlink [createroads]", + requiredType = RequiredType.PLAYER, category = CommandCategory.SETTINGS, confirmation = true) public class Unlink extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java index 9217d0523..f5dc5710e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java @@ -14,8 +14,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.*; @CommandDeclaration(command = "visit", permission = "plots.visit", - description = "Visit someones plot", usage = "/plot visit [|||] [#]", aliases = { - "v", "tp", "teleport", "goto", "home", "h"}, requiredType = RequiredType.PLAYER, + description = "Visit someones plot", usage = "/plot visit [|||] [#]", + aliases = {"v", "tp", "teleport", "goto", "home", "h"}, requiredType = RequiredType.PLAYER, category = CommandCategory.TELEPORT) public class Visit extends Command { public Visit() { 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 c163a10a4..ddd72e9f8 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 @@ -378,8 +378,8 @@ public enum Captions { RATING_ALREADY_EXISTS("$2You have already rated plot $2%s", "Ratings"), RATING_APPLIED( "$4You successfully rated plot $2%s", "Ratings"), - RATING_DISLIKED("$4You successfully disliked plot $2%s", "Ratings"), - RATING_LIKED("$4You successfully liked plot $2%s", "Ratings"), + RATING_DISLIKED("$4You successfully disliked plot $2%s", "Ratings"), RATING_LIKED( + "$4You successfully liked plot $2%s", "Ratings"), RATING_NOT_YOUR_OWN("$2You cannot rate your own plot", "Ratings"), RATING_NOT_DONE( "$2You can only rate finished plots.", "Ratings"), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index 4c142697e..3c492583c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -317,8 +317,7 @@ public class Settings extends Config { public static final class Ratings { @Comment("Replace the rating system with a like system. Will add /plot like/dislike," + " and remove the rating command") public static boolean USE_LIKES = false; - @Comment("Rating categories") - public static List CATEGORIES = new ArrayList<>(); + @Comment("Rating categories") public static List CATEGORIES = new ArrayList<>(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java index 631b4ad45..a3b308335 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java @@ -42,11 +42,9 @@ public class HybridPlotManager extends ClassicPlotManager { files.add(new FileBytes(newDir + "intersection.schem", Files.readAllBytes(intersection.toPath()))); } - File plot = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "plot.schem"); + File plot = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "plot.schem"); if (plot.exists()) { - files.add( - new FileBytes(newDir + "plot.schem", Files.readAllBytes(plot.toPath()))); + files.add(new FileBytes(newDir + "plot.schem", Files.readAllBytes(plot.toPath()))); } } catch (IOException e) { e.printStackTrace(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index 76fec7701..880ddee35 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -34,8 +34,8 @@ public class HybridPlotWorld extends ClassicPlotWorld { public short PATH_WIDTH_LOWER; public short PATH_WIDTH_UPPER; public HashMap G_SCH; - private Location SIGN_LOCATION; public int SCHEM_Y; + private Location SIGN_LOCATION; public HybridPlotWorld(String worldName, String id, IndependentPlotGenerator generator, PlotId min, PlotId max) { @@ -134,13 +134,17 @@ public class HybridPlotWorld extends ClassicPlotWorld { public void setupSchematics() throws SchematicHandler.UnsupportedFormatException { this.G_SCH = new HashMap<>(); - File root = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + this.worldname); + File root = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), + "schematics/GEN_ROAD_SCHEMATIC/" + this.worldname); File schematic1File = new File(root, "sideroad.schem"); - if (!schematic1File.exists()) schematic1File = new File(root, "sideroad.schematic"); + if (!schematic1File.exists()) + schematic1File = new File(root, "sideroad.schematic"); File schematic2File = new File(root, "intersection.schem"); - if (!schematic2File.exists()) schematic2File = new File(root, "intersection.schematic"); + if (!schematic2File.exists()) + schematic2File = new File(root, "intersection.schematic"); File schematic3File = new File(root, "plot.schem"); - if (!schematic3File.exists()) schematic3File = new File(root, "plot.schematic"); + if (!schematic3File.exists()) + schematic3File = new File(root, "plot.schematic"); Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File); Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File); Schematic schematic3 = SchematicHandler.manager.getSchematic(schematic3File); @@ -193,7 +197,8 @@ public class HybridPlotWorld extends ClassicPlotWorld { for (short x = 0; x < w3; x++) { for (short z = 0; z < l3; z++) { for (short y = 0; y < h3; y++) { - BaseBlock id = blockArrayClipboard3.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ())); + BaseBlock id = blockArrayClipboard3.getFullBlock(BlockVector3 + .at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ())); if (!id.getBlockType().getMaterial().isAir()) { addOverlayBlock((short) (x + shift + oddshift + centerShiftX), (short) (y + plotY), (short) (z + shift + oddshift + centerShiftZ), @@ -253,7 +258,8 @@ public class HybridPlotWorld extends ClassicPlotWorld { for (short x = 0; x < w1; x++) { for (short z = 0; z < l1; z++) { for (short y = 0; y < h1; y++) { - BaseBlock id = blockArrayClipboard1.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ())); + BaseBlock id = blockArrayClipboard1.getFullBlock(BlockVector3 + .at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ())); if (!id.getBlockType().getMaterial().isAir()) { addOverlayBlock((short) (x - shift), (short) (y + roadY), (short) (z + shift + oddshift), id, false, h1); @@ -273,7 +279,8 @@ public class HybridPlotWorld extends ClassicPlotWorld { for (short x = 0; x < w2; x++) { for (short z = 0; z < l2; z++) { for (short y = 0; y < h2; y++) { - BaseBlock id = blockArrayClipboard2.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ())); + BaseBlock id = blockArrayClipboard2.getFullBlock(BlockVector3 + .at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ())); if (!id.getBlockType().getMaterial().isAir()) { addOverlayBlock((short) (x - shift), (short) (y + roadY), (short) (z - shift), id, false, h2); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java index a3d9bc186..de6c3390b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java @@ -345,7 +345,8 @@ public abstract class HybridUtils { if (condition) { BaseBlock[] blocks = plotWorld.G_SCH.get(MathMan.pair(absX, absZ)); int minY = plotWorld.SCHEM_Y; - if (!Settings.Schematics.PASTE_ON_TOP) minY = 1; + if (!Settings.Schematics.PASTE_ON_TOP) + minY = 1; int maxY = Math.max(extend, blocks.length); if (blocks != null) { for (int y = 0; y < maxY; y++) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java index b3d15736b..c56763a76 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java @@ -95,8 +95,7 @@ public class PlotListener { } else { MainUtil.sendMessage(player, StringMan .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", - plot.getId(), - "{gamemode}", gamemodeFlag.get())); + plot.getId(), "{gamemode}", gamemodeFlag.get())); } } } @@ -109,8 +108,7 @@ public class PlotListener { } else { MainUtil.sendMessage(player, StringMan .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", - plot.getId(), - "{gamemode}", guestGamemodeFlag.get())); + plot.getId(), "{gamemode}", guestGamemodeFlag.get())); } } } @@ -158,8 +156,7 @@ public class PlotListener { } if (titles) { if (!Captions.TITLE_ENTERED_PLOT.s().isEmpty() || !Captions.TITLE_ENTERED_PLOT_SUB - .s() - .isEmpty()) { + .s().isEmpty()) { TaskManager.runTaskLaterAsync(() -> { Plot lastPlot = player.getMeta(PlotPlayer.META_LAST_PLOT); if ((lastPlot != null) && plot.getId().equals(lastPlot.getId())) { @@ -206,8 +203,7 @@ public class PlotListener { } else { MainUtil.sendMessage(player, StringMan .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", - plot.toString(), - "{gamemode}", pw.GAMEMODE.name().toLowerCase())); + plot.toString(), "{gamemode}", pw.GAMEMODE.name().toLowerCase())); } } } @@ -215,10 +211,10 @@ public class PlotListener { farewell.ifPresent(s -> MainUtil .format(Captions.PREFIX_FAREWELL.s() + s, plot, player, false, new RunnableVal() { - @Override public void run(String value) { - MainUtil.sendMessage(player, value); - } - })); + @Override public void run(String value) { + MainUtil.sendMessage(player, value); + } + })); Optional leave = plot.getFlag(Flags.NOTIFY_LEAVE); if (leave.isPresent() && leave.get()) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java index 14247f792..21014db70 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java @@ -163,8 +163,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { this.Eblocked = true; PlotSquared.debug( Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," - + location - .getBlockZ()); + + location.getBlockZ()); } if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java index 5f2c371bc..e357de0b7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java @@ -1,7 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.object; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; -import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.object.collection.RandomCollection; import com.google.common.collect.ImmutableMap; @@ -56,7 +55,8 @@ import java.util.Map.Entry; } private void addBlock(@NonNull final PlotBlock block, double chance) { - if (chance == -1) chance = 1; + if (chance == -1) + chance = 1; this.blocks.put(block, chance); this.compiled = false; if (head == null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java index 9ce6e1621..0c7de4905 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java @@ -3,7 +3,8 @@ package com.github.intellectualsites.plotsquared.plot.object; public enum Direction { NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, "southwest"), NORTHWEST(7, - "northwest"),; + "northwest"), + ; private int index; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index f4c278cdb..e2f83172e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -58,6 +58,7 @@ public class Plot { * plot owner * (Merged plots can have multiple owners) * Direct access is Deprecated: use getOwners() + * * @deprecated */ @Deprecated public UUID owner; @@ -344,6 +345,7 @@ public class Plot { * plot owner * (Merged plots can have multiple owners) * Direct access is Deprecated: use getOwners() + * * @deprecated */ @Deprecated public UUID getOwner() { @@ -353,6 +355,32 @@ public class Plot { return this.owner; } + /** + * Sets the plot owner (and update the database) + * + * @param owner uuid to set as owner + */ + public void setOwner(UUID owner) { + if (!hasOwner()) { + this.owner = owner; + create(); + return; + } + if (!isMerged()) { + if (!this.owner.equals(owner)) { + this.owner = owner; + DBFunc.setOwner(this, owner); + } + return; + } + for (Plot current : getConnectedPlots()) { + if (!owner.equals(current.owner)) { + current.owner = owner; + DBFunc.setOwner(current, owner); + } + } + } + /** * Gets a immutable set of owner UUIDs for a plot (supports multi-owner mega-plots). *

@@ -748,32 +776,6 @@ public class Plot { } } - /** - * Sets the plot owner (and update the database) - * - * @param owner uuid to set as owner - */ - public void setOwner(UUID owner) { - if (!hasOwner()) { - this.owner = owner; - create(); - return; - } - if (!isMerged()) { - if (!this.owner.equals(owner)) { - this.owner = owner; - DBFunc.setOwner(this, owner); - } - return; - } - for (Plot current : getConnectedPlots()) { - if (!owner.equals(current.owner)) { - current.owner = owner; - DBFunc.setOwner(current, owner); - } - } - } - /** * Sets the plot owner (and update the database) * diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 7c21df8fc..10b9e4c71 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -34,7 +34,8 @@ public class PlotId { */ @Nonnull public static PlotId fromString(@Nonnull String string) { PlotId plot = fromStringOrNull(string); - if (plot == null) throw new IllegalArgumentException("Cannot create PlotID. String invalid."); + if (plot == null) + throw new IllegalArgumentException("Cannot create PlotID. String invalid."); return plot; } @@ -101,6 +102,7 @@ public class PlotId { public PlotId getRelative(Direction direction) { return getRelative(direction.getIndex()); } + /** * Get the PlotId in a relative direction * 0 = north
diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java index 59f7088e8..33e57f753 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java @@ -33,6 +33,7 @@ import org.jetbrains.annotations.Nullable; /** * Initialize a new {@link PlotLoc} and set the Y value to {@code -1} + * * @param x X value * @param z Y value */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java index c850513cd..dd2dc28b5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java @@ -428,6 +428,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { /** * Determines whether or not the player can fly. + * * @return {@code true} if the player is allowed to fly */ public abstract boolean getFlight(); @@ -466,7 +467,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { */ public void unregister() { Plot plot = getCurrentPlot(); - if (plot != null && Settings.Enabled_Components.PERSISTENT_META && plot.getArea() instanceof SinglePlotArea) { + if (plot != null && Settings.Enabled_Components.PERSISTENT_META && plot + .getArea() instanceof SinglePlotArea) { PlotId id = plot.getId(); int x = id.x; int z = id.y; @@ -581,17 +583,21 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { TaskManager.runTask(() -> { if (getMeta("teleportOnLogin", true)) { teleport(loc); - sendMessage(Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX + "," + plotZ + ")"); + sendMessage( + Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX + + "," + plotZ + ")"); } }); } else if (!PlotSquared.get().isMainThread(Thread.currentThread())) { if (getMeta("teleportOnLogin", true)) { if (plot.teleportPlayer(PlotPlayer.this)) { TaskManager.runTask(() -> { - if (getMeta("teleportOnLogin",true)) { + if (getMeta("teleportOnLogin", true)) { if (plot.isLoaded()) { teleport(loc); - sendMessage(Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc-unloaded) (" + plotX + "," + plotZ + ")"); + sendMessage(Captions.TELEPORTED_TO_PLOT.f() + + " (quitLoc-unloaded) (" + plotX + "," + plotZ + + ")"); } } }); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java index e3f0031ba..12d0a11aa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; /** - + * */ public class StringWrapper { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java index 3255a80e7..dd7803d66 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java @@ -38,8 +38,7 @@ public class FlatRandomCollection extends RandomCollection { this.values = (T[]) parsed.toArray(); } - @Override - public T next() { + @Override public T next() { return values[random.nextInt(values.length)]; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java index ac136e9b4..b8dfa0a12 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java @@ -20,14 +20,14 @@ public abstract class RandomCollection { } } + public Random getRandom() { + return random; + } + public void setRandom(Random random) { checkNotNull(random); this.random = random; } - public Random getRandom() { - return random; - } - public abstract T next(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java index 7ea996613..e75b64cb4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java @@ -18,7 +18,8 @@ public class SimpleRandomCollection extends RandomCollection { } public void add(double weight, E result) { - if (weight <= 0) return; + if (weight <= 0) + return; total += weight; map.put(total, result); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java index b8a27bab9..a51ef110b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java @@ -5,13 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.generator.GridPlotWorld; -import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotId; -import com.github.intellectualsites.plotsquared.plot.object.PlotLoc; -import com.github.intellectualsites.plotsquared.plot.object.PlotSettings; -import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; -import com.github.intellectualsites.plotsquared.plot.object.SetupObject; +import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; @@ -66,13 +60,15 @@ public class SinglePlotArea extends GridPlotWorld { File levelDat = new File(src, "level.dat"); if (levelDat.exists()) { try { - Files.copy(levelDat.toPath(), new File(dest, levelDat.getName()).toPath()); + Files.copy(levelDat.toPath(), + new File(dest, levelDat.getName()).toPath()); File data = new File(src, "data"); if (data.exists()) { File dataDest = new File(dest, "data"); dataDest.mkdirs(); for (File file : data.listFiles()) { - Files.copy(file.toPath(), new File(dataDest, file.getName()).toPath()); + Files.copy(file.toPath(), + new File(dataDest, file.getName()).toPath()); } } } catch (IOException ignore) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java index fd99fb067..95b303eea 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java @@ -96,7 +96,9 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager { if (found != null && found.length != 0) { return found; } - return isWorld(world) || world.equals("*") ? array : all.length == 0 ? noPlotAreas : super.getPlotAreas(world, region); + return isWorld(world) || world.equals("*") ? + array : + all.length == 0 ? noPlotAreas : super.getPlotAreas(world, region); } @Override public PlotArea[] getAllPlotAreas() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java index c8beb8ba5..a7c39cf18 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java @@ -12,9 +12,11 @@ import java.util.concurrent.ConcurrentHashMap; public abstract class ChunkManager { + private static final Map> forceChunks = + new ConcurrentHashMap<>(); + private static final Map> addChunks = + new ConcurrentHashMap<>(); public static ChunkManager manager = null; - private static final Map> forceChunks = new ConcurrentHashMap<>(); - private static final Map> addChunks = new ConcurrentHashMap<>(); public static ChunkLoc getChunkChunk(Location location) { int x = location.getX() >> 9; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java index 0e9a6f40f..6229e9332 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java @@ -8,7 +8,6 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; -import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import javax.annotation.Nullable; @@ -77,7 +76,8 @@ public abstract class EventUtil { } } final Plot plot = player.getCurrentPlot(); - if (Settings.Teleport.ON_LOGIN && plot != null && !(plot.getArea() instanceof SinglePlotArea)) { + if (Settings.Teleport.ON_LOGIN && plot != null && !(plot + .getArea() instanceof SinglePlotArea)) { TaskManager.runTask(() -> plot.teleportPlayer(player)); MainUtil.sendMessage(player, Captions.TELEPORTED_TO_ROAD.f() + " (on-login) " + "(" + plot.getId().x + ";" + plot @@ -154,8 +154,8 @@ public abstract class EventUtil { if (plot.hasOwner()) { return Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) - || !( - !notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, + || !(!notifyPerms || MainUtil + .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, Captions.FLAG_HANGING_BREAK.s())); } return Permissions @@ -173,8 +173,8 @@ public abstract class EventUtil { if (plot.hasOwner()) { return Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) - || !( - !notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, + || !(!notifyPerms || MainUtil + .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, Captions.FLAG_MISC_BREAK.s())); } return Permissions @@ -219,9 +219,8 @@ public abstract class EventUtil { .contains(block.getPlotBlock())) { return Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) - || !( - !notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s())); + || !(!notifyPerms || MainUtil + .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, Captions.FLAG_USE.s())); } return true; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java index 262df3f83..55d86ce5a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java @@ -115,10 +115,10 @@ import java.util.Map; if (worldSection.contains(entry.getKey())) { if (entry.getValue() == ConfigurationType.BLOCK) { this.convertBlock(worldSection, entry.getKey(), - worldSection.getString(entry.getKey())); + worldSection.getString(entry.getKey())); } else { this.convertBlockList(worldSection, entry.getKey(), - worldSection.getStringList(entry.getKey())); + worldSection.getStringList(entry.getKey())); } } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java index 1ae9839b8..cfc910748 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java @@ -735,7 +735,8 @@ public class MainUtil { seen = Captions.NEVER.s(); } Optional descriptionFlag = plot.getFlag(Flags.DESCRIPTION); - String description = !descriptionFlag.isPresent() ? Captions.NONE.s() : + String description = !descriptionFlag.isPresent() ? + Captions.NONE.s() : Flags.DESCRIPTION.valueToString(descriptionFlag.get()); StringBuilder flags = new StringBuilder(); @@ -779,10 +780,12 @@ public class MainUtil { TaskManager.runTaskAsync(() -> { String info1; if (Settings.Ratings.USE_LIKES) { - info1 = newInfo.replaceAll("%rating%", String.format("%.0f%%", Like.getLikesPercentage(plot) * 100D)); + info1 = newInfo.replaceAll("%rating%", + String.format("%.0f%%", Like.getLikesPercentage(plot) * 100D)); } else { int max = 10; - if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) { + if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES + .isEmpty()) { max = 8; } if (full && Settings.Ratings.CATEGORIES != null diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java index 522e45fa5..cf04f7f94 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java @@ -253,9 +253,11 @@ public abstract class SchematicHandler { if (!name.endsWith(".schem") && !name.endsWith(".schematic")) { name = name + ".schem"; } - File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS + File.separator + name); + File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), + Settings.Paths.SCHEMATICS + File.separator + name); if (!file.exists()) { - file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS + File.separator + name + "atic"); + file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), + Settings.Paths.SCHEMATICS + File.separator + name + "atic"); } return getSchematic(file); } @@ -270,7 +272,8 @@ public abstract class SchematicHandler { MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS); final List names = new ArrayList<>(); if (parent.exists()) { - final String[] rawNames = parent.list((dir, name) -> name.endsWith(".schematic") || name.endsWith(".schem")); + final String[] rawNames = + parent.list((dir, name) -> name.endsWith(".schematic") || name.endsWith(".schem")); if (rawNames != null) { final List transformed = Arrays.stream(rawNames) .map(rawName -> rawName.substring(0, rawName.length() - 10)) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java index 29d2126f6..0ad79b41b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java @@ -29,15 +29,14 @@ public class UpdateUtility { private void fetchLatestBuildInfo(final BiConsumer whenDone) { this.jenkins.getJobInfo(jobName).whenCompleteAsync((jobInfo, exception) -> { - if (jobInfo == null && exception != null) { - whenDone.accept(null, exception); - } else if (jobInfo != null) { - jobInfo.getLastSuccessfulBuild().getBuildInfo() - .whenComplete(whenDone); - } else { - whenDone.accept(null, new IllegalStateException( - String.format("Could not fetch job info for job %s", this.jobName))); - } + if (jobInfo == null && exception != null) { + whenDone.accept(null, exception); + } else if (jobInfo != null) { + jobInfo.getLastSuccessfulBuild().getBuildInfo().whenComplete(whenDone); + } else { + whenDone.accept(null, new IllegalStateException( + String.format("Could not fetch job info for job %s", this.jobName))); + } }); } @@ -47,17 +46,19 @@ public class UpdateUtility { whenDone.accept(null, throwable); } else { final Collection artifacts = buildInfo.getArtifacts(); - final Optional artifact = artifacts.stream().filter(artifactDescription -> { - final String name = artifactDescription.getFileName(); - final Matcher matcher = artifactPattern.matcher(name); - return matcher.matches(); - }).findAny(); + final Optional artifact = + artifacts.stream().filter(artifactDescription -> { + final String name = artifactDescription.getFileName(); + final Matcher matcher = artifactPattern.matcher(name); + return matcher.matches(); + }).findAny(); if (artifact.isPresent()) { final ArtifactDescription artifactDescription = artifact.get(); whenDone.accept(artifactDescription, null); } else { - whenDone.accept(null, - new NullPointerException(String.format("Could not find any matching artifacts in build %d", buildInfo.getId()))); + whenDone.accept(null, new NullPointerException(String + .format("Could not find any matching artifacts in build %d", + buildInfo.getId()))); } } }); @@ -67,30 +68,34 @@ public class UpdateUtility { final BiConsumer whenDone) { this.getMatchingArtifact(((artifactDescription, throwable) -> { if (throwable != null) { - whenDone.accept(null, new RuntimeException( - String.format("Failed to read artifact description: %s", throwable.getMessage()), throwable)); + whenDone.accept(null, new RuntimeException(String + .format("Failed to read artifact description: %s", throwable.getMessage()), + throwable)); } else { try { final String version = this.isNewer(currentVersion, artifactDescription); if (version != null) { - whenDone.accept(new UpdateDescription(version, artifactDescription.getUrl()), - null); + whenDone + .accept(new UpdateDescription(version, artifactDescription.getUrl()), + null); } else { whenDone.accept(null, null); } } catch (final Throwable exception) { - whenDone.accept(null, - new RuntimeException(String.format("Failed to compare versions: %s", - exception.getMessage()), exception)); + whenDone.accept(null, new RuntimeException( + String.format("Failed to compare versions: %s", exception.getMessage()), + exception)); } } })); } - private String isNewer(@NonNull final String currentVersion, @NonNull final ArtifactDescription artifact) { + private String isNewer(@NonNull final String currentVersion, + @NonNull final ArtifactDescription artifact) { final Matcher matcher = artifactPattern.matcher(artifact.getFileName()); if (!matcher.matches()) { - throw new IllegalArgumentException("Artifact file name does not match artifact pattern"); + throw new IllegalArgumentException( + "Artifact file name does not match artifact pattern"); } final String version = matcher.group("version"); if (version == null) { @@ -101,12 +106,14 @@ public class UpdateUtility { /** * Compare two given versions in the format $major.$minor + * * @param oldVersion current version * @param newVersion other version * @return -1 if the current version is older, 1 is the versions are the same, - * and 1 if the current version is newer + * and 1 if the current version is newer */ - private int compareVersions(@NonNull final String oldVersion, @NonNull final String newVersion) { + private int compareVersions(@NonNull final String oldVersion, + @NonNull final String newVersion) { // Versions look this this: major.minor :P final int[] oldNums = splitVersion(oldVersion); final int[] newNums = splitVersion(newVersion); @@ -131,16 +138,18 @@ public class UpdateUtility { private int[] splitVersion(@NonNull final String versionString) { final String[] parts = versionString.split("\\."); switch (parts.length) { - case 0: return new int[] {-1, -1}; - case 1: return new int[] {-1, Integer.parseInt(parts[0])}; - case 2: return new int[] {Integer.parseInt(parts[0]), Integer.parseInt(parts[1])}; - default: return null; + case 0: + return new int[] {-1, -1}; + case 1: + return new int[] {-1, Integer.parseInt(parts[0])}; + case 2: + return new int[] {Integer.parseInt(parts[0]), Integer.parseInt(parts[1])}; + default: + return null; } } - @Getter - @RequiredArgsConstructor - public static class UpdateDescription { + @Getter @RequiredArgsConstructor public static class UpdateDescription { private final String version; private final String url; } diff --git a/Core/src/main/resources/addplots.js b/Core/src/main/resources/addplots.js index 5691c181c..b45f8d4ff 100644 --- a/Core/src/main/resources/addplots.js +++ b/Core/src/main/resources/addplots.js @@ -5,11 +5,9 @@ This will increase a player's allowed plots by the provided value var uuid = UUIDHandler.getUUID('%s0', null); if (uuid === null) { C_INVALID_PLAYER.send(PlotPlayer, '%s0'); -} -else if (!MathMan.class.static.isInteger('%s1')) { +} else if (!MathMan.class.static.isInteger('%s1')) { C_NOT_VALID_NUMBER.send(PlotPlayer, '(0, ' + Settings.MAX_PLOTS + ')'); -} -else { +} else { var amount = parseInt('%s1'); var pp = IMP.wrapPlayer(UUIDHandler.getUUIDWrapper().getOfflinePlayer(uuid).player); var allowed = pp.getAllowedPlots(); diff --git a/Core/src/main/resources/automerge.js b/Core/src/main/resources/automerge.js index 6a6c2a20f..220a24867 100644 --- a/Core/src/main/resources/automerge.js +++ b/Core/src/main/resources/automerge.js @@ -35,14 +35,12 @@ if ("%s0" === "true") { var plot = plots.get(i); plot.autoMerge(-1, 250000, plot.owner, true); } -} -else if ("%s0" === "false") { +} else if ("%s0" === "false") { for (var i = 0; i < plots.size(); i++) { var plot = plots.get(i); plot.autoMerge(-1, 250000, plot.owner, false); } -} -else { +} else { C_COMMAND_SYNTAX.send(PlotPlayer, "/plot debugexec automerge.js "); MainUtil.class.static.sendMessage(PlotPlayer, "$1 is true or false if you want to remove roads when auto merging"); } diff --git a/Core/src/main/resources/furthest.js b/Core/src/main/resources/furthest.js index b0f973088..7c539894e 100644 --- a/Core/src/main/resources/furthest.js +++ b/Core/src/main/resources/furthest.js @@ -27,7 +27,6 @@ if (PS.hasPlotArea("%s0")) { } } PS.class.static.log(plot); -} -else { +} else { PlotPlayer.sendMessage("Usage: /plot debugexec runasync furthest.js "); }