diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitChunkManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitChunkManager.java index 3104c47d3..9906a7e9a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitChunkManager.java @@ -82,7 +82,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; public class BukkitChunkManager extends ChunkManager { public static boolean isIn(CuboidRegion region, int x, int z) { - return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX() && z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ(); + return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX() + && z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ(); } public static ContentMap swapChunk(World world1, World world2, Chunk pos1, Chunk pos2, @@ -106,8 +107,10 @@ public class BukkitChunkManager extends ChunkManager { LocalBlockQueue queue1 = GlobalBlockQueue.IMP.getNewQueue(worldName1, false); LocalBlockQueue queue2 = GlobalBlockQueue.IMP.getNewQueue(worldName2, false); - for (int x = Math.max(r1.getMinimumPoint().getX(), sx); x <= Math.min(r1.getMaximumPoint().getX(), sx + 15); x++) { - for (int z = Math.max(r1.getMinimumPoint().getZ(), sz); z <= Math.min(r1.getMaximumPoint().getZ(), sz + 15); z++) { + for (int x = Math.max(r1.getMinimumPoint().getX(), sx); + x <= Math.min(r1.getMaximumPoint().getX(), sx + 15); x++) { + for (int z = Math.max(r1.getMinimumPoint().getZ(), sz); + z <= Math.min(r1.getMaximumPoint().getZ(), sz + 15); z++) { for (int y = 0; y < 256; y++) { Block block1 = world1.getBlockAt(x, y, z); BaseBlock baseBlock1 = bukkitWorld1.getFullBlock(BlockVector3.at(x, y, z)); @@ -159,7 +162,8 @@ public class BukkitChunkManager extends ChunkManager { + " Will halt the calling thread until completed."); semaphore.acquire(); Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> { - for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world)).getLoadedChunks()) { + for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world)) + .getLoadedChunks()) { BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5); chunks.add(loc); } @@ -214,7 +218,7 @@ public class BukkitChunkManager extends ChunkManager { if (doWhole) { for (Entity entity : entities) { org.bukkit.Location location = entity.getLocation(); - PaperLib.getChunkAtAsync(location).thenAccept( chunk -> { + PaperLib.getChunkAtAsync(location).thenAccept(chunk -> { if (chunks.contains(chunk)) { int X = chunk.getX(); int Z = chunk.getZ(); @@ -249,7 +253,8 @@ public class BukkitChunkManager extends ChunkManager { return count; } - @Override public boolean copyRegion(Location pos1, Location pos2, Location newPos, + @Override + public boolean copyRegion(Location pos1, Location pos2, Location newPos, final Runnable whenDone) { final int relX = newPos.getX() - pos1.getX(); final int relZ = newPos.getZ() - pos1.getZ(); @@ -303,7 +308,8 @@ public class BukkitChunkManager extends ChunkManager { return true; } - @Override public boolean regenerateRegion(final Location pos1, final Location pos2, + @Override + public boolean regenerateRegion(final Location pos1, final Location pos2, final boolean ignoreAugment, final Runnable whenDone) { final String world = pos1.getWorld(); @@ -341,7 +347,8 @@ public class BukkitChunkManager extends ChunkManager { if (chunkObj == null) { return; } - final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); + final LocalBlockQueue queue = + GlobalBlockQueue.IMP.getNewQueue(world, false); if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) { AugmentedUtils.bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.getX(), chunk.getZ())); @@ -406,11 +413,11 @@ public class BukkitChunkManager extends ChunkManager { if (checkX2 && checkZ2) { map.saveRegion(bukkitWorldObj, xxt2, xxt, zzt2, zzt); // } - CuboidRegion currentPlotClear = - RegionUtil.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); + CuboidRegion currentPlotClear = RegionUtil + .createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); map.saveEntitiesOut(chunkObj, currentPlotClear); - AugmentedUtils.bypass(ignoreAugment, - () -> setChunkInPlotArea(null, new RunnableVal() { + AugmentedUtils.bypass(ignoreAugment, () -> setChunkInPlotArea(null, + new RunnableVal() { @Override public void run(ScopedLocalBlockQueue value) { Location min = value.getMin(); int bx = min.getX(); @@ -420,12 +427,14 @@ public class BukkitChunkManager extends ChunkManager { PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1); BaseBlock[] ids = map.allBlocks.get(plotLoc); if (ids != null) { - for (int y = 0; y < Math.min(128, ids.length); y++) { + for (int y = 0; + y < Math.min(128, ids.length); y++) { BaseBlock id = ids[y]; if (id != null) { value.setBlock(x1, y, z1, id); } else { - value.setBlock(x1, y, z1, BlockTypes.AIR.getDefaultState()); + value.setBlock(x1, y, z1, + BlockTypes.AIR.getDefaultState()); } } for (int y = Math.min(128, ids.length); @@ -454,15 +463,17 @@ public class BukkitChunkManager extends ChunkManager { return true; } - @Override public CompletableFuture loadChunk(String world, BlockVector2 chunkLoc, boolean force) { - return PaperLib.getChunkAtAsync(BukkitUtil.getWorld(world),chunkLoc.getX(), chunkLoc.getZ(), force); + @Override + public CompletableFuture loadChunk(String world, BlockVector2 chunkLoc, boolean force) { + return PaperLib + .getChunkAtAsync(BukkitUtil.getWorld(world), chunkLoc.getX(), chunkLoc.getZ(), force); } @Override public void unloadChunk(final String world, final BlockVector2 chunkLoc, final boolean save) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) { - TaskManager.runTask( - () -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save)); + TaskManager.runTask(() -> BukkitUtil.getWorld(world) + .unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save)); } else { BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save); } @@ -489,7 +500,8 @@ public class BukkitChunkManager extends ChunkManager { } } - @Override public void swap(Location bot1, Location top1, Location bot2, Location top2, + @Override + public void swap(Location bot1, Location top1, Location bot2, Location top2, final Runnable whenDone) { CuboidRegion region1 = RegionUtil.createRegion(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ()); @@ -497,8 +509,8 @@ public class BukkitChunkManager extends ChunkManager { RegionUtil.createRegion(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ()); final World world1 = Bukkit.getWorld(bot1.getWorld()); final World world2 = Bukkit.getWorld(bot2.getWorld()); - checkNotNull(world1,"Critical error during swap."); - checkNotNull(world2,"Critical error during swap."); + checkNotNull(world1, "Critical error during swap."); + checkNotNull(world2, "Critical error during swap."); int relX = bot2.getX() - bot1.getX(); int relZ = bot2.getZ() - bot1.getZ(); @@ -525,13 +537,11 @@ public class BukkitChunkManager extends ChunkManager { if (EntityCategories.PLAYER.contains(entityType)) { return; - } else if (EntityCategories.PROJECTILE.contains(entityType) || - EntityCategories.OTHER.contains(entityType) || - EntityCategories.HANGING.contains(entityType)) { + } else if (EntityCategories.PROJECTILE.contains(entityType) || EntityCategories.OTHER + .contains(entityType) || EntityCategories.HANGING.contains(entityType)) { count[CAP_MISC]++; - } else if (EntityCategories.ANIMAL.contains(entityType) || - EntityCategories.VILLAGER.contains(entityType) || - EntityCategories.TAMEABLE.contains(entityType)) { + } else if (EntityCategories.ANIMAL.contains(entityType) || EntityCategories.VILLAGER + .contains(entityType) || EntityCategories.TAMEABLE.contains(entityType)) { count[CAP_MOB]++; count[CAP_ANIMAL]++; } else if (EntityCategories.VEHICLE.contains(entityType)) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java index 6f907a620..2d3737ee0 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java @@ -74,7 +74,8 @@ public class BukkitCommand implements CommandExecutor, TabCompleter { if (args.length == 0) { return Collections.singletonList("plots"); } - Collection objects = MainCommand.getInstance().tab(player, args, s.endsWith(" ")); + Collection objects = + MainCommand.getInstance().tab(player, args, s.endsWith(" ")); if (objects == null) { return null; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 0778ba8c2..9acc29415 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -25,6 +25,7 @@ */ package com.plotsquared.bukkit; +import com.plotsquared.bukkit.generator.BukkitHybridUtils; import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.listener.ChunkListener; import com.plotsquared.bukkit.listener.EntitySpawnListener; @@ -33,42 +34,46 @@ import com.plotsquared.bukkit.listener.SingleWorldListener; import com.plotsquared.bukkit.listener.WorldEvents; import com.plotsquared.bukkit.placeholder.PlaceholderFormatter; import com.plotsquared.bukkit.placeholder.Placeholders; +import com.plotsquared.bukkit.queue.BukkitLocalQueue; +import com.plotsquared.bukkit.schematic.BukkitSchematicHandler; import com.plotsquared.bukkit.util.BukkitChatManager; import com.plotsquared.bukkit.util.BukkitEconHandler; -import com.plotsquared.bukkit.generator.BukkitHybridUtils; import com.plotsquared.bukkit.util.BukkitInventoryUtil; -import com.plotsquared.bukkit.schematic.BukkitSchematicHandler; import com.plotsquared.bukkit.util.BukkitSetupUtils; import com.plotsquared.bukkit.util.BukkitTaskManager; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.SetGenCB; import com.plotsquared.bukkit.util.UpdateUtility; -import com.plotsquared.bukkit.queue.BukkitLocalQueue; import com.plotsquared.bukkit.util.uuid.DefaultUUIDWrapper; import com.plotsquared.bukkit.util.uuid.FileUUIDHandler; import com.plotsquared.bukkit.util.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.util.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.util.uuid.SQLUUIDHandler; -import com.plotsquared.core.configuration.*; import com.plotsquared.core.IPlotMain; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.ChatFormatter; +import com.plotsquared.core.configuration.ConfigurationNode; +import com.plotsquared.core.configuration.ConfigurationSection; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.HybridGen; import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.IndependentPlotGenerator; +import com.plotsquared.core.generator.SingleWorldGenerator; import com.plotsquared.core.listener.PlotListener; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.plot.message.PlainChatManager; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.plot.world.SinglePlotAreaManager; -import com.plotsquared.core.generator.SingleWorldGenerator; +import com.plotsquared.core.queue.QueueProvider; import com.plotsquared.core.util.ChatManager; import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ConsoleColors; @@ -80,11 +85,10 @@ import com.plotsquared.core.util.ReflectionUtils; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandlerImplementation; -import com.plotsquared.core.util.WorldUtil; -import com.plotsquared.core.queue.QueueProvider; import com.plotsquared.core.util.uuid.UUIDWrapper; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.bukkit.WorldEditPlugin; @@ -123,7 +127,9 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import static com.plotsquared.core.util.PremiumVerification.*; +import static com.plotsquared.core.util.PremiumVerification.getDownloadID; +import static com.plotsquared.core.util.PremiumVerification.getResourceID; +import static com.plotsquared.core.util.PremiumVerification.getUserID; import static com.plotsquared.core.util.ReflectionUtils.getRefClass; public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { @@ -191,8 +197,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } if (PremiumVerification.isPremium()) { - PlotSquared.log(Captions.PREFIX + "&6PlotSquared version licensed to Spigot user " + getUserID()); - PlotSquared.log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/" + getResourceID()); + PlotSquared.log( + Captions.PREFIX + "&6PlotSquared version licensed to Spigot user " + getUserID()); + PlotSquared + .log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/" + getResourceID()); PlotSquared.log(Captions.PREFIX + "&6Download ID: " + getDownloadID()); PlotSquared.log(Captions.PREFIX + "&6Thanks for supporting us :)"); } else { @@ -206,7 +214,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } PlotSquared.log(Captions.PREFIX + "&6PlotSquared hooked into PlaceholderAPI"); } else { - PlotSquared.debug(Captions.PREFIX + "&6PlaceholderAPI is not in use. Hook deactivated."); + PlotSquared + .debug(Captions.PREFIX + "&6PlaceholderAPI is not in use. Hook deactivated."); } this.startMetrics(); @@ -409,8 +418,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case MINECART_TNT: case BOAT: if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { - com.plotsquared.core.location.Location - location = BukkitUtil.getLocation(entity.getLocation()); + com.plotsquared.core.location.Location location = + BukkitUtil.getLocation(entity.getLocation()); Plot plot = location.getPlot(); if (plot == null) { if (location.isPlotArea()) { @@ -466,8 +475,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain PlotId originalPlotId = (PlotId) meta.get(0).value(); if (originalPlotId != null) { - com.plotsquared.core.location.Location - pLoc = BukkitUtil.getLocation(entity.getLocation()); + com.plotsquared.core.location.Location pLoc = + BukkitUtil.getLocation(entity.getLocation()); PlotArea area = pLoc.getPlotArea(); if (area != null) { PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc)); @@ -485,14 +494,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } else { //This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java) - com.plotsquared.core.location.Location - pLoc = BukkitUtil.getLocation(entity.getLocation()); + com.plotsquared.core.location.Location pLoc = + BukkitUtil.getLocation(entity.getLocation()); PlotArea area = pLoc.getPlotArea(); if (area != null) { PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc)); if (currentPlotId != null) { - entity.setMetadata("shulkerPlot", new FixedMetadataValue( - (Plugin) PlotSquared.get().IMP, currentPlotId)); + entity.setMetadata("shulkerPlot", + new FixedMetadataValue( + (Plugin) PlotSquared.get().IMP, currentPlotId)); } } } @@ -668,7 +678,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return new BukkitUtil(); } - @Override @Nullable public GeneratorWrapper getGenerator(@NonNull final String world, + @Override @Nullable + public GeneratorWrapper getGenerator(@NonNull final String world, @Nullable final String name) { if (name == null) { return null; @@ -709,7 +720,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain map.put(plotAreaType.name().toLowerCase(), terrainTypes); } for (final PlotArea plotArea : PlotSquared.get().getPlotAreas()) { - final Map terrainTypeMap = map.get(plotArea.getType().name().toLowerCase()); + final Map terrainTypeMap = + map.get(plotArea.getType().name().toLowerCase()); terrainTypeMap.put(plotArea.getTerrain().name().toLowerCase(), terrainTypeMap.get(plotArea.getTerrain().name().toLowerCase()) + 1); } @@ -847,7 +859,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } - @Override public GeneratorWrapper wrapPlotGenerator(@Nullable final String world, + @Override + public GeneratorWrapper wrapPlotGenerator(@Nullable final String world, @NonNull final IndependentPlotGenerator generator) { return new BukkitPlotGenerator(world, generator); } @@ -855,7 +868,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public List, Boolean>> getPluginIds() { List, Boolean>> names = new ArrayList<>(); for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { - Map.Entry id = new AbstractMap.SimpleEntry<>(plugin.getName(), plugin.getDescription().getVersion()); + Map.Entry id = new AbstractMap.SimpleEntry<>(plugin.getName(), + plugin.getDescription().getVersion()); names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled())); } return names; @@ -863,7 +877,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public Actor getConsole() { @NotNull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); - WorldEditPlugin wePlugin = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit")); + WorldEditPlugin wePlugin = + ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit")); return wePlugin.wrapCommandSender(console); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/command/DebugUUID.java b/Bukkit/src/main/java/com/plotsquared/bukkit/command/DebugUUID.java index 94b3e6604..79b411791 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/command/DebugUUID.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/command/DebugUUID.java @@ -25,29 +25,29 @@ */ package com.plotsquared.bukkit.command; +import com.google.common.collect.Sets; import com.plotsquared.bukkit.util.uuid.DatFileFilter; import com.plotsquared.bukkit.util.uuid.DefaultUUIDWrapper; import com.plotsquared.bukkit.util.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.util.uuid.OfflineUUIDWrapper; -import com.plotsquared.core.command.Argument; -import com.plotsquared.core.command.CommandDeclaration; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.command.Argument; import com.plotsquared.core.command.CommandCategory; +import com.plotsquared.core.command.CommandDeclaration; import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.command.SubCommand; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.OfflinePlotPlayer; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.StringWrapper; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.StringWrapper; +import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; -import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.uuid.UUIDWrapper; -import com.google.common.collect.Sets; import java.io.File; import java.io.IOException; @@ -60,10 +60,13 @@ import java.util.List; import java.util.Map.Entry; import java.util.UUID; -@CommandDeclaration(command = "uuidconvert", permission = "plots.admin", - description = "Debug UUID conversion", usage = "/plot uuidconvert ", - requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG) public class DebugUUID - extends SubCommand { +@CommandDeclaration(command = "uuidconvert", + permission = "plots.admin", + description = "Debug UUID conversion", + usage = "/plot uuidconvert ", + requiredType = RequiredType.CONSOLE, + category = CommandCategory.DEBUG) +public class DebugUUID extends SubCommand { public DebugUUID() { super(Argument.String); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/EntityWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/EntityWrapper.java index b95986a81..6e777f23a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/EntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/EntityWrapper.java @@ -32,7 +32,8 @@ import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; -@Getter public abstract class EntityWrapper { +@Getter +public abstract class EntityWrapper { protected final float yaw; protected final float pitch; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java index a873ebb8e..f0ef20fba 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java @@ -329,7 +329,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { } storeLiving((LivingEntity) entity); return; - // END LIVING // + // END LIVING // default: PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java index e41fb8b6e..a89588598 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java @@ -32,12 +32,13 @@ import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.queue.ScopedLocalBlockQueue; -import java.util.Random; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import org.jetbrains.annotations.NotNull; +import java.util.Random; + final class BlockStatePopulator extends BlockPopulator { private final IndependentPlotGenerator plotGenerator; @@ -47,13 +48,15 @@ final class BlockStatePopulator extends BlockPopulator { this.plotGenerator = plotGenerator; } - @Override public void populate(@NotNull final World world, @NotNull final Random random, + @Override + public void populate(@NotNull final World world, @NotNull final Random random, @NotNull final Chunk source) { if (this.queue == null) { this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false); } final PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null); - final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ()); + final ChunkWrapper wrap = + new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ()); final ScopedLocalBlockQueue chunk = this.queue.getForChunk(wrap.x, wrap.z); if (this.plotGenerator.populateChunk(chunk, area)) { this.queue.flush(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 9caaa37ca..6f886904f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -25,17 +25,17 @@ */ package com.plotsquared.bukkit.generator; -import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.queue.GenChunk; +import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.IndependentPlotGenerator; +import com.plotsquared.core.generator.SingleWorldGenerator; import com.plotsquared.core.location.ChunkWrapper; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.generator.SingleWorldGenerator; +import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.MainUtil; -import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.sk89q.worldedit.math.BlockVector2; import lombok.Getter; import org.bukkit.World; @@ -103,9 +103,7 @@ public class BukkitPlotGenerator extends ChunkGenerator return this.platformGenerator; } - @Override - @NotNull - public List getDefaultPopulators(@NotNull World world) { + @Override @NotNull public List getDefaultPopulators(@NotNull World world) { try { if (!this.loaded) { String name = world.getName(); @@ -149,8 +147,7 @@ public class BukkitPlotGenerator extends ChunkGenerator return toAdd; } - @Override - @NotNull + @Override @NotNull public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome) { @@ -203,8 +200,9 @@ public class BukkitPlotGenerator extends ChunkGenerator } PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null); if (area == null && (area = PlotSquared.get().getPlotArea(this.levelName, null)) == null) { - throw new IllegalStateException("Cannot regenerate chunk that does not belong to a plot area." - + " Location: " + loc + ", world: " + world); + throw new IllegalStateException( + "Cannot regenerate chunk that does not belong to a plot area." + " Location: " + loc + + ", world: " + world); } try { this.plotGenerator.generateChunk(result, area); @@ -215,8 +213,7 @@ public class BukkitPlotGenerator extends ChunkGenerator ChunkManager.postProcessChunk(loc, result); } - @Override - public boolean canSpawn(@NotNull final World world, final int x, final int z) { + @Override public boolean canSpawn(@NotNull final World world, final int x, final int z) { return true; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java index 633fc289f..d5086b06d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java @@ -31,10 +31,9 @@ import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.util.MathMan; import com.plotsquared.core.queue.ScopedLocalBlockQueue; +import com.plotsquared.core.util.MathMan; import com.sk89q.worldedit.bukkit.BukkitAdapter; -import java.util.Random; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.generator.BlockPopulator; @@ -42,6 +41,8 @@ import org.bukkit.generator.ChunkGenerator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; +import java.util.Random; + final class DelegatePlotGenerator extends IndependentPlotGenerator { private final ChunkGenerator chunkGenerator; @@ -71,7 +72,8 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator { Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ)); try { ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() { - @Override public void setBiome(@Range(from = 0, to = 15) int x, + @Override + public void setBiome(@Range(from = 0, to = 15) int x, @Range(from = 0, to = 15) int z, @NotNull Biome biome) { result.setBiome(x, z, BukkitAdapter.adapt(biome)); } @@ -86,8 +88,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator { return Biome.FOREST; } - @Override - public @NotNull Biome getBiome(int x, int y, int z) { + @Override public @NotNull Biome getBiome(int x, int y, int z) { return Biome.FOREST; } }; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java index ab8df40c4..2f84732a7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java @@ -57,7 +57,8 @@ import java.util.HashSet; import static com.plotsquared.core.util.ReflectionUtils.getRefClass; -@SuppressWarnings("unused") public class ChunkListener implements Listener { +@SuppressWarnings("unused") +public class ChunkListener implements Listener { private RefMethod methodGetHandleChunk; private RefField mustSave; @@ -291,11 +292,15 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; ent.remove(); } } - PlotSquared.debug("PlotSquared detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); + PlotSquared.debug( + "PlotSquared detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + ( + chunk.getX() << 4)); } if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { - PlotSquared.debug("PlotSquared detected unsafe chunk: " + (chunk.getX()<< 4) + "," + (chunk.getX() << 4)); + PlotSquared.debug( + "PlotSquared detected unsafe chunk: " + (chunk.getX() << 4) + "," + ( + chunk.getX() << 4)); cleanChunk(chunk); return true; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java index 21a30f02a..e094baf9c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java @@ -28,10 +28,10 @@ package com.plotsquared.bukkit.listener; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; import io.papermc.lib.PaperLib; import org.bukkit.Chunk; import org.bukkit.World; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ForceFieldListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ForceFieldListener.java index 0f96ac45b..7cc0de41d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ForceFieldListener.java @@ -25,15 +25,15 @@ */ package com.plotsquared.bukkit.listener; +import com.google.common.collect.Iterables; import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.flag.implementations.ForcefieldFlag; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.flag.implementations.ForcefieldFlag; import com.plotsquared.core.util.Permissions; -import com.google.common.collect.Iterables; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -41,7 +41,8 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -@SuppressWarnings("unused") public class ForceFieldListener { +@SuppressWarnings("unused") +public class ForceFieldListener { private static Set getNearbyPlayers(Player player, Plot plot) { Set players = new HashSet<>(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java index c1a9da5f5..e4d284f41 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java @@ -26,9 +26,6 @@ package com.plotsquared.bukkit.listener; import com.destroystokyo.paper.MaterialTags; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.stream.JsonReader; import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.UpdateUtility; @@ -36,6 +33,15 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; +import com.plotsquared.core.listener.PlayerBlockEventType; +import com.plotsquared.core.listener.PlotListener; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.PlotArea; +import com.plotsquared.core.plot.PlotHandler; +import com.plotsquared.core.plot.PlotId; +import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.flag.implementations.AnimalAttackFlag; import com.plotsquared.core.plot.flag.implementations.AnimalCapFlag; import com.plotsquared.core.plot.flag.implementations.AnimalInteractFlag; @@ -88,23 +94,14 @@ import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag; import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag; import com.plotsquared.core.plot.flag.implementations.VineGrowFlag; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; -import com.plotsquared.core.listener.PlayerBlockEventType; -import com.plotsquared.core.listener.PlotListener; -import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.plot.PlotHandler; -import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.message.PlotMessage; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.PremiumVerification; -import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.EntityUtil; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.PremiumVerification; import com.plotsquared.core.util.RegExUtil; +import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.entity.EntityCategories; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; @@ -209,12 +206,7 @@ import org.bukkit.projectiles.BlockProjectileSource; import org.bukkit.projectiles.ProjectileSource; import org.bukkit.util.Vector; -import javax.net.ssl.HttpsURLConnection; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; import java.lang.reflect.Field; -import java.net.URL; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -275,31 +267,32 @@ public class PlayerEvents extends PlotListener implements Listener { return false; } - final com.sk89q.worldedit.world.entity.EntityType entityType = BukkitAdapter.adapt(entity.getType()); + final com.sk89q.worldedit.world.entity.EntityType entityType = + BukkitAdapter.adapt(entity.getType()); if (EntityCategories.PLAYER.contains(entityType)) { return false; } - if (EntityCategories.PROJECTILE.contains(entityType) || - EntityCategories.OTHER.contains(entityType) || - EntityCategories.HANGING.contains(entityType)) { + if (EntityCategories.PROJECTILE.contains(entityType) || EntityCategories.OTHER + .contains(entityType) || EntityCategories.HANGING.contains(entityType)) { return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, MiscCapFlag.MISC_CAP_UNLIMITED); } // Has to go go before vehicle as horses are both // animals and vehicles - if (EntityCategories.ANIMAL.contains(entityType) || - EntityCategories.VILLAGER.contains(entityType) || - EntityCategories.TAMEABLE.contains(entityType)) { - return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, - MobCapFlag.MOB_CAP_UNLIMITED, AnimalCapFlag.ANIMAL_CAP_UNLIMITED); + if (EntityCategories.ANIMAL.contains(entityType) || EntityCategories.VILLAGER + .contains(entityType) || EntityCategories.TAMEABLE.contains(entityType)) { + return EntityUtil + .checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, MobCapFlag.MOB_CAP_UNLIMITED, + AnimalCapFlag.ANIMAL_CAP_UNLIMITED); } if (EntityCategories.HOSTILE.contains(entityType)) { - return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, - MobCapFlag.MOB_CAP_UNLIMITED, HostileCapFlag.HOSTILE_CAP_UNLIMITED); + return EntityUtil + .checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, MobCapFlag.MOB_CAP_UNLIMITED, + HostileCapFlag.HOSTILE_CAP_UNLIMITED); } if (EntityCategories.VEHICLE.contains(entityType)) { @@ -763,10 +756,12 @@ public class PlayerEvents extends PlotListener implements Listener { } } if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { - final com.sk89q.worldedit.world.entity.EntityType entityType = BukkitAdapter.adapt(vehicle.getType()); + final com.sk89q.worldedit.world.entity.EntityType entityType = + BukkitAdapter.adapt(vehicle.getType()); // Horses etc are vehicles, but they're also animals // so this filters out all living entities - if (EntityCategories.VEHICLE.contains(entityType) && !EntityCategories.ANIMAL.contains(entityType)) { + if (EntityCategories.VEHICLE.contains(entityType) && !EntityCategories.ANIMAL + .contains(entityType)) { List meta = vehicle.getMetadata("plot"); Plot toPlot = BukkitUtil.getLocation(to).getPlot(); if (!meta.isEmpty()) { @@ -930,7 +925,8 @@ public class PlayerEvents extends PlotListener implements Listener { || area.isForcingPlotChat())) { return; } - if (plot.isDenied(plotPlayer.getUUID()) && !Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_CHAT_BYPASS)) { + if (plot.isDenied(plotPlayer.getUUID()) && !Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_CHAT_BYPASS)) { return; } event.setCancelled(true); @@ -990,10 +986,9 @@ public class PlayerEvents extends PlotListener implements Listener { event.setCancelled(true); return; } - } else if ( - (location.getY() > area.getMaxBuildHeight() || location.getY() < area.getMinBuildHeight()) - && !Permissions - .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { + } else if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area + .getMinBuildHeight()) && !Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { event.setCancelled(true); MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.getTranslated() .replace("{limit}", String.valueOf(area.getMaxBuildHeight()))); @@ -2501,13 +2496,16 @@ public class PlayerEvents extends PlotListener implements Listener { } } else if (!plot.isAdded(pp.getUUID())) { final Entity entity = event.getRightClicked(); - final com.sk89q.worldedit.world.entity.EntityType entityType = BukkitAdapter.adapt(entity.getType()); + final com.sk89q.worldedit.world.entity.EntityType entityType = + BukkitAdapter.adapt(entity.getType()); - if (EntityCategories.HOSTILE.contains(entityType) && plot.getFlag(HostileInteractFlag.class)) { + if (EntityCategories.HOSTILE.contains(entityType) && plot + .getFlag(HostileInteractFlag.class)) { return; } - if (EntityCategories.ANIMAL.contains(entityType) && plot.getFlag(AnimalInteractFlag.class)) { + if (EntityCategories.ANIMAL.contains(entityType) && plot + .getFlag(AnimalInteractFlag.class)) { return; } @@ -2518,20 +2516,23 @@ public class PlayerEvents extends PlotListener implements Listener { return; } - if (EntityCategories.VEHICLE.contains(entityType) && plot.getFlag(VehicleUseFlag.class)) { + if (EntityCategories.VEHICLE.contains(entityType) && plot + .getFlag(VehicleUseFlag.class)) { return; } - if (EntityCategories.PLAYER.contains(entityType) && plot.getFlag(PlayerInteractFlag.class)) { + if (EntityCategories.PLAYER.contains(entityType) && plot + .getFlag(PlayerInteractFlag.class)) { return; } - if (EntityCategories.VILLAGER.contains(entityType) && plot.getFlag(VillagerInteractFlag.class)) { + if (EntityCategories.VILLAGER.contains(entityType) && plot + .getFlag(VillagerInteractFlag.class)) { return; } - if ((EntityCategories.HANGING.contains(entityType) || - EntityCategories.OTHER.contains(entityType)) && plot.getFlag(MiscInteractFlag.class)) { + if ((EntityCategories.HANGING.contains(entityType) || EntityCategories.OTHER + .contains(entityType)) && plot.getFlag(MiscInteractFlag.class)) { return; } @@ -2813,7 +2814,8 @@ public class PlayerEvents extends PlotListener implements Listener { "plots.admin.pve." + stub); return false; } - } else if (EntityCategories.VEHICLE.contains(entityType)) { // Vehicles are managed in vehicle destroy event + } else if (EntityCategories.VEHICLE + .contains(entityType)) { // Vehicles are managed in vehicle destroy event return true; } else { // victim is something else if (plot != null && (plot.getFlag(PveFlag.class) || plot @@ -2884,8 +2886,9 @@ public class PlayerEvents extends PlotListener implements Listener { PlotPlayer pp = BukkitUtil.getPlayer(player); Plot plot = area.getPlot(location); if (plot != null) { - if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area.getMinBuildHeight()) - && !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { + if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area + .getMinBuildHeight()) && !Permissions + .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { event.setCancelled(true); MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.getTranslated() .replace("{limit}", String.valueOf(area.getMaxBuildHeight()))); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/SingleWorldListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/SingleWorldListener.java index 6faed38fe..a5a5ff2f8 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/SingleWorldListener.java @@ -44,7 +44,8 @@ import java.lang.reflect.Method; import static com.plotsquared.core.util.ReflectionUtils.getRefClass; -@SuppressWarnings("unused") public class SingleWorldListener implements Listener { +@SuppressWarnings("unused") +public class SingleWorldListener implements Listener { private Method methodGetHandleChunk; private Field mustSave; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/WorldEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/WorldEvents.java index e963f35c9..59e1fb2ec 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/WorldEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/WorldEvents.java @@ -40,23 +40,23 @@ import org.bukkit.generator.ChunkGenerator; @SuppressWarnings("unused") public class WorldEvents implements Listener { - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onWorldInit(WorldInitEvent event) { - World world = event.getWorld(); - String name = world.getName(); - PlotAreaManager manager = PlotSquared.get().getPlotAreaManager(); - if (manager instanceof SinglePlotAreaManager) { - SinglePlotAreaManager single = (SinglePlotAreaManager) manager; - if (single.isWorld(name)) { - world.setKeepSpawnInMemory(false); - return; - } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onWorldInit(WorldInitEvent event) { + World world = event.getWorld(); + String name = world.getName(); + PlotAreaManager manager = PlotSquared.get().getPlotAreaManager(); + if (manager instanceof SinglePlotAreaManager) { + SinglePlotAreaManager single = (SinglePlotAreaManager) manager; + if (single.isWorld(name)) { + world.setKeepSpawnInMemory(false); + return; + } + } + ChunkGenerator gen = world.getGenerator(); + if (gen instanceof GeneratorWrapper) { + PlotSquared.get().loadWorld(name, (GeneratorWrapper) gen); + } else { + PlotSquared.get().loadWorld(name, new BukkitPlotGenerator(name, gen)); + } } - ChunkGenerator gen = world.getGenerator(); - if (gen instanceof GeneratorWrapper) { - PlotSquared.get().loadWorld(name, (GeneratorWrapper) gen); - } else { - PlotSquared.get().loadWorld(name, new BukkitPlotGenerator(name, gen)); - } - } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/PlaceholderFormatter.java b/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/PlaceholderFormatter.java index d10268f6a..674d810f2 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/PlaceholderFormatter.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/PlaceholderFormatter.java @@ -42,7 +42,7 @@ public class PlaceholderFormatter implements ChatFormatter { final Player player = ((BukkitPlayer) recipient).player; context.setMessage(PlaceholderAPI.setPlaceholders(player, context.getMessage())); } - } + } } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java b/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java index 1cf38cab7..bf2a7a8b9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java @@ -41,33 +41,27 @@ public class Placeholders extends PlaceholderExpansion { public Placeholders() { } - @Override - public boolean persist() { + @Override public boolean persist() { return true; } - @Override - public boolean canRegister() { + @Override public boolean canRegister() { return true; } - @Override - public String getAuthor() { + @Override public String getAuthor() { return "NotMyFault"; } - @Override - public String getIdentifier() { + @Override public String getIdentifier() { return "plotsquared"; } - @Override - public String getVersion() { + @Override public String getVersion() { return "2.4"; } - @Override - public String onPlaceholderRequest(Player p, String identifier) { + @Override public String onPlaceholderRequest(Player p, String identifier) { final PlotPlayer pl = PlotPlayer.get(p.getName()); if (pl == null) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index c4b3951e0..854cc6ec0 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -28,12 +28,12 @@ package com.plotsquared.bukkit.player; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.plot.PlotWeather; import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.MathMan; -import com.plotsquared.core.plot.PlotWeather; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.uuid.UUIDHandler; import com.sk89q.worldedit.bukkit.BukkitAdapter; @@ -167,7 +167,7 @@ public class BukkitPlayer extends PlotPlayer { if (CHECK_EFFECTIVE) { boolean hasAny = false; String stubPlus = stub + "."; - final Set effective = player.getEffectivePermissions(); + final Set effective = player.getEffectivePermissions(); if (!effective.isEmpty()) { for (PermissionAttachmentInfo attach : effective) { String permStr = attach.getPermission(); @@ -211,8 +211,7 @@ public class BukkitPlayer extends PlotPlayer { } @Override public void sendMessage(String message) { - message = message.replace('\u2010', '%') - .replace('\u2020', '&').replace('\u2030', '&'); + message = message.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&'); if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || ( System.currentTimeMillis() - this.getMeta("lastMessageTime") > 5000)) { setMeta("lastMessage", message); @@ -221,12 +220,14 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void teleport(@NotNull final Location location, @NotNull final TeleportCause cause) { + @Override + public void teleport(@NotNull final Location location, @NotNull final TeleportCause cause) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { return; } - final org.bukkit.Location bukkitLocation = new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, - location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch()); + final org.bukkit.Location bukkitLocation = + new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, + location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch()); PaperLib.teleportAsync(player, bukkitLocation, getTeleportCause(cause)); } @@ -280,7 +281,8 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void setGameMode(@NotNull final com.sk89q.worldedit.world.gamemode.GameMode gameMode) { + @Override + public void setGameMode(@NotNull final com.sk89q.worldedit.world.gamemode.GameMode gameMode) { if (ADVENTURE.equals(gameMode)) { this.player.setGameMode(GameMode.ADVENTURE); } else if (CREATIVE.equals(gameMode)) { @@ -344,7 +346,8 @@ public class BukkitPlayer extends PlotPlayer { return PlayerTeleportEvent.TeleportCause.COMMAND; case PLUGIN: return PlayerTeleportEvent.TeleportCause.PLUGIN; - default: return PlayerTeleportEvent.TeleportCause.UNKNOWN; + default: + return PlayerTeleportEvent.TeleportCause.UNKNOWN; } } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java index 9c8b38dd9..26b303f69 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java @@ -28,9 +28,9 @@ package com.plotsquared.bukkit.queue; import com.plotsquared.bukkit.schematic.StateWrapper; import com.plotsquared.bukkit.util.BukkitBlockUtil; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.queue.BasicLocalBlockQueue; import com.plotsquared.core.util.BlockUtil; +import com.plotsquared.core.util.MainUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; @@ -139,7 +139,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { BlockData blockData = BukkitAdapter.adapt(block); Block existing = chunk.getBlock(x, y, z); - final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData()); + final BlockState existingBaseBlock = + BukkitAdapter.adapt(existing.getBlockData()); if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing .getBlockData().matches(blockData)) { continue; @@ -151,8 +152,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { CompoundTag tag = block.getNbtData(); StateWrapper sw = new StateWrapper(tag); - sw.restoreTag(worldObj.getName(), existing.getX(), - existing.getY(), existing.getZ()); + sw.restoreTag(worldObj.getName(), existing.getX(), existing.getY(), + existing.getZ()); } } } @@ -162,7 +163,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { if (isForceSync()) { chunkConsumer.accept(getChunk(worldObj, localChunk)); } else { - PaperLib.getChunkAtAsync(worldObj, localChunk.getX(), localChunk.getZ(), true).thenAccept(chunkConsumer); + PaperLib.getChunkAtAsync(worldObj, localChunk.getX(), localChunk.getZ(), true) + .thenAccept(chunkConsumer); } } @@ -206,8 +208,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { BiomeType biomeType = biomeZ[z]; Biome biome = BukkitAdapter.adapt(biomeType); - worldObj.setBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z, - biome); + worldObj + .setBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z, biome); } } } @@ -216,7 +218,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { if (this.isForceSync()) { chunkConsumer.accept(getChunk(worldObj, lc)); } else { - PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true).thenAccept(chunkConsumer); + PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true) + .thenAccept(chunkConsumer); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java index 77cb4de45..c20815e1e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java @@ -25,14 +25,14 @@ */ package com.plotsquared.bukkit.queue; +import com.google.common.base.Preconditions; import com.plotsquared.bukkit.util.BukkitBlockUtil; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.core.location.ChunkWrapper; import com.plotsquared.core.location.Location; -import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.queue.ScopedLocalBlockQueue; +import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.PatternUtil; -import com.google.common.base.Preconditions; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.biome.BiomeType; @@ -119,7 +119,8 @@ public class GenChunk extends ScopedLocalBlockQueue { int maxX = Math.max(pos1.getX(), pos2.getX()); int maxY = Math.max(pos1.getY(), pos2.getY()); int maxZ = Math.max(pos1.getZ(), pos2.getZ()); - chunkData.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, BukkitAdapter.adapt(block)); + chunkData + .setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, BukkitAdapter.adapt(block)); } @Override public boolean setBiome(int x, int z, BiomeType biomeType) { @@ -135,7 +136,8 @@ public class GenChunk extends ScopedLocalBlockQueue { } @Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) { - return setBlock(x, y, z, PatternUtil.apply(Preconditions.checkNotNull(pattern, "Pattern may not be null"), x, y, z)); + return setBlock(x, y, z, PatternUtil + .apply(Preconditions.checkNotNull(pattern, "Pattern may not be null"), x, y, z)); } @Override public boolean setBlock(int x, int y, int z, BlockState id) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/BukkitSchematicHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/BukkitSchematicHandler.java index 9705b894d..86fbd732e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/BukkitSchematicHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/BukkitSchematicHandler.java @@ -27,12 +27,19 @@ package com.plotsquared.bukkit.schematic; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.core.location.Location; -import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.SchematicHandler; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import com.plotsquared.core.queue.LocalBlockQueue; -import com.sk89q.jnbt.*; +import com.sk89q.jnbt.ByteArrayTag; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.IntArrayTag; +import com.sk89q.jnbt.IntTag; +import com.sk89q.jnbt.ListTag; +import com.sk89q.jnbt.ShortTag; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.math.BlockVector2; @@ -42,7 +49,13 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import java.io.ByteArrayOutputStream; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.IntStream; /** @@ -50,7 +63,8 @@ import java.util.stream.IntStream; */ public class BukkitSchematicHandler extends SchematicHandler { - @Override public void getCompoundTag(final String world, final Set regions, + @Override + public void getCompoundTag(final String world, final Set regions, final RunnableVal whenDone) { // async TaskManager.runTaskAsync(new Runnable() { @@ -112,10 +126,12 @@ public class BukkitSchematicHandler extends SchematicHandler { schematic.put("BiomePaletteMax", new IntTag(biomePalette.size())); Map biomePaletteTag = new HashMap<>(); - biomePalette.forEach((key, value) -> biomePaletteTag.put(key, new IntTag(value))); + biomePalette.forEach( + (key, value) -> biomePaletteTag.put(key, new IntTag(value))); schematic.put("BiomePalette", new CompoundTag(biomePaletteTag)); - schematic.put("BiomeData", new ByteArrayTag(biomeBuffer.toByteArray())); + schematic + .put("BiomeData", new ByteArrayTag(biomeBuffer.toByteArray())); whenDone.value = new CompoundTag(schematic); TaskManager.runTask(whenDone); }); @@ -123,8 +139,10 @@ public class BukkitSchematicHandler extends SchematicHandler { } final Runnable regionTask = this; CuboidRegion region = queue.poll(); - Location pos1 = new Location(world, region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); - Location pos2 = new Location(world, region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); + Location pos1 = new Location(world, region.getMinimumPoint().getX(), + region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); + Location pos2 = new Location(world, region.getMaximumPoint().getX(), + region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); final int p1x = pos1.getX(); final int sy = pos1.getY(); final int p1z = pos1.getZ(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChatManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChatManager.java index 6d8650622..49c4f061b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChatManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChatManager.java @@ -30,8 +30,8 @@ import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.player.ConsolePlayer; -import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.util.ChatManager; import org.bukkit.ChatColor; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java index 7c3c8a985..62136379a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -26,9 +26,9 @@ package com.plotsquared.bukkit.util; import com.plotsquared.bukkit.player.BukkitPlayer; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.PlotItemStack; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.InventoryUtil; import com.sk89q.worldedit.bukkit.BukkitAdapter; import org.bukkit.Bukkit; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java index 26f70fc4d..67b32b813 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -26,10 +26,10 @@ package com.plotsquared.bukkit.util; import com.plotsquared.bukkit.generator.BukkitPlotGenerator; -import com.plotsquared.core.configuration.ConfigurationSection; -import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.ConfigurationNode; +import com.plotsquared.core.configuration.ConfigurationSection; +import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaType; @@ -88,7 +88,7 @@ public class BukkitSetupUtils extends SetupUtils { } World dw = Bukkit.getWorlds().get(0); for (Player player : world.getPlayers()) { - PaperLib.teleportAsync(player,dw.getSpawnLocation()); + PaperLib.teleportAsync(player, dw.getSpawnLocation()); } if (save) { for (Chunk chunk : world.getLoadedChunks()) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index d266c4d31..2371fe799 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -337,15 +337,16 @@ public class BukkitUtil extends WorldUtil { } @Override public void getBiome(String world, int x, int z, final Consumer result) { - ensureLoaded(world, x, z, chunk -> - result.accept(BukkitAdapter.adapt(getWorld(world).getBiome(x, z)))); + ensureLoaded(world, x, z, + chunk -> result.accept(BukkitAdapter.adapt(getWorld(world).getBiome(x, z)))); } @Override public BiomeType getBiomeSynchronous(String world, int x, int z) { return BukkitAdapter.adapt(getWorld(world).getBiome(x, z)); } - @Override public void getHighestBlock(@NonNull final String world, final int x, final int z, + @Override + public void getHighestBlock(@NonNull final String world, final int x, final int z, final IntConsumer result) { ensureLoaded(world, x, z, chunk -> { final World bukkitWorld = getWorld(world); @@ -394,7 +395,8 @@ public class BukkitUtil extends WorldUtil { return bukkitWorld.getMaxHeight() - 1; } - @Override public void getSign(@NonNull final Location location, final Consumer result) { + @Override + public void getSign(@NonNull final Location location, final Consumer result) { ensureLoaded(location, chunk -> { final Block block = chunk.getWorld().getBlockAt(getLocation(location)); if (block.getState() instanceof Sign) { @@ -519,7 +521,8 @@ public class BukkitUtil extends WorldUtil { return new BukkitWorld(Bukkit.getWorld(world)); } - @Override public void getBlock(@NonNull final Location location, final Consumer result) { + @Override + public void getBlock(@NonNull final Location location, final Consumer result) { ensureLoaded(location, chunk -> { final World world = getWorld(location.getWorld()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); @@ -554,7 +557,8 @@ public class BukkitUtil extends WorldUtil { } @Override - public Set getTypesInCategory(final String category) { + public Set getTypesInCategory( + final String category) { final Collection> allowedInterfaces = new HashSet<>(); switch (category) { case "animal": { @@ -563,13 +567,16 @@ public class BukkitUtil extends WorldUtil { allowedInterfaces.add(Animals.class); allowedInterfaces.add(WaterMob.class); allowedInterfaces.add(Ambient.class); - } break; + } + break; case "tameable": { allowedInterfaces.add(Tameable.class); - } break; + } + break; case "vehicle": { allowedInterfaces.add(Vehicle.class); - } break; + } + break; case "hostile": { allowedInterfaces.add(Shulker.class); allowedInterfaces.add(Monster.class); @@ -578,16 +585,20 @@ public class BukkitUtil extends WorldUtil { allowedInterfaces.add(Ghast.class); allowedInterfaces.add(Phantom.class); allowedInterfaces.add(EnderCrystal.class); - } break; + } + break; case "hanging": { allowedInterfaces.add(Hanging.class); - } break; + } + break; case "villager": { allowedInterfaces.add(NPC.class); - } break; + } + break; case "projectile": { allowedInterfaces.add(Projectile.class); - } break; + } + break; case "other": { allowedInterfaces.add(ArmorStand.class); allowedInterfaces.add(FallingBlock.class); @@ -599,16 +610,20 @@ public class BukkitUtil extends WorldUtil { allowedInterfaces.add(ExperienceOrb.class); allowedInterfaces.add(EnderSignal.class); allowedInterfaces.add(Firework.class); - } break; + } + break; case "player": { allowedInterfaces.add(Player.class); - } break; + } + break; default: { PlotSquared.log(Captions.PREFIX + "Unknown entity category requested: " + category); - } break; + } + break; } final Set types = new HashSet<>(); - outer: for (final EntityType bukkitType : EntityType.values()) { + outer: + for (final EntityType bukkitType : EntityType.values()) { final Class entityClass = bukkitType.getEntityClass(); if (entityClass == null) { continue; @@ -623,22 +638,23 @@ public class BukkitUtil extends WorldUtil { return types; } - private static void ensureLoaded(final String world, final int x, final int z, final Consumer chunkConsumer) { - PaperLib.getChunkAtAsync(getWorld(world), x >> 4, z >> 4, true).thenAccept(chunk -> - ensureMainThread(chunkConsumer, chunk)); + private static void ensureLoaded(final String world, final int x, final int z, + final Consumer chunkConsumer) { + PaperLib.getChunkAtAsync(getWorld(world), x >> 4, z >> 4, true) + .thenAccept(chunk -> ensureMainThread(chunkConsumer, chunk)); } private static void ensureLoaded(final Location location, final Consumer chunkConsumer) { - PaperLib.getChunkAtAsync(getLocation(location), true).thenAccept(chunk -> - ensureMainThread(chunkConsumer, chunk)); + PaperLib.getChunkAtAsync(getLocation(location), true) + .thenAccept(chunk -> ensureMainThread(chunkConsumer, chunk)); } private static void ensureMainThread(final Consumer consumer, final T value) { if (Bukkit.isPrimaryThread()) { consumer.accept(value); } else { - Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> - consumer.accept(value)); + Bukkit.getScheduler() + .runTask(BukkitMain.getPlugin(BukkitMain.class), () -> consumer.accept(value)); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/OfflinePlayerUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/OfflinePlayerUtil.java index 3fd2e99af..dcf5570f2 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/OfflinePlayerUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/OfflinePlayerUtil.java @@ -99,7 +99,8 @@ public class OfflinePlayerUtil { Class minecraftServerClass = getNmsClass("MinecraftServer"); Class dimensionManager = getNmsClass("DimensionManager"); Object overworld = getField(makeField(dimensionManager, "OVERWORLD"), null); - Method getWorldServer = makeMethod(minecraftServerClass, "getWorldServer", dimensionManager); + Method getWorldServer = + makeMethod(minecraftServerClass, "getWorldServer", dimensionManager); return callMethod(getWorldServer, server, overworld); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/SendChunk.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/SendChunk.java index 6cc879bc3..7a920fc8b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/SendChunk.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/SendChunk.java @@ -28,8 +28,8 @@ package com.plotsquared.bukkit.util; import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.ReflectionUtils.RefClass; import com.plotsquared.core.util.ReflectionUtils.RefConstructor; import com.plotsquared.core.util.ReflectionUtils.RefField; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java index c004a9e51..458e3ca58 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java @@ -75,8 +75,9 @@ public class UpdateUtility implements Listener { if (internalVersion.isLaterVersion(spigotVersion)) { PlotSquared .log(Captions.PREFIX + "&6There appears to be a PlotSquared update available!"); - PlotSquared.log(Captions.PREFIX + "&6You are running version " + internalVersion.versionString() - + ", &6latest version is " + spigotVersion); + PlotSquared.log( + Captions.PREFIX + "&6You are running version " + internalVersion.versionString() + + ", &6latest version is " + spigotVersion); PlotSquared .log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/77506/updates"); hasUpdate = true; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/LowerOfflineUUIDWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/LowerOfflineUUIDWrapper.java index f300c03eb..ad2be7ce3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/LowerOfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/LowerOfflineUUIDWrapper.java @@ -25,9 +25,9 @@ */ package com.plotsquared.bukkit.util.uuid; +import com.google.common.base.Charsets; import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.PlotPlayer; -import com.google.common.base.Charsets; import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; @@ -37,7 +37,8 @@ import java.util.UUID; public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper { @NotNull @Override public UUID getUUID(PlotPlayer player) { - return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8)); + return UUID.nameUUIDFromBytes( + ("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8)); } @Override public UUID getUUID(OfflinePlotPlayer player) { @@ -47,7 +48,8 @@ public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper { @Override public UUID getUUID(OfflinePlayer player) { return UUID.nameUUIDFromBytes( - ("OfflinePlayer:" + Objects.requireNonNull(player.getName()).toLowerCase()).getBytes(Charsets.UTF_8)); + ("OfflinePlayer:" + Objects.requireNonNull(player.getName()).toLowerCase()) + .getBytes(Charsets.UTF_8)); } @Override public UUID getUUID(String name) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/OfflineUUIDWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/OfflineUUIDWrapper.java index 421484d3d..66ca52814 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/OfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/OfflineUUIDWrapper.java @@ -25,6 +25,8 @@ */ package com.plotsquared.bukkit.util.uuid; +import com.google.common.base.Charsets; +import com.google.common.collect.BiMap; import com.plotsquared.bukkit.player.BukkitOfflinePlayer; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.player.OfflinePlotPlayer; @@ -32,8 +34,6 @@ import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDWrapper; -import com.google.common.base.Charsets; -import com.google.common.collect.BiMap; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.Server; @@ -60,7 +60,8 @@ public class OfflineUUIDWrapper extends UUIDWrapper { } @NotNull @Override public UUID getUUID(PlotPlayer player) { - return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)); + return UUID + .nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)); } @Override public UUID getUUID(OfflinePlotPlayer player) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/SQLUUIDHandler.java index 2d8e38f50..a08956369 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/uuid/SQLUUIDHandler.java @@ -25,18 +25,18 @@ */ package com.plotsquared.bukkit.util.uuid; +import com.google.common.collect.HashBiMap; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.SQLite; -import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.StringWrapper; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandlerImplementation; import com.plotsquared.core.util.uuid.UUIDWrapper; -import com.google.common.collect.HashBiMap; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; diff --git a/Core/src/main/java/com/plotsquared/core/IPlotMain.java b/Core/src/main/java/com/plotsquared/core/IPlotMain.java index 376e9c474..d54bcba01 100644 --- a/Core/src/main/java/com/plotsquared/core/IPlotMain.java +++ b/Core/src/main/java/com/plotsquared/core/IPlotMain.java @@ -233,7 +233,7 @@ public interface IPlotMain extends ILogger { * Gets the generator wrapper for a world (world) and generator (name). * * @param world the world to get the generator from - * @param name the name of the generator + * @param name the name of the generator * @return the generator being used for the provided world */ GeneratorWrapper getGenerator(String world, String name); diff --git a/Core/src/main/java/com/plotsquared/core/api/PlotAPI.java b/Core/src/main/java/com/plotsquared/core/api/PlotAPI.java index acf894c54..70bd11673 100644 --- a/Core/src/main/java/com/plotsquared/core/api/PlotAPI.java +++ b/Core/src/main/java/com/plotsquared/core/api/PlotAPI.java @@ -25,14 +25,14 @@ */ package com.plotsquared.core.api; -import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.EventDispatcher; @@ -60,7 +60,9 @@ import java.util.UUID; * * @version 5 */ -@SuppressWarnings({"unused", "WeakerAccess"}) @NoArgsConstructor public class PlotAPI { +@SuppressWarnings({"unused", "WeakerAccess"}) +@NoArgsConstructor +public class PlotAPI { /** * Gets all plots. diff --git a/Core/src/main/java/com/plotsquared/core/command/Add.java b/Core/src/main/java/com/plotsquared/core/command/Add.java index 4a5da7beb..bc4905c68 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Add.java +++ b/Core/src/main/java/com/plotsquared/core/command/Add.java @@ -28,12 +28,12 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import java.util.Iterator; import java.util.Set; @@ -52,7 +52,8 @@ public class Add extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(final PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); diff --git a/Core/src/main/java/com/plotsquared/core/command/Alias.java b/Core/src/main/java/com/plotsquared/core/command/Alias.java index 9ca6804e6..b1d8d8161 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Alias.java +++ b/Core/src/main/java/com/plotsquared/core/command/Alias.java @@ -28,12 +28,12 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.StringWrapper; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.uuid.UUIDHandler; @CommandDeclaration(command = "setalias", diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index aa00f251f..d90666c35 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -25,31 +25,31 @@ */ package com.plotsquared.core.command; -import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationUtil; +import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.generator.AugmentedUtils; import com.plotsquared.core.generator.HybridPlotWorld; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.plot.message.PlotMessage; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.plot.SetupObject; -import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.RegionUtil; import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.WorldUtil; -import com.plotsquared.core.util.RegionUtil; +import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.util.task.RunnableVal3; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; @@ -170,15 +170,16 @@ public class Area extends SubCommand { ChunkManager.largeRegionTask(world, region, new RunnableVal() { @Override public void run(BlockVector2 value) { - AugmentedUtils.generate(null, world, value.getX(), - value.getZ(), null); + AugmentedUtils + .generate(null, world, value.getX(), + value.getZ(), null); } }, null); } } else { MainUtil.sendMessage(player, - "An error occurred while creating the world: " - + area.getWorldName()); + "An error occurred while creating the world: " + area + .getWorldName()); } }; if (hasConfirmation(player)) { @@ -239,11 +240,13 @@ public class Area extends SubCommand { break; case "f": case "floor": - pa.TOP_BLOCK = ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); + pa.TOP_BLOCK = + ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); break; case "m": case "main": - pa.MAIN_BLOCK = ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); + pa.MAIN_BLOCK = + ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); break; case "w": case "wall": @@ -252,14 +255,19 @@ public class Area extends SubCommand { break; case "b": case "border": - pa.WALL_BLOCK = ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); + pa.WALL_BLOCK = + ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); break; case "terrain": - pa.setTerrain(PlotAreaTerrainType.fromString(pair[1]).orElseThrow(() -> new IllegalArgumentException(pair[1] + " is not a valid terrain."))); + pa.setTerrain(PlotAreaTerrainType.fromString(pair[1]) + .orElseThrow(() -> new IllegalArgumentException( + pair[1] + " is not a valid terrain."))); object.terrain = pa.getTerrain(); break; case "type": - pa.setType(PlotAreaType.fromString(pair[1]).orElseThrow(() -> new IllegalArgumentException(pair[1] + " is not a valid type."))); + pa.setType(PlotAreaType.fromString(pair[1]).orElseThrow( + () -> new IllegalArgumentException( + pair[1] + " is not a valid type."))); object.type = pa.getType(); break; default: @@ -291,8 +299,8 @@ public class Area extends SubCommand { TeleportCause.COMMAND); } else { MainUtil.sendMessage(player, - "An error occurred while creating the world: " - + pa.getWorldName()); + "An error occurred while creating the world: " + pa + .getWorldName()); } try { PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); @@ -376,10 +384,11 @@ public class Area extends SubCommand { percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE; region = "N/A"; } - String value = "&r$1NAME: " + name + "\n$1Type: $2" + area.getType() + "\n$1Terrain: $2" - + area.getTerrain() + "\n$1Usage: $2" + String.format("%.2f", percent) + '%' - + "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + "\n$1Region: $2" - + region + "\n$1Generator: $2" + generator; + String value = + "&r$1NAME: " + name + "\n$1Type: $2" + area.getType() + "\n$1Terrain: $2" + area + .getTerrain() + "\n$1Usage: $2" + String.format("%.2f", percent) + '%' + + "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + + "\n$1Region: $2" + region + "\n$1Generator: $2" + generator; MainUtil.sendMessage(player, Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER.getTranslated(), false); @@ -418,7 +427,8 @@ public class Area extends SubCommand { if (area.getType() == PlotAreaType.PARTIAL) { PlotId min = area.getMin(); PlotId max = area.getMax(); - name = area.getWorldName() + ';' + area.getId() + ';' + min + ';' + max; + name = area.getWorldName() + ';' + area.getId() + ';' + min + ';' + + max; int size = (max.x - min.x + 1) * (max.y - min.y + 1); percent = claimed == 0 ? 0 : size / (double) claimed; region = area.getRegion().toString(); @@ -468,7 +478,8 @@ public class Area extends SubCommand { new RunnableVal() { @Override public void run(BlockVector2 value) { AugmentedUtils - .generate(null, area.getWorldName(), value.getX(), value.getZ(), null); + .generate(null, area.getWorldName(), value.getX(), value.getZ(), + null); } }, () -> player.sendMessage("Regen complete")); return true; @@ -501,10 +512,11 @@ public class Area extends SubCommand { + (region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) / 2, 0, region.getMinimumPoint().getZ() + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) / 2); - WorldUtil.IMP.getHighestBlock(area.getWorldName(), center.getX(), center.getZ(), y -> { - center.setY(1 + y); - player.teleport(center, TeleportCause.COMMAND); - }); + WorldUtil.IMP + .getHighestBlock(area.getWorldName(), center.getX(), center.getZ(), y -> { + center.setY(1 + y); + player.teleport(center, TeleportCause.COMMAND); + }); } return true; case "delete": diff --git a/Core/src/main/java/com/plotsquared/core/command/Auto.java b/Core/src/main/java/com/plotsquared/core/command/Auto.java index 3fa8d8ee6..3b07db443 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Auto.java +++ b/Core/src/main/java/com/plotsquared/core/command/Auto.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.common.primitives.Ints; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; @@ -33,20 +34,19 @@ import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.PlayerAutoPlotEvent; import com.plotsquared.core.events.PlotAutoMergeEvent; import com.plotsquared.core.events.Result; -import com.plotsquared.core.util.Expression; +import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.events.TeleportCause; -import com.plotsquared.core.util.task.AutoClaimFinishTask; import com.plotsquared.core.util.EconHandler; +import com.plotsquared.core.util.Expression; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.AutoClaimFinishTask; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import com.google.common.primitives.Ints; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -117,7 +117,8 @@ public class Auto extends SubCommand { final String schematic) { Set plots = player.getPlots(); if (!plots.isEmpty()) { - plots.iterator().next().teleportPlayer(player, TeleportCause.COMMAND, result -> {}); + plots.iterator().next().teleportPlayer(player, TeleportCause.COMMAND, result -> { + }); } else { autoClaimSafe(player, area, start, schematic); } @@ -149,7 +150,8 @@ public class Auto extends SubCommand { player.setMeta(Auto.class.getName(), true); autoClaimFromDatabase(player, area, start, new RunnableVal() { @Override public void run(final Plot plot) { - TaskManager.IMP.sync(new AutoClaimFinishTask(player, plot, area, allowedPlots, schematic)); + TaskManager.IMP + .sync(new AutoClaimFinishTask(player, plot, area, allowedPlots, schematic)); } }); } @@ -243,8 +245,8 @@ public class Auto extends SubCommand { return false; } final int allowed_plots = player.getAllowedPlots(); - if (!force && (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player, plotarea, - allowed_plots, size_x, size_z))) { + if (!force && (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player, + plotarea, allowed_plots, size_x, size_z))) { return false; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Biome.java b/Core/src/main/java/com/plotsquared/core/command/Biome.java index fca7d037a..c7df94a48 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Biome.java +++ b/Core/src/main/java/com/plotsquared/core/command/Biome.java @@ -26,8 +26,8 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.StringMan; import com.sk89q.worldedit.world.biome.BiomeType; diff --git a/Core/src/main/java/com/plotsquared/core/command/Buy.java b/Core/src/main/java/com/plotsquared/core/command/Buy.java index 32fe02d60..a660a39a1 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Buy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Buy.java @@ -29,14 +29,14 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.PriceFlag; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.uuid.UUIDHandler; import java.util.Set; @@ -54,7 +54,8 @@ public class Buy extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(final PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, final RunnableVal2 whenDone) { @@ -82,15 +83,16 @@ public class Buy extends Command { confirm.run(this, () -> { Captions.REMOVED_BALANCE.send(player, price); EconHandler.manager - .depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.getOwnerAbs()), price); + .depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.getOwnerAbs()), + price); PlotPlayer owner = UUIDHandler.getPlayer(plot.getOwnerAbs()); if (owner != null) { Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price); } PlotFlag plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class); - PlotFlagRemoveEvent - event = PlotSquared.get().getEventDispatcher().callFlagRemove(plotFlag, plot); - if(event.getEventResult() != Result.DENY) { + PlotFlagRemoveEvent event = + PlotSquared.get().getEventDispatcher().callFlagRemove(plotFlag, plot); + if (event.getEventResult() != Result.DENY) { plot.removeFlag(event.getFlag()); } plot.setOwner(player.getUUID()); diff --git a/Core/src/main/java/com/plotsquared/core/command/Claim.java b/Core/src/main/java/com/plotsquared/core/command/Claim.java index b061e1fb6..668142ce5 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Claim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Claim.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.command; +import com.google.common.primitives.Ints; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; @@ -34,16 +34,16 @@ import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.PlayerClaimPlotEvent; import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.Result; -import com.plotsquared.core.util.EconHandler; -import com.plotsquared.core.util.Permissions; -import com.plotsquared.core.util.task.TaskManager; -import com.plotsquared.core.util.task.RunnableVal; -import com.google.common.primitives.Ints; import com.plotsquared.core.location.Direction; -import com.plotsquared.core.util.Expression; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; +import com.plotsquared.core.util.EconHandler; +import com.plotsquared.core.util.Expression; +import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.util.task.TaskManager; @CommandDeclaration(command = "claim", aliases = "c", @@ -64,8 +64,8 @@ public class Claim extends SubCommand { if (plot == null) { return sendMessage(player, Captions.NOT_IN_PLOT); } - PlayerClaimPlotEvent - event = PlotSquared.get().getEventDispatcher().callClaim(player, plot, schematic); + PlayerClaimPlotEvent event = + PlotSquared.get().getEventDispatcher().callClaim(player, plot, schematic); schematic = event.getSchematic(); if (event.getEventResult() == Result.DENY) { sendMessage(player, Captions.EVENT_DENIED, "Claim"); @@ -133,8 +133,8 @@ public class Claim extends SubCommand { DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { if (!plot.claim(player, true, finalSchematic, false)) { - PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + - String.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString())); + PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String + .format("Failed to claim plot %s", plot.getId().toCommaSeparatedString())); sendMessage(player, Captions.PLOT_NOT_CLAIMED); plot.setOwnerAbs(null); } else if (area.isAutoMerge()) { @@ -148,8 +148,9 @@ public class Claim extends SubCommand { } } }), () -> { - PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + - String.format("Failed to add plot %s to the database", plot.getId().toCommaSeparatedString())); + PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String + .format("Failed to add plot %s to the database", + plot.getId().toCommaSeparatedString())); sendMessage(player, Captions.PLOT_NOT_CLAIMED); plot.setOwnerAbs(null); }); diff --git a/Core/src/main/java/com/plotsquared/core/command/Clear.java b/Core/src/main/java/com/plotsquared/core/command/Clear.java index 3cffecada..cc8ab64ab 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Clear.java +++ b/Core/src/main/java/com/plotsquared/core/command/Clear.java @@ -30,16 +30,16 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.AnalysisFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; -import com.plotsquared.core.queue.GlobalBlockQueue; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import java.util.concurrent.CompletableFuture; @@ -62,7 +62,8 @@ public class Clear extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(final PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage()); diff --git a/Core/src/main/java/com/plotsquared/core/command/Cluster.java b/Core/src/main/java/com/plotsquared/core/command/Cluster.java index 56bed3d95..ae220831e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Cluster.java +++ b/Core/src/main/java/com/plotsquared/core/command/Cluster.java @@ -29,14 +29,14 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; +import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotCluster; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.uuid.UUIDHandler; diff --git a/Core/src/main/java/com/plotsquared/core/command/Command.java b/Core/src/main/java/com/plotsquared/core/command/Command.java index a89533733..6535e3b2c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Command.java +++ b/Core/src/main/java/com/plotsquared/core/command/Command.java @@ -25,18 +25,18 @@ */ package com.plotsquared.core.command; -import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.message.PlotMessage; +import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringComparison; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import java.io.IOException; import java.lang.reflect.InvocationTargetException; diff --git a/Core/src/main/java/com/plotsquared/core/command/CommandDeclaration.java b/Core/src/main/java/com/plotsquared/core/command/CommandDeclaration.java index 693ed0cb2..105543ba0 100644 --- a/Core/src/main/java/com/plotsquared/core/command/CommandDeclaration.java +++ b/Core/src/main/java/com/plotsquared/core/command/CommandDeclaration.java @@ -30,7 +30,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -@Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) public @interface CommandDeclaration { String command(); diff --git a/Core/src/main/java/com/plotsquared/core/command/Comment.java b/Core/src/main/java/com/plotsquared/core/command/Comment.java index 58386802e..284587106 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Comment.java +++ b/Core/src/main/java/com/plotsquared/core/command/Comment.java @@ -26,11 +26,11 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.comment.CommentInbox; -import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.plot.comment.CommentManager; +import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.uuid.UUIDHandler; @@ -87,8 +87,8 @@ public class Comment extends SubCommand { String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " "); PlotComment comment = - new PlotComment(player.getLocation().getWorld(), plot.getId(), message, player.getName(), inbox.toString(), - System.currentTimeMillis()); + new PlotComment(player.getLocation().getWorld(), plot.getId(), message, + player.getName(), inbox.toString(), System.currentTimeMillis()); boolean result = inbox.addComment(plot, comment); if (!result) { sendMessage(player, Captions.NO_PLOT_INBOX, ""); diff --git a/Core/src/main/java/com/plotsquared/core/command/Condense.java b/Core/src/main/java/com/plotsquared/core/command/Condense.java index 48195db08..f8a65407d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Condense.java +++ b/Core/src/main/java/com/plotsquared/core/command/Condense.java @@ -26,14 +26,14 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; -import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.task.TaskManager; import java.util.ArrayList; import java.util.Collection; diff --git a/Core/src/main/java/com/plotsquared/core/command/Continue.java b/Core/src/main/java/com/plotsquared/core/command/Continue.java index f2a03ba2a..d366b2ff6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Continue.java +++ b/Core/src/main/java/com/plotsquared/core/command/Continue.java @@ -30,10 +30,10 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; diff --git a/Core/src/main/java/com/plotsquared/core/command/Copy.java b/Core/src/main/java/com/plotsquared/core/command/Copy.java index 2de5b35e8..702255064 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Copy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Copy.java @@ -27,8 +27,8 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; diff --git a/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java b/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java index fcd45f1fe..258467500 100644 --- a/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java +++ b/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java @@ -29,8 +29,8 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.generator.HybridPlotWorld; import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; @CommandDeclaration(command = "createroadschematic", diff --git a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java index df23c4ac7..c652957e4 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java @@ -27,17 +27,17 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.database.DBFunc; +import com.plotsquared.core.database.Database; import com.plotsquared.core.database.MySQL; import com.plotsquared.core.database.SQLManager; import com.plotsquared.core.database.SQLite; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.task.TaskManager; -import com.plotsquared.core.database.Database; import java.io.File; import java.sql.SQLException; diff --git a/Core/src/main/java/com/plotsquared/core/command/Debug.java b/Core/src/main/java/com/plotsquared/core/command/Debug.java index 988adde3d..2926fa6df 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Debug.java +++ b/Core/src/main/java/com/plotsquared/core/command/Debug.java @@ -58,34 +58,35 @@ public class Debug extends SubCommand { if (args.length > 0 && "loadedchunks".equalsIgnoreCase(args[0])) { final long start = System.currentTimeMillis(); MainUtil.sendMessage(player, "Fetching loaded chunks..."); - TaskManager.runTaskAsync(() -> MainUtil.sendMessage(player,"Loaded chunks: " + - ChunkManager.manager.getChunkChunks(player.getLocation().getWorld()).size() + "(" + (System.currentTimeMillis() - start) + "ms) using thread: " + - Thread.currentThread().getName())); + TaskManager.runTaskAsync(() -> MainUtil.sendMessage(player, + "Loaded chunks: " + ChunkManager.manager + .getChunkChunks(player.getLocation().getWorld()).size() + "(" + ( + System.currentTimeMillis() - start) + "ms) using thread: " + Thread + .currentThread().getName())); return true; } if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) { EntityCategories.init(); player.sendMessage(Captions.PREFIX.getTranslated() + "§cEntity Categories: "); EntityCategory.REGISTRY.forEach(category -> { - final StringBuilder builder = new StringBuilder("§7- §6") - .append(category.getId()).append("§7: §6"); + final StringBuilder builder = + new StringBuilder("§7- §6").append(category.getId()).append("§7: §6"); for (final EntityType entityType : category.getAll()) { builder.append(entityType.getId()).append(" "); } player.sendMessage(Captions.PREFIX.getTranslated() + builder.toString()); }); - EntityType.REGISTRY.values().stream() - .sorted(Comparator.comparing(EntityType::getId)) - .forEach(entityType -> { - long categoryCount = EntityCategory.REGISTRY.values() - .stream() - .filter(category -> category.contains(entityType)) - .count(); - if (categoryCount > 0) { - return; - } - player.sendMessage(Captions.PREFIX.getTranslated() + entityType.getName() + " is in " + categoryCount + " categories"); - }); + EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId)) + .forEach(entityType -> { + long categoryCount = EntityCategory.REGISTRY.values().stream() + .filter(category -> category.contains(entityType)).count(); + if (categoryCount > 0) { + return; + } + player.sendMessage( + Captions.PREFIX.getTranslated() + entityType.getName() + " is in " + + categoryCount + " categories"); + }); return true; } if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugClaimTest.java b/Core/src/main/java/com/plotsquared/core/command/DebugClaimTest.java index 40fa3f105..5412ed6a2 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugClaimTest.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugClaimTest.java @@ -25,20 +25,20 @@ */ package com.plotsquared.core.command; +import com.google.common.collect.BiMap; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotManager; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.MainUtil; -import com.plotsquared.core.util.uuid.UUIDHandler; +import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.WorldUtil; -import com.google.common.collect.BiMap; +import com.plotsquared.core.util.uuid.UUIDHandler; import com.sk89q.worldedit.math.BlockVector2; import java.util.ArrayList; diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java index aef2bc8c0..8976c3348 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -25,27 +25,27 @@ */ package com.plotsquared.core.command; +import com.google.common.io.Files; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; -import com.plotsquared.core.plot.flag.GlobalFlagContainer; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.generator.HybridUtils; -import com.plotsquared.core.util.WEManager; -import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.OfflinePlotPlayer; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; +import com.plotsquared.core.plot.expiration.ExpireManager; +import com.plotsquared.core.plot.expiration.PlotAnalysis; +import com.plotsquared.core.plot.flag.GlobalFlagContainer; +import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.message.PlotMessage; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.MainUtil; @@ -53,13 +53,13 @@ import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.WEManager; +import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; -import com.plotsquared.core.util.WorldUtil; -import com.plotsquared.core.queue.GlobalBlockQueue; -import com.plotsquared.core.plot.expiration.ExpireManager; -import com.plotsquared.core.plot.expiration.PlotAnalysis; -import com.google.common.io.Files; import com.sk89q.worldedit.world.block.BlockState; import javax.script.Bindings; @@ -72,7 +72,12 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.sql.Timestamp; -import java.util.*; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.UUID; import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "debugexec", @@ -267,8 +272,8 @@ public class DebugExec extends SubCommand { } boolean result; if (HybridUtils.regions != null) { - result = - HybridUtils.manager.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>()); + result = HybridUtils.manager + .scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>()); } else { result = HybridUtils.manager.scheduleRoadUpdate(area, 0); } @@ -333,7 +338,8 @@ public class DebugExec extends SubCommand { System.getProperty("line.separator")); new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null, RequiredType.NONE, CommandCategory.DEBUG) { - @Override public CompletableFuture execute(PlotPlayer player, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { try { diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java b/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java index ee831aad5..9cca145a5 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java @@ -25,17 +25,17 @@ */ package com.plotsquared.core.command; +import com.google.common.base.Charsets; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.plot.world.SinglePlotAreaManager; -import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.WorldUtil; -import com.google.common.base.Charsets; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.util.uuid.UUIDHandler; import java.io.File; import java.util.UUID; @@ -51,7 +51,8 @@ public class DebugImportWorlds extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { // UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)) diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java index 9c303d5bf..388bd0460 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java @@ -25,17 +25,17 @@ */ package com.plotsquared.core.command; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.net.IncendoPaster; import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.PremiumVerification; +import com.plotsquared.core.util.net.IncendoPaster; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.plotsquared.core.util.PremiumVerification; import lombok.NonNull; import java.io.BufferedReader; @@ -83,7 +83,8 @@ public class DebugPaste extends SubCommand { b.append("# PlotSquared Information\n"); b.append("Resource ID: ").append(PremiumVerification.getResourceID()).append("\n"); b.append("Download ID: ").append(PremiumVerification.getDownloadID()).append("\n"); - b.append("This PlotSquared version is licensed to the spigot user ").append(PremiumVerification.getUserID()).append("\n\n"); + b.append("This PlotSquared version is licensed to the spigot user ") + .append(PremiumVerification.getUserID()).append("\n\n"); b.append("# Server Information\n"); b.append("Server Version: ").append(PlotSquared.get().IMP.getServerImplementation()) .append("\n"); diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java index 534241c73..07ce9a516 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java @@ -29,10 +29,10 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.generator.HybridPlotManager; import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotManager; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.MainUtil; import java.util.Arrays; diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugSaveTest.java b/Core/src/main/java/com/plotsquared/core/command/DebugSaveTest.java index 3cd184abe..dc2fc612d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugSaveTest.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugSaveTest.java @@ -27,8 +27,8 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.database.DBFunc; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import java.util.ArrayList; diff --git a/Core/src/main/java/com/plotsquared/core/command/Delete.java b/Core/src/main/java/com/plotsquared/core/command/Delete.java index 97f262271..1a95046df 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Delete.java +++ b/Core/src/main/java/com/plotsquared/core/command/Delete.java @@ -29,12 +29,12 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.Result; -import com.plotsquared.core.util.Expression; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.EconHandler; +import com.plotsquared.core.util.Expression; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.TaskManager; @@ -62,7 +62,8 @@ public class Delete extends SubCommand { if (!plot.hasOwner()) { return !sendMessage(player, Captions.PLOT_UNOWNED); } - Result eventResult = PlotSquared.get().getEventDispatcher().callDelete(plot).getEventResult(); + Result eventResult = + PlotSquared.get().getEventDispatcher().callDelete(plot).getEventResult(); if (eventResult == Result.DENY) { sendMessage(player, Captions.EVENT_DENIED, "Delete"); return true; diff --git a/Core/src/main/java/com/plotsquared/core/command/Deny.java b/Core/src/main/java/com/plotsquared/core/command/Deny.java index a8a9290b8..d591bfa1a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Deny.java +++ b/Core/src/main/java/com/plotsquared/core/command/Deny.java @@ -29,12 +29,12 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; -import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.uuid.UUIDHandler; import com.sk89q.worldedit.world.gamemode.GameModes; import java.util.Set; diff --git a/Core/src/main/java/com/plotsquared/core/command/Desc.java b/Core/src/main/java/com/plotsquared/core/command/Desc.java index b7d2de59a..f128920e8 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Desc.java +++ b/Core/src/main/java/com/plotsquared/core/command/Desc.java @@ -30,9 +30,9 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; -import com.plotsquared.core.plot.flag.implementations.DescriptionFlag; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.flag.implementations.DescriptionFlag; import com.plotsquared.core.util.MainUtil; @CommandDeclaration(command = "setdescription", diff --git a/Core/src/main/java/com/plotsquared/core/command/Done.java b/Core/src/main/java/com/plotsquared/core/command/Done.java index b1afc67ac..4e9015e04 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Done.java +++ b/Core/src/main/java/com/plotsquared/core/command/Done.java @@ -31,17 +31,17 @@ import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotDoneEvent; import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.Result; -import com.plotsquared.core.plot.flag.PlotFlag; -import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.util.MainUtil; -import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.plot.expiration.PlotAnalysis; +import com.plotsquared.core.plot.flag.PlotFlag; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; +import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.RunnableVal; @CommandDeclaration(command = "done", aliases = {"submit"}, diff --git a/Core/src/main/java/com/plotsquared/core/command/Download.java b/Core/src/main/java/com/plotsquared/core/command/Download.java index 85dc1cd87..25e3c13d7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Download.java +++ b/Core/src/main/java/com/plotsquared/core/command/Download.java @@ -28,15 +28,15 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.plot.flag.implementations.DoneFlag; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.task.RunnableVal; import com.sk89q.jnbt.CompoundTag; import java.net.URL; diff --git a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java index a7355b092..80ee2512a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java @@ -32,24 +32,24 @@ import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.GlobalFlagContainer; import com.plotsquared.core.plot.flag.InternalFlag; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.types.IntegerFlag; import com.plotsquared.core.plot.flag.types.ListFlag; -import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.message.PlotMessage; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringComparison; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.helpmenu.HelpMenu; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -206,7 +206,8 @@ public final class FlagCommand extends Command { return null; } - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { if (args.length == 0 || !Arrays @@ -220,7 +221,8 @@ public final class FlagCommand extends Command { return super.execute(player, args, confirm, whenDone); } - @Override public Collection tab(final PlotPlayer player, final String[] args, + @Override + public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { if (args.length == 1) { return Stream @@ -356,7 +358,8 @@ public final class FlagCommand extends Command { return; } } - } final String value = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " "); + } + final String value = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " "); final PlotFlag parsed; try { parsed = event.getFlag().parse(value); @@ -448,7 +451,8 @@ public final class FlagCommand extends Command { PlotFlag plotFlag = parsedFlag.createFlagInstance(list); PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot); if (addEvent.getEventResult() == Result.DENY) { - sendMessage(player, Captions.EVENT_DENIED, "Re-addition of " + plotFlag.getName()); + sendMessage(player, Captions.EVENT_DENIED, + "Re-addition of " + plotFlag.getName()); return; } if (plot.setFlag(addEvent.getFlag())) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Grant.java b/Core/src/main/java/com/plotsquared/core/command/Grant.java index ea2171c80..acec1b084 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Grant.java +++ b/Core/src/main/java/com/plotsquared/core/command/Grant.java @@ -25,17 +25,17 @@ */ package com.plotsquared.core.command; +import com.google.common.primitives.Ints; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import com.plotsquared.core.util.MainUtil; -import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.uuid.UUIDHandler; -import com.google.common.primitives.Ints; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -51,7 +51,8 @@ public class Grant extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(final PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { checkTrue(args.length >= 1 && args.length <= 2, Captions.COMMAND_SYNTAX, getUsage()); diff --git a/Core/src/main/java/com/plotsquared/core/command/Help.java b/Core/src/main/java/com/plotsquared/core/command/Help.java index 8f284c186..a1bbdc244 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Help.java +++ b/Core/src/main/java/com/plotsquared/core/command/Help.java @@ -27,12 +27,12 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.helpmenu.HelpMenu; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import java.util.concurrent.CompletableFuture; @@ -51,7 +51,8 @@ public class Help extends Command { return true; } - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { switch (args.length) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Inbox.java b/Core/src/main/java/com/plotsquared/core/command/Inbox.java index 00154570c..938033758 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Inbox.java +++ b/Core/src/main/java/com/plotsquared/core/command/Inbox.java @@ -26,14 +26,14 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.comment.CommentInbox; -import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.plot.comment.CommentManager; +import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.task.RunnableVal; import java.util.List; diff --git a/Core/src/main/java/com/plotsquared/core/command/Info.java b/Core/src/main/java/com/plotsquared/core/command/Info.java index a6fe53fbb..23c63450b 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Info.java +++ b/Core/src/main/java/com/plotsquared/core/command/Info.java @@ -28,11 +28,11 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; -import com.plotsquared.core.plot.flag.implementations.HideInfoFlag; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.flag.implementations.HideInfoFlag; import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.task.RunnableVal; @CommandDeclaration(command = "info", aliases = "i", diff --git a/Core/src/main/java/com/plotsquared/core/command/Kick.java b/Core/src/main/java/com/plotsquared/core/command/Kick.java index f30c4d081..1d113a874 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Kick.java +++ b/Core/src/main/java/com/plotsquared/core/command/Kick.java @@ -29,12 +29,12 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; -import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.uuid.UUIDHandler; import java.util.HashSet; import java.util.Set; diff --git a/Core/src/main/java/com/plotsquared/core/command/Leave.java b/Core/src/main/java/com/plotsquared/core/command/Leave.java index 32c4e1ae8..fdd2d70b4 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Leave.java +++ b/Core/src/main/java/com/plotsquared/core/command/Leave.java @@ -27,11 +27,11 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import com.plotsquared.core.util.MainUtil; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -47,7 +47,8 @@ public class Leave extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); diff --git a/Core/src/main/java/com/plotsquared/core/command/Like.java b/Core/src/main/java/com/plotsquared/core/command/Like.java index 305ae645e..9414985c3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Like.java +++ b/Core/src/main/java/com/plotsquared/core/command/Like.java @@ -30,11 +30,11 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.PlotRateEvent; -import com.plotsquared.core.plot.flag.implementations.DoneFlag; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.plot.Rating; import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.Rating; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.TaskManager; @@ -71,7 +71,8 @@ public class Like extends SubCommand { for (final Plot plot : plots) { if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(plot)) && plot .isBasePlot() && (!plot.getLikes().containsKey(uuid))) { - plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {}); + plot.teleportPlayer(player, TeleportCause.COMMAND, result -> { + }); MainUtil.sendMessage(player, Captions.RATE_THIS); return true; } @@ -123,8 +124,8 @@ public class Like extends SubCommand { rating = 1; } plot.addRating(uuid, new Rating(rating)); - final PlotRateEvent - event = PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating)); + final PlotRateEvent event = + PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating)); if (event.getRating() != null) { plot.addRating(uuid, event.getRating()); if (like) { diff --git a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java index 28d322c4a..8d151fb10 100644 --- a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java @@ -29,22 +29,22 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared.SortType; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.flag.implementations.DoneFlag; -import com.plotsquared.core.plot.flag.implementations.PriceFlag; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.plot.message.PlotMessage; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Rating; -import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.plot.expiration.ExpireManager; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; +import com.plotsquared.core.plot.flag.implementations.PriceFlag; +import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringComparison; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.uuid.UUIDHandler; -import com.plotsquared.core.plot.expiration.ExpireManager; import java.util.ArrayList; import java.util.Arrays; diff --git a/Core/src/main/java/com/plotsquared/core/command/Load.java b/Core/src/main/java/com/plotsquared/core/command/Load.java index fca5e67a3..58e2197b9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Load.java +++ b/Core/src/main/java/com/plotsquared/core/command/Load.java @@ -28,15 +28,15 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.schematic.Schematic; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.SchematicHandler; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import java.net.MalformedURLException; diff --git a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java index 263012e0f..fb1dc68ed 100644 --- a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java @@ -27,16 +27,16 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.player.ConsolePlayer; -import com.plotsquared.core.util.Expression; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.ConsolePlayer; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.util.EconHandler; +import com.plotsquared.core.util.Expression; +import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import com.plotsquared.core.util.EconHandler; -import com.plotsquared.core.util.Permissions; import java.util.Arrays; import java.util.concurrent.CompletableFuture; @@ -167,7 +167,8 @@ public class MainCommand extends Command { if (EconHandler.manager != null) { PlotArea area = player.getApplicablePlotArea(); if (area != null) { - Expression priceEval = area.getPrices().get(cmd.getFullId()); + Expression priceEval = + area.getPrices().get(cmd.getFullId()); Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; if (price != null && EconHandler.manager.getMoney(player) < price) { @@ -215,7 +216,8 @@ public class MainCommand extends Command { return true; } - @Override public CompletableFuture execute(final PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { // Clear perm caching // @@ -253,7 +255,8 @@ public class MainCommand extends Command { if (EconHandler.manager != null) { PlotArea area = player.getApplicablePlotArea(); if (area != null) { - Expression priceEval = area.getPrices().get(cmd.getFullId()); + Expression priceEval = + area.getPrices().get(cmd.getFullId()); Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; if (price != 0d && EconHandler.manager.getMoney(player) < price) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Merge.java b/Core/src/main/java/com/plotsquared/core/command/Merge.java index 81856bbb4..742b7fe10 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Merge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Merge.java @@ -31,12 +31,12 @@ import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.Result; import com.plotsquared.core.location.Direction; -import com.plotsquared.core.util.Expression; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.EconHandler; +import com.plotsquared.core.util.Expression; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; @@ -182,7 +182,8 @@ public class Merge extends SubCommand { } else { terrain = true; } - if (!force && !terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { + if (!force && !terrain && !Permissions + .hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); return true; diff --git a/Core/src/main/java/com/plotsquared/core/command/Middle.java b/Core/src/main/java/com/plotsquared/core/command/Middle.java index 0eddec2e5..58e7e437b 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Middle.java +++ b/Core/src/main/java/com/plotsquared/core/command/Middle.java @@ -26,10 +26,10 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; /** * @author manuelgu, altered by Citymonstret diff --git a/Core/src/main/java/com/plotsquared/core/command/Move.java b/Core/src/main/java/com/plotsquared/core/command/Move.java index 4fdf0ea0b..e95c35a1c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Move.java +++ b/Core/src/main/java/com/plotsquared/core/command/Move.java @@ -28,13 +28,13 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import java.util.concurrent.CompletableFuture; @@ -46,7 +46,8 @@ import java.util.concurrent.CompletableFuture; requiredType = RequiredType.PLAYER) public class Move extends SubCommand { - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { Location location = player.getLocation(); @@ -94,16 +95,16 @@ public class Move extends SubCommand { return CompletableFuture.completedFuture(false); } - return plot1.move(plot2, () -> {}, false) - .thenApply(result -> { - if (result) { - MainUtil.sendMessage(player, Captions.MOVE_SUCCESS); - return true; - } else { - MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED); - return false; - } - }); + return plot1.move(plot2, () -> { + }, false).thenApply(result -> { + if (result) { + MainUtil.sendMessage(player, Captions.MOVE_SUCCESS); + return true; + } else { + MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED); + return false; + } + }); } @Override public boolean onCommand(final PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Music.java b/Core/src/main/java/com/plotsquared/core/command/Music.java index 9228c1ca7..78e0b74e1 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Music.java +++ b/Core/src/main/java/com/plotsquared/core/command/Music.java @@ -25,17 +25,17 @@ */ package com.plotsquared.core.command; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; -import com.plotsquared.core.plot.flag.PlotFlag; -import com.plotsquared.core.plot.flag.implementations.MusicFlag; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.PlotItemStack; +import com.plotsquared.core.plot.flag.PlotFlag; +import com.plotsquared.core.plot.flag.implementations.MusicFlag; import com.sk89q.worldedit.world.item.ItemTypes; import java.util.Arrays; diff --git a/Core/src/main/java/com/plotsquared/core/command/Near.java b/Core/src/main/java/com/plotsquared/core/command/Near.java index 8be253018..a7c020762 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Near.java +++ b/Core/src/main/java/com/plotsquared/core/command/Near.java @@ -26,11 +26,11 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import com.plotsquared.core.util.StringMan; import java.util.concurrent.CompletableFuture; @@ -45,7 +45,8 @@ public class Near extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); diff --git a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java index c8c31f916..db8ade16a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java @@ -28,8 +28,8 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.MainUtil; -import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.PremiumVerification; +import com.plotsquared.core.util.task.TaskManager; @CommandDeclaration(command = "plugin", permission = "plots.use", @@ -48,7 +48,8 @@ public class PluginCmd extends SubCommand { "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault $2& $1SirYwell"); MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki"); - MainUtil.sendMessage(player, "$2>> $1&lPremium$2: $1" + PremiumVerification.isPremium()); + MainUtil + .sendMessage(player, "$2>> $1&lPremium$2: $1" + PremiumVerification.isPremium()); }); return true; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Purge.java b/Core/src/main/java/com/plotsquared/core/command/Purge.java index a248e9a50..7ac505aa3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Purge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Purge.java @@ -29,10 +29,10 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.listener.PlotListener; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; diff --git a/Core/src/main/java/com/plotsquared/core/command/Rate.java b/Core/src/main/java/com/plotsquared/core/command/Rate.java index ab1f1b523..1d80a0c37 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Rate.java +++ b/Core/src/main/java/com/plotsquared/core/command/Rate.java @@ -30,13 +30,13 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.PlotRateEvent; -import com.plotsquared.core.plot.flag.implementations.DoneFlag; +import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.PlotItemStack; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Rating; -import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; @@ -84,7 +84,8 @@ public class Rate extends SubCommand { if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(p)) && p .isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p .isAdded(uuid)) { - p.teleportPlayer(player, TeleportCause.COMMAND, result -> {}); + p.teleportPlayer(player, TeleportCause.COMMAND, result -> { + }); MainUtil.sendMessage(player, Captions.RATE_THIS); return true; } @@ -140,8 +141,8 @@ public class Rate extends SubCommand { index.increment(); if (index.getValue() >= Settings.Ratings.CATEGORIES.size()) { int rV = rating.getValue(); - PlotRateEvent event = - PlotSquared.get().getEventDispatcher().callRating(this.player, plot, new Rating(rV)); + PlotRateEvent event = PlotSquared.get().getEventDispatcher() + .callRating(this.player, plot, new Rating(rV)); if (event.getRating() != null) { plot.addRating(this.player.getUUID(), event.getRating()); sendMessage(this.player, Captions.RATING_APPLIED, @@ -209,7 +210,8 @@ public class Rate extends SubCommand { sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString()); return; } - PlotRateEvent event = PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating)); + PlotRateEvent event = + PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating)); if (event.getRating() != null) { plot.addRating(uuid, event.getRating()); sendMessage(player, Captions.RATING_APPLIED, plot.getId().toString()); diff --git a/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java b/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java index 230c6eea1..c5334241e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java +++ b/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java @@ -29,9 +29,9 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.generator.HybridPlotManager; import com.plotsquared.core.generator.HybridUtils; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotManager; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.MainUtil; @CommandDeclaration(command = "regenallroads", diff --git a/Core/src/main/java/com/plotsquared/core/command/Relight.java b/Core/src/main/java/com/plotsquared/core/command/Relight.java index be6d8e95c..b41e80baa 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Relight.java +++ b/Core/src/main/java/com/plotsquared/core/command/Relight.java @@ -26,13 +26,13 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.queue.LocalBlockQueue; +import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import com.plotsquared.core.util.ChunkManager; -import com.plotsquared.core.queue.LocalBlockQueue; import java.util.concurrent.CompletableFuture; @@ -46,7 +46,8 @@ public class Relight extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(final PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { final Plot plot = player.getCurrentPlot(); diff --git a/Core/src/main/java/com/plotsquared/core/command/Reload.java b/Core/src/main/java/com/plotsquared/core/command/Reload.java index b099d3c02..2fc594d23 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Reload.java +++ b/Core/src/main/java/com/plotsquared/core/command/Reload.java @@ -25,13 +25,13 @@ */ package com.plotsquared.core.command; +import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.MemorySection; import com.plotsquared.core.configuration.file.YamlConfiguration; -import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.util.MainUtil; import java.io.IOException; @@ -52,8 +52,8 @@ public class Reload extends SubCommand { PlotSquared.get().setupConfigs(); Captions.load(PlotSquared.get().translationFile); PlotSquared.get().forEachPlotArea(area -> { - ConfigurationSection worldSection = - PlotSquared.get().worlds.getConfigurationSection("worlds." + area.getWorldName()); + ConfigurationSection worldSection = PlotSquared.get().worlds + .getConfigurationSection("worlds." + area.getWorldName()); if (worldSection == null) { return; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Remove.java b/Core/src/main/java/com/plotsquared/core/command/Remove.java index d461b6557..2ed34aca9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Remove.java +++ b/Core/src/main/java/com/plotsquared/core/command/Remove.java @@ -29,8 +29,8 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.uuid.UUIDHandler; @@ -95,29 +95,34 @@ public class Remove extends SubCommand { for (UUID uuid : uuids) { if (plot.getTrusted().contains(uuid)) { if (plot.removeTrusted(uuid)) { - PlotSquared - .get().getEventDispatcher().callTrusted(player, plot, uuid, false); + PlotSquared.get().getEventDispatcher() + .callTrusted(player, plot, uuid, false); count++; } } else if (plot.getMembers().contains(uuid)) { if (plot.removeMember(uuid)) { - PlotSquared.get().getEventDispatcher().callMember(player, plot, uuid, false); + PlotSquared.get().getEventDispatcher() + .callMember(player, plot, uuid, false); count++; } } else if (plot.getDenied().contains(uuid)) { if (plot.removeDenied(uuid)) { - PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuid, false); + PlotSquared.get().getEventDispatcher() + .callDenied(player, plot, uuid, false); count++; } } else if (uuid == DBFunc.EVERYONE) { if (plot.removeTrusted(uuid)) { - PlotSquared.get().getEventDispatcher().callTrusted(player, plot, uuid, false); + PlotSquared.get().getEventDispatcher() + .callTrusted(player, plot, uuid, false); count++; } else if (plot.removeMember(uuid)) { - PlotSquared.get().getEventDispatcher().callMember(player, plot, uuid, false); + PlotSquared.get().getEventDispatcher() + .callMember(player, plot, uuid, false); count++; } else if (plot.removeDenied(uuid)) { - PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuid, false); + PlotSquared.get().getEventDispatcher() + .callDenied(player, plot, uuid, false); count++; } } diff --git a/Core/src/main/java/com/plotsquared/core/command/Save.java b/Core/src/main/java/com/plotsquared/core/command/Save.java index 4945cbefd..207ce9cbc 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Save.java +++ b/Core/src/main/java/com/plotsquared/core/command/Save.java @@ -28,13 +28,13 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.SchematicHandler; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import com.sk89q.jnbt.CompoundTag; diff --git a/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java b/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java index 287f31cf8..89c29b6c2 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java @@ -25,22 +25,22 @@ */ package com.plotsquared.core.command; +import com.google.common.collect.Lists; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.ConsolePlayer; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.schematic.Schematic; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import com.google.common.collect.Lists; import java.net.URL; import java.util.ArrayList; diff --git a/Core/src/main/java/com/plotsquared/core/command/Set.java b/Core/src/main/java/com/plotsquared/core/command/Set.java index ad378b29d..ca301a2fa 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Set.java +++ b/Core/src/main/java/com/plotsquared/core/command/Set.java @@ -27,14 +27,14 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotManager; -import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.PatternUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; -import com.plotsquared.core.queue.GlobalBlockQueue; -import com.plotsquared.core.util.PatternUtil; import com.sk89q.worldedit.function.pattern.Pattern; import java.util.ArrayList; diff --git a/Core/src/main/java/com/plotsquared/core/command/SetCommand.java b/Core/src/main/java/com/plotsquared/core/command/SetCommand.java index 4848dd11a..9531790cb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SetCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/SetCommand.java @@ -28,8 +28,8 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; diff --git a/Core/src/main/java/com/plotsquared/core/command/SetHome.java b/Core/src/main/java/com/plotsquared/core/command/SetHome.java index 0045c9135..d9182faed 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SetHome.java +++ b/Core/src/main/java/com/plotsquared/core/command/SetHome.java @@ -28,8 +28,8 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; @CommandDeclaration(command = "sethome", diff --git a/Core/src/main/java/com/plotsquared/core/command/Setup.java b/Core/src/main/java/com/plotsquared/core/command/Setup.java index d9854252e..9799a558d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Setup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Setup.java @@ -27,17 +27,17 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationNode; +import com.plotsquared.core.configuration.ConfigurationUtil; +import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.generator.GeneratorWrapper; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.plot.message.PlotMessage; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.SetupObject; -import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.StringMan; @@ -152,7 +152,8 @@ public class Setup extends SubCommand { types.add("augmented"); types.add("partial"); Optional plotAreaType; - if (args.length != 1 || !(plotAreaType = PlotAreaType.fromString(args[0])).isPresent()) { + if (args.length != 1 || !(plotAreaType = PlotAreaType.fromString(args[0])) + .isPresent()) { MainUtil.sendMessage(player, "&cYou must choose a world type!"); for (String type : types) { int i = allTypes.indexOf(type); @@ -272,7 +273,8 @@ public class Setup extends SubCommand { break; case 5: { // Choose terrain Optional optTerrain; - if (args.length != 1 || !(optTerrain = PlotAreaTerrainType.fromString(args[0])).isPresent()) { + if (args.length != 1 || !(optTerrain = PlotAreaTerrainType.fromString(args[0])) + .isPresent()) { MainUtil.sendMessage(player, "&cYou must choose the terrain!" + "\n&8 - &2NONE&8 - &7No terrain at all" + "\n&8 - &7ORE&8 - &7Just some ore veins and trees" diff --git a/Core/src/main/java/com/plotsquared/core/command/SubCommand.java b/Core/src/main/java/com/plotsquared/core/command/SubCommand.java index 95d830ab9..4b4dd1d89 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SubCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/SubCommand.java @@ -53,7 +53,8 @@ public abstract class SubCommand extends Command { return true; } - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { return CompletableFuture.completedFuture(onCommand(player, args)); diff --git a/Core/src/main/java/com/plotsquared/core/command/Swap.java b/Core/src/main/java/com/plotsquared/core/command/Swap.java index a6f62fd62..d8447c84e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Swap.java +++ b/Core/src/main/java/com/plotsquared/core/command/Swap.java @@ -27,12 +27,12 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import java.util.concurrent.CompletableFuture; @@ -44,13 +44,15 @@ import java.util.concurrent.CompletableFuture; requiredType = RequiredType.PLAYER) public class Swap extends SubCommand { - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { Location location = player.getLocation(); Plot plot1 = location.getPlotAbs(); if (plot1 == null) { - return CompletableFuture.completedFuture(!MainUtil.sendMessage(player, Captions.NOT_IN_PLOT)); + return CompletableFuture + .completedFuture(!MainUtil.sendMessage(player, Captions.NOT_IN_PLOT)); } if (!plot1.isOwner(player.getUUID()) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { @@ -79,16 +81,16 @@ public class Swap extends SubCommand { return CompletableFuture.completedFuture(false); } - return plot1.move(plot2, () -> {}, true) - .thenApply(result -> { - if (result) { - MainUtil.sendMessage(player, Captions.SWAP_SUCCESS); - return true; - } else { - MainUtil.sendMessage(player, Captions.SWAP_OVERLAP); - return false; - } - }); + return plot1.move(plot2, () -> { + }, true).thenApply(result -> { + if (result) { + MainUtil.sendMessage(player, Captions.SWAP_SUCCESS); + return true; + } else { + MainUtil.sendMessage(player, Captions.SWAP_OVERLAP); + return false; + } + }); } @Override public boolean onCommand(final PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Target.java b/Core/src/main/java/com/plotsquared/core/command/Target.java index 0b76c2a8e..5edc9b5a5 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Target.java +++ b/Core/src/main/java/com/plotsquared/core/command/Target.java @@ -28,8 +28,8 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.StringMan; diff --git a/Core/src/main/java/com/plotsquared/core/command/Template.java b/Core/src/main/java/com/plotsquared/core/command/Template.java index 4f06375fd..373f3b38e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Template.java +++ b/Core/src/main/java/com/plotsquared/core/command/Template.java @@ -25,24 +25,24 @@ */ package com.plotsquared.core.command; -import com.plotsquared.core.configuration.ConfigurationSection; -import com.plotsquared.core.configuration.InvalidConfigurationException; -import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ConfigurationNode; +import com.plotsquared.core.configuration.ConfigurationSection; +import com.plotsquared.core.configuration.InvalidConfigurationException; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.util.FileBytes; +import com.plotsquared.core.configuration.file.YamlConfiguration; +import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotManager; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.SetupObject; -import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.queue.GlobalBlockQueue; +import com.plotsquared.core.util.FileBytes; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.SetupUtils; -import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.WorldUtil; -import com.plotsquared.core.queue.GlobalBlockQueue; +import com.plotsquared.core.util.task.TaskManager; import java.io.File; import java.io.FileInputStream; diff --git a/Core/src/main/java/com/plotsquared/core/command/Toggle.java b/Core/src/main/java/com/plotsquared/core/command/Toggle.java index 002c74cba..8bb25014c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Toggle.java +++ b/Core/src/main/java/com/plotsquared/core/command/Toggle.java @@ -27,9 +27,9 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import com.plotsquared.core.util.MainUtil; @CommandDeclaration(command = "toggle", aliases = {"attribute"}, diff --git a/Core/src/main/java/com/plotsquared/core/command/Trim.java b/Core/src/main/java/com/plotsquared/core/command/Trim.java index 44e771f2f..ddc84c08b 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trim.java @@ -28,18 +28,18 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.ChunkManager; -import com.plotsquared.core.util.MainUtil; -import com.plotsquared.core.util.task.TaskManager; -import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue; -import com.plotsquared.core.plot.expiration.ExpireManager; +import com.plotsquared.core.util.ChunkManager; +import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.RegionUtil; +import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.TaskManager; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; diff --git a/Core/src/main/java/com/plotsquared/core/command/Trust.java b/Core/src/main/java/com/plotsquared/core/command/Trust.java index bff94f5e0..8a93e6cd8 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trust.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trust.java @@ -28,12 +28,12 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import java.util.Iterator; import java.util.Set; @@ -52,7 +52,8 @@ public class Trust extends Command { super(MainCommand.getInstance(), true); } - @Override public CompletableFuture execute(final PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot currentPlot = player.getCurrentPlot(); diff --git a/Core/src/main/java/com/plotsquared/core/command/Unlink.java b/Core/src/main/java/com/plotsquared/core/command/Unlink.java index cca09d5b9..d2d5fa8d2 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Unlink.java +++ b/Core/src/main/java/com/plotsquared/core/command/Unlink.java @@ -30,8 +30,8 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.events.PlotUnlinkEvent; import com.plotsquared.core.events.Result; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; diff --git a/Core/src/main/java/com/plotsquared/core/command/Visit.java b/Core/src/main/java/com/plotsquared/core/command/Visit.java index 558d7d9de..372130a2d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Visit.java +++ b/Core/src/main/java/com/plotsquared/core/command/Visit.java @@ -28,16 +28,16 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag; +import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal2; -import com.plotsquared.core.util.task.RunnableVal3; -import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.RunnableVal2; +import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.uuid.UUIDHandler; import java.util.ArrayList; @@ -64,7 +64,8 @@ public class Visit extends Command { return tabOf(player, args, space, getUsage()); } - @Override public CompletableFuture execute(final PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, final RunnableVal2 whenDone) throws CommandException { if (args.length == 1 && args[0].contains(":")) { @@ -170,14 +171,13 @@ public class Visit extends Command { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OTHER); return CompletableFuture.completedFuture(false); } - if (!plot.getFlag(UntrustedVisitFlag.class) && - !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED)) { + if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED)) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED); return CompletableFuture.completedFuture(false); } } - confirm.run(this, () -> - plot.teleportPlayer(player, TeleportCause.COMMAND, result -> { + confirm.run(this, () -> plot.teleportPlayer(player, TeleportCause.COMMAND, result -> { if (result) { whenDone.run(Visit.this, CommandResult.SUCCESS); } else { diff --git a/Core/src/main/java/com/plotsquared/core/configuration/CaptionUtility.java b/Core/src/main/java/com/plotsquared/core/configuration/CaptionUtility.java index 432836422..3180f62b4 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/CaptionUtility.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/CaptionUtility.java @@ -30,7 +30,8 @@ import com.plotsquared.core.player.PlotPlayer; public class CaptionUtility { public static String formatRaw(PlotPlayer recipient, String message, Object... args) { - final ChatFormatter.ChatContext chatContext = new ChatFormatter.ChatContext(recipient, message, args, true); + final ChatFormatter.ChatContext chatContext = + new ChatFormatter.ChatContext(recipient, message, args, true); for (final ChatFormatter chatFormatter : ChatFormatter.formatters) { chatFormatter.format(chatContext); } @@ -38,7 +39,8 @@ public class CaptionUtility { } public static String format(PlotPlayer recipient, String message, Object... args) { - final ChatFormatter.ChatContext chatContext = new ChatFormatter.ChatContext(recipient, message, args, false); + final ChatFormatter.ChatContext chatContext = + new ChatFormatter.ChatContext(recipient, message, args, false); for (final ChatFormatter chatFormatter : ChatFormatter.formatters) { chatFormatter.format(chatContext); } @@ -47,7 +49,8 @@ public class CaptionUtility { public static String format(PlotPlayer recipient, Caption caption, Object... args) { if (caption.usePrefix() && caption.getTranslated().length() > 0) { - return Captions.PREFIX.getTranslated() + format(recipient, caption.getTranslated(), args); + return Captions.PREFIX.getTranslated() + format(recipient, caption.getTranslated(), + args); } else { return format(recipient, caption.getTranslated(), args); } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Captions.java b/Core/src/main/java/com/plotsquared/core/configuration/Captions.java index 7336e6cd2..0daa72732 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Captions.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Captions.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.configuration; -import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.util.StringMan; import java.io.File; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/ChatFormatter.java b/Core/src/main/java/com/plotsquared/core/configuration/ChatFormatter.java index 33a4db472..e873d1c41 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/ChatFormatter.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/ChatFormatter.java @@ -34,13 +34,16 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -@FunctionalInterface public interface ChatFormatter { +@FunctionalInterface +public interface ChatFormatter { - Collection formatters = new ArrayList<>(Collections.singletonList(new PlotSquaredChatFormatter())); + Collection formatters = + new ArrayList<>(Collections.singletonList(new PlotSquaredChatFormatter())); void format(ChatContext context); - @AllArgsConstructor final class ChatContext { + @AllArgsConstructor + final class ChatContext { @Getter private final PlotPlayer recipient; @Getter @Setter private String message; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Config.java b/Core/src/main/java/com/plotsquared/core/configuration/Config.java index fe5283895..701cca773 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Config.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Config.java @@ -25,9 +25,9 @@ */ package com.plotsquared.core.configuration; -import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Settings.Enabled_Components; +import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.util.StringMan; import java.io.File; @@ -394,21 +394,26 @@ public class Config { /** * Indicates that a field should be instantiated / created. */ - @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface Create { + @Retention(RetentionPolicy.RUNTIME) + @Target({ElementType.FIELD}) + public @interface Create { } /** * Indicates that a field cannot be modified. */ - @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface Final { + @Retention(RetentionPolicy.RUNTIME) + @Target({ElementType.FIELD}) + public @interface Final { } /** * Creates a comment. */ - @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) + @Retention(RetentionPolicy.RUNTIME) + @Target({ElementType.FIELD, ElementType.TYPE}) public @interface Comment { String[] value(); } @@ -417,7 +422,8 @@ public class Config { /** * The names of any default blocks. */ - @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) + @Retention(RetentionPolicy.RUNTIME) + @Target({ElementType.FIELD, ElementType.TYPE}) public @interface BlockName { String[] value(); } @@ -426,7 +432,8 @@ public class Config { /** * Any field or class with is not part of the config. */ - @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) + @Retention(RetentionPolicy.RUNTIME) + @Target({ElementType.FIELD, ElementType.TYPE}) public @interface Ignore { } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/InvalidConfigurationException.java b/Core/src/main/java/com/plotsquared/core/configuration/InvalidConfigurationException.java index b99dcdcd4..03c7353bb 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/InvalidConfigurationException.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/InvalidConfigurationException.java @@ -28,7 +28,8 @@ package com.plotsquared.core.configuration; /** * Exception thrown when attempting to load an invalid {@link Configuration}. */ -@SuppressWarnings("serial") public class InvalidConfigurationException extends Exception { +@SuppressWarnings("serial") +public class InvalidConfigurationException extends Exception { /** * Creates a new instance of InvalidConfigurationException without a diff --git a/Core/src/main/java/com/plotsquared/core/configuration/PlotSquaredChatFormatter.java b/Core/src/main/java/com/plotsquared/core/configuration/PlotSquaredChatFormatter.java index 0ea5aad73..fe142f0fb 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/PlotSquaredChatFormatter.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/PlotSquaredChatFormatter.java @@ -34,7 +34,8 @@ public class PlotSquaredChatFormatter implements ChatFormatter { @Override public void format(final ChatContext context) { if (context.isRawOutput()) { - context.setMessage(context.getMessage().replace('&', '\u2020').replace('\u00A7', '\u2030')); + context.setMessage( + context.getMessage().replace('&', '\u2020').replace('\u00A7', '\u2030')); } if (context.getArgs().length == 0) { return; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 4e1e521af..37c008586 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -150,7 +150,8 @@ public class Settings extends Config { TITLES = config.getBoolean("titles", TITLES); // Update Notifications - Enabled_Components.UPDATE_NOTIFICATIONS = config.getBoolean("update-notifications", Enabled_Components.UPDATE_NOTIFICATIONS); + Enabled_Components.UPDATE_NOTIFICATIONS = + config.getBoolean("update-notifications", Enabled_Components.UPDATE_NOTIFICATIONS); // Teleportation Teleport.DELAY = config.getInt("teleport.delay", Teleport.DELAY); @@ -191,7 +192,8 @@ public class Settings extends Config { return true; } - @Comment("This is an auto clearing task called `task1`") @BlockName("task1") + @Comment("This is an auto clearing task called `task1`") + @BlockName("task1") // The name for the default block public static final class Auto_Clear extends ConfigBlock { @Create // This value has to be generated since an instance isn't static @@ -239,24 +241,31 @@ public class Settings extends Config { } - @Comment("General settings") public static final class General { + @Comment("General settings") + public static final class General { @Comment("Display scientific numbers (4.2E8)") public static boolean SCIENTIFIC = false; @Comment("Replace wall when merging") public static boolean MERGE_REPLACE_WALL = true; } - @Comment("Update checker settings") public static final class UpdateChecker { + + @Comment("Update checker settings") + public static final class UpdateChecker { @Comment("How often to poll for updates (in minutes)") public static int POLL_RATE = 360; - @Comment("Only notify console once after an update is found") public static boolean NOTIFY_ONCE = true; + @Comment("Only notify console once after an update is found") public static boolean + NOTIFY_ONCE = true; } - @Comment("Schematic Settings") public static final class Schematics { - @Comment("Whether schematic based generation should paste schematic on top of plots, or from Y=1") + @Comment("Schematic Settings") + public static final class Schematics { + @Comment( + "Whether schematic based generation should paste schematic on top of plots, or from Y=1") public static boolean PASTE_ON_TOP = true; } - @Comment("Configure the paths that will be used") public static final class Paths { + @Comment("Configure the paths that will be used") + public static final class Paths { public static String SCHEMATICS = "schematics"; public static String SCRIPTS = "scripts"; public static String TEMPLATES = "templates"; @@ -295,7 +304,8 @@ public class Settings extends Config { } - @Comment("Relating to how many plots someone can claim ") public static final class Limit { + @Comment("Relating to how many plots someone can claim ") + public static final class Limit { @Comment("Should the limit be global (over multiple worlds)") public static boolean GLOBAL = false; @Comment({"The max. range of permissions to check e.g. plots.plot.127", @@ -328,7 +338,8 @@ public class Settings extends Config { false; @Comment("Disable redstone when all owners/trusted/members are offline") public static boolean DISABLE_OFFLINE = false; - @Comment("Detect and cancel invalid pistons on the edge of plots (e.g. placed with WorldEdit)") + @Comment( + "Detect and cancel invalid pistons on the edge of plots (e.g. placed with WorldEdit)") public static boolean DETECT_INVALID_EDGE_PISTONS = false; } @@ -355,7 +366,8 @@ public class Settings extends Config { true; @Comment("The UUID cacher is used to resolve player names") public static boolean UUID_CACHE = true; - @Comment("Whether we should notify you about updates or not.") public static boolean UPDATE_NOTIFICATIONS = true; + @Comment("Whether we should notify you about updates or not.") public static boolean + UPDATE_NOTIFICATIONS = true; @Comment("Stores user metadata in a database") public static boolean PERSISTENT_META = true; @Comment("Optimizes permission checks") public static boolean PERMISSION_CACHE = true; @Comment("Optimizes block changing code") public static boolean BLOCK_CACHE = true; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/StaticCaption.java b/Core/src/main/java/com/plotsquared/core/configuration/StaticCaption.java index 87c1a4d9c..403cc4c88 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/StaticCaption.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/StaticCaption.java @@ -27,7 +27,8 @@ package com.plotsquared.core.configuration; import lombok.RequiredArgsConstructor; -@RequiredArgsConstructor public final class StaticCaption implements Caption { +@RequiredArgsConstructor +public final class StaticCaption implements Caption { private final String value; private final boolean usePrefix; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Storage.java b/Core/src/main/java/com/plotsquared/core/configuration/Storage.java index 5bc6a67b0..44a0be29b 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Storage.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Storage.java @@ -42,7 +42,8 @@ public class Storage extends Config { load(file, Storage.class); } - @Comment("MySQL section") public static final class MySQL { + @Comment("MySQL section") + public static final class MySQL { @Comment("Should MySQL be used?") public static boolean USE = false; public static String HOST = "localhost"; public static String PORT = "3306"; @@ -55,7 +56,8 @@ public class Storage extends Config { } - @Comment("SQLite section") public static final class SQLite { + @Comment("SQLite section") + public static final class SQLite { @Comment("Should SQLite be used?") public static boolean USE = true; @Comment("The file to use") public static String DB = "storage"; } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/file/YamlConfiguration.java b/Core/src/main/java/com/plotsquared/core/configuration/file/YamlConfiguration.java index 0dcffc0ce..f57cc56f8 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/file/YamlConfiguration.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/file/YamlConfiguration.java @@ -25,10 +25,10 @@ */ package com.plotsquared.core.configuration.file; +import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Configuration; import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.InvalidConfigurationException; -import com.plotsquared.core.PlotSquared; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/serialization/DelegateDeserialization.java b/Core/src/main/java/com/plotsquared/core/configuration/serialization/DelegateDeserialization.java index 983719fe1..1cace0091 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/serialization/DelegateDeserialization.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/serialization/DelegateDeserialization.java @@ -34,7 +34,8 @@ import java.lang.annotation.Target; * Applies to a {@link ConfigurationSerializable} that will delegate all * deserialization to another {@link ConfigurationSerializable}. */ -@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) public @interface DelegateDeserialization { /** * Which class should be used as a delegate for this classes diff --git a/Core/src/main/java/com/plotsquared/core/configuration/serialization/SerializableAs.java b/Core/src/main/java/com/plotsquared/core/configuration/serialization/SerializableAs.java index 464cc3bd7..06c4d93fd 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/serialization/SerializableAs.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/serialization/SerializableAs.java @@ -44,7 +44,9 @@ import java.lang.annotation.Target; * * @see ConfigurationSerialization#registerClass(Class, String) */ -@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface SerializableAs { +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface SerializableAs { /** * This is the name your class will be stored and retrieved as. *

diff --git a/Core/src/main/java/com/plotsquared/core/database/AbstractDB.java b/Core/src/main/java/com/plotsquared/core/database/AbstractDB.java index 0e26b9083..4f3beccc2 100644 --- a/Core/src/main/java/com/plotsquared/core/database/AbstractDB.java +++ b/Core/src/main/java/com/plotsquared/core/database/AbstractDB.java @@ -25,13 +25,13 @@ */ package com.plotsquared.core.database; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotCluster; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.comment.PlotComment; +import com.plotsquared.core.plot.flag.PlotFlag; +import com.plotsquared.core.util.task.RunnableVal; import org.jetbrains.annotations.NotNull; import java.util.HashMap; diff --git a/Core/src/main/java/com/plotsquared/core/database/DBFunc.java b/Core/src/main/java/com/plotsquared/core/database/DBFunc.java index c479612eb..2f12b2db6 100644 --- a/Core/src/main/java/com/plotsquared/core/database/DBFunc.java +++ b/Core/src/main/java/com/plotsquared/core/database/DBFunc.java @@ -25,13 +25,13 @@ */ package com.plotsquared.core.database; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotCluster; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.comment.PlotComment; +import com.plotsquared.core.plot.flag.PlotFlag; +import com.plotsquared.core.util.task.RunnableVal; import java.sql.ResultSet; import java.sql.ResultSetMetaData; diff --git a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java index 4ced85720..b0608291b 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java @@ -25,27 +25,27 @@ */ package com.plotsquared.core.database; -import com.plotsquared.core.configuration.ConfigurationSection; +import com.google.common.base.Charsets; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Storage; -import com.plotsquared.core.plot.flag.FlagContainer; -import com.plotsquared.core.plot.flag.FlagParseException; -import com.plotsquared.core.plot.flag.GlobalFlagContainer; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotCluster; import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotSettings; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.comment.PlotComment; +import com.plotsquared.core.plot.flag.FlagContainer; +import com.plotsquared.core.plot.flag.FlagParseException; +import com.plotsquared.core.plot.flag.GlobalFlagContainer; +import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import com.google.common.base.Charsets; import org.jetbrains.annotations.NotNull; import java.sql.Connection; @@ -75,7 +75,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicInteger; -@SuppressWarnings("SqlDialectInspection") public class SQLManager implements AbstractDB { +@SuppressWarnings("SqlDialectInspection") +public class SQLManager implements AbstractDB { // Public final public final String SET_OWNER; @@ -606,23 +607,23 @@ import java.util.concurrent.atomic.AtomicInteger; } } - createFlags(idMap, myList, () -> - createSettings(settings, - () -> createTiers(helpers, "helpers", - () -> createTiers(trusted, "trusted", - () -> createTiers(denied, "denied", () -> { - try { - SQLManager.this.connection.commit(); - } catch (SQLException e) { - e.printStackTrace(); - } - if (whenDone != null) { - whenDone.run(); - } + createFlags(idMap, myList, () -> createSettings(settings, + () -> createTiers(helpers, "helpers", + () -> createTiers(trusted, "trusted", + () -> createTiers(denied, "denied", () -> { + try { + SQLManager.this.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } + if (whenDone != null) { + whenDone.run(); + } }))))); } catch (SQLException e) { e.printStackTrace(); - PlotSquared.debug("&7[WARN] Failed to set all flags and member tiers for plots"); + PlotSquared + .debug("&7[WARN] Failed to set all flags and member tiers for plots"); try { SQLManager.this.connection.commit(); } catch (SQLException e1) { @@ -687,11 +688,12 @@ import java.util.concurrent.atomic.AtomicInteger; } public void createFlags(Map ids, List plots, Runnable whenDone) { - try (final PreparedStatement preparedStatement = - this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) { + try (final PreparedStatement preparedStatement = this.connection.prepareStatement( + "INSERT INTO `" + SQLManager.this.prefix + + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) { for (final Plot plot : plots) { final FlagContainer flagContainer = plot.getFlagContainer(); - for (final PlotFlag flagEntry : flagContainer.getFlagMap().values()) { + for (final PlotFlag flagEntry : flagContainer.getFlagMap().values()) { preparedStatement.setInt(1, ids.get(plot.getId())); preparedStatement.setString(2, flagEntry.getName()); preparedStatement.setString(3, flagEntry.toString()); @@ -700,17 +702,21 @@ import java.util.concurrent.atomic.AtomicInteger; try { preparedStatement.executeBatch(); } catch (final Exception e) { - PlotSquared.log(Captions.PREFIX.getTranslated() + "Failed to store flag values for plot with entry ID: " + plot.getId()); + PlotSquared.log(Captions.PREFIX.getTranslated() + + "Failed to store flag values for plot with entry ID: " + plot.getId()); e.printStackTrace(); continue; } - PlotSquared.debug(Captions.PREFIX.getTranslated() + "- Finished converting flags for plot with entry ID: " + plot.getId()); + PlotSquared.debug(Captions.PREFIX.getTranslated() + + "- Finished converting flags for plot with entry ID: " + plot.getId()); } } catch (final Exception e) { PlotSquared.log(Captions.PREFIX.getTranslated() + "Failed to store flag values:"); e.printStackTrace(); } - PlotSquared.log(Captions.PREFIX.getTranslated() + "Finished converting flags (" + plots.size() + " plots processed)"); + PlotSquared.log( + Captions.PREFIX.getTranslated() + "Finished converting flags (" + plots.size() + + " plots processed)"); whenDone.run(); } @@ -890,8 +896,8 @@ import java.util.concurrent.atomic.AtomicInteger; } public void createSettings(final ArrayList myList, final Runnable whenDone) { - try (final PreparedStatement preparedStatement = - this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_settings`" + try (final PreparedStatement preparedStatement = this.connection.prepareStatement( + "INSERT INTO `" + SQLManager.this.prefix + "plot_settings`" + "(`plot_plot_id`,`biome`,`rain`,`custom_time`,`time`,`deny_entry`,`alias`,`merged`,`position`) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)")) { int packet; @@ -926,13 +932,15 @@ import java.util.concurrent.atomic.AtomicInteger; } else { position = loc.getX() + "," + loc.getY() + ',' + loc.getZ(); } - preparedStatement.setString( 9, position); + preparedStatement.setString(9, position); preparedStatement.addBatch(); if (++updated >= packet) { try { preparedStatement.executeBatch(); } catch (final Exception e) { - PlotSquared.log(Captions.PREFIX.getTranslated() + "Failed to store settings values for plot with entry ID: " + legacySettings.id); + PlotSquared.log(Captions.PREFIX.getTranslated() + + "Failed to store settings values for plot with entry ID: " + + legacySettings.id); e.printStackTrace(); continue; } @@ -944,7 +952,8 @@ import java.util.concurrent.atomic.AtomicInteger; try { preparedStatement.executeBatch(); } catch (final Exception e) { - PlotSquared.log(Captions.PREFIX.getTranslated() + "Failed to store settings values"); + PlotSquared + .log(Captions.PREFIX.getTranslated() + "Failed to store settings values"); e.printStackTrace(); } } @@ -952,7 +961,9 @@ import java.util.concurrent.atomic.AtomicInteger; PlotSquared.log(Captions.PREFIX.getTranslated() + "Failed to store settings values:"); e.printStackTrace(); } - PlotSquared.log(Captions.PREFIX.getTranslated() + "Finished converting settings (" + myList.size() + " plots processed)"); + PlotSquared.log( + Captions.PREFIX.getTranslated() + "Finished converting settings (" + myList.size() + + " plots processed)"); whenDone.run(); } @@ -964,9 +975,8 @@ import java.util.concurrent.atomic.AtomicInteger; @Override public String getCreateSQLite(int size) { return getCreateSQLite(size, "INSERT INTO `" + SQLManager.this.prefix - + "plot_settings` SELECT ? AS `plot_plot_id`, ? AS `biome`, ? AS `rain`, ? AS `custom_time`, ? AS `time`, ? AS " - + "`deny_entry`, ? AS `alias`, ? AS `merged`, ? AS `position` ", - 10); + + "plot_settings` SELECT ? AS `plot_plot_id`, ? AS `biome`, ? AS `rain`, ? AS `custom_time`, ? AS `time`, ? AS " + + "`deny_entry`, ? AS `alias`, ? AS `merged`, ? AS `position` ", 10); } @Override public String getCreateSQL() { @@ -1161,8 +1171,7 @@ import java.util.concurrent.atomic.AtomicInteger; + " `biome` VARCHAR(45) DEFAULT 'FOREST'," + " `rain` INT(1) DEFAULT 0," + " `custom_time` TINYINT(1) DEFAULT '0'," + " `time` INT(11) DEFAULT '8000'," + " `deny_entry` TINYINT(1) DEFAULT '0'," - + " `alias` VARCHAR(50) DEFAULT NULL," - + " `merged` INT(11) DEFAULT NULL," + + " `alias` VARCHAR(50) DEFAULT NULL," + " `merged` INT(11) DEFAULT NULL," + " `position` VARCHAR(50) NOT NULL DEFAULT 'DEFAULT'," + " PRIMARY KEY (`plot_plot_id`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8"); stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix @@ -1192,8 +1201,7 @@ import java.util.concurrent.atomic.AtomicInteger; + " `cluster_id` INT(11) NOT NULL," + " `biome` VARCHAR(45) DEFAULT 'FOREST'," + " `rain` INT(1) DEFAULT 0," + " `custom_time` TINYINT(1) DEFAULT '0'," + " `time` INT(11) DEFAULT '8000'," + " `deny_entry` TINYINT(1) DEFAULT '0'," - + " `alias` VARCHAR(50) DEFAULT NULL," - + " `merged` INT(11) DEFAULT NULL," + + " `alias` VARCHAR(50) DEFAULT NULL," + " `merged` INT(11) DEFAULT NULL," + " `position` VARCHAR(50) NOT NULL DEFAULT 'DEFAULT'," + " PRIMARY KEY (`cluster_id`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8"); stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "player_meta` (" @@ -1203,9 +1211,9 @@ import java.util.concurrent.atomic.AtomicInteger; + ") ENGINE=InnoDB DEFAULT CHARSET=utf8"); stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot_flags`(" + "`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY," - + "`plot_id` INT(11) NOT NULL," + " `flag` VARCHAR(256)," + " `value` VARCHAR(512)," - + "FOREIGN KEY (plot_id) REFERENCES `" + this.prefix + "plot` (id) ON DELETE CASCADE, " - + "UNIQUE (plot_id, flag)" + + "`plot_id` INT(11) NOT NULL," + " `flag` VARCHAR(256)," + + " `value` VARCHAR(512)," + "FOREIGN KEY (plot_id) REFERENCES `" + this.prefix + + "plot` (id) ON DELETE CASCADE, " + "UNIQUE (plot_id, flag)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8"); } else { stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` (" @@ -1232,8 +1240,7 @@ import java.util.concurrent.atomic.AtomicInteger; + " `biome` VARCHAR(45) DEFAULT 'FOREST'," + " `rain` INT(1) DEFAULT 0," + " `custom_time` TINYINT(1) DEFAULT '0'," + " `time` INT(11) DEFAULT '8000'," + " `deny_entry` TINYINT(1) DEFAULT '0'," - + " `alias` VARCHAR(50) DEFAULT NULL," - + " `merged` INT(11) DEFAULT NULL," + + " `alias` VARCHAR(50) DEFAULT NULL," + " `merged` INT(11) DEFAULT NULL," + " `position` VARCHAR(50) NOT NULL DEFAULT 'DEFAULT'," + " PRIMARY KEY (`plot_plot_id`)" + ')'); stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix @@ -1254,8 +1261,7 @@ import java.util.concurrent.atomic.AtomicInteger; + " `cluster_id` INT(11) NOT NULL," + " `biome` VARCHAR(45) DEFAULT 'FOREST'," + " `rain` INT(1) DEFAULT 0," + " `custom_time` TINYINT(1) DEFAULT '0'," + " `time` INT(11) DEFAULT '8000'," + " `deny_entry` TINYINT(1) DEFAULT '0'," - + " `alias` VARCHAR(50) DEFAULT NULL," - + " `merged` INT(11) DEFAULT NULL," + + " `alias` VARCHAR(50) DEFAULT NULL," + " `merged` INT(11) DEFAULT NULL," + " `position` VARCHAR(50) NOT NULL DEFAULT 'DEFAULT'," + " PRIMARY KEY (`cluster_id`)" + ')'); stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "player_meta` (" @@ -1263,10 +1269,10 @@ import java.util.concurrent.atomic.AtomicInteger; + " `uuid` VARCHAR(40) NOT NULL," + " `key` VARCHAR(32) NOT NULL," + " `value` blob NOT NULL" + ')'); stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot_flags`(" - + "`id` INTEGER PRIMARY KEY AUTOINCREMENT," - + "`plot_id` INTEGER NOT NULL," + " `flag` VARCHAR(256)," + " `value` VARCHAR(512)," - + "FOREIGN KEY (plot_id) REFERENCES `" + this.prefix + "plot` (id) ON DELETE CASCADE, " - + "UNIQUE (plot_id, flag))"); + + "`id` INTEGER PRIMARY KEY AUTOINCREMENT," + "`plot_id` INTEGER NOT NULL," + + " `flag` VARCHAR(256)," + " `value` VARCHAR(512)," + + "FOREIGN KEY (plot_id) REFERENCES `" + this.prefix + + "plot` (id) ON DELETE CASCADE, " + "UNIQUE (plot_id, flag))"); } stmt.executeBatch(); stmt.clearBatch(); @@ -1667,11 +1673,14 @@ import java.util.concurrent.atomic.AtomicInteger; e.printStackTrace(); return false; } - PlotSquared.log(Captions.PREFIX.getTranslated() + "Loaded " + flagMap.size() + " plot flag collections..."); - PlotSquared.log(Captions.PREFIX.getTranslated() + "Attempting to store these flags in the new table..."); + PlotSquared.log(Captions.PREFIX.getTranslated() + "Loaded " + flagMap.size() + + " plot flag collections..."); + PlotSquared.log(Captions.PREFIX.getTranslated() + + "Attempting to store these flags in the new table..."); // - try (final PreparedStatement preparedStatement = - this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) { + try (final PreparedStatement preparedStatement = this.connection.prepareStatement( + "INSERT INTO `" + SQLManager.this.prefix + + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) { long timeStarted = System.currentTimeMillis(); int flagsProcessed = 0; @@ -1683,7 +1692,8 @@ import java.util.concurrent.atomic.AtomicInteger; } for (final Map.Entry> plotFlagEntry : flagMap.entrySet()) { - for (final Map.Entry flagEntry : plotFlagEntry.getValue().entrySet()) { + for (final Map.Entry flagEntry : plotFlagEntry.getValue() + .entrySet()) { preparedStatement.setInt(1, plotFlagEntry.getKey()); preparedStatement.setString(2, flagEntry.getKey()); preparedStatement.setString(3, flagEntry.getValue()); @@ -1695,17 +1705,25 @@ import java.util.concurrent.atomic.AtomicInteger; try { preparedStatement.executeBatch(); } catch (final Exception e) { - PlotSquared.log(Captions.PREFIX.getTranslated() + "Failed to store flag values for plot with entry ID: " + plotFlagEntry.getKey()); + PlotSquared.log(Captions.PREFIX.getTranslated() + + "Failed to store flag values for plot with entry ID: " + plotFlagEntry + .getKey()); e.printStackTrace(); continue; } - if (System.currentTimeMillis() - timeStarted >= 1000L || plotsProcessed >= flagMap.size()) { + if (System.currentTimeMillis() - timeStarted >= 1000L || plotsProcessed >= flagMap + .size()) { timeStarted = System.currentTimeMillis(); - PlotSquared.log(Captions.PREFIX.getTranslated() + "... Flag conversion in progress. " + String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100) + "% Done"); + PlotSquared.log( + Captions.PREFIX.getTranslated() + "... Flag conversion in progress. " + + String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100) + + "% Done"); } - PlotSquared.debug(Captions.PREFIX.getTranslated() + "- Finished converting flags for plot with entry ID: " + plotFlagEntry.getKey()); + PlotSquared.debug(Captions.PREFIX.getTranslated() + + "- Finished converting flags for plot with entry ID: " + plotFlagEntry + .getKey()); } } catch (final Exception e) { PlotSquared.log(Captions.PREFIX.getTranslated() + "Failed to store flag values:"); @@ -1942,25 +1960,30 @@ import java.util.concurrent.atomic.AtomicInteger; deleteRows(toDelete, this.prefix + "plot_denied", "plot_plot_id"); } - try (final ResultSet resultSet = statement.executeQuery("SELECT * FROM `" + this.prefix + "plot_flags`")) { + try (final ResultSet resultSet = statement + .executeQuery("SELECT * FROM `" + this.prefix + "plot_flags`")) { final ArrayList toDelete = new ArrayList<>(); - final Map>> invalidFlags = new HashMap<>(); + final Map>> invalidFlags = new HashMap<>(); while (resultSet.next()) { id = resultSet.getInt("plot_id"); final String flag = resultSet.getString("flag"); final String value = resultSet.getString("value"); final Plot plot = plots.get(id); if (plot != null) { - final PlotFlag plotFlag = GlobalFlagContainer.getInstance().getFlagFromString(flag); + final PlotFlag plotFlag = + GlobalFlagContainer.getInstance().getFlagFromString(flag); if (plotFlag == null) { plot.getFlagContainer().addUnknownFlag(flag, value); } else { try { plot.getFlagContainer().addFlag(plotFlag.parse(value)); } catch (final FlagParseException e) { - PlotSquared.debug("Plot with ID " + id + " has an invalid value:"); - PlotSquared.debug(Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", plotFlag.getName()) - .replace("%flag_value%", e.getValue()).replace("%error%", e.getErrorMessage())); + PlotSquared + .debug("Plot with ID " + id + " has an invalid value:"); + PlotSquared.debug(Captions.FLAG_PARSE_ERROR.getTranslated() + .replace("%flag_name%", plotFlag.getName()) + .replace("%flag_value%", e.getValue()) + .replace("%error%", e.getErrorMessage())); if (!invalidFlags.containsKey(plot)) { invalidFlags.put(plot, new ArrayList<>()); } @@ -1975,10 +1998,12 @@ import java.util.concurrent.atomic.AtomicInteger; } } if (Settings.Enabled_Components.DATABASE_PURGER) { - for (final Map.Entry>> plotFlagEntry : invalidFlags.entrySet()) { - for (final PlotFlag flag : plotFlagEntry.getValue()) { + for (final Map.Entry>> plotFlagEntry : invalidFlags + .entrySet()) { + for (final PlotFlag flag : plotFlagEntry.getValue()) { PlotSquared.debug("&cPlot \"" + plotFlagEntry.getKey() + "\"" - + " had an invalid flag (" + flag.getName() + "). A fix has been attempted."); + + " had an invalid flag (" + flag.getName() + + "). A fix has been attempted."); removeFlag(plotFlagEntry.getKey(), flag); } } @@ -2076,8 +2101,9 @@ import java.util.concurrent.atomic.AtomicInteger; final int id2 = getId(plot2); final PlotId pos1 = plot1.getId(); final PlotId pos2 = plot2.getId(); - try (final PreparedStatement preparedStatement = this.connection.prepareStatement("UPDATE `" + SQLManager.this.prefix - + "plot` SET `plot_id_x` = ?, `plot_id_z` = ? WHERE `id` = ?")) { + try (final PreparedStatement preparedStatement = this.connection.prepareStatement( + "UPDATE `" + SQLManager.this.prefix + + "plot` SET `plot_id_x` = ?, `plot_id_z` = ? WHERE `id` = ?")) { preparedStatement.setInt(1, pos1.getX()); preparedStatement.setInt(2, pos1.getY()); preparedStatement.setInt(3, id1); @@ -2087,7 +2113,9 @@ import java.util.concurrent.atomic.AtomicInteger; preparedStatement.setInt(3, id2); preparedStatement.execute(); } catch (final Exception e) { - PlotSquared.log(Captions.PREFIX.getTranslated() + "Failed to persist swap of " + plot1 + " and " + plot2 + "!"); + PlotSquared.log( + Captions.PREFIX.getTranslated() + "Failed to persist swap of " + plot1 + " and " + + plot2 + "!"); e.printStackTrace(); future.complete(false); return; @@ -2127,10 +2155,12 @@ import java.util.concurrent.atomic.AtomicInteger; @Override public PreparedStatement get() throws SQLException { final String statement; if (SQLManager.this.mySQL) { - statement = "INSERT INTO `" + SQLManager.this.prefix + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?) " + statement = "INSERT INTO `" + SQLManager.this.prefix + + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?) " + "ON DUPLICATE KEY UPDATE `value` = ?"; } else { - statement = "INSERT INTO `" + SQLManager.this.prefix + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?) " + statement = "INSERT INTO `" + SQLManager.this.prefix + + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?) " + "ON CONFLICT(`plot_id`,`flag`) DO UPDATE SET `value` = ?"; } return SQLManager.this.connection.prepareStatement(statement); @@ -2146,8 +2176,9 @@ import java.util.concurrent.atomic.AtomicInteger; } @Override public PreparedStatement get() throws SQLException { - return SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix - + "plot_flags` WHERE `plot_id` = ? AND `flag` = ?"); + return SQLManager.this.connection.prepareStatement( + "DELETE FROM `" + SQLManager.this.prefix + + "plot_flags` WHERE `plot_id` = ? AND `flag` = ?"); } }); } @@ -2337,7 +2368,8 @@ import java.util.concurrent.atomic.AtomicInteger; }); } - @Override public void getComments(@NotNull Plot plot, final String inbox, + @Override + public void getComments(@NotNull Plot plot, final String inbox, final RunnableVal> whenDone) { addPlotTask(plot, new UniqueStatement("getComments_" + plot) { @Override public void set(PreparedStatement statement) throws SQLException { @@ -2583,7 +2615,8 @@ import java.util.concurrent.atomic.AtomicInteger; }); } - @Override public void addPersistentMeta(final UUID uuid, final String key, final byte[] meta, + @Override + public void addPersistentMeta(final UUID uuid, final String key, final byte[] meta, final boolean replace) { addPlayerTask(uuid, new UniqueStatement("addPersistentMeta") { @Override public void set(PreparedStatement statement) throws SQLException { @@ -3044,8 +3077,8 @@ import java.util.concurrent.atomic.AtomicInteger; } // owner if (!plot.getOwnerAbs().equals(dataPlot.getOwnerAbs())) { - PlotSquared - .debug("&8 - &7Setting owner: " + plot + " -> " + MainUtil.getName(plot.getOwnerAbs())); + PlotSquared.debug("&8 - &7Setting owner: " + plot + " -> " + MainUtil + .getName(plot.getOwnerAbs())); setOwner(plot, plot.getOwnerAbs()); } // trusted @@ -3116,8 +3149,7 @@ import java.util.concurrent.atomic.AtomicInteger; Set> df = dataPlot.getFlags(); if (!pf.isEmpty() && !df.isEmpty()) { if (pf.size() != df.size() || !StringMan - .isEqual(StringMan.joinOrdered(pf, ","), - StringMan.joinOrdered(df, ","))) { + .isEqual(StringMan.joinOrdered(pf, ","), StringMan.joinOrdered(df, ","))) { PlotSquared.debug(" - Correcting flags for: " + plot); // setFlags(plot, pf); // TODO: Re-implement @@ -3251,6 +3283,7 @@ import java.util.concurrent.atomic.AtomicInteger; public abstract void set(PreparedStatement statement) throws SQLException; } + private class UUIDPair { public final int id; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java index 693fc0220..7bb935791 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java @@ -26,8 +26,8 @@ package com.plotsquared.core.events; import com.plotsquared.core.command.Claim; -import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.PlotArea; import lombok.Getter; import lombok.Setter; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerClaimPlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerClaimPlotEvent.java index d9fd19e8a..6901a54ba 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerClaimPlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerClaimPlotEvent.java @@ -26,8 +26,8 @@ package com.plotsquared.core.events; import com.plotsquared.core.command.Claim; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import javax.annotation.Nullable; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerEnterPlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerEnterPlotEvent.java index 4ef8191b4..568809513 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerEnterPlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerEnterPlotEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; public class PlayerEnterPlotEvent extends PlotPlayerEvent { diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerLeavePlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerLeavePlotEvent.java index 916d08571..9a4366450 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerLeavePlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerLeavePlotEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; /** * diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotDeniedEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotDeniedEvent.java index cdcad5e3e..f3458a615 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotDeniedEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotDeniedEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import java.util.UUID; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotHelperEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotHelperEvent.java index f52957e30..55a606381 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotHelperEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotHelperEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import java.util.UUID; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotTrustedEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotTrustedEvent.java index d8591a5a0..85db4a32d 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotTrustedEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotTrustedEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import java.util.UUID; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java index 38dffe966..8f6d40903 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java @@ -26,8 +26,8 @@ package com.plotsquared.core.events; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; /** * Called when a player teleports to a plot @@ -58,13 +58,11 @@ public class PlayerTeleportToPlotEvent extends PlotPlayerEvent implements Cancel return this.from; } - @Override - public Result getEventResult() { + @Override public Result getEventResult() { return eventResult; } - @Override - public void setEventResult(Result e) { + @Override public void setEventResult(Result e) { this.eventResult = e; } } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotAutoMergeEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotAutoMergeEvent.java index 657a34838..a84bc5de0 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotAutoMergeEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotAutoMergeEvent.java @@ -56,6 +56,7 @@ public final class PlotAutoMergeEvent extends PlotEvent implements CancellablePl this.world = world; this.plots = plots; } + /** * Get the plots being added. * @@ -65,13 +66,11 @@ public final class PlotAutoMergeEvent extends PlotEvent implements CancellablePl return Collections.unmodifiableList(this.plots); } - @Override - public Result getEventResult() { + @Override public Result getEventResult() { return eventResult; } - @Override - public void setEventResult(Result e) { + @Override public void setEventResult(Result e) { this.eventResult = e; } } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java index 240f084e5..0e1f5eb48 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java @@ -25,9 +25,9 @@ */ package com.plotsquared.core.events; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.player.PlotPlayer; import org.jetbrains.annotations.Nullable; import java.util.UUID; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotClearEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotClearEvent.java index d91745d5a..b4fedfab6 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotClearEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotClearEvent.java @@ -57,13 +57,11 @@ public class PlotClearEvent extends PlotEvent implements CancellablePlotEvent { return getPlot().getWorldName(); } - @Override - public Result getEventResult() { + @Override public Result getEventResult() { return eventResult; } - @Override - public void setEventResult(Result e) { + @Override public void setEventResult(Result e) { this.eventResult = e; } } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotDeleteEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotDeleteEvent.java index 3f1ebd5a3..f2b7f70a8 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotDeleteEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotDeleteEvent.java @@ -57,13 +57,11 @@ public class PlotDeleteEvent extends PlotEvent implements CancellablePlotEvent { return getPlot().getWorldName(); } - @Override - public Result getEventResult() { + @Override public Result getEventResult() { return eventResult; } - @Override - public void setEventResult(Result e) { + @Override public void setEventResult(Result e) { this.eventResult = e; } } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotFlagAddEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotFlagAddEvent.java index e53f5cad5..4dc1e4f86 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotFlagAddEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotFlagAddEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.flag.PlotFlag; /** * Called when a Flag is added to a plot. @@ -45,13 +45,11 @@ public class PlotFlagAddEvent extends PlotFlagEvent implements CancellablePlotEv super(plot, flag); } - @Override - public Result getEventResult() { + @Override public Result getEventResult() { return eventResult; } - @Override - public void setEventResult(Result e) { + @Override public void setEventResult(Result e) { this.eventResult = e; } } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotFlagEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotFlagEvent.java index fb7439d79..54863d15c 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotFlagEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotFlagEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.flag.PlotFlag; public abstract class PlotFlagEvent extends PlotEvent { private final PlotFlag flag; @@ -39,7 +39,7 @@ public abstract class PlotFlagEvent extends PlotEvent { /** * Get the flag involved * - * @return the flag involved + * @return the flag involved */ public PlotFlag getFlag() { return flag; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotFlagRemoveEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotFlagRemoveEvent.java index 1191fe3ce..fbab48326 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotFlagRemoveEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotFlagRemoveEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.flag.PlotFlag; /** * Called when a flag is removed from a plot @@ -45,13 +45,11 @@ public class PlotFlagRemoveEvent extends PlotFlagEvent implements CancellablePlo super(plot, flag); } - @Override - public Result getEventResult() { + @Override public Result getEventResult() { return eventResult; } - @Override - public void setEventResult(Result e) { + @Override public void setEventResult(Result e) { this.eventResult = e; } } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java index 63c0acecc..71bc2eaad 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java @@ -26,8 +26,8 @@ package com.plotsquared.core.events; import com.plotsquared.core.location.Direction; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotPlayerEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotPlayerEvent.java index b331dd32f..5e591fb57 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotPlayerEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotPlayerEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; public abstract class PlotPlayerEvent extends PlotEvent { diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java index 52e7775e7..7bd8ec31e 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.events; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Rating; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java b/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java index d45fd2243..146d42b82 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java @@ -55,8 +55,8 @@ public class AugmentedUtils { enabled = true; } - public static boolean generate(@Nullable Object chunkObject, @NotNull final String world, final int chunkX, final int chunkZ, - LocalBlockQueue queue) { + public static boolean generate(@Nullable Object chunkObject, @NotNull final String world, + final int chunkX, final int chunkZ, LocalBlockQueue queue) { if (!enabled) { return false; } @@ -134,8 +134,8 @@ public class AugmentedUtils { continue; } generationResult = true; - secondaryMask = new LocationOffsetDelegateLocalBlockQueue(canPlace, blockX, - blockZ, primaryMask); + secondaryMask = new LocationOffsetDelegateLocalBlockQueue(canPlace, blockX, blockZ, + primaryMask); } else { secondaryMask = primaryMask; for (int x = relativeBottomX; x <= relativeTopX; x++) { @@ -152,8 +152,9 @@ public class AugmentedUtils { secondaryMask.setChunkObject(chunkObject); secondaryMask.setForceSync(true); - ScopedLocalBlockQueue scoped = new ScopedLocalBlockQueue(secondaryMask, new Location(world, blockX, 0, blockZ), - new Location(world, blockX + 15, 255, blockZ + 15)); + ScopedLocalBlockQueue scoped = + new ScopedLocalBlockQueue(secondaryMask, new Location(world, blockX, 0, blockZ), + new Location(world, blockX + 15, 255, blockZ + 15)); generator.generateChunk(scoped, area); generator.populateChunk(scoped, area); } diff --git a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java index 1cb7f0103..ffd9bbdef 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java @@ -26,16 +26,16 @@ package com.plotsquared.core.generator; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.plot.BlockBucket; import com.plotsquared.core.location.Direction; import com.plotsquared.core.location.Location; +import com.plotsquared.core.plot.BlockBucket; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.util.MathMan; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.util.BlockUtil; +import com.plotsquared.core.util.MathMan; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.block.BlockTypes; @@ -223,11 +223,11 @@ public class ClassicPlotManager extends SquarePlotManager { if (plot.isBasePlot()) { for (CuboidRegion region : plot.getRegions()) { Location pos1 = - new Location(classicPlotWorld.getWorldName(), region.getMinimumPoint().getX(), maxY, - region.getMinimumPoint().getZ()); + new Location(classicPlotWorld.getWorldName(), region.getMinimumPoint().getX(), + maxY, region.getMinimumPoint().getZ()); Location pos2 = - new Location(classicPlotWorld.getWorldName(), region.getMaximumPoint().getX(), maxY, - region.getMaximumPoint().getZ()); + new Location(classicPlotWorld.getWorldName(), region.getMaximumPoint().getX(), + maxY, region.getMaximumPoint().getZ()); queue.setCuboid(pos1, pos2, blocks); } } @@ -356,19 +356,21 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING.toPattern()); queue.setCuboid( - new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), - new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), - classicPlotWorld.WALL_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, + sz + 1), + new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, + ez - 1), classicPlotWorld.WALL_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.getWorldName(), ex, 1, sz + 1), new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING.toPattern()); queue.setCuboid( - new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), - new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), - classicPlotWorld.WALL_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, + sz + 1), + new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, + ez - 1), classicPlotWorld.WALL_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), - new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), - classicPlotWorld.ROAD_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, + ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern()); return queue.enqueue(); } @@ -392,19 +394,21 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, sz), classicPlotWorld.WALL_FILLING.toPattern()); queue.setCuboid( - new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz), - new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, sz), - classicPlotWorld.WALL_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, + sz), + new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, + sz), classicPlotWorld.WALL_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, ez), new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, ez), classicPlotWorld.WALL_FILLING.toPattern()); queue.setCuboid( - new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, ez), - new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), - classicPlotWorld.WALL_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, + ez), + new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, + ez), classicPlotWorld.WALL_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), - new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), - classicPlotWorld.ROAD_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, + ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern()); return queue.enqueue(); } @@ -424,8 +428,8 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.getWorldName(), ex - 1, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), - new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), - classicPlotWorld.ROAD_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, + ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern()); return queue.enqueue(); } @@ -443,8 +447,8 @@ public class ClassicPlotManager extends SquarePlotManager { classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockTypes.AIR.getDefaultState()); queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx, 1, sz + 1), - new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), - classicPlotWorld.MAIN_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT - 1, + ez - 1), classicPlotWorld.MAIN_BLOCK.toPattern()); queue.setCuboid( new Location(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), new Location(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), @@ -466,8 +470,8 @@ public class ClassicPlotManager extends SquarePlotManager { classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockTypes.AIR.getDefaultState()); queue.setCuboid(new Location(classicPlotWorld.getWorldName(), sx + 1, 1, sz), - new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), - classicPlotWorld.MAIN_BLOCK.toPattern()); + new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, + ez), classicPlotWorld.MAIN_BLOCK.toPattern()); queue.setCuboid( new Location(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), new Location(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), diff --git a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java index e90a174df..c8c9e7add 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java @@ -25,10 +25,10 @@ */ package com.plotsquared.core.generator; -import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationNode; +import com.plotsquared.core.configuration.ConfigurationSection; +import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.plot.BlockBucket; import com.plotsquared.core.plot.PlotId; @@ -38,7 +38,8 @@ import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; import java.util.Locale; -@SuppressWarnings("WeakerAccess") public abstract class ClassicPlotWorld extends SquarePlotWorld { +@SuppressWarnings("WeakerAccess") +public abstract class ClassicPlotWorld extends SquarePlotWorld { public int ROAD_HEIGHT = 62; public int PLOT_HEIGHT = 62; @@ -116,8 +117,8 @@ import java.util.Locale; // Dump world settings if (Settings.DEBUG) { - PlotSquared.debug(String - .format("- Dumping settings for ClassicPlotWorld with name %s", this.getWorldName())); + PlotSquared.debug(String.format("- Dumping settings for ClassicPlotWorld with name %s", + this.getWorldName())); final Field[] fields = this.getClass().getFields(); for (final Field field : fields) { final String name = field.getName().toLowerCase(Locale.ENGLISH); diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java b/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java index b3cb7c537..f54c3a705 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java @@ -25,14 +25,14 @@ */ package com.plotsquared.core.generator; +import com.google.common.base.Preconditions; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.util.MathMan; import com.plotsquared.core.queue.ScopedLocalBlockQueue; -import com.google.common.base.Preconditions; +import com.plotsquared.core.util.MathMan; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockTypes; @@ -66,7 +66,8 @@ public class HybridGen extends IndependentPlotGenerator { } } - @Override public void generateChunk(@NotNull ScopedLocalBlockQueue result, @NotNull PlotArea settings) { + @Override + public void generateChunk(@NotNull ScopedLocalBlockQueue result, @NotNull PlotArea settings) { Preconditions.checkNotNull(result, "result cannot be null"); Preconditions.checkNotNull(settings, "settings cannot be null"); @@ -114,8 +115,10 @@ public class HybridGen extends IndependentPlotGenerator { } relativeX[i] = v; if (hybridPlotWorld.ROAD_WIDTH != 0) { - insideRoadX[i] = v < hybridPlotWorld.PATH_WIDTH_LOWER || v > hybridPlotWorld.PATH_WIDTH_UPPER; - insideWallX[i] = v == hybridPlotWorld.PATH_WIDTH_LOWER || v == hybridPlotWorld.PATH_WIDTH_UPPER; + insideRoadX[i] = + v < hybridPlotWorld.PATH_WIDTH_LOWER || v > hybridPlotWorld.PATH_WIDTH_UPPER; + insideWallX[i] = + v == hybridPlotWorld.PATH_WIDTH_LOWER || v == hybridPlotWorld.PATH_WIDTH_UPPER; } } // The Z-coordinate of a given Z coordinate, relative to the @@ -133,8 +136,10 @@ public class HybridGen extends IndependentPlotGenerator { } relativeZ[i] = v; if (hybridPlotWorld.ROAD_WIDTH != 0) { - insideRoadZ[i] = v < hybridPlotWorld.PATH_WIDTH_LOWER || v > hybridPlotWorld.PATH_WIDTH_UPPER; - insideWallZ[i] = v == hybridPlotWorld.PATH_WIDTH_LOWER || v == hybridPlotWorld.PATH_WIDTH_UPPER; + insideRoadZ[i] = + v < hybridPlotWorld.PATH_WIDTH_LOWER || v > hybridPlotWorld.PATH_WIDTH_UPPER; + insideWallZ[i] = + v == hybridPlotWorld.PATH_WIDTH_LOWER || v == hybridPlotWorld.PATH_WIDTH_UPPER; } } // generation @@ -157,7 +162,8 @@ public class HybridGen extends IndependentPlotGenerator { result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern()); } if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { - placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true); + placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, + true); } } else { // wall @@ -165,9 +171,11 @@ public class HybridGen extends IndependentPlotGenerator { result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern()); } if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { - result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, hybridPlotWorld.WALL_BLOCK.toPattern()); + result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, + hybridPlotWorld.WALL_BLOCK.toPattern()); } else { - placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true); + placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, + true); } } } @@ -179,7 +187,8 @@ public class HybridGen extends IndependentPlotGenerator { result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern()); } if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { - placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true); + placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, + true); } } else if (insideWallZ[z]) { // wall @@ -187,18 +196,22 @@ public class HybridGen extends IndependentPlotGenerator { result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern()); } if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { - result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, hybridPlotWorld.WALL_BLOCK.toPattern()); + result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, + hybridPlotWorld.WALL_BLOCK.toPattern()); } else { - placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true); + placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, + true); } } else { // plot for (int y = 1; y < hybridPlotWorld.PLOT_HEIGHT; y++) { result.setBlock(x, y, z, hybridPlotWorld.MAIN_BLOCK.toPattern()); } - result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z, hybridPlotWorld.TOP_BLOCK.toPattern()); + result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z, + hybridPlotWorld.TOP_BLOCK.toPattern()); if (hybridPlotWorld.PLOT_SCHEMATIC) { - placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, false); + placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, + false); } } } diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java index e9775d904..3fd91eb3c 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java @@ -67,8 +67,9 @@ public class HybridPlotManager extends ClassicPlotManager { HashSet files = Sets.newHashSet( new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(hybridPlotWorld))); - String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator - + hybridPlotWorld.getWorldName() + File.separator; + String dir = + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld + .getWorldName() + File.separator; try { File sideRoad = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem"); @@ -100,10 +101,10 @@ public class HybridPlotManager extends ClassicPlotManager { PlotId id2 = new PlotId(id.x + 1, id.y); Location bot = getPlotBottomLocAbs(id2); Location top = getPlotTopLocAbs(id); - Location pos1 = new Location(hybridPlotWorld.getWorldName(), top.getX() + 1, 0, bot.getZ() - 1); - Location pos2 = - new Location(hybridPlotWorld.getWorldName(), bot.getX(), Math.min(getWorldHeight(), 255), - top.getZ() + 1); + Location pos1 = + new Location(hybridPlotWorld.getWorldName(), top.getX() + 1, 0, bot.getZ() - 1); + Location pos2 = new Location(hybridPlotWorld.getWorldName(), bot.getX(), + Math.min(getWorldHeight(), 255), top.getZ() + 1); MainUtil.resetBiome(hybridPlotWorld, pos1, pos2); if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { return true; @@ -160,10 +161,10 @@ public class HybridPlotManager extends ClassicPlotManager { PlotId id2 = new PlotId(id.x, id.y + 1); Location bot = getPlotBottomLocAbs(id2); Location top = getPlotTopLocAbs(id); - Location pos1 = new Location(hybridPlotWorld.getWorldName(), bot.getX() - 1, 0, top.getZ() + 1); - Location pos2 = - new Location(hybridPlotWorld.getWorldName(), top.getX() + 1, Math.min(getWorldHeight(), 255), - bot.getZ()); + Location pos1 = + new Location(hybridPlotWorld.getWorldName(), bot.getX() - 1, 0, top.getZ() + 1); + Location pos2 = new Location(hybridPlotWorld.getWorldName(), top.getX() + 1, + Math.min(getWorldHeight(), 255), bot.getZ()); MainUtil.resetBiome(hybridPlotWorld, pos1, pos2); if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { return true; @@ -203,8 +204,8 @@ public class HybridPlotManager extends ClassicPlotManager { Location pos2 = plot.getExtendedTopAbs(); // If augmented final boolean canRegen = - (hybridPlotWorld.getType() == PlotAreaType.AUGMENTED) - && (hybridPlotWorld.getTerrain() != PlotAreaTerrainType.NONE) && REGENERATIVE_CLEAR; + (hybridPlotWorld.getType() == PlotAreaType.AUGMENTED) && (hybridPlotWorld.getTerrain() + != PlotAreaTerrainType.NONE) && REGENERATIVE_CLEAR; // The component blocks final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern(); final Pattern filling = hybridPlotWorld.MAIN_BLOCK.toPattern(); diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index 3a4163b55..74e70e721 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -25,9 +25,9 @@ */ package com.plotsquared.core.generator; -import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java index 80ba833a4..0f2be456e 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java @@ -29,9 +29,6 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.Result; -import com.plotsquared.core.plot.flag.GlobalFlagContainer; -import com.plotsquared.core.plot.flag.PlotFlag; -import com.plotsquared.core.plot.flag.implementations.AnalysisFlag; import com.plotsquared.core.listener.WEExtent; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; @@ -39,18 +36,21 @@ import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotManager; -import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.util.ChunkManager; -import com.plotsquared.core.util.MainUtil; -import com.plotsquared.core.util.MathMan; -import com.plotsquared.core.util.SchematicHandler; -import com.plotsquared.core.util.task.TaskManager; -import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.plot.expiration.PlotAnalysis; +import com.plotsquared.core.plot.flag.GlobalFlagContainer; +import com.plotsquared.core.plot.flag.PlotFlag; +import com.plotsquared.core.plot.flag.implementations.AnalysisFlag; import com.plotsquared.core.queue.ChunkBlockQueue; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue; -import com.plotsquared.core.plot.expiration.PlotAnalysis; +import com.plotsquared.core.util.ChunkManager; +import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.RegionUtil; +import com.plotsquared.core.util.SchematicHandler; +import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.util.task.TaskManager; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; @@ -469,14 +469,15 @@ public abstract class HybridUtils { BlockVector2 loc = iterator.next(); iterator.remove(); PlotSquared.debug( - "[ERROR] Could not update '" + area.getWorldName() + "/region/r." + loc - .getX() + "." + loc.getZ() + ".mca' (Corrupt chunk?)"); + "[ERROR] Could not update '" + area.getWorldName() + "/region/r." + + loc.getX() + "." + loc.getZ() + ".mca' (Corrupt chunk?)"); int sx = loc.getX() << 5; int sz = loc.getZ() << 5; for (int x = sx; x < sx + 32; x++) { for (int z = sz; z < sz + 32; z++) { ChunkManager.manager - .unloadChunk(area.getWorldName(), BlockVector2.at(x, z), true); + .unloadChunk(area.getWorldName(), BlockVector2.at(x, z), + true); } } PlotSquared.debug(" - Potentially skipping 1024 chunks"); diff --git a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java index 4c6843b95..d209ee0e2 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java @@ -228,8 +228,9 @@ public abstract class SquarePlotManager extends GridPlotManager { } PlotSquared.debug("invalid location: " + Arrays.toString(merged)); } catch (Exception ignored) { - PlotSquared.debug("Invalid plot / road width in settings.yml for world: " - + squarePlotWorld.getWorldName()); + PlotSquared.debug( + "Invalid plot / road width in settings.yml for world: " + squarePlotWorld + .getWorldName()); } return null; } @@ -246,6 +247,7 @@ public abstract class SquarePlotManager extends GridPlotManager { int z = (squarePlotWorld.ROAD_OFFSET_Z + (pz * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - squarePlotWorld.PLOT_WIDTH - (int) Math .floor(squarePlotWorld.ROAD_WIDTH / 2); - return new Location(squarePlotWorld.getWorldName(), x, squarePlotWorld.getMinBuildHeight(), z); + return new Location(squarePlotWorld.getWorldName(), x, squarePlotWorld.getMinBuildHeight(), + z); } } diff --git a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java index 7532f4c37..026b13ddc 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.generator; -import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.plot.PlotId; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index a3ebf1d8c..08133387e 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -26,11 +26,18 @@ package com.plotsquared.core.listener; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.plot.PlotWeather; +import com.plotsquared.core.collection.ByteArrayUtilities; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.PlotArea; +import com.plotsquared.core.plot.PlotWeather; +import com.plotsquared.core.plot.comment.CommentManager; +import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.plot.flag.GlobalFlagContainer; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.DenyExitFlag; @@ -48,20 +55,13 @@ import com.plotsquared.core.plot.flag.implementations.TimeFlag; import com.plotsquared.core.plot.flag.implementations.TitlesFlag; import com.plotsquared.core.plot.flag.implementations.WeatherFlag; import com.plotsquared.core.plot.flag.types.TimedFlag; -import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.plot.comment.CommentManager; -import com.plotsquared.core.collection.ByteArrayUtilities; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.WorldUtil; -import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.util.task.TaskManager; +import com.plotsquared.core.util.uuid.UUIDHandler; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; @@ -94,7 +94,8 @@ public class PlotListener { } double level = WorldUtil.IMP.getHealth(player); if (level != value.max) { - WorldUtil.IMP.setHealth(player, Math.min(level + value.amount, value.max)); + WorldUtil.IMP + .setHealth(player, Math.min(level + value.amount, value.max)); } } } @@ -114,7 +115,8 @@ public class PlotListener { } int level = WorldUtil.IMP.getFoodLevel(player); if (level != value.max) { - WorldUtil.IMP.setFoodLevel(player, Math.min(level + value.amount, value.max)); + WorldUtil.IMP + .setFoodLevel(player, Math.min(level + value.amount, value.max)); } } } @@ -148,13 +150,12 @@ public class PlotListener { final String greeting = plot.getFlag(GreetingFlag.class); if (!greeting.isEmpty()) { - MainUtil - .format(Captions.PREFIX_GREETING.getTranslated() + greeting, plot, player, - false, new RunnableVal() { - @Override public void run(String value) { - MainUtil.sendMessage(player, value); - } - }); + MainUtil.format(Captions.PREFIX_GREETING.getTranslated() + greeting, plot, player, + false, new RunnableVal() { + @Override public void run(String value) { + MainUtil.sendMessage(player, value); + } + }); } if (plot.getFlag(NotifyEnterFlag.class)) { @@ -174,8 +175,7 @@ public class PlotListener { if (flyStatus != FlyFlag.FlyStatus.DEFAULT) { boolean flight = player.getFlight(); GameMode gamemode = player.getGameMode(); - if (flight != (gamemode == GameModes.CREATIVE - || gamemode == GameModes.SPECTATOR)) { + if (flight != (gamemode == GameModes.CREATIVE || gamemode == GameModes.SPECTATOR)) { player.setPersistentMeta("flight", ByteArrayUtilities.booleanToBytes(player.getFlight())); } @@ -189,8 +189,8 @@ public class PlotListener { player.setGameMode(gameMode); } else { MainUtil.sendMessage(player, StringMan - .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), - "{plot}", plot.getId(), "{gamemode}", gameMode)); + .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}", + plot.getId(), "{gamemode}", gameMode)); } } } @@ -202,15 +202,14 @@ public class PlotListener { player.setGameMode(guestGameMode); } else { MainUtil.sendMessage(player, StringMan - .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), - "{plot}", plot.getId(), "{gamemode}", guestGameMode)); + .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}", + plot.getId(), "{gamemode}", guestGameMode)); } } } long time = plot.getFlag(TimeFlag.class); - if (time != TimeFlag.TIME_DISABLED.getValue() && !player - .getAttribute("disabletime")) { + if (time != TimeFlag.TIME_DISABLED.getValue() && !player.getAttribute("disabletime")) { try { player.setTime(time); } catch (Exception ignored) { @@ -282,11 +281,13 @@ public class PlotListener { TimedFlag.Timed feed = plot.getFlag(FeedFlag.class); if (feed != null && feed.getInterval() != 0 && feed.getValue() != 0) { - feedRunnable.put(player.getUUID(), new Interval(feed.getInterval(), feed.getValue(), 20)); + feedRunnable + .put(player.getUUID(), new Interval(feed.getInterval(), feed.getValue(), 20)); } TimedFlag.Timed heal = plot.getFlag(HealFlag.class); if (heal != null && heal.getInterval() != 0 && heal.getValue() != 0) { - healRunnable.put(player.getUUID(), new Interval(heal.getInterval(), heal.getValue(), 20)); + healRunnable + .put(player.getUUID(), new Interval(heal.getInterval(), heal.getValue(), 20)); } return true; } diff --git a/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java b/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java index 9e476b51f..c9d883f55 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java +++ b/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java @@ -28,8 +28,8 @@ package com.plotsquared.core.listener; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.WEManager; @@ -67,9 +67,8 @@ public class WESubscriber { Player player = (Player) actor; Location location = player.getLocation(); com.plotsquared.core.location.Location pLoc = - new com.plotsquared.core.location.Location( - player.getWorld().getName(), location.getBlockX(), location.getBlockX(), - location.getBlockZ()); + new com.plotsquared.core.location.Location(player.getWorld().getName(), + location.getBlockX(), location.getBlockX(), location.getBlockZ()); Plot plot = pLoc.getPlot(); if (plot == null) { event.setExtent(new NullExtent()); diff --git a/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java b/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java index b4c0b39cd..6181f9fad 100644 --- a/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java +++ b/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java @@ -30,10 +30,13 @@ import lombok.AllArgsConstructor; import org.jetbrains.annotations.Nullable; //todo better description needed + + /** * (x,y,z) or (x,z) representation for PlotSquared (hence the "Plot" prefix) */ -@AllArgsConstructor public final class PlotLoc { +@AllArgsConstructor +public final class PlotLoc { private final int x; private final int y; diff --git a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java index 551e5ba52..bf295c9d7 100644 --- a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java @@ -28,9 +28,9 @@ package com.plotsquared.core.player; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.database.DBFunc; +import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.plot.PlotWeather; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.regions.CuboidRegion; diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index 1c40bd9e6..911c56adb 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -25,31 +25,31 @@ */ package com.plotsquared.core.player; -import com.plotsquared.core.command.CommandCaller; +import com.google.common.base.Preconditions; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.command.CommandCaller; import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; -import com.plotsquared.core.plot.flag.implementations.DoneFlag; +import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotCluster; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.plot.PlotWeather; +import com.plotsquared.core.plot.expiration.ExpireManager; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.plot.world.SinglePlotAreaManager; import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.Permissions; -import com.plotsquared.core.plot.PlotWeather; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; -import com.plotsquared.core.plot.expiration.ExpireManager; -import com.plotsquared.core.util.task.RunnableVal; -import com.google.common.base.Preconditions; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.item.ItemType; @@ -652,25 +652,25 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { TaskManager.runTask(() -> { if (getMeta("teleportOnLogin", true)) { teleport(location); - sendMessage( - CaptionUtility.format(PlotPlayer.this, Captions.TELEPORTED_TO_PLOT.getTranslated()) - + " (quitLoc) (" + plotX - + "," + plotZ + ")"); + sendMessage(CaptionUtility.format(PlotPlayer.this, + Captions.TELEPORTED_TO_PLOT.getTranslated()) + + " (quitLoc) (" + plotX + "," + plotZ + ")"); } }); } else if (!PlotSquared.get().isMainThread(Thread.currentThread())) { if (getMeta("teleportOnLogin", true)) { - plot.teleportPlayer(PlotPlayer.this, result -> TaskManager.runTask(() -> { - if (getMeta("teleportOnLogin", true)) { - if (plot.isLoaded()) { - teleport(location); - sendMessage(CaptionUtility.format(PlotPlayer.this, - Captions.TELEPORTED_TO_PLOT.getTranslated()) - + " (quitLoc-unloaded) (" + plotX + "," + plotZ - + ")"); + plot.teleportPlayer(PlotPlayer.this, + result -> TaskManager.runTask(() -> { + if (getMeta("teleportOnLogin", true)) { + if (plot.isLoaded()) { + teleport(location); + sendMessage(CaptionUtility.format(PlotPlayer.this, + Captions.TELEPORTED_TO_PLOT.getTranslated()) + + " (quitLoc-unloaded) (" + plotX + "," + plotZ + + ")"); + } } - } - })); + })); } } } catch (Throwable e) { @@ -727,7 +727,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { } } - @FunctionalInterface public interface PlotPlayerConverter { + @FunctionalInterface + public interface PlotPlayerConverter { PlotPlayer convert(BaseObject object); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java b/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java index 59a2221ba..b5a6250ab 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java +++ b/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java @@ -25,13 +25,13 @@ */ package com.plotsquared.core.plot; -import com.plotsquared.core.configuration.serialization.ConfigurationSerializable; -import com.plotsquared.core.configuration.ConfigurationUtil; -import com.plotsquared.core.util.MathMan; -import com.plotsquared.core.util.StringMan; -import com.plotsquared.core.util.BlockUtil; -import com.plotsquared.core.util.PatternUtil; import com.google.common.collect.ImmutableMap; +import com.plotsquared.core.configuration.ConfigurationUtil; +import com.plotsquared.core.configuration.serialization.ConfigurationSerializable; +import com.plotsquared.core.util.BlockUtil; +import com.plotsquared.core.util.MathMan; +import com.plotsquared.core.util.PatternUtil; +import com.plotsquared.core.util.StringMan; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockState; @@ -49,7 +49,8 @@ import java.util.regex.Matcher; * A block bucket is a container of block types, where each block * has a specified chance of being randomly picked */ -@EqualsAndHashCode(of = {"input"}) @SuppressWarnings({"unused", "WeakerAccess"}) +@EqualsAndHashCode(of = {"input"}) +@SuppressWarnings({"unused", "WeakerAccess"}) public final class BlockBucket implements ConfigurationSerializable { private static java.util.regex.Pattern regex = java.util.regex.Pattern.compile( "((?[A-Za-z_]+):)?(?([A-Za-z_]+(\\[?[\\S\\s]+\\])?))(:(?[0-9]{1,3}))?"); @@ -134,7 +135,8 @@ public final class BlockBucket implements ConfigurationSerializable { String chanceStr = matcher.group("chance"); String block = matcher.group("block"); //noinspection PointlessNullCheck - if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan.isInteger(chanceStr)) { + if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan + .isInteger(chanceStr)) { String namespace = matcher.group("namespace"); string = (namespace == null ? "" : namespace + ":") + block; } @@ -191,7 +193,10 @@ public final class BlockBucket implements ConfigurationSerializable { return ImmutableMap.of("blocks", this.toString()); } - @Getter @EqualsAndHashCode @RequiredArgsConstructor private static final class Range { + @Getter + @EqualsAndHashCode + @RequiredArgsConstructor + private static final class Range { private final int min; private final int max; diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index d029542dd..975c9becf 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -25,13 +25,10 @@ */ package com.plotsquared.core.plot; -import com.plotsquared.core.events.TeleportCause; -import com.plotsquared.core.location.BlockLoc; -import com.plotsquared.core.location.Direction; -import com.plotsquared.core.location.Location; +import com.google.common.collect.BiMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.location.PlotLoc; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.Settings; @@ -40,32 +37,35 @@ import com.plotsquared.core.events.PlotComponentSetEvent; import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.PlotUnlinkEvent; import com.plotsquared.core.events.Result; +import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.generator.SquarePlotWorld; +import com.plotsquared.core.listener.PlotListener; +import com.plotsquared.core.location.BlockLoc; +import com.plotsquared.core.location.Direction; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.location.PlotLoc; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.comment.PlotComment; +import com.plotsquared.core.plot.expiration.ExpireManager; +import com.plotsquared.core.plot.expiration.PlotAnalysis; import com.plotsquared.core.plot.flag.FlagContainer; import com.plotsquared.core.plot.flag.GlobalFlagContainer; import com.plotsquared.core.plot.flag.InternalFlag; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.KeepFlag; -import com.plotsquared.core.generator.SquarePlotWorld; -import com.plotsquared.core.listener.PlotListener; -import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.plot.schematic.Schematic; +import com.plotsquared.core.queue.GlobalBlockQueue; +import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.StringWrapper; +import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; -import com.plotsquared.core.util.WorldUtil; -import com.plotsquared.core.queue.GlobalBlockQueue; -import com.plotsquared.core.queue.LocalBlockQueue; -import com.plotsquared.core.plot.expiration.ExpireManager; -import com.plotsquared.core.plot.expiration.PlotAnalysis; -import com.plotsquared.core.util.task.RunnableVal; -import com.google.common.collect.BiMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector2; @@ -103,7 +103,12 @@ import java.util.function.Consumer; import java.util.stream.Collectors; import static com.plotsquared.core.command.SubCommand.sendMessage; -import static com.plotsquared.core.util.entity.EntityCategories.*; +import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL; +import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY; +import static com.plotsquared.core.util.entity.EntityCategories.CAP_MISC; +import static com.plotsquared.core.util.entity.EntityCategories.CAP_MOB; +import static com.plotsquared.core.util.entity.EntityCategories.CAP_MONSTER; +import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; /** @@ -1285,12 +1290,12 @@ public class Plot { int[] count = new int[6]; for (Plot current : this.getConnectedPlots()) { int[] result = ChunkManager.manager.countEntities(current); - count[CAP_ENTITY] += result[CAP_ENTITY]; - count[CAP_ANIMAL] += result[CAP_ANIMAL]; - count[CAP_MONSTER] += result[CAP_MONSTER]; - count[CAP_MOB] += result[CAP_MOB]; - count[CAP_VEHICLE] += result[CAP_VEHICLE]; - count[CAP_MISC] += result[CAP_MISC]; + count[CAP_ENTITY] += result[CAP_ENTITY]; + count[CAP_ANIMAL] += result[CAP_ANIMAL]; + count[CAP_MONSTER] += result[CAP_MONSTER]; + count[CAP_MOB] += result[CAP_MOB]; + count[CAP_VEHICLE] += result[CAP_VEHICLE]; + count[CAP_MISC] += result[CAP_MISC]; } return count; } @@ -3058,8 +3063,8 @@ public class Plot { /** * Teleport a player to a plot and send them the teleport message. * - * @param player the player - * @param cause the cause of the teleport + * @param player the player + * @param cause the cause of the teleport * @param resultConsumer Called with the result of the teleportation */ public void teleportPlayer(final PlotPlayer player, TeleportCause cause, diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java index b8e2f7ab2..45749d9e1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -31,10 +31,10 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.collection.QuadMap; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationNode; -import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.ConfigurationSection; +import com.plotsquared.core.configuration.ConfigurationUtil; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.generator.GridPlotWorld; import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.location.Direction; @@ -217,8 +217,8 @@ public abstract class PlotArea { return false; } PlotArea plotarea = (PlotArea) obj; - return this.getWorldHash() == plotarea.getWorldHash() && this.getWorldName().equals(plotarea.getWorldName()) - && StringMan.isEqual(this.getId(), plotarea.getId()); + return this.getWorldHash() == plotarea.getWorldHash() && this.getWorldName() + .equals(plotarea.getWorldName()) && StringMan.isEqual(this.getId(), plotarea.getId()); } public Set getClusters() { @@ -359,8 +359,9 @@ public abstract class PlotArea { String prefix = " "; for (final PlotFlag flag : flagCollection) { Object value = flag.toString(); - flagBuilder.append(prefix).append(CaptionUtility.format(null, Captions.PLOT_FLAG_LIST.getTranslated(), - flag.getName(), CaptionUtility.formatRaw(null, value.toString(), ""))); + flagBuilder.append(prefix).append(CaptionUtility + .format(null, Captions.PLOT_FLAG_LIST.getTranslated(), flag.getName(), + CaptionUtility.formatRaw(null, value.toString(), ""))); prefix = ", "; } } @@ -543,8 +544,8 @@ public abstract class PlotArea { } public boolean contains(@NotNull final Location location) { - return StringMan.isEqual(location.getWorld(), this.getWorldName()) && (getRegionAbs() == null - || this.region.contains(location.getBlockVector3())); + return StringMan.isEqual(location.getWorld(), this.getWorldName()) && ( + getRegionAbs() == null || this.region.contains(location.getBlockVector3())); } @NotNull public Set getPlotsAbs(final UUID uuid) { @@ -599,6 +600,7 @@ public abstract class PlotArea { public int getPlotCount(@Nullable final PlotPlayer player) { return player != null ? getPlotCount(player.getUUID()) : 0; } + @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { @@ -640,7 +642,8 @@ public abstract class PlotArea { return this.clusters != null ? this.clusters.get(plot.getId().x, plot.getId().y) : null; } - @Nullable public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1, + @Nullable + public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1, @NotNull final PlotId pos2) { if (this.clusters == null) { return null; @@ -1051,15 +1054,16 @@ public abstract class PlotArea { } else { split = key.split(":"); } - final PlotFlag flagInstance = GlobalFlagContainer.getInstance().getFlagFromString(split[0]); + final PlotFlag flagInstance = + GlobalFlagContainer.getInstance().getFlagFromString(split[0]); if (flagInstance != null) { try { flags.add(flagInstance.parse(split[1])); } catch (final FlagParseException e) { - PlotSquared.log(Captions.PREFIX.getTranslated() + - String.format("§cFailed to parse default flag with key §6'%s'§c and value: §6'%s'§c." - + " Reason: %s. This flag will not be added as a default flag.", - e.getFlag().getName(), e.getValue(), e.getErrorMessage())); + PlotSquared.log(Captions.PREFIX.getTranslated() + String.format( + "§cFailed to parse default flag with key §6'%s'§c and value: §6'%s'§c." + + " Reason: %s. This flag will not be added as a default flag.", + e.getFlag().getName(), e.getValue(), e.getErrorMessage())); } } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotAreaTerrainType.java b/Core/src/main/java/com/plotsquared/core/plot/PlotAreaTerrainType.java index e0835c263..1008f0104 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotAreaTerrainType.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotAreaTerrainType.java @@ -54,14 +54,13 @@ public enum PlotAreaTerrainType { ALL; private static final Map types = Stream.of(values()) - .collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity())); + .collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity())); public static Optional fromString(String typeString) { return Optional.ofNullable(types.get(typeString.toLowerCase())); } - @Deprecated - public static Optional fromLegacyInt(int typeId) { + @Deprecated public static Optional fromLegacyInt(int typeId) { if (typeId < 0 || typeId >= values().length) { return Optional.empty(); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotAreaType.java b/Core/src/main/java/com/plotsquared/core/plot/PlotAreaType.java index 69108a67e..60c9fc7f0 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotAreaType.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotAreaType.java @@ -32,19 +32,16 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public enum PlotAreaType { - NORMAL, - AUGMENTED, - PARTIAL; + NORMAL, AUGMENTED, PARTIAL; private static final Map types = Stream.of(values()) - .collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity())); + .collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity())); public static Optional fromString(String typeName) { return Optional.ofNullable(types.get(typeName.toLowerCase())); } - @Deprecated - public static Optional fromLegacyInt(int typeId) { + @Deprecated public static Optional fromLegacyInt(int typeId) { if (typeId < 0 || typeId >= values().length) { return Optional.empty(); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java b/Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java index 51eed1f47..c9de0e90c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java @@ -25,9 +25,9 @@ */ package com.plotsquared.core.plot; +import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.location.Location; -import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.RegionUtil; import com.sk89q.worldedit.regions.CuboidRegion; @@ -154,12 +154,13 @@ public class PlotCluster { public void getHome(Consumer result) { BlockLoc home = this.settings.getPosition(); Consumer locationConsumer = toReturn -> { - MainUtil.getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(), max -> { - if (max > toReturn.getY()) { - toReturn.setY(1 + max); - } - result.accept(toReturn); - }); + MainUtil.getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(), + max -> { + if (max > toReturn.getY()) { + toReturn.setY(1 + max); + } + result.accept(toReturn); + }); }; if (home.getY() == 0) { // default pos diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotId.java b/Core/src/main/java/com/plotsquared/core/plot/PlotId.java index f7fa1f39d..3421de833 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotId.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotId.java @@ -31,10 +31,8 @@ import org.jetbrains.annotations.Nullable; public class PlotId { - @Deprecated - public int x; - @Deprecated - public int y; + @Deprecated public int x; + @Deprecated public int y; private int hash; /** diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotManager.java b/Core/src/main/java/com/plotsquared/core/plot/PlotManager.java index 836251ddf..236eeee0f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotManager.java @@ -25,9 +25,9 @@ */ package com.plotsquared.core.plot; -import com.plotsquared.core.location.Location; import com.plotsquared.core.command.Template; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.location.Location; import com.plotsquared.core.util.FileBytes; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotSettings.java b/Core/src/main/java/com/plotsquared/core/plot/PlotSettings.java index 39d74083d..d873d6800 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotSettings.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotSettings.java @@ -25,10 +25,10 @@ */ package com.plotsquared.core.plot; +import com.google.common.collect.ImmutableList; import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.location.Direction; import com.plotsquared.core.plot.comment.PlotComment; -import com.google.common.collect.ImmutableList; import lombok.Getter; import lombok.Setter; diff --git a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentInbox.java b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentInbox.java index d707d0686..a1caeec21 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentInbox.java +++ b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentInbox.java @@ -26,10 +26,10 @@ package com.plotsquared.core.plot.comment; import com.plotsquared.core.database.DBFunc; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.task.RunnableVal; import java.util.List; diff --git a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java index 17be28d07..6c41b905c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java @@ -25,13 +25,13 @@ */ package com.plotsquared.core.plot.comment; +import com.google.common.annotations.Beta; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import com.google.common.annotations.Beta; import java.util.Collection; import java.util.HashMap; diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java index 27bb96185..84f4139ff 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java @@ -32,21 +32,21 @@ import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotUnlinkEvent; import com.plotsquared.core.events.Result; +import com.plotsquared.core.generator.HybridUtils; +import com.plotsquared.core.player.OfflinePlotPlayer; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.PlotArea; +import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.flag.GlobalFlagContainer; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.AnalysisFlag; import com.plotsquared.core.plot.flag.implementations.KeepFlag; -import com.plotsquared.core.generator.HybridUtils; -import com.plotsquared.core.player.OfflinePlotPlayer; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.message.PlotMessage; -import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; -import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; @@ -337,8 +337,10 @@ public class ExpireManager { } }, () -> { PlotFlag plotFlag = GlobalFlagContainer.getInstance() - .getFlag(AnalysisFlag.class).createFlagInstance(changed.asList()); - PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, newPlot); + .getFlag(AnalysisFlag.class) + .createFlagInstance(changed.asList()); + PlotFlagAddEvent event = + new PlotFlagAddEvent(plotFlag, newPlot); if (event.getEventResult() == Result.DENY) { return; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpiryTask.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpiryTask.java index 53a33100f..a7cd1b86b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpiryTask.java +++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpiryTask.java @@ -51,8 +51,8 @@ public class ExpiryTask { } public boolean allowsArea(PlotArea area) { - return settings.WORLDS.contains(area.toString()) || settings.WORLDS.contains(area.getWorldName()) - || settings.WORLDS.contains("*"); + return settings.WORLDS.contains(area.toString()) || settings.WORLDS + .contains(area.getWorldName()) || settings.WORLDS.contains("*"); } public boolean applies(PlotArea area) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java index dba11d26e..f7d326411 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java +++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java @@ -27,11 +27,11 @@ package com.plotsquared.core.plot.expiration; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.plot.flag.implementations.AnalysisFlag; import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.plot.flag.implementations.AnalysisFlag; import com.plotsquared.core.util.MathMan; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import java.lang.reflect.Array; diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java index 446f31348..ba923c396 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java @@ -26,10 +26,10 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.player.PlotPlayer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java index 2cd329f7d..390ae4ba7 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java @@ -26,9 +26,9 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.InternalFlag; import com.plotsquared.core.plot.flag.PlotFlag; -import com.plotsquared.core.plot.Plot; import org.jetbrains.annotations.NotNull; public class DoneFlag extends PlotFlag implements InternalFlag { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java index dbd28d360..ffe72a7b4 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java @@ -88,9 +88,7 @@ public class FlyFlag extends PlotFlag { } public enum FlyStatus { - ENABLED, - DISABLED, - DEFAULT + ENABLED, DISABLED, DEFAULT } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java index 6d50df274..175c22c1e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java @@ -51,8 +51,8 @@ public class MusicFlag extends PlotFlag { input = "music_disc_" + input; } final ItemType itemType = ItemUtil.get(input); - if (itemType != null && itemType.getId() != null && - (itemType == ItemTypes.AIR || itemType.getId().contains("music_disc_"))) { + if (itemType != null && itemType.getId() != null && (itemType == ItemTypes.AIR || itemType + .getId().contains("music_disc_"))) { return new MusicFlag(ItemUtil.get(input)); } else { throw new FlagParseException(this, input, Captions.FLAG_ERROR_MUSIC); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java index c51ef7b00..0b160dae5 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java @@ -83,9 +83,7 @@ public class TitlesFlag extends PlotFlag } public enum TitlesFlagValue { - NONE, - TRUE, - FALSE; + NONE, TRUE, FALSE; @Nullable public static TitlesFlagValue fromString(final String value) { if (value.equalsIgnoreCase("true")) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java index 5900eb354..7b7ea495d 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java @@ -26,8 +26,8 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.PlotWeather; +import com.plotsquared.core.plot.flag.PlotFlag; import org.jetbrains.annotations.NotNull; import java.util.Arrays; @@ -35,12 +35,9 @@ import java.util.Collection; public class WeatherFlag extends PlotFlag { - public static final WeatherFlag PLOT_WEATHER_FLAG_RAIN = - new WeatherFlag(PlotWeather.RAIN); - public static final WeatherFlag PLOT_WEATHER_FLAG_CLEAR = - new WeatherFlag(PlotWeather.CLEAR); - public static final WeatherFlag PLOT_WEATHER_FLAG_OFF = - new WeatherFlag(PlotWeather.RESET); + public static final WeatherFlag PLOT_WEATHER_FLAG_RAIN = new WeatherFlag(PlotWeather.RAIN); + public static final WeatherFlag PLOT_WEATHER_FLAG_CLEAR = new WeatherFlag(PlotWeather.CLEAR); + public static final WeatherFlag PLOT_WEATHER_FLAG_OFF = new WeatherFlag(PlotWeather.RESET); /** * Construct a new flag instance. @@ -92,7 +89,8 @@ public class WeatherFlag extends PlotFlag { } @Override public Collection getTabCompletions() { - return Arrays.asList("rain", "storm", "on", "lightning", "thunder", "clear", "off", "sun", "reset"); + return Arrays + .asList("rain", "storm", "on", "lightning", "thunder", "clear", "off", "sun", "reset"); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java index 445357ae7..6f30448f3 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java @@ -58,8 +58,11 @@ public abstract class BlockTypeListFlag> if (blockState == null) { // If it's not a block state, we assume it's a block category final BlockCategory blockCategory; - if (!blockString.startsWith("#") || (blockCategory = BlockCategory.REGISTRY.get(blockString.substring(1))) == null) { - throw new FlagParseException(this, blockString, Captions.FLAG_ERROR_INVALID_BLOCK); + if (!blockString.startsWith("#") + || (blockCategory = BlockCategory.REGISTRY.get(blockString.substring(1))) + == null) { + throw new FlagParseException(this, blockString, + Captions.FLAG_ERROR_INVALID_BLOCK); } else { blockTypeWrapper = BlockTypeWrapper.get(blockCategory); } @@ -79,10 +82,12 @@ public abstract class BlockTypeListFlag> @Override public Collection getTabCompletions() { final Collection tabCompletions = new ArrayList<>(); - tabCompletions.addAll(BlockType.REGISTRY.keySet().stream().map(val -> val.replace("minecraft:", "")) - .collect(Collectors.toList())); - tabCompletions.addAll(BlockCategory.REGISTRY.keySet().stream().map(val -> "#" + val.replace("minecraft:", "")) - .collect(Collectors.toList())); + tabCompletions.addAll( + BlockType.REGISTRY.keySet().stream().map(val -> val.replace("minecraft:", "")) + .collect(Collectors.toList())); + tabCompletions.addAll( + BlockCategory.REGISTRY.keySet().stream().map(val -> "#" + val.replace("minecraft:", "")) + .collect(Collectors.toList())); return tabCompletions; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java index db7f8d6f7..30c75e73b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java @@ -40,7 +40,8 @@ import java.util.Map; * Container that class either contains a {@link BlockType} * or a {@link BlockCategory} */ -@EqualsAndHashCode public class BlockTypeWrapper { +@EqualsAndHashCode +public class BlockTypeWrapper { @Nullable @Getter private final BlockType blockType; @Nullable @Getter private final BlockCategory blockCategory; @@ -63,7 +64,7 @@ import java.util.Map; } else { return key; } - } else if(this.blockCategory != null) { + } else if (this.blockCategory != null) { final String key = this.blockCategory.toString(); if (key.startsWith("minecraft:")) { return '#' + key.substring(10); diff --git a/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java b/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java index e0e56c4fb..95ae8e953 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java +++ b/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java @@ -26,8 +26,8 @@ package com.plotsquared.core.plot.message; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.ChatManager; public class PlotMessage { diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java index 3769347a4..c4528bb81 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java @@ -25,10 +25,10 @@ */ package com.plotsquared.core.plot.world; +import com.plotsquared.core.collection.QuadMap; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.util.StringMan; -import com.plotsquared.core.collection.QuadMap; import com.sk89q.worldedit.regions.CuboidRegion; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java index 953a7cd6f..b6d23b3d4 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java @@ -37,7 +37,7 @@ public interface PlotAreaManager { * method assumes that the caller already knows that * the location belongs to a plot area, in which * case it will return the appropriate plot area. - * + *

* If the location does not belong to a plot area, * it may still return an area. * diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java index 24f3e610f..a57fe7d3d 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java @@ -25,12 +25,12 @@ */ package com.plotsquared.core.plot.world; -import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; +import com.plotsquared.core.plot.flag.PlotFlag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java index 39af62076..da1613cee 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java @@ -25,25 +25,25 @@ */ package com.plotsquared.core.plot.world; -import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationNode; -import com.plotsquared.core.generator.SingleWorldGenerator; -import com.plotsquared.core.plot.flag.FlagContainer; +import com.plotsquared.core.configuration.ConfigurationSection; +import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.generator.GridPlotWorld; +import com.plotsquared.core.generator.SingleWorldGenerator; import com.plotsquared.core.location.Location; +import com.plotsquared.core.location.PlotLoc; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.location.PlotLoc; import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.PlotSettings; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.SetupObject; +import com.plotsquared.core.plot.flag.FlagContainer; import com.plotsquared.core.util.SetupUtils; -import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.WorldUtil; +import com.plotsquared.core.util.task.RunnableVal; +import com.plotsquared.core.util.task.TaskManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -197,8 +197,9 @@ public class SinglePlotArea extends GridPlotWorld { PlotSettings s = p.getSettings(); final FlagContainer oldContainer = p.getFlagContainer(); - p = new SinglePlot(p.getId(), p.getOwnerAbs(), p.getTrusted(), p.getMembers(), p.getDenied(), - s.getAlias(), s.getPosition(), null, this, s.getMerged(), p.getTimestamp(), p.temp); + p = new SinglePlot(p.getId(), p.getOwnerAbs(), p.getTrusted(), p.getMembers(), + p.getDenied(), s.getAlias(), s.getPosition(), null, this, s.getMerged(), + p.getTimestamp(), p.temp); p.getFlagContainer().addAll(oldContainer); return p; diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java index 6f13bc7cd..eb512cd50 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java @@ -25,10 +25,10 @@ */ package com.plotsquared.core.plot.world; +import com.plotsquared.core.collection.ArrayUtil; import com.plotsquared.core.generator.SingleWorldGenerator; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.collection.ArrayUtil; import com.plotsquared.core.util.SetupUtils; import com.sk89q.worldedit.regions.CuboidRegion; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java index 570488307..f979b4e9f 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java +++ b/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java @@ -27,11 +27,11 @@ package com.plotsquared.core.queue; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.util.PatternUtil; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.StringMan; -import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.WorldUtil; -import com.plotsquared.core.util.PatternUtil; +import com.plotsquared.core.util.uuid.UUIDHandler; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector2; @@ -131,7 +131,8 @@ public abstract class LocalBlockQueue { .equals(loc)) { continue; } - pLoc.setY(WorldUtil.IMP.getHighestBlockSynchronous(getWorld(), pLoc.getX(), pLoc.getZ())); + pLoc.setY( + WorldUtil.IMP.getHighestBlockSynchronous(getWorld(), pLoc.getX(), pLoc.getZ())); pp.teleport(pLoc); } } diff --git a/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateLocalBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateLocalBlockQueue.java index 966cb36a6..cea58a95d 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateLocalBlockQueue.java @@ -40,9 +40,8 @@ public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQue private final int blockX; private final int blockZ; - public LocationOffsetDelegateLocalBlockQueue(final boolean[][] canPlace, - final int blockX, final int blockZ, - @Nullable LocalBlockQueue parent) { + public LocationOffsetDelegateLocalBlockQueue(final boolean[][] canPlace, final int blockX, + final int blockZ, @Nullable LocalBlockQueue parent) { super(parent); this.canPlace = canPlace; this.blockX = blockX; @@ -62,8 +61,10 @@ public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQue return super.setBlock(x, y, z, id); } } catch (final Exception e) { - PlotSquared.debug(String.format("Failed to set block at: %d;%d;%d (to = %s) with offset %d;%d." - + " Translated to: %d;%d", x, y, z, id, blockX, blockZ, x - blockX, z - blockZ)); + PlotSquared.debug(String.format( + "Failed to set block at: %d;%d;%d (to = %s) with offset %d;%d." + + " Translated to: %d;%d", x, y, z, id, blockX, blockZ, x - blockX, + z - blockZ)); throw e; } return false; diff --git a/Core/src/main/java/com/plotsquared/core/util/ChatManager.java b/Core/src/main/java/com/plotsquared/core/util/ChatManager.java index e6f741219..0398f6538 100644 --- a/Core/src/main/java/com/plotsquared/core/util/ChatManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/ChatManager.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.util; -import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.message.PlotMessage; public abstract class ChatManager { public static ChatManager manager; diff --git a/Core/src/main/java/com/plotsquared/core/util/ChunkManager.java b/Core/src/main/java/com/plotsquared/core/util/ChunkManager.java index 6a938b7e6..4a4082d8b 100644 --- a/Core/src/main/java/com/plotsquared/core/util/ChunkManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/ChunkManager.java @@ -28,10 +28,10 @@ package com.plotsquared.core.util; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.queue.ScopedLocalBlockQueue; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; diff --git a/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java b/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java index e0e579171..91eb4e99d 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java @@ -26,9 +26,9 @@ package com.plotsquared.core.util; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag; -import com.plotsquared.core.plot.Plot; import lombok.NonNull; import lombok.experimental.UtilityClass; @@ -42,7 +42,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; /** * Entity related general utility methods */ -@UtilityClass public final class EntityUtil { +@UtilityClass +public final class EntityUtil { private static int capNumeral(@NonNull final String flagName) { int i; diff --git a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java index e64c3b919..cb554b754 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java +++ b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java @@ -25,7 +25,11 @@ */ package com.plotsquared.core.util; +import com.google.common.eventbus.EventBus; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.configuration.CaptionUtility; +import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlayerAutoPlotEvent; import com.plotsquared.core.events.PlayerClaimPlotEvent; import com.plotsquared.core.events.PlayerEnterPlotEvent; @@ -46,10 +50,15 @@ import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.PlotRateEvent; import com.plotsquared.core.events.PlotUnlinkEvent; +import com.plotsquared.core.listener.PlayerBlockEventType; +import com.plotsquared.core.location.Direction; +import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.configuration.CaptionUtility; -import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.PlotArea; +import com.plotsquared.core.plot.PlotId; +import com.plotsquared.core.plot.Rating; +import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.DeviceInteractFlag; import com.plotsquared.core.plot.flag.implementations.MiscPlaceFlag; @@ -58,17 +67,8 @@ import com.plotsquared.core.plot.flag.implementations.PlaceFlag; import com.plotsquared.core.plot.flag.implementations.UseFlag; import com.plotsquared.core.plot.flag.implementations.VehiclePlaceFlag; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; -import com.plotsquared.core.listener.PlayerBlockEventType; -import com.plotsquared.core.location.Direction; -import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.plot.Rating; import com.plotsquared.core.plot.world.SinglePlotArea; -import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.util.task.TaskManager; -import com.google.common.eventbus.EventBus; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; @@ -241,7 +241,8 @@ public class EventDispatcher { final Plot plot = player.getCurrentPlot(); if (Settings.Teleport.ON_LOGIN && plot != null && !(plot .getArea() instanceof SinglePlotArea)) { - TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {})); + TaskManager.runTask(() -> plot.teleportPlayer(player, result -> { + })); MainUtil.sendMessage(player, CaptionUtility.format(player, Captions.TELEPORTED_TO_ROAD.getTranslated()) + " (on-login) " + "(" + plot.getId().x + ";" + plot.getId().y + ")"); @@ -251,7 +252,8 @@ public class EventDispatcher { public void doRespawnTask(final PlotPlayer player) { final Plot plot = player.getCurrentPlot(); if (Settings.Teleport.ON_DEATH && plot != null) { - TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {})); + TaskManager.runTask(() -> plot.teleportPlayer(player, result -> { + })); MainUtil.sendMessage(player, Captions.TELEPORTED_TO_ROAD); } } diff --git a/Core/src/main/java/com/plotsquared/core/util/InventoryUtil.java b/Core/src/main/java/com/plotsquared/core/util/InventoryUtil.java index c203a9656..c2d12ae13 100644 --- a/Core/src/main/java/com/plotsquared/core/util/InventoryUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/InventoryUtil.java @@ -25,9 +25,9 @@ */ package com.plotsquared.core.util; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.PlotItemStack; -import com.plotsquared.core.player.PlotPlayer; /** * This class is only used by internal functions, for most cases use the PlotInventory class diff --git a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java index e930c6aec..d329a8e23 100644 --- a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java +++ b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java @@ -25,12 +25,12 @@ */ package com.plotsquared.core.util; -import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.plot.BlockBucket; +import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.player.ConsolePlayer; +import com.plotsquared.core.plot.BlockBucket; import com.sk89q.worldedit.world.block.BlockState; import lombok.NonNull; @@ -42,7 +42,8 @@ import java.util.Map; /** * Converts legacy configurations into the new (BlockBucket) format */ -@SuppressWarnings("unused") public final class LegacyConverter { +@SuppressWarnings("unused") +public final class LegacyConverter { public static final String CONFIGURATION_VERSION = "post_flattening"; private static final HashMap TYPE_MAP = new HashMap<>(); @@ -109,7 +110,8 @@ import java.util.Map; final BlockBucket bucket = this.blockToBucket(block); this.setString(section, key, bucket); PlotSquared.log(CaptionUtility - .format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(), block, bucket.toString())); + .format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(), + block, bucket.toString())); } private void convertBlockList(@NonNull final ConfigurationSection section, @@ -118,8 +120,8 @@ import java.util.Map; final BlockBucket bucket = this.blockListToBucket(blocks); this.setString(section, key, bucket); PlotSquared.log(CaptionUtility - .format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(), plotBlockArrayString(blocks), - bucket.toString())); + .format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(), + plotBlockArrayString(blocks), bucket.toString())); } private String plotBlockArrayString(@NonNull final BlockState[] blocks) { diff --git a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java index 0bd6bee3e..93cb7b3e4 100644 --- a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java @@ -26,28 +26,27 @@ package com.plotsquared.core.util; import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.util.net.AbstractDelegateOutputStream; -import com.plotsquared.core.configuration.ConfigurationSection; -import com.plotsquared.core.player.ConsolePlayer; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.command.Like; import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; -import com.plotsquared.core.plot.expiration.ExpireManager; -import com.plotsquared.core.plot.flag.PlotFlag; -import com.plotsquared.core.plot.flag.implementations.DescriptionFlag; -import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag; -import com.plotsquared.core.plot.flag.types.DoubleFlag; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.ConsolePlayer; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotId; - +import com.plotsquared.core.plot.expiration.ExpireManager; +import com.plotsquared.core.plot.flag.PlotFlag; +import com.plotsquared.core.plot.flag.implementations.DescriptionFlag; +import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag; +import com.plotsquared.core.plot.flag.types.DoubleFlag; +import com.plotsquared.core.util.net.AbstractDelegateOutputStream; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.uuid.UUIDHandler; @@ -59,11 +58,9 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; -import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.io.Reader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; @@ -97,6 +94,7 @@ import java.util.stream.IntStream; public class MainUtil { private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0"); + static { FLAG_DECIMAL_FORMAT.setMaximumFractionDigits(340); } @@ -252,10 +250,12 @@ public class MainUtil { */ public static boolean resetBiome(PlotArea area, Location pos1, Location pos2) { BiomeType biome = area.getPlotBiome(); - if (!Objects.equals(WorldUtil.IMP.getBiomeSynchronous(area.getWorldName(), (pos1.getX() + pos2.getX()) / 2, - (pos1.getZ() + pos2.getZ()) / 2), biome)) { - MainUtil.setBiome(area.getWorldName(), pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(), - biome); + if (!Objects.equals(WorldUtil.IMP + .getBiomeSynchronous(area.getWorldName(), (pos1.getX() + pos2.getX()) / 2, + (pos1.getZ() + pos2.getZ()) / 2), biome)) { + MainUtil + .setBiome(area.getWorldName(), pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(), + biome); return true; } return false; @@ -656,8 +656,8 @@ public class MainUtil { .format(null, (prefix ? Captions.PREFIX.getTranslated() : "") + msg); PlotSquared.log(message); } else { - player.sendMessage( - CaptionUtility.format(player, (prefix ? Captions.PREFIX.getTranslated() : "") + Captions.color(msg))); + player.sendMessage(CaptionUtility.format(player, + (prefix ? Captions.PREFIX.getTranslated() : "") + Captions.color(msg))); } } return true; @@ -776,8 +776,8 @@ public class MainUtil { * @param full * @param whenDone */ - public static void format(final String iInfo, final Plot plot, PlotPlayer player, final boolean full, - final RunnableVal whenDone) { + public static void format(final String iInfo, final Plot plot, PlotPlayer player, + final boolean full, final RunnableVal whenDone) { int num = plot.getConnectedPlots().size(); String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : Captions.NONE.getTranslated(); Location bot = plot.getCorners()[0]; @@ -820,16 +820,19 @@ public class MainUtil { } else { value = flag.toString(); } - flags.append(prefix).append(CaptionUtility.format(player, Captions.PLOT_FLAG_LIST.getTranslated(), - flag.getName(), CaptionUtility.formatRaw(player, value.toString(), ""))); + flags.append(prefix).append(CaptionUtility + .format(player, Captions.PLOT_FLAG_LIST.getTranslated(), flag.getName(), + CaptionUtility.formatRaw(player, value.toString(), ""))); prefix = ", "; } } boolean build = plot.isAdded(player.getUUID()); String owner = plot.getOwners().isEmpty() ? "unowned" : getPlayerList(plot.getOwners()); if (plot.getArea() != null) { - info = info.replace("%area%", plot.getArea().getWorldName() + - (plot.getArea().getId() == null ? "" : "(" + plot.getArea().getId() + ")")); + info = info.replace("%area%", + plot.getArea().getWorldName() + (plot.getArea().getId() == null ? + "" : + "(" + plot.getArea().getId() + ")")); } else { info = info.replace("%area%", Captions.NONE.getTranslated()); } @@ -941,9 +944,8 @@ public class MainUtil { } private static T getValueFromConfig(ConfigurationSection config, String path, - IntFunction> intParser, - Function> textualParser, - Supplier defaultValue) { + IntFunction> intParser, Function> textualParser, + Supplier defaultValue) { String value = config.getString(path); if (value == null) { return defaultValue.get(); @@ -955,16 +957,12 @@ public class MainUtil { } public static PlotAreaType getType(ConfigurationSection config) { - return getValueFromConfig(config, "generator.type", - PlotAreaType::fromLegacyInt, - PlotAreaType::fromString, - () -> PlotAreaType.NORMAL); + return getValueFromConfig(config, "generator.type", PlotAreaType::fromLegacyInt, + PlotAreaType::fromString, () -> PlotAreaType.NORMAL); } public static PlotAreaTerrainType getTerrain(ConfigurationSection config) { - return getValueFromConfig(config, "generator.terrain", - PlotAreaTerrainType::fromLegacyInt, - PlotAreaTerrainType::fromString, - () -> PlotAreaTerrainType.NONE); + return getValueFromConfig(config, "generator.terrain", PlotAreaTerrainType::fromLegacyInt, + PlotAreaTerrainType::fromString, () -> PlotAreaTerrainType.NONE); } } diff --git a/Core/src/main/java/com/plotsquared/core/util/OperationUtil.java b/Core/src/main/java/com/plotsquared/core/util/OperationUtil.java index af2df598e..37dc11d80 100644 --- a/Core/src/main/java/com/plotsquared/core/util/OperationUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/OperationUtil.java @@ -25,10 +25,10 @@ */ package com.plotsquared.core.util; -import com.plotsquared.core.location.Location; -import com.plotsquared.core.player.PlotPlayer; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListeningExecutorService; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; diff --git a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java index 146215c52..a5a3911cc 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java @@ -25,10 +25,10 @@ */ package com.plotsquared.core.util; +import com.google.common.base.Preconditions; import com.plotsquared.core.command.Command; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.player.PlotPlayer; -import com.google.common.base.Preconditions; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.InputParseException; @@ -47,10 +47,8 @@ public class PatternUtil { public static BaseBlock apply(@NotNull Pattern pattern, int x, int y, int z) { Preconditions.checkNotNull(pattern, "Pattern may not be null"); - if (pattern instanceof BlockPattern - || pattern instanceof RandomPattern - || pattern instanceof BlockState - || pattern instanceof BlockType + if (pattern instanceof BlockPattern || pattern instanceof RandomPattern + || pattern instanceof BlockState || pattern instanceof BlockType || pattern instanceof BaseBlock) { return pattern.apply(BlockVector3.ZERO); } diff --git a/Core/src/main/java/com/plotsquared/core/util/RuntimeExceptionRunnableVal.java b/Core/src/main/java/com/plotsquared/core/util/RuntimeExceptionRunnableVal.java index 56bb9cc70..f66b384ed 100644 --- a/Core/src/main/java/com/plotsquared/core/util/RuntimeExceptionRunnableVal.java +++ b/Core/src/main/java/com/plotsquared/core/util/RuntimeExceptionRunnableVal.java @@ -30,7 +30,8 @@ import lombok.RequiredArgsConstructor; import java.util.concurrent.atomic.AtomicBoolean; -@RequiredArgsConstructor public class RuntimeExceptionRunnableVal extends RunnableVal { +@RequiredArgsConstructor +public class RuntimeExceptionRunnableVal extends RunnableVal { private final RunnableVal function; private final AtomicBoolean running; diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index d110626f9..3adb8d19e 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -31,11 +31,11 @@ import com.plotsquared.core.generator.ClassicPlotWorld; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.util.uuid.UUIDHandler; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.schematic.Schematic; import com.plotsquared.core.queue.LocalBlockQueue; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; +import com.plotsquared.core.util.uuid.UUIDHandler; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; @@ -205,7 +205,8 @@ public abstract class SchematicHandler { if (pw instanceof ClassicPlotWorld) { y_offset_actual = yOffset + ((ClassicPlotWorld) pw).PLOT_HEIGHT; } else { - y_offset_actual = yOffset + 1 + WorldUtil.IMP.getHighestBlockSynchronous(plot.getWorldName(), + y_offset_actual = yOffset + 1 + WorldUtil.IMP + .getHighestBlockSynchronous(plot.getWorldName(), region.getMinimumPoint().getX() + 1, region.getMinimumPoint().getZ() + 1); } diff --git a/Core/src/main/java/com/plotsquared/core/util/WEManager.java b/Core/src/main/java/com/plotsquared/core/util/WEManager.java index 9734a562a..110c3ec3e 100644 --- a/Core/src/main/java/com/plotsquared/core/util/WEManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/WEManager.java @@ -27,12 +27,12 @@ package com.plotsquared.core.util; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.plot.flag.implementations.DoneFlag; -import com.plotsquared.core.plot.flag.implementations.NoWorldeditFlag; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; +import com.plotsquared.core.plot.flag.implementations.NoWorldeditFlag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; diff --git a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java index 33ce89694..9c7730703 100644 --- a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java @@ -27,8 +27,8 @@ package com.plotsquared.core.util; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.location.Location; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.task.RunnableVal; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; @@ -70,8 +70,7 @@ public abstract class WorldUtil { /** * @deprecated May result in synchronous chunk loading */ - @Deprecated - public abstract String[] getSignSynchronous(Location location); + @Deprecated public abstract String[] getSignSynchronous(Location location); public abstract Location getSpawn(String world); @@ -90,24 +89,21 @@ public abstract class WorldUtil { /** * @deprecated May result in synchronous chunk loading */ - @Deprecated - public abstract BiomeType getBiomeSynchronous(String world, int x, int z); + @Deprecated public abstract BiomeType getBiomeSynchronous(String world, int x, int z); public abstract void getBlock(Location location, Consumer result); /** * @deprecated May result in synchronous chunk loading */ - @Deprecated - public abstract BlockState getBlockSynchronous(Location location); + @Deprecated public abstract BlockState getBlockSynchronous(Location location); public abstract void getHighestBlock(String world, int x, int z, final IntConsumer result); /** * @deprecated May result in synchronous chunk loading */ - @Deprecated - public abstract int getHighestBlockSynchronous(String world, int x, int z); + @Deprecated public abstract int getHighestBlockSynchronous(String world, int x, int z); public abstract void setSign(String world, int x, int y, int z, String[] lines); @@ -115,7 +111,8 @@ public abstract class WorldUtil { public abstract com.sk89q.worldedit.world.World getWeWorld(String world); - public void upload(@NotNull final Plot plot, UUID uuid, String file, RunnableVal whenDone) { + public void upload(@NotNull final Plot plot, UUID uuid, String file, + RunnableVal whenDone) { plot.getHome(home -> MainUtil.upload(uuid, file, "zip", new RunnableVal() { @Override public void run(OutputStream output) { try (final ZipOutputStream zos = new ZipOutputStream(output)) { diff --git a/Core/src/main/java/com/plotsquared/core/util/entity/EntityCategories.java b/Core/src/main/java/com/plotsquared/core/util/entity/EntityCategories.java index 485db847b..ae1a5c0cd 100644 --- a/Core/src/main/java/com/plotsquared/core/util/entity/EntityCategories.java +++ b/Core/src/main/java/com/plotsquared/core/util/entity/EntityCategories.java @@ -30,22 +30,22 @@ package com.plotsquared.core.util.entity; */ public class EntityCategories { - public static final int CAP_ENTITY = 0; - public static final int CAP_ANIMAL = 1; + public static final int CAP_ENTITY = 0; + public static final int CAP_ANIMAL = 1; public static final int CAP_MONSTER = 2; - public static final int CAP_MOB = 3; + public static final int CAP_MOB = 3; public static final int CAP_VEHICLE = 4; - public static final int CAP_MISC = 5; + public static final int CAP_MISC = 5; - public static final EntityCategory ANIMAL = register("animal"); - public static final EntityCategory TAMEABLE = register("tameable"); - public static final EntityCategory VEHICLE = register("vehicle"); - public static final EntityCategory HOSTILE = register("hostile"); - public static final EntityCategory HANGING = register("hanging"); - public static final EntityCategory VILLAGER = register("villager"); - public static final EntityCategory PROJECTILE = register("projectile"); - public static final EntityCategory OTHER = register("other"); - public static final EntityCategory PLAYER = register("player"); + public static final EntityCategory ANIMAL = register("animal"); + public static final EntityCategory TAMEABLE = register("tameable"); + public static final EntityCategory VEHICLE = register("vehicle"); + public static final EntityCategory HOSTILE = register("hostile"); + public static final EntityCategory HANGING = register("hanging"); + public static final EntityCategory VILLAGER = register("villager"); + public static final EntityCategory PROJECTILE = register("projectile"); + public static final EntityCategory OTHER = register("other"); + public static final EntityCategory PLAYER = register("player"); public static EntityCategory register(final String id) { final EntityCategory entityCategory = new EntityCategory(id); @@ -53,6 +53,7 @@ public class EntityCategories { return entityCategory; } - public static void init() {} + public static void init() { + } } diff --git a/Core/src/main/java/com/plotsquared/core/util/entity/EntityCategory.java b/Core/src/main/java/com/plotsquared/core/util/entity/EntityCategory.java index 60f7190ef..30236ed34 100644 --- a/Core/src/main/java/com/plotsquared/core/util/entity/EntityCategory.java +++ b/Core/src/main/java/com/plotsquared/core/util/entity/EntityCategory.java @@ -38,7 +38,8 @@ import java.util.Set; */ public class EntityCategory extends Category implements Keyed { - public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("entity type"); + public static final NamespacedRegistry REGISTRY = + new NamespacedRegistry<>("entity type"); private final String key; diff --git a/Core/src/main/java/com/plotsquared/core/util/net/IncendoPaster.java b/Core/src/main/java/com/plotsquared/core/util/net/IncendoPaster.java index 16b30da39..46ae63f7d 100644 --- a/Core/src/main/java/com/plotsquared/core/util/net/IncendoPaster.java +++ b/Core/src/main/java/com/plotsquared/core/util/net/IncendoPaster.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.util.net; -import com.plotsquared.core.PlotSquared; import com.google.common.base.Charsets; +import com.plotsquared.core.PlotSquared; import java.io.BufferedReader; import java.io.InputStreamReader; @@ -44,7 +44,8 @@ import java.util.Locale; /** * Single class paster for the Incendo paste service */ -@SuppressWarnings({"unused", "WeakerAccess"}) public final class IncendoPaster { +@SuppressWarnings({"unused", "WeakerAccess"}) +public final class IncendoPaster { /** * Upload service URL diff --git a/Core/src/main/java/com/plotsquared/core/util/task/AutoClaimFinishTask.java b/Core/src/main/java/com/plotsquared/core/util/task/AutoClaimFinishTask.java index 8e7640eda..81d2d2199 100644 --- a/Core/src/main/java/com/plotsquared/core/util/task/AutoClaimFinishTask.java +++ b/Core/src/main/java/com/plotsquared/core/util/task/AutoClaimFinishTask.java @@ -32,14 +32,15 @@ import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.Result; import com.plotsquared.core.location.Direction; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.player.PlotPlayer; import lombok.RequiredArgsConstructor; import static com.plotsquared.core.util.MainUtil.sendMessage; -@RequiredArgsConstructor public final class AutoClaimFinishTask extends RunnableVal { +@RequiredArgsConstructor +public final class AutoClaimFinishTask extends RunnableVal { private final PlotPlayer player; private final Plot plot; @@ -62,8 +63,7 @@ import static com.plotsquared.core.util.MainUtil.sendMessage; if (event.getEventResult() == Result.DENY) { sendMessage(player, Captions.EVENT_DENIED, "Auto merge"); } else { - plot.autoMerge(event.getDir(), event.getMax(), player.getUUID(), - true); + plot.autoMerge(event.getDir(), event.getMax(), player.getUUID(), true); } } } else { diff --git a/Core/src/main/java/com/plotsquared/core/util/task/ObjectTaskRunnable.java b/Core/src/main/java/com/plotsquared/core/util/task/ObjectTaskRunnable.java index 62be029fe..63c0ebc8c 100644 --- a/Core/src/main/java/com/plotsquared/core/util/task/ObjectTaskRunnable.java +++ b/Core/src/main/java/com/plotsquared/core/util/task/ObjectTaskRunnable.java @@ -29,7 +29,8 @@ import lombok.RequiredArgsConstructor; import java.util.Iterator; -@RequiredArgsConstructor public class ObjectTaskRunnable implements Runnable { +@RequiredArgsConstructor +public class ObjectTaskRunnable implements Runnable { private final Iterator iterator; private final RunnableVal task; diff --git a/Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java b/Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java index 0aefe9e08..5878a9247 100644 --- a/Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java @@ -131,8 +131,8 @@ public abstract class TaskManager { return function.value; } final AtomicBoolean running = new AtomicBoolean(true); - final RuntimeExceptionRunnableVal - run = new RuntimeExceptionRunnableVal<>(function, running); + final RuntimeExceptionRunnableVal run = + new RuntimeExceptionRunnableVal<>(function, running); TaskManager.IMP.task(run); try { synchronized (function) { diff --git a/Core/src/main/java/com/plotsquared/core/util/uuid/UUIDHandler.java b/Core/src/main/java/com/plotsquared/core/util/uuid/UUIDHandler.java index 8cafdde93..6dd8b1c47 100644 --- a/Core/src/main/java/com/plotsquared/core/util/uuid/UUIDHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/uuid/UUIDHandler.java @@ -25,14 +25,14 @@ */ package com.plotsquared.core.util.uuid; +import com.google.common.collect.BiMap; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.PlotPlayer; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.StringWrapper; -import com.google.common.collect.BiMap; +import com.plotsquared.core.util.task.RunnableVal; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/plotsquared/core/util/uuid/UUIDHandlerImplementation.java b/Core/src/main/java/com/plotsquared/core/util/uuid/UUIDHandlerImplementation.java index f899b640c..687af58e0 100644 --- a/Core/src/main/java/com/plotsquared/core/util/uuid/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/plotsquared/core/util/uuid/UUIDHandlerImplementation.java @@ -25,20 +25,20 @@ */ package com.plotsquared.core.util.uuid; +import com.google.common.base.Charsets; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.OfflinePlotPlayer; -import com.plotsquared.core.plot.Plot; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.StringMan; -import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.StringWrapper; +import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import com.google.common.base.Charsets; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;