From 930dee9326d19dbcbdacc3df8d2aa9a090062173 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 4 Nov 2019 17:44:23 +0000 Subject: [PATCH] Refactor BlockVector2 --- .../plotsquared/bukkit/BukkitMain.java | 42 +++++++- .../plotsquared/bukkit/chat/FancyMessage.java | 14 ++- .../bukkit/commands/DebugUUID.java | 12 ++- .../bukkit/generator/BukkitPlotGenerator.java | 6 +- .../generator/DelegatePlotGenerator.java | 1 - .../bukkit/listeners/ChunkListener.java | 1 - .../bukkit/listeners/PlayerEvents.java | 101 ++++++++++++++++-- .../bukkit/object/entity/EntityBaseStats.java | 1 - .../entity/ReplicatingEntityWrapper.java | 18 +++- .../bukkit/object/schematic/StateWrapper.java | 7 +- .../bukkit/util/BukkitChunkManager.java | 62 ++++++----- .../bukkit/util/BukkitCommand.java | 8 +- .../bukkit/util/BukkitEventUtil.java | 18 +++- .../bukkit/util/BukkitHybridUtils.java | 8 +- .../bukkit/util/BukkitLegacyMappings.java | 8 +- .../bukkit/util/BukkitSchematicHandler.java | 17 ++- .../plotsquared/bukkit/util/BukkitUtil.java | 8 +- .../plotsquared/bukkit/util/Metrics.java | 16 ++- .../plotsquared/bukkit/util/NbtFactory.java | 25 ++++- .../bukkit/util/OfflinePlayerUtil.java | 8 +- .../plotsquared/bukkit/util/SendChunk.java | 10 +- .../plotsquared/commands/Command.java | 10 +- .../configuration/MemorySection.java | 7 +- .../configuration/file/FileConfiguration.java | 11 +- .../plotsquared/json/JSONObject.java | 11 +- .../plotsquared/json/JSONTokener.java | 7 +- .../plotsquared/plot/IPlotMain.java | 12 ++- .../plotsquared/plot/PlotSquared.java | 57 +++++++++- .../plotsquared/plot/commands/Area.java | 32 ++++-- .../plotsquared/plot/commands/Auto.java | 10 +- .../plotsquared/plot/commands/Claim.java | 8 +- .../plotsquared/plot/commands/Cluster.java | 8 +- .../plot/commands/DebugClaimTest.java | 11 +- .../plotsquared/plot/commands/DebugExec.java | 25 ++++- .../plotsquared/plot/commands/FlagCmd.java | 11 +- .../plotsquared/plot/commands/Like.java | 6 +- .../plotsquared/plot/commands/ListCmd.java | 8 +- .../plot/commands/MainCommand.java | 9 +- .../plotsquared/plot/commands/Rate.java | 12 ++- .../plot/commands/RegenAllRoads.java | 2 +- .../plotsquared/plot/commands/Relight.java | 6 +- .../plotsquared/plot/commands/Save.java | 6 +- .../plotsquared/plot/commands/Setup.java | 16 ++- .../plotsquared/plot/commands/Template.java | 11 +- .../plotsquared/plot/commands/Trim.java | 40 ++++--- .../plotsquared/plot/commands/Visit.java | 12 ++- .../plotsquared/plot/config/Config.java | 6 +- .../plotsquared/plot/database/MySQL.java | 6 +- .../plotsquared/plot/database/SQLManager.java | 35 ++++-- .../plotsquared/plot/database/SQLite.java | 6 +- .../plotsquared/plot/flag/FlagManager.java | 7 +- .../plot/flag/PlotBlockListFlag.java | 1 - .../plotsquared/plot/flag/StringFlag.java | 1 - .../plot/generator/ClassicPlotManager.java | 8 +- .../plot/generator/ClassicPlotWorld.java | 1 - .../plotsquared/plot/generator/HybridGen.java | 6 +- .../plot/generator/HybridPlotManager.java | 8 +- .../plot/generator/HybridUtils.java | 75 +++++++------ .../generator/IndependentPlotGenerator.java | 5 +- .../plot/generator/SquarePlotManager.java | 7 +- .../plot/listener/PlotListener.java | 11 +- .../plotsquared/plot/object/BlockBucket.java | 8 +- .../plotsquared/plot/object/BlockLoc.java | 50 ++++++--- .../plotsquared/plot/object/ChunkLoc.java | 50 --------- .../plot/object/LegacyPlotBlock.java | 1 - .../plotsquared/plot/object/Location.java | 5 +- .../plotsquared/plot/object/Plot.java | 39 +++++-- .../plotsquared/plot/object/PlotArea.java | 10 +- .../plotsquared/plot/object/PlotCluster.java | 4 +- .../plotsquared/plot/object/PlotPlayer.java | 8 +- .../plotsquared/plot/object/PlotSettings.java | 2 +- .../object/worlds/DefaultPlotAreaManager.java | 8 +- .../plot/object/worlds/SinglePlot.java | 8 +- .../plot/object/worlds/SinglePlotArea.java | 9 +- .../plot/object/worlds/SinglePlotManager.java | 7 +- .../object/worlds/SingleWorldGenerator.java | 6 +- .../plotsquared/plot/util/ChunkManager.java | 76 ++++++------- .../plotsquared/plot/util/EventUtil.java | 11 +- .../plotsquared/plot/util/IncendoPaster.java | 7 +- .../plotsquared/plot/util/MainUtil.java | 28 ++++- .../plot/util/SchematicHandler.java | 29 +++-- .../plotsquared/plot/util/UUIDHandler.java | 2 +- .../plot/util/UUIDHandlerImplementation.java | 2 +- .../plotsquared/plot/util/WorldUtil.java | 16 ++- .../plot/util/block/LocalBlockQueue.java | 6 +- .../plot/util/expiry/ExpireManager.java | 19 +++- .../plot/util/expiry/PlotAnalysis.java | 7 +- .../plotsquared/plot/util/EventUtilTest.java | 7 +- .../plotsquared/nukkit/NukkitMain.java | 4 - .../nukkit/generator/NukkitPlotGenerator.java | 1 - .../nukkit/listeners/PlayerEvents.java | 3 - .../nukkit/object/NukkitPlayer.java | 1 - .../plotsquared/nukkit/util/Metrics.java | 2 - .../nukkit/util/NukkitChunkManager.java | 7 +- .../nukkit/util/NukkitEventUtil.java | 1 - .../nukkit/util/NukkitSchematicHandler.java | 9 +- .../plotsquared/nukkit/util/NukkitUtil.java | 1 - .../nukkit/util/block/NukkitHybridGen.java | 2 + .../nukkit/util/block/NukkitLocalQueue.java | 2 + .../nukkit/util/block/NukkitWrappedChunk.java | 2 + .../plotsquared/sponge/SpongeMain.java | 1 - .../sponge/listener/MainListener.java | 3 - .../sponge/util/SpongeChunkManager.java | 8 +- .../sponge/util/SpongeCommand.java | 2 - .../sponge/util/SpongeEventUtil.java | 1 - .../sponge/util/SpongeMetrics.java | 37 +++---- .../sponge/util/SpongeSchematicHandler.java | 9 +- .../sponge/util/SpongeSetupUtils.java | 1 - .../plotsquared/sponge/util/SpongeUtil.java | 2 - .../sponge/util/block/GenChunk.java | 2 + .../sponge/util/block/SpongeLocalQueue.java | 2 + 111 files changed, 1061 insertions(+), 389 deletions(-) delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkLoc.java diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index 272d09056..a851207cd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -7,7 +7,21 @@ import com.github.intellectualsites.plotsquared.bukkit.listeners.PlayerEvents; import com.github.intellectualsites.plotsquared.bukkit.listeners.PlotPlusListener; import com.github.intellectualsites.plotsquared.bukkit.listeners.SingleWorldListener; import com.github.intellectualsites.plotsquared.bukkit.listeners.WorldEvents; -import com.github.intellectualsites.plotsquared.bukkit.util.*; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitBlockRegistry; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitChatManager; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitChunkManager; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitCommand; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEconHandler; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEventUtil; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitHybridUtils; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitInventoryUtil; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitLegacyMappings; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitSchematicHandler; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitSetupUtils; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitTaskManager; +import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; +import com.github.intellectualsites.plotsquared.bukkit.util.Metrics; +import com.github.intellectualsites.plotsquared.bukkit.util.SetGenCB; import com.github.intellectualsites.plotsquared.bukkit.util.block.BukkitLocalQueue; import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper; import com.github.intellectualsites.plotsquared.bukkit.uuid.FileUUIDHandler; @@ -35,14 +49,36 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManag import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.ChatManager; +import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; +import com.github.intellectualsites.plotsquared.plot.util.ConsoleColors; +import com.github.intellectualsites.plotsquared.plot.util.EconHandler; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil; +import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils; +import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; +import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandlerImplementation; +import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.sk89q.worldedit.WorldEdit; import io.papermc.lib.PaperLib; import lombok.Getter; import lombok.NonNull; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.World; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java index 56635abb0..348f50f9a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java @@ -19,8 +19,18 @@ import org.bukkit.inventory.ItemStack; import java.io.IOException; import java.io.StringWriter; -import java.lang.reflect.*; -import java.util.*; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.logging.Level; /** diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java index bb5930228..49d399da1 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java @@ -16,7 +16,11 @@ import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.StringWrapper; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.google.common.collect.Sets; @@ -24,8 +28,12 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +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 ", diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 465fcab20..53a7dd358 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -5,13 +5,13 @@ import com.github.intellectualsites.plotsquared.bukkit.util.block.GenChunk; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; +import com.sk89q.worldedit.math.BlockVector2; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.generator.BlockPopulator; @@ -145,7 +145,7 @@ public class BukkitPlotGenerator extends ChunkGenerator if (this.platformGenerator != this) { return this.platformGenerator.generateChunkData(world, random, x, z, biome); } else { - generate(new ChunkLoc(x, z), world, result); + generate(BlockVector2.at(x, z), world, result); } } catch (Throwable e) { e.printStackTrace(); @@ -154,7 +154,7 @@ public class BukkitPlotGenerator extends ChunkGenerator return result.getChunkData(); } - private void generate(ChunkLoc loc, World world, ScopedLocalBlockQueue result) { + private void generate(BlockVector2 loc, World world, ScopedLocalBlockQueue result) { // Load if improperly loaded if (!this.loaded) { String name = world.getName(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java index c8b57dc78..6a2655d24 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java @@ -9,7 +9,6 @@ import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotId; -import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import lombok.RequiredArgsConstructor; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java index 5634ff02f..046c0de8f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java @@ -1,7 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 611303552..f70d7f46b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -10,8 +10,25 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; -import com.github.intellectualsites.plotsquared.plot.object.*; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotHandler; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; +import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.StringWrapper; +import com.github.intellectualsites.plotsquared.plot.util.EntityUtil; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.RegExUtil; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility; import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -23,18 +40,81 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; import org.bukkit.command.PluginCommand; -import org.bukkit.entity.*; +import org.bukkit.entity.Ageable; +import org.bukkit.entity.Animals; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Fireball; +import org.bukkit.entity.Hanging; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.ItemFrame; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Monster; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.entity.Tameable; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.entity.Vehicle; +import org.bukkit.entity.Villager; +import org.bukkit.entity.WaterMob; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.block.*; -import org.bukkit.event.entity.*; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.block.BlockDispenseEvent; +import org.bukkit.event.block.BlockExplodeEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonRetractEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.BlockRedstoneEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.EntityBlockFormEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityCombustByEntityEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.LingeringPotionSplashEvent; +import org.bukkit.event.entity.PotionSplashEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.player.*; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerChangedWorldEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerEggThrowEvent; +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; @@ -53,8 +133,15 @@ import org.bukkit.projectiles.ProjectileSource; import org.bukkit.util.Vector; import java.lang.reflect.Field; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import java.util.regex.Pattern; /** diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityBaseStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityBaseStats.java index d33b4d913..c36236a5d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityBaseStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityBaseStats.java @@ -1,6 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; - class EntityBaseStats { EntityWrapper passenger; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java index 769fcc9b3..a237bf96a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java @@ -8,7 +8,23 @@ import org.bukkit.Rotation; import org.bukkit.TreeSpecies; import org.bukkit.World; import org.bukkit.block.BlockFace; -import org.bukkit.entity.*; +import org.bukkit.entity.AbstractHorse; +import org.bukkit.entity.Ageable; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Bat; +import org.bukkit.entity.Boat; +import org.bukkit.entity.ChestedHorse; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Entity; +import org.bukkit.entity.IronGolem; +import org.bukkit.entity.Item; +import org.bukkit.entity.ItemFrame; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Painting; +import org.bukkit.entity.Rabbit; +import org.bukkit.entity.Sheep; +import org.bukkit.entity.Slime; +import org.bukkit.entity.Tameable; import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java index aaf5f4aa5..3d5c75edf 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java @@ -3,7 +3,12 @@ package com.github.intellectualsites.plotsquared.bukkit.object.schematic; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.sk89q.jnbt.*; +import com.sk89q.jnbt.ByteTag; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.ListTag; +import com.sk89q.jnbt.ShortTag; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java index 6771d1d3a..d768ac32b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java @@ -5,13 +5,20 @@ import com.github.intellectualsites.plotsquared.bukkit.object.entity.Replicating import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotLoc; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import io.papermc.lib.PaperLib; @@ -25,8 +32,14 @@ import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.concurrent.CompletableFuture; public class BukkitChunkManager extends ChunkManager { @@ -35,15 +48,6 @@ public class BukkitChunkManager extends ChunkManager { return x >= region.minX && x <= region.maxX && z >= region.minZ && z <= region.maxZ; } - private static byte getOrdinal(Object[] list, Object value) { - for (byte i = 0; i < list.length; i++) { - if (list[i].equals(value)) { - return i; - } - } - return 0; - } - public static ContentMap swapChunk(World world1, World world2, Chunk pos1, Chunk pos2, RegionWrapper r1, RegionWrapper r2) { ContentMap map = new ContentMap(); @@ -104,10 +108,10 @@ public class BukkitChunkManager extends ChunkManager { return map; } - @Override public Set getChunkChunks(String world) { - Set chunks = super.getChunkChunks(world); + @Override public Set getChunkChunks(String world) { + Set chunks = super.getChunkChunks(world); for (Chunk chunk : Bukkit.getWorld(world).getLoadedChunks()) { - ChunkLoc loc = new ChunkLoc(chunk.getX() >> 5, chunk.getZ() >> 5); + BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5); chunks.add(loc); } return chunks; @@ -210,10 +214,10 @@ public class BukkitChunkManager extends ChunkManager { int bz = value[3]; int tx = value[4]; int tz = value[5]; - ChunkLoc loc = new ChunkLoc(value[0], value[1]); - int cxx = loc.x << 4; - int czz = loc.z << 4; - PaperLib.getChunkAtAsync(oldWorld, loc.x, loc.z) + BlockVector2 loc = BlockVector2.at(value[0], value[1]); + int cxx = loc.getX() << 4; + int czz = loc.getZ() << 4; + PaperLib.getChunkAtAsync(oldWorld, loc.getX(), loc.getZ()) .thenAccept(chunk1 -> map.saveEntitiesIn(chunk1, region)).thenRun(() -> { for (int x = bx & 15; x <= (tx & 15); x++) { for (int z = bz & 15; z <= (tz & 15); z++) { @@ -256,11 +260,11 @@ public class BukkitChunkManager extends ChunkManager { final int tcx = p2x >> 4; final int tcz = p2z >> 4; - final List chunks = new ArrayList<>(); + final List chunks = new ArrayList<>(); for (int x = bcx; x <= tcx; x++) { for (int z = bcz; z <= tcz; z++) { - chunks.add(new ChunkLoc(x, z)); + chunks.add(BlockVector2.at(x, z)); } } final World worldObj = Bukkit.getWorld(world); @@ -269,9 +273,9 @@ public class BukkitChunkManager extends ChunkManager { @Override public void run() { long start = System.currentTimeMillis(); while (!chunks.isEmpty() && System.currentTimeMillis() - start < 5) { - final ChunkLoc chunk = chunks.remove(0); - int x = chunk.x; - int z = chunk.z; + final BlockVector2 chunk = chunks.remove(0); + int x = chunk.getX(); + int z = chunk.getZ(); int xxb = x << 4; int zzb = z << 4; int xxt = xxb + 15; @@ -284,7 +288,7 @@ public class BukkitChunkManager extends ChunkManager { if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z && PlotSquared.imp().getServerVersion()[1] == 13) { AugmentedUtils - .bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.x, chunk.z)); + .bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.getX(), chunk.getZ())); continue; } boolean checkX1 = false; @@ -393,17 +397,17 @@ public class BukkitChunkManager extends ChunkManager { return true; } - @Override public CompletableFuture loadChunk(String world, ChunkLoc chunkLoc, boolean force) { - return PaperLib.getChunkAtAsync(BukkitUtil.getWorld(world),chunkLoc.x, chunkLoc.z, 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 ChunkLoc chunkLoc, final boolean save) { + 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.x, chunkLoc.z, save)); + () -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save)); } else { - BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save); + BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitCommand.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitCommand.java index 27edabf78..190aa077a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitCommand.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitCommand.java @@ -4,7 +4,13 @@ import com.github.intellectualsites.plotsquared.bukkit.commands.DebugUUID; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import org.bukkit.command.*; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.command.ProxiedCommandSender; +import org.bukkit.command.RemoteConsoleCommandSender; +import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; import java.util.ArrayList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java index c2e39715e..25ca0e16e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java @@ -1,6 +1,22 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.bukkit.events.*; +import com.github.intellectualsites.plotsquared.bukkit.events.PlayerClaimPlotEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotDeniedEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotHelperEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotTrustedEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlayerTeleportToPlotEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotAutoMergeEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotChangeOwnerEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotClearEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotComponentSetEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotDeleteEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotFlagAddEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotFlagRemoveEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotMergeEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotRateEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.PlotUnlinkEvent; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java index fb0d20fbc..2d0e2cfa2 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java @@ -5,7 +5,13 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; +import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java index 0331e948a..c7d953ea7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java @@ -15,7 +15,13 @@ import lombok.ToString; import org.bukkit.Bukkit; import org.bukkit.Material; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import java.util.stream.Collectors; /** diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSchematicHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSchematicHandler.java index 76462a11e..3f980d37c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSchematicHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSchematicHandler.java @@ -8,13 +8,26 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.block.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.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; 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; /** diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java index a6f49ca66..00bc7809f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java @@ -3,7 +3,13 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/Metrics.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/Metrics.java index ff6e1b310..e3870d940 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/Metrics.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/Metrics.java @@ -10,12 +10,24 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; import javax.net.ssl.HttpsURLConnection; -import java.io.*; +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; import java.util.concurrent.Callable; import java.util.logging.Level; import java.util.zip.GZIPOutputStream; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java index acf0f82fa..10407f5ec 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java @@ -13,9 +13,28 @@ import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.inventory.ItemStack; -import java.io.*; -import java.lang.reflect.*; -import java.util.*; +import java.io.BufferedInputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.DataOutput; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.AbstractList; +import java.util.AbstractMap; +import java.util.AbstractSet; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/OfflinePlayerUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/OfflinePlayerUtil.java index a3e40fae1..a4ee94f80 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/OfflinePlayerUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/OfflinePlayerUtil.java @@ -9,7 +9,13 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.UUID; -import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.*; +import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.callConstructor; +import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.callMethod; +import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getCbClass; +import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getNmsClass; +import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getUtilClass; +import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.makeConstructor; +import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.makeMethod; public class OfflinePlayerUtil { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java index 09f8462bb..8b5e89b27 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java @@ -2,7 +2,6 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -12,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefFie import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefMethod; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.sk89q.worldedit.math.BlockVector2; import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -129,12 +129,12 @@ public class SendChunk { } } - public void sendChunk(String worldName, Collection chunkLocations) { + public void sendChunk(String worldName, Collection chunkLocations) { World myWorld = Bukkit.getWorld(worldName); ArrayList chunks = new ArrayList<>(); - for (ChunkLoc loc : chunkLocations) { - if (myWorld.isChunkLoaded(loc.x, loc.z)) { - PaperLib.getChunkAtAsync(myWorld, loc.x, loc.z).thenAccept(chunks::add); + for (BlockVector2 loc : chunkLocations) { + if (myWorld.isChunkLoaded(loc.getX(), loc.getZ())) { + PaperLib.getChunkAtAsync(myWorld, loc.getX(), loc.getZ()).thenAccept(chunks::add); } } sendChunk(chunks); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java index faaf3c7af..691daa93e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java @@ -19,7 +19,15 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.CompletableFuture; public abstract class Command { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemorySection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemorySection.java index 0f87931f4..14233b758 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemorySection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemorySection.java @@ -1,6 +1,11 @@ package com.github.intellectualsites.plotsquared.configuration; -import java.util.*; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * A type of {@link ConfigurationSection} that is stored in memory. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfiguration.java index a56c65901..e8123cfc9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfiguration.java @@ -4,7 +4,16 @@ import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; import com.github.intellectualsites.plotsquared.configuration.MemoryConfiguration; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; import java.nio.charset.StandardCharsets; import java.util.stream.Collectors; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java index cd67bb158..965e95644 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java @@ -7,8 +7,15 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.*; +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Locale; +import java.util.Map; import java.util.Map.Entry; +import java.util.ResourceBundle; +import java.util.Set; import java.util.stream.IntStream; /** @@ -554,7 +561,9 @@ public class JSONObject { return new JSONObject((Map) object); } Package objectPackage = object.getClass().getPackage(); + String objectPackageName = objectPackage != null ? objectPackage.getName() : ""; + if (objectPackageName.startsWith("java.") || objectPackageName.startsWith("javax.") || ( object.getClass().getClassLoader() == null)) { return object.toString(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONTokener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONTokener.java index 290b9ea0b..195ceeb5d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONTokener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONTokener.java @@ -1,6 +1,11 @@ package com.github.intellectualsites.plotsquared.json; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; /** * A JSONTokener takes a source string and extracts characters and tokens from it. It is used by the JSONObject and diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java index 8fff0921d..fb62a61ce 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java @@ -6,7 +6,17 @@ import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGe import com.github.intellectualsites.plotsquared.plot.logger.ILogger; import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.ChatManager; +import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; +import com.github.intellectualsites.plotsquared.plot.util.EconHandler; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil; +import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; +import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; +import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandlerImplementation; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index 45c284a3f..d6c7b437c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -20,12 +20,39 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; import com.github.intellectualsites.plotsquared.plot.listener.WESubscriber; import com.github.intellectualsites.plotsquared.plot.logger.ILogger; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotFilter; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotManager; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.StringWrapper; import com.github.intellectualsites.plotsquared.plot.object.worlds.DefaultPlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.ChatManager; +import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; +import com.github.intellectualsites.plotsquared.plot.util.CommentManager; +import com.github.intellectualsites.plotsquared.plot.util.EconHandler; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil; +import com.github.intellectualsites.plotsquared.plot.util.LegacyConverter; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils; +import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; +import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpiryTask; @@ -35,15 +62,37 @@ import lombok.NonNull; import lombok.Setter; import org.jetbrains.annotations.Nullable; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; import java.nio.file.Files; import java.sql.SQLException; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; +import java.util.Properties; +import java.util.Set; +import java.util.UUID; import java.util.function.Consumer; import java.util.regex.Pattern; import java.util.stream.Collectors; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java index f4c73a972..0f39ebe94 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java @@ -7,8 +7,24 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; -import com.github.intellectualsites.plotsquared.plot.object.*; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; +import com.github.intellectualsites.plotsquared.plot.object.SetupObject; +import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; +import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.sk89q.worldedit.math.BlockVector2; import java.io.IOException; import java.util.ArrayList; @@ -120,10 +136,10 @@ import java.util.Set; player.teleport(WorldUtil.IMP.getSpawn(world)); if (area.TERRAIN != 3) { ChunkManager.largeRegionTask(world, region, - new RunnableVal() { - @Override public void run(ChunkLoc value) { + new RunnableVal() { + @Override public void run(BlockVector2 value) { AugmentedUtils - .generate(world, value.x, value.z, + .generate(world, value.getX(), value.getZ(), null); } }, null); @@ -415,9 +431,9 @@ import java.util.Set; return false; } ChunkManager - .largeRegionTask(area.worldname, area.getRegion(), new RunnableVal() { - @Override public void run(ChunkLoc value) { - AugmentedUtils.generate(area.worldname, value.x, value.z, null); + .largeRegionTask(area.worldname, area.getRegion(), new RunnableVal() { + @Override public void run(BlockVector2 value) { + AugmentedUtils.generate(area.worldname, value.getX(), value.getZ(), null); } }, () -> player.sendMessage("Regen complete")); return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java index 93eef7813..bf0a221b8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java @@ -5,14 +5,20 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Direction; +import com.github.intellectualsites.plotsquared.plot.object.Expression; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; - import org.jetbrains.annotations.Nullable; + import java.util.Set; @CommandDeclaration(command = "auto", permission = "plots.auto", diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java index 94a82fdd8..aba59ad05 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java @@ -4,7 +4,13 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Direction; +import com.github.intellectualsites.plotsquared.plot.object.Expression; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.Permissions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java index 1bc8f779e..088273c9c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java @@ -5,7 +5,13 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java index de7d754a3..411a3290b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java @@ -4,12 +4,19 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotManager; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.StringWrapper; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.google.common.collect.BiMap; +import com.sk89q.worldedit.math.BlockVector2; import java.util.ArrayList; import java.util.Map; @@ -55,7 +62,7 @@ public class DebugClaimTest extends SubCommand { continue; } Location location = manager.getSignLoc(plot); - ChunkLoc chunk = new ChunkLoc(location.getX() >> 4, location.getZ() >> 4); + BlockVector2 chunk = BlockVector2.at(location.getX() >> 4, location.getZ() >> 4); ChunkManager.manager.loadChunk(area.worldname, chunk, false).thenRun(() -> { String[] lines = WorldUtil.IMP.getSign(location); if (lines != null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java index 841c6fc8c..6d5894616 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java @@ -10,8 +10,29 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.listener.WEManager; -import com.github.intellectualsites.plotsquared.plot.object.*; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; +import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; +import com.github.intellectualsites.plotsquared.plot.util.EconHandler; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; +import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index af0389dec..746ddfe98 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -22,7 +22,16 @@ import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.StringMan; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; @CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setflag"}, usage = "/plot flag ", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag") diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java index f839a9b1a..378da26c2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java @@ -14,7 +14,11 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; @CommandDeclaration(command = "like", permission = "plots.like", description = "Like the plot", usage = "/plot like [next|purge]", category = CommandCategory.INFO, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java index 4917e2499..2b70e48e5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java @@ -11,7 +11,13 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.Rating; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.EconHandler; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.StringComparison; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import java.util.ArrayList; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java index 31095cd75..dd060c88e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java @@ -5,7 +5,14 @@ import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; +import com.github.intellectualsites.plotsquared.plot.object.Expression; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.Permissions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java index 9c93925b6..f81f02719 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java @@ -7,8 +7,16 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.Flags; -import com.github.intellectualsites.plotsquared.plot.object.*; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; +import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.Rating; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import java.util.ArrayList; import java.util.HashMap; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java index 9fcdc811d..e47cb610f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java @@ -43,7 +43,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD); return false; } - //Set chunks = ChunkManager.manager.getChunkChunks(name); + //Set chunks = ChunkManager.manager.getChunkChunks(name); MainUtil .sendMessage(player, "&cIf no schematic is set, the following will not do anything"); MainUtil.sendMessage(player, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java index 5af706df3..cc5c8c21a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java @@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java index 481acba53..d000f55e2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java @@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java index 7b21352e2..82190f1b2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java @@ -15,11 +15,23 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; -import lombok.*; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +import lombok.ToString; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.UUID; @CommandDeclaration(command = "setup", permission = "plots.admin.command.setup", description = "Setup wizard for plot worlds", usage = "/plot setup", aliases = {"create"}, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java index fe41e61ab..85a0fe633 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java @@ -8,14 +8,21 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.FileBytes; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotManager; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.SetupObject; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trim.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trim.java index 3b3504c24..000aa9b56 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trim.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trim.java @@ -3,7 +3,12 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; @@ -11,6 +16,7 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; +import com.sk89q.worldedit.math.BlockVector2; import java.io.File; import java.io.IOException; @@ -31,7 +37,7 @@ import java.util.Set; public static ArrayList expired = null; private static volatile boolean TASK = false; - public static boolean getBulkRegions(final ArrayList empty, final String world, + public static boolean getBulkRegions(final ArrayList empty, final String world, final Runnable whenDone) { if (Trim.TASK) { return false; @@ -71,7 +77,7 @@ import java.util.Set; String[] split = name.split("\\."); int x = Integer.parseInt(split[1]); int z = Integer.parseInt(split[2]); - ChunkLoc loc = new ChunkLoc(x, z); + BlockVector2 loc = BlockVector2.at(x, z); empty.add(loc); } catch (NumberFormatException ignored) { PlotSquared.debug("INVALID MCA: " + name); @@ -90,7 +96,7 @@ import java.util.Set; * @return */ public static boolean getTrimRegions(String world, - final RunnableVal2, Set> result) { + final RunnableVal2, Set> result) { if (result == null) { return false; } @@ -114,7 +120,7 @@ import java.util.Set; int ccz2 = pos2.getZ() >> 9; for (int x = ccx1; x <= ccx2; x++) { for (int z = ccz1; z <= ccz2; z++) { - ChunkLoc loc = new ChunkLoc(x, z); + BlockVector2 loc = BlockVector2.at(x, z); if (result.value1.remove(loc)) { result.value2.add(loc); } @@ -141,8 +147,8 @@ import java.util.Set; } Trim.TASK = true; final boolean regen = args.length == 2 && Boolean.parseBoolean(args[1]); - getTrimRegions(world, new RunnableVal2, Set>() { - @Override public void run(Set viable, final Set nonViable) { + getTrimRegions(world, new RunnableVal2, Set>() { + @Override public void run(Set viable, final Set nonViable) { Runnable regenTask; if (regen) { PlotSquared.log("Starting regen task:"); @@ -155,16 +161,16 @@ import java.util.Set; player.sendMessage("Trim done!"); return; } - Iterator iterator = nonViable.iterator(); - ChunkLoc mcr = iterator.next(); + Iterator iterator = nonViable.iterator(); + BlockVector2 mcr = iterator.next(); iterator.remove(); - int cbx = mcr.x << 5; - int cbz = mcr.z << 5; + int cbx = mcr.getX() << 5; + int cbz = mcr.getZ() << 5; // get all 1024 chunks - HashSet chunks = new HashSet<>(); + HashSet chunks = new HashSet<>(); for (int x = cbx; x < cbx + 32; x++) { for (int z = cbz; z < cbz + 32; z++) { - ChunkLoc loc = new ChunkLoc(x, z); + BlockVector2 loc = BlockVector2.at(x, z); chunks.add(loc); } } @@ -182,16 +188,16 @@ import java.util.Set; } for (int x = plotReg.minX >> 4; x <= plotReg.maxX >> 4; x++) { for (int z = plotReg.minZ >> 4; z <= plotReg.maxZ >> 4; z++) { - ChunkLoc loc = new ChunkLoc(x, z); + BlockVector2 loc = BlockVector2.at(x, z); chunks.remove(loc); } } } final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); - TaskManager.objectTask(chunks, new RunnableVal() { - @Override public void run(ChunkLoc value) { - queue.regenChunk(value.x, value.z); + TaskManager.objectTask(chunks, new RunnableVal() { + @Override public void run(BlockVector2 value) { + queue.regenChunk(value.getX(), value.getZ()); } }, this); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java index 5c38ea63f..e2b7fa382 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java @@ -6,13 +6,21 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.UUID; import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "visit", permission = "plots.visit", diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Config.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Config.java index ace39f846..7234743cf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Config.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Config.java @@ -14,7 +14,11 @@ import java.lang.annotation.Target; import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class Config { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/MySQL.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/MySQL.java index d5943d1ac..f8b2cedb0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/MySQL.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/MySQL.java @@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.config.Storage; import com.github.intellectualsites.plotsquared.plot.util.StringMan; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; /** * Connects to and uses a MySQL database diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java index 2f041cc57..a62924e9e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java @@ -6,7 +6,13 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.config.Storage; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotSettings; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.StringMan; @@ -14,11 +20,26 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.google.common.base.Charsets; import org.jetbrains.annotations.NotNull; -import java.sql.*; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Queue; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicInteger; @@ -857,10 +878,10 @@ import java.util.concurrent.atomic.AtomicInteger; statement.setInt(i * 10 + 9, hash); BlockLoc loc = pair.settings.getPosition(); String position; - if (loc.y == 0) { + if (loc.getY() == 0) { position = "DEFAULT"; } else { - position = loc.x + "," + loc.y + ',' + loc.z; + position = loc.getX() + "," + loc.getY() + ',' + loc.getZ(); } statement.setString(i * 10 + 10, position); } @@ -898,10 +919,10 @@ import java.util.concurrent.atomic.AtomicInteger; stmt.setInt(i * 10 + 9, n); BlockLoc loc = pair.settings.getPosition(); String position; - if (loc.y == 0) { + if (loc.getY() == 0) { position = "DEFAULT"; } else { - position = loc.x + "," + loc.y + ',' + loc.z; + position = loc.getX() + "," + loc.getY() + ',' + loc.getZ(); } stmt.setString(i * 10 + 10, position); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLite.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLite.java index 3675ad0cd..10ceb8784 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLite.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLite.java @@ -4,7 +4,11 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import java.io.File; import java.io.IOException; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; /** * Connects to and uses a SQLite database. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java index 6dc4aa2ff..51391f788 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java @@ -10,7 +10,12 @@ import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.google.common.collect.ImmutableSet; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java index 93bd8c56f..d042ecb4d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java @@ -9,7 +9,6 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.Arrays; import java.util.HashSet; import java.util.Objects; -import java.util.Set; import java.util.stream.Collectors; public class PlotBlockListFlag extends ListFlag> { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java index 6438ec938..31447847c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java @@ -1,6 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; - import com.github.intellectualsites.plotsquared.plot.config.Captions; public class StringFlag extends Flag { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotManager.java index f7ce683ba..a15b9ab1b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotManager.java @@ -1,7 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.config.Settings; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.object.Direction; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java index 143879680..ec80b3b84 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java @@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.util.Locale; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java index 81d76b929..6cb57ba8f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java @@ -2,7 +2,11 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import com.sk89q.worldedit.world.block.BaseBlock; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java index cd711dd6e..528ad57f9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java @@ -3,7 +3,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.Template; import com.github.intellectualsites.plotsquared.plot.config.Settings; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.object.FileBytes; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java index f7dc4d619..9e09ea977 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java @@ -5,7 +5,14 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotManager; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; @@ -15,18 +22,26 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.world.block.BaseBlock; import java.io.File; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; public abstract class HybridUtils { public static HybridUtils manager; - public static Set regions; - public static Set chunks = new HashSet<>(); + public static Set regions; + public static Set chunks = new HashSet<>(); public static PlotArea area; public static boolean UPDATE = false; @@ -113,13 +128,13 @@ public abstract class HybridUtils { return count; } - public final ArrayList getChunks(ChunkLoc region) { - ArrayList chunks = new ArrayList<>(); - int sx = region.x << 5; - int sz = region.z << 5; + public final ArrayList getChunks(BlockVector2 region) { + ArrayList chunks = new ArrayList<>(); + int sx = region.getX() << 5; + int sz = region.getZ() << 5; for (int x = sx; x < sx + 32; x++) { for (int z = sz; z < sz + 32; z++) { - chunks.add(new ChunkLoc(x, z)); + chunks.add(BlockVector2.at(x, z)); } } return chunks; @@ -130,7 +145,7 @@ public abstract class HybridUtils { return false; } HybridUtils.UPDATE = true; - Set regions = ChunkManager.manager.getChunkChunks(area.worldname); + Set regions = ChunkManager.manager.getChunkChunks(area.worldname); return scheduleRoadUpdate(area, regions, extend); } @@ -139,12 +154,12 @@ public abstract class HybridUtils { return false; } HybridUtils.UPDATE = true; - Set regions = new HashSet<>(); - regions.add(ChunkManager.getChunkChunk(plot.getCenter())); + Set regions = new HashSet<>(); + regions.add(ChunkManager.getRegion(plot.getCenter())); return scheduleRoadUpdate(plot.getArea(), regions, extend); } - public boolean scheduleRoadUpdate(final PlotArea area, Set regions, + public boolean scheduleRoadUpdate(final PlotArea area, Set regions, final int extend) { HybridUtils.regions = regions; HybridUtils.area = area; @@ -153,9 +168,9 @@ public abstract class HybridUtils { TaskManager.runTask(new Runnable() { @Override public void run() { if (!UPDATE) { - Iterator iter = chunks.iterator(); + Iterator iter = chunks.iterator(); while (iter.hasNext()) { - ChunkLoc chunk = iter.next(); + BlockVector2 chunk = iter.next(); iter.remove(); boolean regenedRoad = regenerateRoad(area, chunk, extend); if (!regenedRoad) { @@ -183,10 +198,10 @@ public abstract class HybridUtils { try { if (chunks.size() < 1024) { if (!HybridUtils.regions.isEmpty()) { - Iterator iterator = HybridUtils.regions.iterator(); - ChunkLoc loc = iterator.next(); + Iterator iterator = HybridUtils.regions.iterator(); + BlockVector2 loc = iterator.next(); iterator.remove(); - PlotSquared.debug("Updating .mcr: " + loc.x + ", " + loc.z + PlotSquared.debug("Updating .mcr: " + loc.getX() + ", " + loc.getZ() + " (approx 1024 chunks)"); PlotSquared .debug(" - Remaining: " + HybridUtils.regions.size()); @@ -198,10 +213,10 @@ public abstract class HybridUtils { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { long start = System.currentTimeMillis(); - Iterator iterator = chunks.iterator(); + Iterator iterator = chunks.iterator(); while (System.currentTimeMillis() - start < 20 && !chunks .isEmpty()) { - final ChunkLoc chunk = iterator.next(); + final BlockVector2 chunk = iterator.next(); iterator.remove(); boolean regenedRoads = regenerateRoad(area, chunk, extend); @@ -214,18 +229,18 @@ public abstract class HybridUtils { } } catch (Exception e) { e.printStackTrace(); - Iterator iterator = HybridUtils.regions.iterator(); - ChunkLoc loc = iterator.next(); + Iterator iterator = HybridUtils.regions.iterator(); + BlockVector2 loc = iterator.next(); iterator.remove(); PlotSquared.debug( - "[ERROR] Could not update '" + area.worldname + "/region/r." + loc.x - + "." + loc.z + ".mca' (Corrupt chunk?)"); - int sx = loc.x << 5; - int sz = loc.z << 5; + "[ERROR] Could not update '" + area.worldname + "/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.worldname, new ChunkLoc(x, z), true); + .unloadChunk(area.worldname, BlockVector2.at(x, z), true); } } PlotSquared.debug(" - Potentially skipping 1024 chunks"); @@ -303,9 +318,9 @@ public abstract class HybridUtils { return ey; } - public boolean regenerateRoad(final PlotArea area, final ChunkLoc chunk, int extend) { - int x = chunk.x << 4; - int z = chunk.z << 4; + public boolean regenerateRoad(final PlotArea area, final BlockVector2 chunk, int extend) { + int x = chunk.getX() << 4; + int z = chunk.getZ() << 4; int ex = x + 15; int ez = z + 15; HybridPlotWorld plotWorld = (HybridPlotWorld) area; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/IndependentPlotGenerator.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/IndependentPlotGenerator.java index 459aee272..def532368 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/IndependentPlotGenerator.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/IndependentPlotGenerator.java @@ -1,7 +1,10 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.SetupObject; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotManager.java index be19930fd..8ee343b3f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotManager.java @@ -1,7 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Direction; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java index ce1007e15..7aee40de0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java @@ -11,7 +11,16 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; +import com.github.intellectualsites.plotsquared.plot.util.CommentManager; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; +import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import java.util.HashMap; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java index 8dde0ee20..bd15eddf9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java @@ -10,8 +10,14 @@ import lombok.NonNull; import lombok.RequiredArgsConstructor; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; import java.util.Map.Entry; +import java.util.Random; /** * A block bucket is a container of block types, where each block diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockLoc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockLoc.java index d170054a8..a4f02a9ef 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockLoc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockLoc.java @@ -2,12 +2,12 @@ package com.github.intellectualsites.plotsquared.plot.object; public class BlockLoc { - public final int x; - public final int y; - public final int z; + private final int x; + private final int y; + private final int z; - public final float yaw; - public final float pitch; + private final float yaw; + private final float pitch; public BlockLoc(int x, int y, int z, float yaw, float pitch) { this.x = x; @@ -27,10 +27,6 @@ public class BlockLoc { float yaw; float pitch; - if (parts.length == 3) { - yaw = 0f; - pitch = 0f; - } if (parts.length == 5) { yaw = Float.parseFloat(parts[3]); pitch = Float.parseFloat(parts[4]); @@ -47,9 +43,9 @@ public class BlockLoc { @Override public int hashCode() { int prime = 31; int result = 1; - result = prime * result + this.x; - result = prime * result + this.y; - result = prime * result + this.z; + result = prime * result + this.getX(); + result = prime * result + this.getY(); + result = prime * result + this.getZ(); return result; } @@ -58,20 +54,42 @@ public class BlockLoc { return true; } if (obj == null) { - return this.x == 0 && this.y == 0 && this.z == 0; + return this.getX() == 0 && this.getY() == 0 && this.getZ() == 0; } if (getClass() != obj.getClass()) { return false; } BlockLoc other = (BlockLoc) obj; - return this.x == other.x && this.y == other.y && this.z == other.z; + return this.getX() == other.getX() && this.getY() == other.getY() && this.getZ() == other + .getZ(); } @Override public String toString() { - if (this.x == 0 && this.y == 0 && this.z == 0) { + if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0) { return ""; } - return this.x + "," + this.y + ',' + this.z + ',' + this.yaw + ',' + this.pitch; + return this.getX() + "," + this.getY() + ',' + this.getZ() + ',' + this.getYaw() + + ',' + this.getPitch(); } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getZ() { + return z; + } + + public float getYaw() { + return yaw; + } + + public float getPitch() { + return pitch; + } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkLoc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkLoc.java deleted file mode 100644 index 29bd3857f..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkLoc.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -public class ChunkLoc { - - public int x; - public int z; - - public ChunkLoc(int x, int z) { - this.x = x; - this.z = z; - } - - public static long getChunkLong(int x, int z) { - return (long) x & 0xffffffffL | ((long) z & 0xffffffffL) << 32; - } - - public long toLong() { - return getChunkLong(this.x,this.z); - } - - public static int getX(long chunkLong) { - return (int)(chunkLong & 0xffffffffL); - } - - public static int getZ(long chunkLong) { - return (int)(chunkLong >>> 32 & 0xffffffffL); - } - - @Override public int hashCode() { - return (x << 16) | (z & 0xFFFF); - } - - @Override public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ChunkLoc other = (ChunkLoc) obj; - return (this.x == other.x) && (this.z == other.z); - } - - @Override public String toString() { - return this.x + "," + this.z; - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java index 38407a52f..0596cd010 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java @@ -1,7 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.object; import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import lombok.Getter; import lombok.Setter; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java index 2e28594df..5f2b6bafe 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java @@ -2,6 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.object; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import lombok.Getter; import lombok.Setter; @@ -127,8 +128,8 @@ public class Location implements Cloneable, Comparable { } } - public ChunkLoc getChunkLoc() { - return new ChunkLoc(this.x >> 4, this.z >> 4); + public BlockVector2 getBlockVector2() { + return BlockVector2.at(this.x >> 4, this.z >> 4); } public Location add(int x, int y, int z) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index cafcae466..6708289f3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -12,7 +12,16 @@ import com.github.intellectualsites.plotsquared.plot.generator.SquarePlotWorld; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; @@ -21,6 +30,7 @@ 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.math.BlockVector2; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,8 +40,18 @@ import java.awt.geom.Rectangle2D; import java.io.File; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; @@ -920,7 +940,7 @@ public class Plot { region.maxZ + extendBiome); ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run(int[] value) { - ChunkLoc loc = new ChunkLoc(value[0], value[1]); + BlockVector2 loc = BlockVector2.at(value[0], value[1]); ChunkManager.manager.loadChunk(getWorldName(), loc, false); MainUtil.setBiome(getWorldName(), value[2], value[3], value[4], value[5], biome); @@ -1251,13 +1271,14 @@ public class Plot { */ public Location getHome() { BlockLoc home = this.getPosition(); - if (home == null || home.x == 0 && home.z == 0) { + if (home == null || home.getX() == 0 && home.getZ() == 0) { return this.getDefaultHome(true); } else { Location bottom = this.getBottomAbs(); Location location = - new Location(bottom.getWorld(), bottom.getX() + home.x, bottom.getY() + home.y, - bottom.getZ() + home.z, home.yaw, home.pitch); + new Location(bottom.getWorld(), bottom.getX() + home.getX(), bottom.getY() + home + .getY(), + bottom.getZ() + home.getZ(), home.getYaw(), home.getPitch()); if (!isLoaded()) { return location; } @@ -1413,11 +1434,11 @@ public class Plot { */ public void refreshChunks() { LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); - HashSet chunks = new HashSet<>(); + HashSet chunks = new HashSet<>(); for (RegionWrapper region : Plot.this.getRegions()) { for (int x = region.minX >> 4; x <= region.maxX >> 4; x++) { for (int z = region.minZ >> 4; z <= region.maxZ >> 4; z++) { - if (chunks.add(new ChunkLoc(x, z))) { + if (chunks.add(BlockVector2.at(x, z))) { queue.refreshChunk(x, z); } } @@ -2142,7 +2163,7 @@ public class Plot { String[] lines = TaskManager.IMP.sync(new RunnableVal() { @Override public void run(String[] value) { ChunkManager.manager - .loadChunk(location.getWorld(), location.getChunkLoc(), false); + .loadChunk(location.getWorld(), location.getBlockVector2(), false); this.value = WorldUtil.IMP.getSign(location); } }); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java index ff6668ea4..b3217297d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java @@ -24,8 +24,16 @@ import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Consumer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotCluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotCluster.java index feaf64ddb..d5d7c95d3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotCluster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotCluster.java @@ -126,7 +126,7 @@ public class PlotCluster { public Location getHome() { BlockLoc home = this.settings.getPosition(); Location toReturn; - if (home.y == 0) { + if (home.getY() == 0) { // default pos Plot center = getCenterPlot(); toReturn = center.getHome(); @@ -136,7 +136,7 @@ public class PlotCluster { toReturn.setY(location.getY()); } } else { - toReturn = getClusterBottom().add(home.x, home.y, home.z); + toReturn = getClusterBottom().add(home.getX(), home.getY(), home.getZ()); } int max = MainUtil.getHeighestBlock(this.area.worldname, toReturn.getX(), toReturn.getZ()); if (max > toReturn.getY()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java index f8e21255b..e7ee3d40f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java @@ -10,7 +10,13 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.EconHandler; +import com.github.intellectualsites.plotsquared.plot.util.EventUtil; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; +import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.google.common.base.Preconditions; import lombok.NonNull; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java index ce51fea33..8d7904690 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java @@ -104,7 +104,7 @@ public class PlotSettings { } public void setPosition(BlockLoc position) { - if (position != null && position.x == 0 && position.y == 0 && position.z == 0) { + if (position != null && position.getX() == 0 && position.getY() == 0 && position.getZ() == 0) { position = null; } this.position = position; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/DefaultPlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/DefaultPlotAreaManager.java index 31a86b874..8d5152a1b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/DefaultPlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/DefaultPlotAreaManager.java @@ -6,7 +6,13 @@ import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Set; public class DefaultPlotAreaManager implements PlotAreaManager { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java index 8c80e46a7..7f63e2ed0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java @@ -2,7 +2,13 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.google.common.collect.Sets; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java index 8f8ac96b1..1f5e70856 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java @@ -5,7 +5,14 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.generator.GridPlotWorld; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotLoc; +import com.github.intellectualsites.plotsquared.plot.object.PlotManager; +import com.github.intellectualsites.plotsquared.plot.object.PlotSettings; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; +import com.github.intellectualsites.plotsquared.plot.object.SetupObject; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotManager.java index 0c5a7e866..49d3788d5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotManager.java @@ -1,7 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SingleWorldGenerator.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SingleWorldGenerator.java index 9ba3df278..d50e3d22f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SingleWorldGenerator.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SingleWorldGenerator.java @@ -2,7 +2,11 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; public class SingleWorldGenerator extends IndependentPlotGenerator { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java index 55a99c9b9..206f2b710 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java @@ -1,7 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.util; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; @@ -9,6 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; +import com.sk89q.worldedit.math.BlockVector2; import java.io.File; import java.util.ArrayList; @@ -21,31 +21,31 @@ import java.util.concurrent.ConcurrentHashMap; public abstract class ChunkManager { - private static final Map> forceChunks = + private static final Map> forceChunks = new ConcurrentHashMap<>(); - private static final Map> addChunks = + private static final Map> addChunks = new ConcurrentHashMap<>(); public static ChunkManager manager = null; - public static ChunkLoc getChunkChunk(Location location) { + public static BlockVector2 getRegion(Location location) { int x = location.getX() >> 9; int z = location.getZ() >> 9; - return new ChunkLoc(x, z); + return BlockVector2.at(x, z); } public static void setChunkInPlotArea(RunnableVal force, - RunnableVal add, String world, ChunkLoc loc) { + RunnableVal add, String world, BlockVector2 loc) { LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); if (PlotSquared.get().isAugmented(world)) { - int blockX = loc.x << 4; - int blockZ = loc.z << 4; + int blockX = loc.getX() << 4; + int blockZ = loc.getZ() << 4; ScopedLocalBlockQueue scoped = new ScopedLocalBlockQueue(queue, new Location(world, blockX, 0, blockZ), new Location(world, blockX + 15, 255, blockZ + 15)); if (force != null) { force.run(scoped); } else { - scoped.regenChunk(loc.x, loc.z); + scoped.regenChunk(loc.getX(), loc.getZ()); if (add != null) { add.run(scoped); } @@ -54,13 +54,13 @@ public abstract class ChunkManager { } else { forceChunks.put(loc, force); addChunks.put(loc, add); - queue.regenChunk(loc.x, loc.z); + queue.regenChunk(loc.getX(), loc.getZ()); forceChunks.remove(loc); addChunks.remove(loc); } } - public static boolean preProcessChunk(ChunkLoc loc, ScopedLocalBlockQueue queue) { + public static boolean preProcessChunk(BlockVector2 loc, ScopedLocalBlockQueue queue) { final RunnableVal forceChunk = forceChunks.get(loc); if (forceChunk != null) { forceChunk.run(queue); @@ -70,7 +70,7 @@ public abstract class ChunkManager { return false; } - public static boolean postProcessChunk(ChunkLoc loc, ScopedLocalBlockQueue queue) { + public static boolean postProcessChunk(BlockVector2 loc, ScopedLocalBlockQueue queue) { final RunnableVal addChunk = forceChunks.get(loc); if (addChunk != null) { addChunk.run(queue); @@ -81,13 +81,13 @@ public abstract class ChunkManager { } public static void largeRegionTask(final String world, final RegionWrapper region, - final RunnableVal task, final Runnable whenDone) { + final RunnableVal task, final Runnable whenDone) { TaskManager.runTaskAsync(() -> { - HashSet chunks = new HashSet<>(); - Set mcrs = manager.getChunkChunks(world); - for (ChunkLoc mcr : mcrs) { - int bx = mcr.x << 9; - int bz = mcr.z << 9; + HashSet chunks = new HashSet<>(); + Set mcrs = manager.getChunkChunks(world); + for (BlockVector2 mcr : mcrs) { + int bx = mcr.getX() << 9; + int bz = mcr.getZ() << 9; int tx = bx + 511; int tz = bz + 511; if (bx <= region.maxX && tx >= region.minX && bz <= region.maxZ @@ -100,16 +100,16 @@ public abstract class ChunkManager { int cbz = z << 4; int ctz = cbz + 15; if (cbz <= region.maxZ && ctz >= region.minZ) { - chunks.add(new ChunkLoc(x, z)); + chunks.add(BlockVector2.at(x, z)); } } } } } } - TaskManager.objectTask(chunks, new RunnableVal() { + TaskManager.objectTask(chunks, new RunnableVal() { - @Override public void run(ChunkLoc value) { + @Override public void run(BlockVector2 value) { manager.loadChunk(world, value, false).thenRun(()-> task.run(value)); } }, whenDone); @@ -152,21 +152,21 @@ public abstract class ChunkManager { final int bcz = p1z >> 4; final int tcx = p2x >> 4; final int tcz = p2z >> 4; - final ArrayList chunks = new ArrayList<>(); + final ArrayList chunks = new ArrayList<>(); for (int x = bcx; x <= tcx; x++) { for (int z = bcz; z <= tcz; z++) { - chunks.add(new ChunkLoc(x, z)); + chunks.add(BlockVector2.at(x, z)); } } TaskManager.runTask(new Runnable() { @Override public void run() { long start = System.currentTimeMillis(); while (!chunks.isEmpty() && ((System.currentTimeMillis() - start) < allocate)) { - ChunkLoc chunk = chunks.remove(0); + BlockVector2 chunk = chunks.remove(0); task.value = new int[7]; - task.value[0] = chunk.x; - task.value[1] = chunk.z; + task.value[0] = chunk.getX(); + task.value[1] = chunk.getZ(); task.value[2] = task.value[0] << 4; task.value[3] = task.value[1] << 4; task.value[4] = task.value[2] + 15; @@ -211,11 +211,11 @@ public abstract class ChunkManager { */ public abstract int[] countEntities(Plot plot); - public abstract CompletableFuture loadChunk(String world, ChunkLoc loc, boolean force); + public abstract CompletableFuture loadChunk(String world, BlockVector2 loc, boolean force); - public abstract void unloadChunk(String world, ChunkLoc loc, boolean save); + public abstract void unloadChunk(String world, BlockVector2 loc, boolean save); - public Set getChunkChunks(String world) { + public Set getChunkChunks(String world) { File folder = new File(PlotSquared.get().IMP.getWorldContainer(), world + File.separator + "region"); File[] regionFiles = folder.listFiles(); @@ -223,7 +223,7 @@ public abstract class ChunkManager { throw new RuntimeException( "Could not find worlds folder: " + folder + " ? (no read access?)"); } - HashSet chunks = new HashSet<>(); + HashSet chunks = new HashSet<>(); for (File file : regionFiles) { String name = file.getName(); if (name.endsWith("mca")) { @@ -231,7 +231,7 @@ public abstract class ChunkManager { try { int x = Integer.parseInt(split[1]); int z = Integer.parseInt(split[2]); - ChunkLoc loc = new ChunkLoc(x, z); + BlockVector2 loc = BlockVector2.at(x, z); chunks.add(loc); } catch (NumberFormatException ignored) { } @@ -240,16 +240,16 @@ public abstract class ChunkManager { return chunks; } - public void deleteRegionFiles(String world, Collection chunks) { + public void deleteRegionFiles(String world, Collection chunks) { deleteRegionFiles(world, chunks, null); } - public void deleteRegionFiles(final String world, final Collection chunks, + public void deleteRegionFiles(final String world, final Collection chunks, final Runnable whenDone) { TaskManager.runTaskAsync(() -> { - for (ChunkLoc loc : chunks) { + for (BlockVector2 loc : chunks) { String directory = - world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca"; File file = new File(PlotSquared.get().IMP.getWorldContainer(), directory); PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)"); @@ -261,9 +261,9 @@ public abstract class ChunkManager { }); } - public Plot hasPlot(String world, ChunkLoc chunk) { - int x1 = chunk.x << 4; - int z1 = chunk.z << 4; + public Plot hasPlot(String world, BlockVector2 chunk) { + int x1 = chunk.getX() << 4; + int z1 = chunk.getZ() << 4; int x2 = x1 + 15; int z2 = z1 + 15; Location bot = new Location(world, x1, 0, z1); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java index fcb376355..5d443a43e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java @@ -6,11 +6,18 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.LazyBlock; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.Rating; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; - import org.jetbrains.annotations.Nullable; + import java.util.HashSet; import java.util.List; import java.util.Optional; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/IncendoPaster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/IncendoPaster.java index 1fec0e567..b5ebe5d17 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/IncendoPaster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/IncendoPaster.java @@ -9,7 +9,12 @@ import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.Locale; /** * Single class paster for the Incendo paste service diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java index 1f42d6772..af4b21e3c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java @@ -10,12 +10,25 @@ import com.github.intellectualsites.plotsquared.plot.flag.DoubleFlag; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.stream.AbstractDelegateOutputStream; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import org.jetbrains.annotations.NotNull; -import java.io.*; +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; @@ -23,8 +36,17 @@ import java.net.URLConnection; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.text.DecimalFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.IntStream; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java index 326d151e6..90a9b905f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java @@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld; -import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; @@ -26,16 +25,34 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader; import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import org.jetbrains.annotations.NotNull; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -197,9 +214,9 @@ public abstract class SchematicHandler { ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run(int[] value) { - ChunkLoc chunk = new ChunkLoc(value[0], value[1]); - int x = chunk.x; - int z = chunk.z; + BlockVector2 chunk = BlockVector2.at(value[0], value[1]); + int x = chunk.getX(); + int z = chunk.getZ(); int xxb = x << 4; int zzb = z << 4; int xxt = xxb + 15; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java index 60a0d778b..9967e88eb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java @@ -10,8 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.object.StringWrapper; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.google.common.collect.BiMap; import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; + import java.util.HashMap; import java.util.HashSet; import java.util.Map; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java index 17ab6b5ce..b5e37ed93 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java @@ -14,8 +14,8 @@ 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; + import java.util.HashMap; import java.util.HashSet; import java.util.Map; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/WorldUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/WorldUtil.java index 3aaed57fb..a503e1882 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/WorldUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/WorldUtil.java @@ -1,13 +1,19 @@ package com.github.intellectualsites.plotsquared.plot.util; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.math.BlockVector2; import java.io.ByteArrayOutputStream; import java.io.File; @@ -104,10 +110,10 @@ public abstract class WorldUtil { int brz = bot.getZ() >> 9; int trx = top.getX() >> 9; int trz = top.getZ() >> 9; - Set files = ChunkManager.manager.getChunkChunks(bot.getWorld()); - for (ChunkLoc mca : files) { - if (mca.x >= brx && mca.x <= trx && mca.z >= brz && mca.z <= trz) { - final File file = getMcr(plot.getWorldName(), mca.x, mca.z); + Set files = ChunkManager.manager.getChunkChunks(bot.getWorld()); + for (BlockVector2 mca : files) { + if (mca.getX() >= brx && mca.getX() <= trx && mca.getZ() >= brz && mca.getZ() <= trz) { + final File file = getMcr(plot.getWorldName(), mca.getX(), mca.getZ()); if (file != null) { //final String name = "r." + (x - cx) + "." + (z - cz) + ".mca"; String name = file.getName(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java index 04a9e2f0c..1ce8ccd11 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java @@ -1,7 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.util.block; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -10,6 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.world.block.BaseBlock; import java.util.Map; @@ -83,11 +83,11 @@ public abstract class LocalBlockQueue { public final void regenChunkSafe(int x, int z) { regenChunk(x, z); fixChunkLighting(x, z); - ChunkLoc loc = new ChunkLoc(x, z); + BlockVector2 loc = BlockVector2.at(x, z); for (Map.Entry entry : UUIDHandler.getPlayers().entrySet()) { PlotPlayer pp = entry.getValue(); Location pLoc = pp.getLocation(); - if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getChunkLoc() + if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getBlockVector2() .equals(loc)) { continue; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java index 2fbcdee01..dbd9773f0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java @@ -7,13 +7,28 @@ import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/PlotAnalysis.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/PlotAnalysis.java index 429a71035..484759d66 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/PlotAnalysis.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/PlotAnalysis.java @@ -10,7 +10,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import java.lang.reflect.Array; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; public class PlotAnalysis { diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java index 6ae75a86d..fd2a8db15 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java @@ -1,7 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.util; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.Rating; import java.util.List; import java.util.UUID; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/NukkitMain.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/NukkitMain.java index 1cc8b8246..c84a73b67 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/NukkitMain.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/NukkitMain.java @@ -25,19 +25,15 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; -import com.github.intellectualsites.plotsquared.plot.generator.*; -import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; -import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider; import com.sk89q.worldedit.WorldEdit; import java.io.File; import java.lang.reflect.Field; -import java.util.*; public final class NukkitMain extends PluginBase implements Listener, IPlotMain { diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/generator/NukkitPlotGenerator.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/generator/NukkitPlotGenerator.java index ef274cf2b..d1712993b 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/generator/NukkitPlotGenerator.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/generator/NukkitPlotGenerator.java @@ -9,7 +9,6 @@ import com.github.intellectualsites.plotsquared.nukkit.util.block.NukkitWrappedC import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/PlayerEvents.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/PlayerEvents.java index c429ba0fd..456cb97b2 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/PlayerEvents.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/PlayerEvents.java @@ -28,11 +28,8 @@ import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; -import com.github.intellectualsites.plotsquared.plot.object.*; -import com.github.intellectualsites.plotsquared.plot.util.*; import com.google.common.base.Optional; -import java.util.*; import java.util.Map.Entry; import java.util.regex.Pattern; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/object/NukkitPlayer.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/object/NukkitPlayer.java index fa6bf2a59..f53213d69 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/object/NukkitPlayer.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/object/NukkitPlayer.java @@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.nukkit.util.NukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.*; import java.util.Collections; import java.util.UUID; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/Metrics.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/Metrics.java index 1a41b836d..9b2ffb10c 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/Metrics.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/Metrics.java @@ -6,12 +6,10 @@ import cn.nukkit.utils.LogLevel; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; -import java.io.*; import java.net.Proxy; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; -import java.util.*; import java.util.zip.GZIPOutputStream; public class Metrics { diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitChunkManager.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitChunkManager.java index 5caea648f..32da16dc3 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitChunkManager.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitChunkManager.java @@ -1,8 +1,7 @@ package com.github.intellectualsites.plotsquared.nukkit.util; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; +import com.github.intellectualsites.plotsquared.plot.object.BlockVector2; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; @@ -16,11 +15,11 @@ public class NukkitChunkManager extends ChunkManager { return new int[0]; } - @Override public boolean loadChunk(String world, ChunkLoc loc, boolean force) { + @Override public boolean loadChunk(String world, BlockVector2 loc, boolean force) { return true; } - @Override public void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe) { + @Override public void unloadChunk(String world, BlockVector2 loc, boolean save, boolean safe) { } diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitEventUtil.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitEventUtil.java index 532870c43..d59e45ebf 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitEventUtil.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitEventUtil.java @@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.nukkit.NukkitMain; import com.github.intellectualsites.plotsquared.nukkit.events.*; import com.github.intellectualsites.plotsquared.nukkit.object.NukkitPlayer; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import javax.annotation.Nullable; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitSchematicHandler.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitSchematicHandler.java index 7e8fcf362..4a301101a 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitSchematicHandler.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitSchematicHandler.java @@ -6,7 +6,7 @@ import cn.nukkit.level.format.generic.BaseFullChunk; import cn.nukkit.math.Vector3; import com.github.intellectualsites.plotsquared.jnbt.*; import com.github.intellectualsites.plotsquared.nukkit.NukkitMain; -import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; +import com.github.intellectualsites.plotsquared.plot.object.BlockVector2; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -16,7 +16,6 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import java.io.IOException; -import java.util.*; /** * Schematic Handler. @@ -98,10 +97,10 @@ public class NukkitSchematicHandler extends SchematicHandler { final int sy = pos1.getY(); final int ey = pos2.getY(); // Generate list of chunks - final ArrayList chunks = new ArrayList<>(); + final ArrayList chunks = new ArrayList<>(); for (int x = bcx; x <= tcx; x++) { for (int z = bcz; z <= tcz; z++) { - chunks.add(new ChunkLoc(x, z)); + chunks.add(BlockVector2.at(x, z)); } } final Level worldObj = plugin.getServer().getLevelByName(world); @@ -113,7 +112,7 @@ public class NukkitSchematicHandler extends SchematicHandler { while (!chunks.isEmpty() && System.currentTimeMillis() - start < 20) { // save schematics - ChunkLoc chunk = chunks.remove(0); + BlockVector2 chunk = chunks.remove(0); BaseFullChunk bc = worldObj.getChunk(chunk.x, chunk.z); try { bc.load(false); diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitUtil.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitUtil.java index 4712d129d..ad085dca3 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitUtil.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/NukkitUtil.java @@ -20,7 +20,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; -import com.github.intellectualsites.plotsquared.plot.util.*; import java.lang.reflect.Field; import java.util.ArrayList; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitHybridGen.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitHybridGen.java index ccca6dfe8..6af270e63 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitHybridGen.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitHybridGen.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.nukkit.util.block; +import com.sk89q.worldedit.math.BlockVector2; + import cn.nukkit.level.Level; import com.github.intellectualsites.plotsquared.nukkit.NukkitMain; import com.github.intellectualsites.plotsquared.nukkit.generator.NukkitPlotGenerator; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitLocalQueue.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitLocalQueue.java index 0a8012691..297df7c6b 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitLocalQueue.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitLocalQueue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.nukkit.util.block; +import com.sk89q.worldedit.math.BlockVector2; + import cn.nukkit.block.Block; import cn.nukkit.level.Level; import cn.nukkit.level.biome.EnumBiome; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitWrappedChunk.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitWrappedChunk.java index 1dcb029f5..bc5182947 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitWrappedChunk.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/util/block/NukkitWrappedChunk.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.nukkit.util.block; +import com.sk89q.worldedit.math.BlockVector2; + import cn.nukkit.level.biome.Biome; import cn.nukkit.level.biome.EnumBiome; import cn.nukkit.level.format.generic.BaseFullChunk; diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/SpongeMain.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/SpongeMain.java index 0877e42fb..07e535040 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/SpongeMain.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/SpongeMain.java @@ -18,7 +18,6 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManag import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator; -import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.github.intellectualsites.plotsquared.sponge.generator.SpongePlotGenerator; diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/listener/MainListener.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/listener/MainListener.java index 01dcfcd16..09f500103 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/listener/MainListener.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/listener/MainListener.java @@ -4,8 +4,6 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; -import com.github.intellectualsites.plotsquared.plot.object.*; -import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.sponge.SpongeMain; import com.github.intellectualsites.plotsquared.sponge.object.SpongePlayer; import com.github.intellectualsites.plotsquared.sponge.util.SpongeUtil; @@ -35,7 +33,6 @@ import org.spongepowered.api.event.world.ExplosionEvent.Detonate; import org.spongepowered.api.text.Text; import org.spongepowered.api.world.World; -import java.util.*; import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Predicate; diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeChunkManager.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeChunkManager.java index 5de2ae309..f5a26c306 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeChunkManager.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeChunkManager.java @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.sponge.util; -import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; +import com.github.intellectualsites.plotsquared.plot.object.BlockVector2; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; @@ -53,12 +53,12 @@ public class SpongeChunkManager extends ChunkManager { return count; } - @Override public boolean loadChunk(String world, ChunkLoc loc, boolean force) { + @Override public boolean loadChunk(String world, BlockVector2 loc, boolean force) { World worldObj = SpongeUtil.getWorld(world); return worldObj.loadChunk(loc.x << 4, 0, loc.z << 4, force).isPresent(); } - @Override public Set getChunkChunks(String world) { + @Override public Set getChunkChunks(String world) { // TODO save world; return super.getChunkChunks(world); } @@ -100,7 +100,7 @@ public class SpongeChunkManager extends ChunkManager { throw new UnsupportedOperationException("NOT IMPLEMENTED YET"); } - @Override public void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe) { + @Override public void unloadChunk(String world, BlockVector2 loc, boolean save, boolean safe) { World worldObj = SpongeUtil.getWorld(world); Optional chunk = worldObj.getChunk(loc.x << 4, 0, loc.z << 4); if (chunk.isPresent()) { diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeCommand.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeCommand.java index 2c6b9b936..21ab4b19e 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeCommand.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeCommand.java @@ -16,8 +16,6 @@ import org.spongepowered.api.text.Text; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; -import java.util.*; - public class SpongeCommand implements CommandCallable { @Override public CommandResult process(CommandSource source, String arguments) diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeEventUtil.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeEventUtil.java index d4c16e73d..a69f4c431 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeEventUtil.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeEventUtil.java @@ -1,7 +1,6 @@ package com.github.intellectualsites.plotsquared.sponge.util; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.sponge.SpongeMain; import com.github.intellectualsites.plotsquared.sponge.events.*; diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeMetrics.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeMetrics.java index 4ea1bc19d..4a221d4e9 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeMetrics.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeMetrics.java @@ -1,5 +1,24 @@ package com.github.intellectualsites.plotsquared.sponge.util; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; +import com.google.inject.Inject; +import ninja.leaping.configurate.commented.CommentedConfigurationNode; +import ninja.leaping.configurate.hocon.HoconConfigurationLoader; +import ninja.leaping.configurate.loader.ConfigurationLoader; +import org.spongepowered.api.Game; +import org.spongepowered.api.plugin.PluginContainer; +import org.spongepowered.api.scheduler.Task; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.zip.GZIPOutputStream; + /* * Copyright 2011-2013 Tyler Blair. All rights reserved. * @@ -28,24 +47,6 @@ package com.github.intellectualsites.plotsquared.sponge.util; * either expressed or implied, of anybody else. */ -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.google.inject.Inject; -import ninja.leaping.configurate.commented.CommentedConfigurationNode; -import ninja.leaping.configurate.hocon.HoconConfigurationLoader; -import ninja.leaping.configurate.loader.ConfigurationLoader; -import org.spongepowered.api.Game; -import org.spongepowered.api.plugin.PluginContainer; -import org.spongepowered.api.scheduler.Task; - -import java.io.*; -import java.net.Proxy; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.zip.GZIPOutputStream; - public class SpongeMetrics { /** diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSchematicHandler.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSchematicHandler.java index 648a3ebd2..ecfe61fe4 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSchematicHandler.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSchematicHandler.java @@ -1,17 +1,16 @@ package com.github.intellectualsites.plotsquared.sponge.util; import com.github.intellectualsites.plotsquared.jnbt.*; -import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; +import com.sk89q.worldedit.math.BlockVector2; import org.spongepowered.api.block.BlockState; import org.spongepowered.api.item.inventory.Carrier; import org.spongepowered.api.item.inventory.type.CarriedInventory; import org.spongepowered.api.world.World; -import java.util.*; import java.util.Map.Entry; public class SpongeSchematicHandler extends SchematicHandler { @@ -92,10 +91,10 @@ public class SpongeSchematicHandler extends SchematicHandler { int sy = pos1.getY(); int ey = pos2.getY(); // Generate list of chunks - ArrayList chunks = new ArrayList<>(); + ArrayList chunks = new ArrayList<>(); for (int x = bcx; x <= tcx; x++) { for (int z = bcz; z <= tcz; z++) { - chunks.add(new ChunkLoc(x, z)); + chunks.add(BlockVector2.at(x, z)); } } World worldObj = SpongeUtil.getWorld(world); @@ -106,7 +105,7 @@ public class SpongeSchematicHandler extends SchematicHandler { while (!chunks.isEmpty() && System.currentTimeMillis() - start < 20) { // save schematics - ChunkLoc chunk = chunks.remove(0); + BlockVector2 chunk = chunks.remove(0); int X = chunk.x; int Z = chunk.z; if (!worldObj.getChunk(X, 0, Z).isPresent() && !worldObj diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSetupUtils.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSetupUtils.java index 3caf627bc..7a8cfc1a6 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSetupUtils.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSetupUtils.java @@ -19,7 +19,6 @@ import org.spongepowered.api.world.gen.WorldGeneratorModifier; import org.spongepowered.api.world.storage.WorldProperties; import java.io.IOException; -import java.util.*; import java.util.Map.Entry; public class SpongeSetupUtils extends SetupUtils { diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeUtil.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeUtil.java index e1307f76d..404006678 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeUtil.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeUtil.java @@ -9,7 +9,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; -import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.sponge.SpongeMain; import com.github.intellectualsites.plotsquared.sponge.object.SpongePlayer; import net.minecraft.block.Block; @@ -39,7 +38,6 @@ import org.spongepowered.api.world.extent.Extent; import java.io.IOException; import java.lang.reflect.Field; -import java.util.*; public class SpongeUtil extends WorldUtil { diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/GenChunk.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/GenChunk.java index f88e8fa0d..698befdf8 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/GenChunk.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/GenChunk.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.sponge.util.block; +import com.sk89q.worldedit.math.BlockVector2; + import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; diff --git a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/SpongeLocalQueue.java b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/SpongeLocalQueue.java index 00e294138..51efceeb2 100644 --- a/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/SpongeLocalQueue.java +++ b/Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/SpongeLocalQueue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.sponge.util.block; +import com.sk89q.worldedit.math.BlockVector2; + import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PseudoRandom; import com.github.intellectualsites.plotsquared.plot.util.MainUtil;