From 1fbfc767c4542d22b253da99e9bfd407430197b3 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Mon, 21 Jan 2019 09:20:33 +0100 Subject: [PATCH 001/258] Use PaperLib and make command task return completable futures --- Bukkit/build.gradle | 7 ++ .../plotsquared/bukkit/BukkitMain.java | 98 +++---------------- .../bukkit/events/PlayerPlotTrustedEvent.java | 4 - .../bukkit/object/BukkitPlayer.java | 78 ++++++++------- .../plotsquared/commands/Command.java | 51 +++++----- .../plotsquared/plot/commands/Add.java | 27 ++--- .../plotsquared/plot/commands/Buy.java | 40 ++++---- .../plotsquared/plot/commands/Clear.java | 49 +++++----- .../plotsquared/plot/commands/DebugExec.java | 4 +- .../plot/commands/DebugImportWorlds.java | 6 +- .../plotsquared/plot/commands/Grant.java | 9 +- .../plotsquared/plot/commands/Help.java | 85 ++++++++-------- .../plotsquared/plot/commands/Leave.java | 4 +- .../plot/commands/MainCommand.java | 89 ++++++++--------- .../plotsquared/plot/commands/Near.java | 5 +- .../plotsquared/plot/commands/Relight.java | 17 ++-- .../plotsquared/plot/commands/SubCommand.java | 7 +- .../plotsquared/plot/commands/Trust.java | 27 ++--- .../plotsquared/plot/commands/Visit.java | 23 +++-- .../plot/object/ConsolePlayer.java | 11 ++- .../plotsquared/plot/object/PlotPlayer.java | 15 +-- 21 files changed, 311 insertions(+), 345 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 3bc057a45..e6a9117bb 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -3,6 +3,10 @@ repositories { maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "http://nexus.hc.to/content/repositories/pub_releases" } maven { url = "https://repo.codemc.org/repository/maven-public" } + maven { + name 'papermc' + url 'https://papermc.io/repo/repository/maven-public/' + } mavenLocal() } @@ -12,6 +16,7 @@ dependencies { compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT' compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT') compile(group: 'org.bstats', name: 'bstats-bukkit', version: '1.4') + compile "io.papermc:paperlib:1.0.1" compile("net.milkbowl.vault:VaultAPI:1.7") { exclude module: 'bukkit' } @@ -37,7 +42,9 @@ shadowJar { dependencies { include(dependency(':Core')) include(dependency('org.bstats:bstats-bukkit:1.4')) + include(dependency("io.papermc:paperlib:1.0.1")) } + relocate 'io.papermc.lib', 'com.github.intellectualsites.plotsquared.bukkit.paperlib' // relocate('org.mcstats', 'com.plotsquared.stats') archiveName = "${parent.name}-${project.name}-${parent.version}.jar" destinationDir = file '../target' 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 ae95bd371..bc8fb225e 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 @@ -1,36 +1,11 @@ package com.github.intellectualsites.plotsquared.bukkit; -import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; - import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; -import com.github.intellectualsites.plotsquared.bukkit.listeners.ChunkListener; -import com.github.intellectualsites.plotsquared.bukkit.listeners.EntitySpawnListener; -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.listeners.*; import com.github.intellectualsites.plotsquared.bukkit.titles.DefaultTitle_111; -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.SendChunk; -import com.github.intellectualsites.plotsquared.bukkit.util.SetGenCB; +import com.github.intellectualsites.plotsquared.bukkit.util.*; 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; -import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; -import com.github.intellectualsites.plotsquared.bukkit.uuid.OfflineUUIDWrapper; -import com.github.intellectualsites.plotsquared.bukkit.uuid.SQLUUIDHandler; +import com.github.intellectualsites.plotsquared.bukkit.uuid.*; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.IPlotMain; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -41,57 +16,23 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.HybridGen; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry; -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.object.SetupObject; +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.object.worlds.SingleWorldGenerator; -import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; -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.WorldUtil; +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.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.extension.platform.Capability; -import java.io.File; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; -import javax.annotation.Nullable; +import io.papermc.lib.PaperLib; import lombok.Getter; import lombok.NonNull; -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.*; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -104,6 +45,13 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; +import javax.annotation.Nullable; +import java.io.File; +import java.lang.reflect.Method; +import java.util.*; + +import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; + public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { @Getter private static WorldEdit worldEdit; @@ -170,23 +118,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain getServer().getName(); PlotPlayer.registerConverter(Player.class, BukkitUtil::getPlayer); - - if (Bukkit.getVersion().contains("git-Spigot")) { - // Uses System.out.println because the logger isn't initialized yet - System.out - .println("[P2] ========================== USE PAPER =========================="); - System.out.println("[P2] Paper offers a more complete API for us to work with"); - System.out.println("[P2] and we may come to rely on it in the future."); - System.out.println("[P2] It is also recommended out of a performance standpoint as"); - System.out - .println("[P2] it contains many improvements missing from Spigot and Bukkit."); - System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads"); - System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/"); - System.out.println("[P2] NOTE: This is only a recommendation"); - System.out.println("[P2] both Spigot and CraftBukkit are still supported."); - System.out - .println("[P2] ==============================================================="); - } + PaperLib.suggestPaper(this); new PlotSquared(this, "Bukkit"); if (Settings.Enabled_Components.METRICS) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java index 95440056f..f2f9efe71 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java @@ -6,10 +6,6 @@ import org.bukkit.event.HandlerList; import java.util.UUID; -/** - - - */ public class PlayerPlotTrustedEvent extends PlotEvent { private static final HandlerList handlers = new HandlerList(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 7aecb854c..1255c0fc4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -7,15 +7,20 @@ import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.*; -import org.bukkit.*; +import com.google.common.base.Preconditions; +import io.papermc.lib.PaperLib; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.WeatherType; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventException; import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.RegisteredListener; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Set; import java.util.UUID; @@ -24,7 +29,7 @@ import java.util.stream.Collectors; public class BukkitPlayer extends PlotPlayer { public final Player player; - public boolean offline; + private boolean offline; private UUID uuid; private String name; @@ -32,21 +37,23 @@ public class BukkitPlayer extends PlotPlayer { *

Please do not use this method. Instead use * BukkitUtil.getPlayer(Player), as it caches player objects.

* - * @param player + * @param player Bukkit player instance */ - public BukkitPlayer(Player player) { + public BukkitPlayer(@Nonnull final Player player) { + Preconditions.checkNotNull(player, "Bukkit player instance cannot be null"); this.player = player; super.populatePersistentMetaMap(); } - public BukkitPlayer(Player player, boolean offline) { + public BukkitPlayer(@Nonnull final Player player, final boolean offline) { + Preconditions.checkNotNull(player, "Bukkit player instance cannot be null"); this.player = player; this.offline = offline; super.populatePersistentMetaMap(); } @Override public Location getLocation() { - Location location = super.getLocation(); + final Location location = super.getLocation(); return location == null ? BukkitUtil.getLocation(this.player) : location; } @@ -61,9 +68,10 @@ public class BukkitPlayer extends PlotPlayer { return this.player.getLastPlayed(); } - @Override public boolean canTeleport(Location loc) { - org.bukkit.Location to = BukkitUtil.getLocation(loc); - org.bukkit.Location from = player.getLocation(); + @Override public boolean canTeleport(@Nonnull final Location loc) { + Preconditions.checkNotNull(loc, "Bukkit location cannot be null"); + final org.bukkit.Location to = BukkitUtil.getLocation(loc); + final org.bukkit.Location from = player.getLocation(); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); callEvent(event); if (event.isCancelled() || !event.getTo().equals(to)) { @@ -75,32 +83,34 @@ public class BukkitPlayer extends PlotPlayer { } private void callEvent(final Event event) { - RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); - for (RegisteredListener listener : listeners) { + Preconditions.checkNotNull(event, "Event cannot be null"); + + final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); + for (final RegisteredListener listener : listeners) { if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) { continue; } try { listener.callEvent(event); - } catch (EventException e) { + } catch (final EventException e) { e.printStackTrace(); } } } - @Override public boolean hasPermission(String permission) { + @Override public boolean hasPermission(final String permission) { if (this.offline && EconHandler.manager != null) { return EconHandler.manager.hasPermission(getName(), permission); } return this.player.hasPermission(permission); } - @Override public int hasPermissionRange(String stub, int range) { + @Override public int hasPermissionRange(final String stub, final int range) { if (hasPermission(C.PERMISSION_ADMIN.s())) { return Integer.MAX_VALUE; } - String[] nodes = stub.split("\\."); - StringBuilder n = new StringBuilder(); + final String[] nodes = stub.split("\\."); + final StringBuilder n = new StringBuilder(); for (int i = 0; i < (nodes.length - 1); i++) { n.append(nodes[i]).append("."); if (!stub.equals(n + C.PERMISSION_STAR.s())) { @@ -114,7 +124,7 @@ public class BukkitPlayer extends PlotPlayer { } int max = 0; String stubPlus = stub + "."; - Set effective = player.getEffectivePermissions(); + final Set effective = player.getEffectivePermissions(); if (!effective.isEmpty()) { for (PermissionAttachmentInfo attach : effective) { String perm = attach.getPermission(); @@ -139,12 +149,12 @@ public class BukkitPlayer extends PlotPlayer { return max; } - @Override public boolean isPermissionSet(String permission) { + @Override public boolean isPermissionSet(final String permission) { return this.player.isPermissionSet(permission); } - @Override public void sendMessage(String message) { - if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || ( + @Override public void sendMessage(final String message) { + if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || ( System.currentTimeMillis() - this.getMeta("lastMessageTime") > 5000)) { setMeta("lastMessage", message); setMeta("lastMessageTime", System.currentTimeMillis()); @@ -152,14 +162,13 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void teleport(Location location) { + @Override public void teleport(@Nonnull final Location location) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { return; } - this.player.teleport( - new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, - location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch()), - TeleportCause.COMMAND); + final org.bukkit.Location bukkitLocation = new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, + location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch()); + PaperLib.teleportAsync(player, bukkitLocation); } @Override public String getName() { @@ -177,14 +186,14 @@ public class BukkitPlayer extends PlotPlayer { this.player.setCompassTarget( new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX(), location.getY(), location.getZ())); - } @Override public Location getLocationFull() { return BukkitUtil.getLocationFull(this.player); } - @Override public void setWeather(PlotWeather weather) { + @Override public void setWeather(@Nonnull final PlotWeather weather) { + Preconditions.checkNotNull(weather, "Specified weather cannot be null"); switch (weather) { case CLEAR: this.player.setPlayerWeather(WeatherType.CLEAR); @@ -201,7 +210,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public PlotGameMode getGameMode() { + @Nonnull @Override public PlotGameMode getGameMode() { switch (this.player.getGameMode()) { case ADVENTURE: return PlotGameMode.ADVENTURE; @@ -216,7 +225,8 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void setGameMode(PlotGameMode gameMode) { + @Override public void setGameMode(@Nonnull final PlotGameMode gameMode) { + Preconditions.checkNotNull(gameMode, "Specified gamemode cannot be null"); switch (gameMode) { case ADVENTURE: this.player.setGameMode(GameMode.ADVENTURE); @@ -236,7 +246,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void setTime(long time) { + @Override public void setTime(final long time) { if (time != Long.MAX_VALUE) { this.player.setPlayerTime(time, false); } else { @@ -252,7 +262,9 @@ public class BukkitPlayer extends PlotPlayer { this.player.setAllowFlight(fly); } - @Override public void playMusic(Location location, PlotBlock id) { + @Override public void playMusic(@Nonnull final Location location, @Nonnull final PlotBlock id) { + Preconditions.checkNotNull(location, "Specified location cannot be null"); + Preconditions.checkNotNull(id, "Specified block cannot be null"); if (PlotBlock.isEverything(id) || id.isAir()) { // Let's just stop all the discs because why not? for (final Sound sound : Arrays.stream(Sound.values()).filter(sound -> sound.name().contains("DISC")).collect( @@ -266,7 +278,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void kick(String message) { + @Override public void kick(final String message) { this.player.kickPlayer(message); } 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 6bac09a26..a581b8585 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 @@ -13,10 +13,10 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.*; import java.io.IOException; -import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.*; +import java.util.concurrent.CompletableFuture; public abstract class Command { @@ -56,10 +56,9 @@ public abstract class Command { public Command(Command parent, boolean isStatic) { this.parent = parent; this.isStatic = isStatic; - Annotation cdAnnotation = getClass().getAnnotation(CommandDeclaration.class); + CommandDeclaration cdAnnotation = getClass().getAnnotation(CommandDeclaration.class); if (cdAnnotation != null) { - CommandDeclaration declaration = (CommandDeclaration) cdAnnotation; - init(declaration); + init(cdAnnotation); } for (final Method method : getClass().getDeclaredMethods()) { if (method.isAnnotationPresent(CommandDeclaration.class)) { @@ -70,14 +69,16 @@ public abstract class Command { && types[2] == String[].class && types[3] == RunnableVal3.class && types[4] == RunnableVal2.class) { Command tmp = new Command(this, true) { - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { try { method.invoke(Command.this, this, player, args, confirm, whenDone); + return CompletableFuture.completedFuture(true); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } + return CompletableFuture.completedFuture(false); } }; tmp.init(method.getAnnotation(CommandDeclaration.class)); @@ -263,9 +264,10 @@ public abstract class Command { * @param player Caller * @param args Arguments * @param confirm Instance, Success, Failure - * @return + * @return CompletableFuture true if the command executed fully, false in + * any other case */ - public void execute(PlotPlayer player, String[] args, + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { if (args.length == 0 || args[0] == null) { @@ -274,28 +276,28 @@ public abstract class Command { } else { C.COMMAND_SYNTAX.send(player, getUsage()); } - return; + return CompletableFuture.completedFuture(false); } - if (this.allCommands == null || this.allCommands.isEmpty()) { + if (this.allCommands.isEmpty()) { player.sendMessage( "Not Implemented: https://github.com/IntellectualSites/PlotSquared/issues/new"); - return; + return CompletableFuture.completedFuture(false); } Command cmd = getCommand(args[0]); if (cmd == null) { if (this.parent != null) { C.COMMAND_SYNTAX.send(player, getUsage()); - return; + return CompletableFuture.completedFuture(false); } // Help command try { - if (args.length == 0 || MathMan.isInteger(args[0]) - || CommandCategory.valueOf(args[0].toUpperCase()) != null) { - // This will default certain syntax to the help command - // e.g. /plot, /plot 1, /plot claiming - MainCommand.getInstance().help.execute(player, args, null, null); - return; + if (!MathMan.isInteger(args[0])) { + CommandCategory.valueOf(args[0].toUpperCase()); } + // This will default certain syntax to the help command + // e.g. /plot, /plot 1, /plot claiming + MainCommand.getInstance().help.execute(player, args, null, null); + return CompletableFuture.completedFuture(false); } catch (IllegalArgumentException ignored) { } // Command recommendation @@ -304,16 +306,16 @@ public abstract class Command { if (commands.isEmpty()) { MainUtil .sendMessage(player, C.DID_YOU_MEAN, MainCommand.getInstance().help.getUsage()); - return; + return CompletableFuture.completedFuture(false); } - HashSet setargs = new HashSet<>(args.length); + HashSet setArgs = new HashSet<>(args.length); for (String arg : args) { - setargs.add(arg.toLowerCase()); + setArgs.add(arg.toLowerCase()); } - String[] allargs = setargs.toArray(new String[setargs.size()]); + String[] allArgs = setArgs.toArray(new String[0]); int best = 0; for (Command current : commands) { - int match = getMatch(allargs, current); + int match = getMatch(allArgs, current); if (match > best) { cmd = current; } @@ -322,17 +324,18 @@ public abstract class Command { cmd = new StringComparison<>(args[0], this.allCommands).getMatchObject(); } MainUtil.sendMessage(player, C.DID_YOU_MEAN, cmd.getUsage()); - return; + return CompletableFuture.completedFuture(false); } String[] newArgs = Arrays.copyOfRange(args, 1, args.length); if (!cmd.checkArgs(player, newArgs) || !cmd.canExecute(player, true)) { - return; + return CompletableFuture.completedFuture(false); } try { cmd.execute(player, newArgs, confirm, whenDone); } catch (CommandException e) { e.perform(player); } + return CompletableFuture.completedFuture(true); } public boolean checkArgs(PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java index 03d27555a..ed70d96d6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java @@ -15,6 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import java.util.Iterator; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "add", description = "Allow a user to build in a plot while you are online", @@ -25,7 +26,7 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); @@ -61,22 +62,22 @@ import java.util.UUID; checkTrue(!uuids.isEmpty(), null); checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS); - confirm.run(this, new Runnable() { - @Override // Success - public void run() { - for (UUID uuid : uuids) { - if (uuid != DBFunc.EVERYONE) { - if (!plot.removeTrusted(uuid)) { - if (plot.getDenied().contains(uuid)) { - plot.removeDenied(uuid); - } + // Success + confirm.run(this, () -> { + for (UUID uuid : uuids) { + if (uuid != DBFunc.EVERYONE) { + if (!plot.removeTrusted(uuid)) { + if (plot.getDenied().contains(uuid)) { + plot.removeDenied(uuid); } } - plot.addMember(uuid); - EventUtil.manager.callMember(player, plot, uuid, true); - MainUtil.sendMessage(player, C.MEMBER_ADDED); } + plot.addMember(uuid); + EventUtil.manager.callMember(player, plot, uuid, true); + MainUtil.sendMessage(player, C.MEMBER_ADDED); } }, null); + + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java index 25f9484b1..5c6a88b93 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.Optional; import java.util.Set; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "buy", description = "Buy the plot you are standing on", usage = "/plot buy", permission = "plots.buy", category = CommandCategory.CLAIMING, @@ -23,7 +24,7 @@ import java.util.Set; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, final RunnableVal2 whenDone) { check(EconHandler.manager, C.ECON_DISABLED); @@ -46,27 +47,24 @@ import java.util.Set; final double price = flag.get(); checkTrue(player.getMoney() >= price, C.CANNOT_AFFORD_PLOT); player.withdraw(price); - confirm.run(this, new Runnable() { - @Override // Success - public void run() { - C.REMOVED_BALANCE.send(player, price); - EconHandler.manager - .depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.owner), price); - PlotPlayer owner = UUIDHandler.getPlayer(plot.owner); - if (owner != null) { - C.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price); - } - plot.removeFlag(Flags.PRICE); - plot.setOwner(player.getUUID()); - C.CLAIMED.send(player); - whenDone.run(Buy.this, CommandResult.SUCCESS); - } - }, new Runnable() { - @Override // Failure - public void run() { - player.deposit(price); - whenDone.run(Buy.this, CommandResult.FAILURE); + // Failure + // Success + confirm.run(this, () -> { + C.REMOVED_BALANCE.send(player, price); + EconHandler.manager + .depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.owner), price); + PlotPlayer owner = UUIDHandler.getPlayer(plot.owner); + if (owner != null) { + C.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price); } + plot.removeFlag(Flags.PRICE); + plot.setOwner(player.getUUID()); + C.CLAIMED.send(player); + whenDone.run(Buy.this, CommandResult.SUCCESS); + }, () -> { + player.deposit(price); + whenDone.run(Buy.this, CommandResult.FAILURE); }); + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java index efd6b1525..b4de09259 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java @@ -14,6 +14,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; +import java.util.concurrent.CompletableFuture; + @CommandDeclaration(command = "clear", description = "Clear the plot you stand on", permission = "plots.clear", category = CommandCategory.APPEARANCE, usage = "/plot clear", aliases = "reset", confirmation = true) public class Clear extends Command { @@ -25,7 +27,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage()); @@ -35,34 +37,29 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER); checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions .hasPermission(player, C.PERMISSION_CONTINUE), C.DONE_ALREADY_DONE); - confirm.run(this, new Runnable() { - @Override public void run() { - final long start = System.currentTimeMillis(); - boolean result = plot.clear(true, false, new Runnable() { - @Override public void run() { - plot.unlink(); - GlobalBlockQueue.IMP.addTask(new Runnable() { - @Override public void run() { - plot.removeRunning(); - // If the state changes, then mark it as no longer done - if (plot.getFlag(Flags.DONE).isPresent()) { - FlagManager.removePlotFlag(plot, Flags.DONE); - } - if (plot.getFlag(Flags.ANALYSIS).isPresent()) { - FlagManager.removePlotFlag(plot, Flags.ANALYSIS); - } - MainUtil.sendMessage(player, C.CLEARING_DONE, - "" + (System.currentTimeMillis() - start)); - } - }); + confirm.run(this, () -> { + final long start = System.currentTimeMillis(); + boolean result = plot.clear(true, false, () -> { + plot.unlink(); + GlobalBlockQueue.IMP.addTask(() -> { + plot.removeRunning(); + // If the state changes, then mark it as no longer done + if (plot.getFlag(Flags.DONE).isPresent()) { + FlagManager.removePlotFlag(plot, Flags.DONE); } + if (plot.getFlag(Flags.ANALYSIS).isPresent()) { + FlagManager.removePlotFlag(plot, Flags.ANALYSIS); + } + MainUtil.sendMessage(player, C.CLEARING_DONE, + "" + (System.currentTimeMillis() - start)); }); - if (!result) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); - } else { - plot.addRunning(); - } + }); + if (!result) { + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + } else { + plot.addRunning(); } }, null); + return CompletableFuture.completedFuture(true); } } 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 dfcda68ae..f0f4e148a 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 @@ -23,6 +23,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.sql.Timestamp; import java.util.*; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = {"exec", "$"}, @@ -265,7 +266,7 @@ import java.util.*; System.getProperty("line.separator")); new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null, RequiredType.NONE, CommandCategory.DEBUG) { - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { try { @@ -276,6 +277,7 @@ import java.util.*; e.printStackTrace(); MainUtil.sendMessage(player, C.COMMAND_WENT_WRONG); } + return CompletableFuture.completedFuture(true); } }; return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index ddffaf744..8a4cfe613 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -16,6 +16,7 @@ import com.google.common.base.Charsets; import java.io.File; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "debugimportworlds", permission = "plots.admin", description = "Import worlds by player name", requiredType = RequiredType.CONSOLE, @@ -24,14 +25,14 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { // UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)) PlotAreaManager pam = PlotSquared.get().getPlotAreaManager(); if (!(pam instanceof SinglePlotAreaManager)) { player.sendMessage("Must be a single plot area!"); - return; + return CompletableFuture.completedFuture(false); } SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea(); PlotId id = new PlotId(0, 0); @@ -54,5 +55,6 @@ import java.util.UUID; } } player.sendMessage("Done!"); + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index d29bd76bb..18938f2ee 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING, usage = "/plot grant [player]", permission = "plots.grant", @@ -23,7 +24,7 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { checkTrue(args.length >= 1 && args.length <= 2, C.COMMAND_SYNTAX, getUsage()); @@ -33,7 +34,7 @@ import java.util.UUID; case "check": if (!Permissions.hasPermission(player, C.PERMISSION_GRANT.f(arg0))) { C.NO_PERMISSION.send(player, C.PERMISSION_GRANT.f(arg0)); - return; + return CompletableFuture.completedFuture(false); } if (args.length > 2) { break; @@ -42,7 +43,7 @@ import java.util.UUID; args.length == 2 ? UUIDHandler.getUUIDFromString(args[1]) : player.getUUID(); if (uuid == null) { C.INVALID_PLAYER.send(player, args[1]); - return; + return CompletableFuture.completedFuture(false); } MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal() { @Override public void run(byte[] array) { @@ -65,7 +66,9 @@ import java.util.UUID; } } }); + return CompletableFuture.completedFuture(true); } C.COMMAND_SYNTAX.send(player, getUsage()); + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index f0ff64af1..a62d1ab6f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -11,6 +11,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.helpmenu.HelpMenu; +import java.util.concurrent.CompletableFuture; + @CommandDeclaration(command = "help", description = "Get this help menu", aliases = {"he", "?"}, category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use") public class Help extends Command { @@ -22,72 +24,73 @@ public class Help extends Command { return true; } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { switch (args.length) { case 0: - displayHelp(player, null, 0); - return; + return displayHelp(player, null, 0); case 1: if (MathMan.isInteger(args[0])) { try { - displayHelp(player, null, Integer.parseInt(args[0])); + return displayHelp(player, null, Integer.parseInt(args[0])); } catch (NumberFormatException ignored) { - displayHelp(player, null, 1); + return displayHelp(player, null, 1); } } else { - displayHelp(player, args[0], 1); + return displayHelp(player, args[0], 1); } - return; case 2: if (MathMan.isInteger(args[1])) { try { - displayHelp(player, args[0], Integer.parseInt(args[1])); + return displayHelp(player, args[0], Integer.parseInt(args[1])); } catch (NumberFormatException ignored) { - displayHelp(player, args[0], 1); + return displayHelp(player, args[0], 1); } } - return; + return CompletableFuture.completedFuture(false); default: C.COMMAND_SYNTAX.send(player, getUsage()); } + return CompletableFuture.completedFuture(true); } - public void displayHelp(PlotPlayer player, String cat, int page) { - CommandCategory catEnum = null; - if (cat != null) { - if (StringMan.isEqualIgnoreCase(cat, "all")) { - catEnum = null; - } else { - for (CommandCategory c : CommandCategory.values()) { - if (StringMan.isEqualIgnoreCaseToAny(cat, c.name(), c.toString())) { - catEnum = c; - cat = c.name(); - break; + public CompletableFuture displayHelp(final PlotPlayer player, final String catRaw, final int page) { + return CompletableFuture.supplyAsync(() -> { + String cat = catRaw; + + CommandCategory catEnum = null; + if (cat != null) { + if (!StringMan.isEqualIgnoreCase(cat, "all")) { + for (CommandCategory c : CommandCategory.values()) { + if (StringMan.isEqualIgnoreCaseToAny(cat, c.name(), c.toString())) { + catEnum = c; + cat = c.name(); + break; + } + } + if (catEnum == null) { + cat = null; } } - if (catEnum == null) { - cat = null; + } + if (cat == null && page == 0) { + StringBuilder builder = new StringBuilder(); + builder.append(C.HELP_HEADER.s()); + for (CommandCategory c : CommandCategory.values()) { + builder.append("\n").append(StringMan + .replaceAll(C.HELP_INFO_ITEM.s(), "%category%", c.toString().toLowerCase(), + "%category_desc%", c.toString())); } + builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all") + .replaceAll("%category_desc%", "Display all commands")); + builder.append("\n").append(C.HELP_FOOTER.s()); + MainUtil.sendMessage(player, builder.toString(), false); + return true; } - } - if (cat == null && page == 0) { - StringBuilder builder = new StringBuilder(); - builder.append(C.HELP_HEADER.s()); - for (CommandCategory c : CommandCategory.values()) { - builder.append("\n" + StringMan - .replaceAll(C.HELP_INFO_ITEM.s(), "%category%", c.toString().toLowerCase(), - "%category_desc%", c.toString())); - } - builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all") - .replaceAll("%category_desc%", "Display all commands")); - builder.append("\n" + C.HELP_FOOTER.s()); - MainUtil.sendMessage(player, builder.toString(), false); - return; - } - page--; - new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages() - .generatePage(page, getParent().toString()).render(); + new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages() + .generatePage(page - 1, getParent().toString()).render(); + return true; + }); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index 5504ce777..cf49be592 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "leave", description = "Removes self from being trusted or a member of the plot", @@ -20,7 +21,7 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); @@ -44,5 +45,6 @@ import java.util.UUID; MainUtil.sendMessage(player, C.REMOVED_PLAYERS, 1); } } + return CompletableFuture.completedFuture(true); } } 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 0e1630e76..c50c5a221 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 @@ -10,6 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import java.util.Arrays; +import java.util.concurrent.CompletableFuture; /** * PlotSquared command class. @@ -126,27 +127,25 @@ public class MainCommand extends Command { @Override public void run(final Command cmd, final Runnable success, final Runnable failure) { if (cmd.hasConfirmation(player)) { - CmdConfirm.addPending(player, cmd.getUsage(), new Runnable() { - @Override public void run() { - if (EconHandler.manager != null) { - PlotArea area = player.getApplicablePlotArea(); - if (area != null) { - Expression priceEval = - area.PRICES.get(cmd.getFullId()); - Double price = - priceEval != null ? priceEval.evaluate(0d) : 0d; - if (price != null - && EconHandler.manager.getMoney(player) < price) { - if (failure != null) { - failure.run(); - } - return; + CmdConfirm.addPending(player, cmd.getUsage(), () -> { + if (EconHandler.manager != null) { + PlotArea area = player.getApplicablePlotArea(); + if (area != null) { + Expression priceEval = + area.PRICES.get(cmd.getFullId()); + Double price = + priceEval != null ? priceEval.evaluate(0d) : 0d; + if (price != null + && EconHandler.manager.getMoney(player) < price) { + if (failure != null) { + failure.run(); } + return; } } - if (success != null) { - success.run(); - } + } + if (success != null) { + success.run(); } }); return; @@ -172,6 +171,8 @@ public class MainCommand extends Command { @Override public void run(Command cmd, CommandResult result) { // Post command stuff!? } + }).thenAccept(result -> { + // TODO: Something with the command result }); } catch (CommandException e) { e.perform(player); @@ -187,7 +188,7 @@ public class MainCommand extends Command { PlotSquared.debug("Command registration is now done during instantiation"); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { // Clear perm caching // @@ -218,37 +219,32 @@ public class MainCommand extends Command { args = Arrays.copyOfRange(args, 1, args.length); } if (args.length >= 2 && !args[0].isEmpty() && args[0].charAt(0) == '-') { - switch (args[0].substring(1)) { - case "f": - confirm = new RunnableVal3() { - @Override - public void run(Command cmd, Runnable success, Runnable failure) { - if (EconHandler.manager != null) { - PlotArea area = player.getApplicablePlotArea(); - if (area != null) { - Expression priceEval = - area.PRICES.get(cmd.getFullId()); - Double price = - priceEval != null ? priceEval.evaluate(0d) : 0d; - if (price != 0d - && EconHandler.manager.getMoney(player) < price) { - if (failure != null) { - failure.run(); - } - return; + if ("f".equals(args[0].substring(1))) { + confirm = new RunnableVal3() { + @Override public void run(Command cmd, Runnable success, Runnable failure) { + if (EconHandler.manager != null) { + PlotArea area = player.getApplicablePlotArea(); + if (area != null) { + Expression priceEval = area.PRICES.get(cmd.getFullId()); + Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; + if (price != 0d + && EconHandler.manager.getMoney(player) < price) { + if (failure != null) { + failure.run(); } + return; } } - if (success != null) { - success.run(); - } } - }; - args = Arrays.copyOfRange(args, 1, args.length); - break; - default: - C.INVALID_COMMAND_FLAG.send(player); - return; + if (success != null) { + success.run(); + } + } + }; + args = Arrays.copyOfRange(args, 1, args.length); + } else { + C.INVALID_COMMAND_FLAG.send(player); + return CompletableFuture.completedFuture(false); } } } @@ -278,6 +274,7 @@ public class MainCommand extends Command { player.setMeta(PlotPlayer.META_LAST_PLOT, plot); } } + return CompletableFuture.completedFuture(true); } @Override public boolean canExecute(PlotPlayer player, boolean message) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java index c3e9c5f9e..e2278c4e2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java @@ -9,16 +9,19 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import java.util.concurrent.CompletableFuture; + @CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players", usage = "/plot near", category = CommandCategory.INFO) public class Near extends Command { public Near() { super(MainCommand.getInstance(), true); } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); C.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", ")); + return CompletableFuture.completedFuture(true); } } 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 79a87b887..0d3638fe3 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 @@ -7,7 +7,7 @@ import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; -import java.util.HashSet; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight", category = CommandCategory.DEBUG) public class Relight extends Command { @@ -15,25 +15,24 @@ import java.util.HashSet; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { final Plot plot = player.getCurrentPlot(); if (plot == null) { C.NOT_IN_PLOT.send(player); - return; + return CompletableFuture.completedFuture(false); } - HashSet regions = plot.getRegions(); final LocalBlockQueue queue = plot.getArea().getQueue(false); ChunkManager.chunkTask(plot, new RunnableVal() { @Override public void run(int[] value) { queue.fixChunkLighting(value[0], value[1]); } - }, new Runnable() { - @Override public void run() { - plot.refreshChunks(); - C.SET_BLOCK_ACTION_FINISHED.send(player); - } + }, () -> { + plot.refreshChunks(); + C.SET_BLOCK_ACTION_FINISHED.send(player); }, 5); + + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java index 396185e29..f0055829d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java @@ -7,6 +7,8 @@ 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 java.util.concurrent.CompletableFuture; + /** * SubCommand class * @@ -23,13 +25,12 @@ public abstract class SubCommand extends Command { setRequiredArguments(arguments); } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { - onCommand(player, args); + return CompletableFuture.completedFuture(onCommand(player, args)); } - public abstract boolean onCommand(PlotPlayer player, String[] args); public boolean sendMessage(PlotPlayer player, C message, Object... args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java index 6e6f0c5ab..7b6dfb761 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java @@ -15,6 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import java.util.Iterator; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.NONE, usage = "/plot trust ", @@ -25,7 +26,7 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); @@ -61,22 +62,22 @@ import java.util.UUID; checkTrue(!uuids.isEmpty(), null); checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS); - confirm.run(this, new Runnable() { - @Override // Success - public void run() { - for (UUID uuid : uuids) { - if (uuid != DBFunc.EVERYONE) { - if (!plot.removeMember(uuid)) { - if (plot.getDenied().contains(uuid)) { - plot.removeDenied(uuid); - } + // Success + confirm.run(this, () -> { + for (UUID uuid : uuids) { + if (uuid != DBFunc.EVERYONE) { + if (!plot.removeMember(uuid)) { + if (plot.getDenied().contains(uuid)) { + plot.removeDenied(uuid); } } - plot.addTrusted(uuid); - EventUtil.manager.callTrusted(player, plot, uuid, true); - MainUtil.sendMessage(player, C.TRUSTED_ADDED); } + plot.addTrusted(uuid); + EventUtil.manager.callTrusted(player, plot, uuid, true); + MainUtil.sendMessage(player, C.TRUSTED_ADDED); } }, null); + + return CompletableFuture.completedFuture(true); } } 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 8f1e50f16..6bd269968 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 @@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.*; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "visit", permission = "plots.visit", description = "Visit someones plot", usage = "/plot visit [|||] [#]", @@ -26,7 +27,7 @@ import java.util.*; return tabOf(player, args, space, getUsage()); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, final RunnableVal2 whenDone) throws CommandException { if (args.length == 1 && args[0].contains(":")) { @@ -41,7 +42,7 @@ import java.util.*; if (!MathMan.isInteger(args[1])) { C.NOT_VALID_NUMBER.send(player, "(1, ∞)"); C.COMMAND_SYNTAX.send(player, getUsage()); - return; + return CompletableFuture.completedFuture(false); } page = Integer.parseInt(args[2]); case 2: @@ -50,12 +51,12 @@ import java.util.*; if (sortByArea == null) { C.NOT_VALID_NUMBER.send(player, "(1, ∞)"); C.COMMAND_SYNTAX.send(player, getUsage()); - return; + return CompletableFuture.completedFuture(false); } UUID user = UUIDHandler.getUUIDFromString(args[0]); if (user == null) { C.COMMAND_SYNTAX.send(player, getUsage()); - return; + return CompletableFuture.completedFuture(false); } unsorted = PlotSquared.get().getBasePlots(user); shouldSortByArea = true; @@ -92,13 +93,13 @@ import java.util.*; } if (unsorted == null || unsorted.isEmpty()) { C.FOUND_NO_PLOTS.send(player); - return; + return CompletableFuture.completedFuture(false); } unsorted = new ArrayList<>(unsorted); unsorted.removeIf(plot -> !plot.isBasePlot()); if (page < 1 || page > unsorted.size()) { C.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")"); - return; + return CompletableFuture.completedFuture(false); } List plots; if (shouldSortByArea) { @@ -111,23 +112,23 @@ import java.util.*; if (!plot.hasOwner()) { if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_UNOWNED)) { C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_UNOWNED); - return; + return CompletableFuture.completedFuture(false); } } else if (plot.isOwner(player.getUUID())) { if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OWNED) && !Permissions .hasPermission(player, C.PERMISSION_HOME)) { C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OWNED); - return; + return CompletableFuture.completedFuture(false); } } else if (plot.isAdded(player.getUUID())) { if (!Permissions.hasPermission(player, C.PERMISSION_SHARED)) { C.NO_PERMISSION.send(player, C.PERMISSION_SHARED); - return; + return CompletableFuture.completedFuture(false); } } else { if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OTHER)) { C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OTHER); - return; + return CompletableFuture.completedFuture(false); } } confirm.run(this, () -> { @@ -137,6 +138,8 @@ import java.util.*; whenDone.run(Visit.this, CommandResult.FAILURE); } }, () -> whenDone.run(Visit.this, CommandResult.FAILURE)); + + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 18a0ce7bc..62b7f2544 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -6,6 +6,7 @@ import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import javax.annotation.Nonnull; import java.util.UUID; public class ConsolePlayer extends PlotPlayer { @@ -33,7 +34,7 @@ public class ConsolePlayer extends PlotPlayer { return instance; } - @Override public boolean canTeleport(Location loc) { + @Override public boolean canTeleport(@Nonnull Location loc) { return true; } @@ -95,14 +96,14 @@ public class ConsolePlayer extends PlotPlayer { return RequiredType.CONSOLE; } - @Override public void setWeather(PlotWeather weather) { + @Override public void setWeather(@Nonnull PlotWeather weather) { } - @Override public PlotGameMode getGameMode() { + @Nonnull @Override public PlotGameMode getGameMode() { return PlotGameMode.NOT_SET; } - @Override public void setGameMode(PlotGameMode gameMode) { + @Override public void setGameMode(@Nonnull PlotGameMode gameMode) { } @Override public void setTime(long time) { @@ -115,7 +116,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setFlight(boolean fly) { } - @Override public void playMusic(Location location, PlotBlock id) { + @Override public void playMusic(@Nonnull Location location, @Nonnull PlotBlock id) { } @Override public void kick(String message) { 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 d535c625e..4c3a2f6de 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 @@ -12,8 +12,10 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAre import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; +import com.google.common.base.Preconditions; import lombok.NonNull; +import javax.annotation.Nonnull; import java.nio.ByteBuffer; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -335,8 +337,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { */ @Override public abstract UUID getUUID(); - public boolean canTeleport(Location loc) { - Location current = getLocationFull(); + public boolean canTeleport(@Nonnull final Location loc) { + Preconditions.checkNotNull(loc, "Specified location cannot be null"); + final Location current = getLocationFull(); teleport(loc); boolean result = true; if (!getLocation().equals(loc)) { @@ -409,21 +412,21 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @param weather the weather visible to the player */ - public abstract void setWeather(PlotWeather weather); + public abstract void setWeather(@Nonnull PlotWeather weather); /** * Get this player's gamemode. * * @return the gamemode of the player. */ - public abstract PlotGameMode getGameMode(); + @Nonnull public abstract PlotGameMode getGameMode(); /** * Set this player's gameMode. * * @param gameMode the gamemode to set */ - public abstract void setGameMode(PlotGameMode gameMode); + public abstract void setGameMode(@Nonnull PlotGameMode gameMode); /** * Set this player's local time (ticks). @@ -447,7 +450,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @param location where to play the music * @param id the record item id */ - public abstract void playMusic(Location location, PlotBlock id); + public abstract void playMusic(@Nonnull Location location, @Nonnull PlotBlock id); /** * Check if this player is banned. From b66734a4722a5d4fe27505b813873781b370e28f Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 13 May 2019 21:57:41 -0400 Subject: [PATCH 002/258] Misc. code changes A lot of renaming Some formatting Narrowed scope of variables Added annotations --- .../bukkit/object/BukkitOfflinePlayer.java | 3 +- .../bukkit/object/BukkitPlayer.java | 11 ++- .../bukkit/util/OfflinePlayerUtil.java | 8 -- .../bukkit/util/block/GenChunk.java | 28 +++--- .../bukkit/uuid/DefaultUUIDWrapper.java | 3 +- .../bukkit/uuid/LowerOfflineUUIDWrapper.java | 6 +- .../bukkit/uuid/OfflineUUIDWrapper.java | 6 +- .../plotsquared/commands/Command.java | 8 +- .../ConfigurationSerialization.java | 26 +++-- .../plotsquared/plot/commands/Auto.java | 31 +++--- .../plotsquared/plot/commands/Clear.java | 44 ++++----- .../plotsquared/plot/commands/Cluster.java | 1 - .../plotsquared/plot/commands/Condense.java | 8 +- .../plotsquared/plot/commands/Database.java | 10 +- .../plotsquared/plot/commands/DebugPaste.java | 4 +- .../plotsquared/plot/commands/Deny.java | 12 ++- .../plotsquared/plot/commands/ListCmd.java | 20 +++- .../plotsquared/plot/commands/Load.java | 18 ++-- .../plotsquared/plot/commands/Remove.java | 2 +- .../plot/commands/SchematicCmd.java | 20 ++-- .../plotsquared/plot/commands/Setup.java | 12 ++- .../plotsquared/plot/commands/Trust.java | 12 +-- .../plotsquared/plot/config/Captions.java | 50 ++++------ .../plotsquared/plot/database/SQLManager.java | 25 +++-- .../plot/generator/AugmentedUtils.java | 9 +- .../plot/generator/HybridPlotManager.java | 15 +-- .../plotsquared/plot/listener/WEManager.java | 7 +- .../plotsquared/plot/object/BlockBucket.java | 8 +- .../plotsquared/plot/object/Plot.java | 94 +++++++++---------- .../plotsquared/plot/object/PlotArea.java | 10 +- .../plot/object/worlds/SinglePlotArea.java | 12 +-- .../object/worlds/SinglePlotAreaManager.java | 3 +- .../plot/util/HastebinUtility.java | 9 +- .../plotsquared/plot/util/MainUtil.java | 4 +- .../plot/util/ReflectionUtils.java | 21 +++-- .../plot/util/SchematicHandler.java | 21 ++++- .../plotsquared/plot/util/UUIDHandler.java | 19 ++-- .../plot/util/UUIDHandlerImplementation.java | 22 +++-- .../plotsquared/plot/util/WorldUtil.java | 24 +++-- .../plot/util/block/GlobalBlockQueue.java | 84 ++++++++--------- .../plot/util/expiry/ExpireManager.java | 3 +- .../plotsquared/plot/uuid/UUIDWrapper.java | 3 +- 42 files changed, 409 insertions(+), 327 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java index 390e9d9be..7c52a25de 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java @@ -2,6 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import org.bukkit.OfflinePlayer; +import org.jetbrains.annotations.NotNull; import java.util.UUID; @@ -19,7 +20,7 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer { this.player = player; } - @Override public UUID getUUID() { + @NotNull @Override public UUID getUUID() { return this.player.getUniqueId(); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 1afe93656..7b1ce2c54 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -6,7 +6,12 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.EconHandler; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +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.UUIDHandler; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; @@ -18,8 +23,8 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.RegisteredListener; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Set; import java.util.UUID; @@ -55,7 +60,7 @@ public class BukkitPlayer extends PlotPlayer { return location == null ? BukkitUtil.getLocation(this.player) : location; } - @Nonnull @Override public UUID getUUID() { + @NotNull @Override public UUID getUUID() { if (this.uuid == null) { this.uuid = UUIDHandler.getUUID(this); } 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 f1bc97bb1..a3e40fae1 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 @@ -13,14 +13,6 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils public class OfflinePlayerUtil { - public static Player loadPlayer(String name) { - return loadPlayer(Bukkit.getOfflinePlayer(name)); - } - - public static Player loadPlayer(UUID id) { - return loadPlayer(Bukkit.getOfflinePlayer(id)); - } - public static Player loadPlayer(OfflinePlayer player) { if (player == null) { return null; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index eebac8ef0..1049d902a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -26,8 +26,8 @@ public class GenChunk extends ScopedLocalBlockQueue { public BiomeGrid biomeGrid; public Chunk chunk; public String world; - public int cx; - public int cz; + public int chunkX; + public int chunkZ; @Getter @Setter private ChunkData cd = null; public GenChunk() { @@ -39,7 +39,7 @@ public class GenChunk extends ScopedLocalBlockQueue { if (chunk == null) { World worldObj = BukkitUtil.getWorld(world); if (worldObj != null) { - this.chunk = worldObj.getChunkAt(cx, cz); + this.chunk = worldObj.getChunkAt(chunkX, chunkZ); } } return chunk; @@ -52,8 +52,8 @@ public class GenChunk extends ScopedLocalBlockQueue { public void setChunk(ChunkWrapper wrap) { chunk = null; world = wrap.world; - cx = wrap.x; - cz = wrap.z; + chunkX = wrap.x; + chunkZ = wrap.z; } @Override public void fillBiome(String biomeName) { @@ -82,13 +82,13 @@ public class GenChunk extends ScopedLocalBlockQueue { Arrays.fill(data, start, end, block); } } - int minx = Math.min(pos1.getX(), pos2.getX()); - int miny = Math.min(pos1.getY(), pos2.getY()); - int minz = Math.min(pos1.getZ(), pos2.getZ()); - int maxx = Math.max(pos1.getX(), pos2.getX()); - int maxy = Math.max(pos1.getY(), pos2.getY()); - int maxz = Math.max(pos1.getZ(), pos2.getZ()); - cd.setRegion(minx, miny, minz, maxx + 1, maxy + 1, maxz + 1, block.to(Material.class)); + int minX = Math.min(pos1.getX(), pos2.getX()); + int minY = Math.min(pos1.getY(), pos2.getY()); + int minZ = Math.min(pos1.getZ(), pos2.getZ()); + int maxX = Math.max(pos1.getX(), pos2.getX()); + int maxY = Math.max(pos1.getY(), pos2.getY()); + int maxZ = Math.max(pos1.getZ(), pos2.getZ()); + cd.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, block.to(Material.class)); } @Override public boolean setBiome(int x, int z, String biome) { @@ -147,11 +147,11 @@ public class GenChunk extends ScopedLocalBlockQueue { } public int getX() { - return chunk == null ? cx : chunk.getX(); + return chunk == null ? chunkX : chunk.getX(); } public int getZ() { - return chunk == null ? cz : chunk.getZ(); + return chunk == null ? chunkZ : chunk.getZ(); } @Override public String getWorld() { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java index ce058b691..40d902f8e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java @@ -7,13 +7,14 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.UUID; public class DefaultUUIDWrapper extends UUIDWrapper { - @Override public UUID getUUID(PlotPlayer player) { + @NotNull @Override public UUID getUUID(PlotPlayer player) { return ((BukkitPlayer) player).player.getUniqueId(); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java index 55e2039a0..3f33387b9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java @@ -4,14 +4,14 @@ import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.google.common.base.Charsets; import org.bukkit.OfflinePlayer; +import org.jetbrains.annotations.NotNull; import java.util.UUID; public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper { - @Override public UUID getUUID(PlotPlayer player) { - return UUID.nameUUIDFromBytes( - ("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8)); + @NotNull @Override public UUID getUUID(PlotPlayer player) { + return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8)); } @Override public UUID getUUID(OfflinePlotPlayer player) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java index 6686c09f1..306f67e4e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java @@ -13,6 +13,7 @@ import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.Server; import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -33,9 +34,8 @@ public class OfflineUUIDWrapper extends UUIDWrapper { } } - @Override public UUID getUUID(PlotPlayer player) { - return UUID - .nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)); + @NotNull @Override public UUID getUUID(PlotPlayer player) { + return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)); } @Override public UUID getUUID(OfflinePlotPlayer player) { 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 bf803d712..277ebe2e7 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 @@ -10,7 +10,11 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; 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.*; +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 java.io.IOException; import java.lang.reflect.InvocationTargetException; @@ -150,10 +154,10 @@ public abstract class Command { this.perm = declaration.permission(); this.required = declaration.requiredType(); this.category = declaration.category(); - HashMap options = new HashMap<>(); List aliasOptions = new ArrayList<>(); aliasOptions.add(this.id); aliasOptions.addAll(Arrays.asList(declaration.aliases())); + HashMap options = new HashMap<>(); options.put("aliases", aliasOptions); options.put("description", declaration.description()); options.put("usage", declaration.usage()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java index 0783b4af5..cb1abd54a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java @@ -212,10 +212,15 @@ public class ConfigurationSerialization { return result; } } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ex) { - Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, - "Could not call method '" + method.toString() + "' of " + this.clazz - + " for deserialization", - ex instanceof InvocationTargetException ? ex.getCause() : ex); + if (ex instanceof InvocationTargetException) { + Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, + "Could not call method '" + method.toString() + "' of " + this.clazz + + " for deserialization", ex.getCause()); + } else { + Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, + "Could not call method '" + method.toString() + "' of " + this.clazz + + " for deserialization", ex); + } } return null; @@ -226,10 +231,15 @@ public class ConfigurationSerialization { try { return ctor.newInstance(args); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException ex) { - Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, - "Could not call constructor '" + ctor.toString() + "' of " + this.clazz - + " for deserialization", - ex instanceof InvocationTargetException ? ex.getCause() : ex); + if (ex instanceof InvocationTargetException) { + Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, + "Could not call constructor '" + ctor.toString() + "' of " + this.clazz + + " for deserialization", ex.getCause()); + } else { + Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, + "Could not call constructor '" + ctor.toString() + "' of " + this.clazz + + " for deserialization", ex); + } } return null; 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 fb6d571be..fa187877e 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,8 +5,17 @@ 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.util.*; +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 javax.annotation.Nullable; import java.util.Set; @@ -68,15 +77,15 @@ public class Auto extends SubCommand { * @param player * @param area * @param start - * @param schem + * @param schematic */ public static void homeOrAuto(final PlotPlayer player, final PlotArea area, PlotId start, - final String schem) { + final String schematic) { Set plots = player.getPlots(); if (!plots.isEmpty()) { plots.iterator().next().teleportPlayer(player); } else { - autoClaimSafe(player, area, start, schem); + autoClaimSafe(player, area, start, schematic); } } @@ -86,11 +95,11 @@ public class Auto extends SubCommand { * @param player * @param area * @param start - * @param schem + * @param schematic */ public static void autoClaimSafe(final PlotPlayer player, final PlotArea area, PlotId start, - final String schem) { - autoClaimSafe(player, area, start, schem, null); + final String schematic) { + autoClaimSafe(player, area, start, schematic, null); } /** @@ -99,10 +108,10 @@ public class Auto extends SubCommand { * @param player * @param area * @param start - * @param schem + * @param schematic */ public static void autoClaimSafe(final PlotPlayer player, final PlotArea area, PlotId start, - final String schem, @Nullable final Integer allowedPlots) { + final String schematic, @Nullable final Integer allowedPlots) { player.setMeta(Auto.class.getName(), true); autoClaimFromDatabase(player, area, start, new RunnableVal() { @Override public void run(final Plot plot) { @@ -112,7 +121,7 @@ public class Auto extends SubCommand { if (plot == null) { MainUtil.sendMessage(player, Captions.NO_FREE_PLOTS); } else if (checkAllowedPlots(player, area, allowedPlots, 1, 1)) { - plot.claim(player, true, schem, false); + plot.claim(player, true, schematic, false); if (area.AUTO_MERGE) { plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java index c16b603ac..6bde7ffd0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java @@ -36,33 +36,27 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER); checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions .hasPermission(player, Captions.PERMISSION_CONTINUE), Captions.DONE_ALREADY_DONE); - confirm.run(this, new Runnable() { - @Override public void run() { - final long start = System.currentTimeMillis(); - boolean result = plot.clear(true, false, new Runnable() { - @Override public void run() { - plot.unlink(); - GlobalBlockQueue.IMP.addTask(new Runnable() { - @Override public void run() { - plot.removeRunning(); - // If the state changes, then mark it as no longer done - if (plot.getFlag(Flags.DONE).isPresent()) { - FlagManager.removePlotFlag(plot, Flags.DONE); - } - if (plot.getFlag(Flags.ANALYSIS).isPresent()) { - FlagManager.removePlotFlag(plot, Flags.ANALYSIS); - } - MainUtil.sendMessage(player, Captions.CLEARING_DONE, - "" + (System.currentTimeMillis() - start)); - } - }); + confirm.run(this, () -> { + final long start = System.currentTimeMillis(); + boolean result = plot.clear(true, false, () -> { + plot.unlink(); + GlobalBlockQueue.IMP.addTask(() -> { + plot.removeRunning(); + // If the state changes, then mark it as no longer done + if (plot.getFlag(Flags.DONE).isPresent()) { + FlagManager.removePlotFlag(plot, Flags.DONE); } + if (plot.getFlag(Flags.ANALYSIS).isPresent()) { + FlagManager.removePlotFlag(plot, Flags.ANALYSIS); + } + MainUtil.sendMessage(player, Captions.CLEARING_DONE, + "" + (System.currentTimeMillis() - start)); }); - if (!result) { - MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); - } else { - plot.addRunning(); - } + }); + if (!result) { + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); + } else { + plot.addRunning(); } }, null); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java index a59c65550..32d7095a9 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 @@ -466,7 +466,6 @@ import java.util.UUID; PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) { PlotCluster current = plot.getCluster(); if (current != null && current.equals(cluster)) { - player.getLocation().getWorld(); plot.unclaim(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index 478a0cab9..184e2289d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -11,8 +11,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; import java.util.Set; -import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; @CommandDeclaration(command = "condense", permission = "plots.admin", @@ -104,6 +108,7 @@ import java.util.concurrent.atomic.AtomicBoolean; return false; } MainUtil.sendMessage(player, "TASK STARTED..."); + Condense.TASK = true; Runnable run = new Runnable() { @Override public void run() { if (!Condense.TASK) { @@ -147,7 +152,6 @@ import java.util.concurrent.atomic.AtomicBoolean; } } }; - Condense.TASK = true; TaskManager.runTaskAsync(run); return true; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index e94850121..d908f2105 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -87,8 +87,8 @@ import java.util.Map.Entry; HashMap> map = manager.getPlots(); plots = new ArrayList<>(); for (Entry> entry : map.entrySet()) { - String areaname = entry.getKey(); - PlotArea pa = PlotSquared.get().getPlotAreaByString(areaname); + String areaName = entry.getKey(); + PlotArea pa = PlotSquared.get().getPlotAreaByString(areaName); if (pa != null) { for (Entry entry2 : entry.getValue().entrySet()) { Plot plot = entry2.getValue(); @@ -123,9 +123,9 @@ import java.util.Map.Entry; plots.add(plot); } } else { - HashMap plotmap = PlotSquared.get().plots_tmp - .computeIfAbsent(areaname, k -> new HashMap<>()); - plotmap.putAll(entry.getValue()); + HashMap plotMap = PlotSquared.get().plots_tmp + .computeIfAbsent(areaName, k -> new HashMap<>()); + plotMap.putAll(entry.getValue()); } } DBFunc.createPlotsAndData(plots, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index f28b33a0a..7fe7bfdd1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -27,11 +27,11 @@ import java.util.stream.Collectors; extends SubCommand { private static String readFile(@NonNull final File file) throws IOException { - final StringBuilder content = new StringBuilder(); final List lines; try (final BufferedReader reader = new BufferedReader(new FileReader(file))) { lines = reader.lines().collect(Collectors.toList()); } + final StringBuilder content = new StringBuilder(); for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) { content.append(lines.get(i)).append("\n"); } @@ -41,7 +41,6 @@ import java.util.stream.Collectors; @Override public boolean onCommand(final PlotPlayer player, String[] args) { TaskManager.runTaskAsync(() -> { try { - final IncendoPaster incendoPaster = new IncendoPaster("plotsquared"); StringBuilder b = new StringBuilder(); b.append( @@ -79,6 +78,7 @@ import java.util.stream.Collectors; "\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues"); b.append("\n# or via our Discord at https://discord.gg/ngZCzbU"); + final IncendoPaster incendoPaster = new IncendoPaster("plotsquared"); incendoPaster.addFile(new IncendoPaster.PasteFile("information", b.toString())); try { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 34a2936f8..fa6a1f96c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -8,9 +8,13 @@ import com.github.intellectualsites.plotsquared.plot.database.DBFunc; 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.util.*; +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.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; -import java.util.Iterator; import java.util.Set; import java.util.UUID; @@ -44,9 +48,7 @@ import java.util.UUID; MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); return false; } - Iterator iter = uuids.iterator(); - while (iter.hasNext()) { - UUID uuid = iter.next(); + for (UUID uuid : uuids) { if (uuid == DBFunc.EVERYONE && !( Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) { 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 e2951db6a..bd4613409 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 @@ -5,12 +5,22 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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.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.expiry.ExpireManager; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; import java.util.Map.Entry; +import java.util.Optional; +import java.util.UUID; @CommandDeclaration(command = "list", aliases = {"l", "find", "search"}, description = "List plots", permission = "plots.list", category = CommandCategory.INFO, @@ -20,7 +30,7 @@ public class ListCmd extends SubCommand { private String[] getArgumentList(PlotPlayer player) { List args = new ArrayList<>(); if (EconHandler.manager != null && Permissions - .hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) { + .hasPermission(player, Captions.PERMISSION_LIST_FOR_SALE)) { args.add("forsale"); } if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) { @@ -222,9 +232,9 @@ public class ListCmd extends SubCommand { sort = false; break; case "forsale": - if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) { + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FOR_SALE)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_LIST_FORSALE); + Captions.PERMISSION_LIST_FOR_SALE); return false; } if (EconHandler.manager == null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java index 234568fda..d18332798 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java @@ -4,7 +4,11 @@ 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.config.Settings; -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.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; @@ -50,9 +54,9 @@ import java.util.List; MainUtil.sendMessage(player, Captions.LOAD_NULL); return false; } - String schem; + String schematic; try { - schem = schematics.get(Integer.parseInt(args[0]) - 1); + schematic = schematics.get(Integer.parseInt(args[0]) - 1); } catch (Exception ignored) { // use /plot load MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, @@ -61,7 +65,7 @@ import java.util.List; } final URL url; try { - url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schem); + url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic); } catch (MalformedURLException e) { e.printStackTrace(); MainUtil.sendMessage(player, Captions.LOAD_FAILED); @@ -70,8 +74,8 @@ import java.util.List; plot.addRunning(); MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); TaskManager.runTaskAsync(() -> { - Schematic schematic = SchematicHandler.manager.getSchematic(url); - if (schematic == null) { + Schematic taskSchematic = SchematicHandler.manager.getSchematic(url); + if (taskSchematic == null) { plot.removeRunning(); sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent or not in gzip format"); @@ -79,7 +83,7 @@ import java.util.List; } PlotArea area = plot.getArea(); SchematicHandler.manager - .paste(schematic, plot, 0, area.MIN_BUILD_HEIGHT, 0, false, + .paste(taskSchematic, plot, 0, area.MIN_BUILD_HEIGHT, 0, false, new RunnableVal() { @Override public void run(Boolean value) { plot.removeRunning(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java index 30c364671..875eb6e4c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java @@ -44,11 +44,11 @@ import java.util.UUID; int count = 0; switch (args[0]) { case "unknown": { - ArrayList toRemove = new ArrayList<>(); HashSet all = new HashSet<>(); all.addAll(plot.getMembers()); all.addAll(plot.getTrusted()); all.addAll(plot.getDenied()); + ArrayList toRemove = new ArrayList<>(); for (UUID uuid : all) { if (UUIDHandler.getName(uuid) == null) { toRemove.add(uuid); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index 48f0a8a1c..24ccbe016 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -4,9 +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.config.Settings; -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.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +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.google.common.collect.Lists; import java.net.URL; import java.util.ArrayList; @@ -191,9 +201,7 @@ public class SchematicCmd extends SubCommand { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } - location.getWorld(); - Collection plots = new ArrayList<>(); - plots.add(plot); + ArrayList plots = Lists.newArrayList(plot); boolean result = SchematicHandler.manager.exportAll(plots, null, null, () -> { MainUtil.sendMessage(player, "&aFinished export"); SchematicCmd.this.running = false; @@ -212,7 +220,7 @@ public class SchematicCmd extends SubCommand { return false; } final String string = - StringMan.join(SchematicHandler.manager.getShematicNames(), "$2, $1"); + StringMan.join(SchematicHandler.manager.getSchematicNames(), "$2, $1"); Captions.SCHEMATIC_LIST.send(player, string); } break; 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 66fbd041a..2b7e5ab7f 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 @@ -6,7 +6,11 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; -import com.github.intellectualsites.plotsquared.plot.object.*; +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.SetupObject; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.StringMan; @@ -345,7 +349,7 @@ import java.util.Map.Entry; return messages; } - @Override public boolean parseInut(String input) { + @Override public boolean parseInput(String input) { this.generator = input.toLowerCase(); return true; } @@ -385,7 +389,7 @@ import java.util.Map.Entry; return messages; } - @Override public boolean parseInut(String input) { + @Override public boolean parseInput(String input) { if (!WORLD_TYPES.keySet().contains(input.toLowerCase())) { return false; } @@ -416,7 +420,7 @@ import java.util.Map.Entry; public abstract Collection showDescriptionMessage(); - public abstract boolean parseInut(String input); + public abstract boolean parseInput(String input); public final PlotMessage getUsage() { return new PlotMessage("Usage: ").color("$1") diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java index 6724efdda..81a508ee3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java @@ -39,25 +39,25 @@ import java.util.UUID; checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage()); final Set uuids = MainUtil.getUUIDsFromString(args[0]); checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]); - Iterator iter = uuids.iterator(); + Iterator iterator = uuids.iterator(); int size = currentPlot.getTrusted().size() + currentPlot.getMembers().size(); - while (iter.hasNext()) { - UUID uuid = iter.next(); + while (iterator.hasNext()) { + UUID uuid = iterator.next(); if (uuid == DBFunc.EVERYONE && !( Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) { MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid)); - iter.remove(); + iterator.remove(); continue; } if (currentPlot.isOwner(uuid)) { MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); - iter.remove(); + iterator.remove(); continue; } if (currentPlot.getTrusted().contains(uuid)) { MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); - iter.remove(); + iterator.remove(); continue; } size += currentPlot.getMembers().contains(uuid) ? 0 : 1; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 2037bcdf1..0c6f501df 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -125,8 +125,8 @@ public enum Captions { PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"), PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"), PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"), - PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), - PERMISSION_LIST_FORSALE("plots.list.forsale", "static.permissions"), + PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), PERMISSION_LIST_FOR_SALE( + "plots.list.forsale", "static.permissions"), PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"), PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"), PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"), @@ -211,37 +211,25 @@ public enum Captions { CLUSTER_AVAILABLE_ARGS( "$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, " + "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_LIST_HEADING( - "$2There are $1%s$2 clusters in this world", "Cluster"), - - CLUSTER_LIST_ELEMENT("$2 - $1%s&-", "Cluster"), CLUSTER_INTERSECTION( - "$2The proposed area overlaps with: %s0", "Cluster"), - - CLUSTER_OUTSIDE("$2The proposed area is outside the plot area: %s0", "Cluster"), CLUSTER_ADDED( - "$4Successfully created the cluster.", "Cluster"), - - CLUSTER_DELETED("$4Successfully deleted the cluster.", "Cluster"), CLUSTER_RESIZED( - "$4Successfully resized the cluster.", "Cluster"), - - CLUSTER_ADDED_USER("$4Successfully added user to the cluster.", "Cluster"), CANNOT_KICK_PLAYER( - "$2You cannot kick that player", "Cluster"), - - CLUSTER_INVITED("$1You have been invited to the following cluster: $2%s", - "Cluster"), CLUSTER_REMOVED("$1You have been removed from cluster: $2%s", "Cluster"), - - CLUSTER_KICKED_USER("$4Successfully kicked the user", "Cluster"), INVALID_CLUSTER( - "$1Invalid cluster name: $2%s", "Cluster"), - - CLUSTER_NOT_ADDED("$2That player was not added to the plot cluster", - "Cluster"), CLUSTER_CANNOT_LEAVE("$1You must delete or transfer ownership before leaving", - "Cluster"), - - CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster", + "$2There are $1%s$2 clusters in this world", "Cluster"), CLUSTER_LIST_ELEMENT("$2 - $1%s&-", + "Cluster"), CLUSTER_INTERSECTION( + "$2The proposed area overlaps with: %s0", "Cluster"), CLUSTER_OUTSIDE( + "$2The proposed area is outside the plot area: %s0", "Cluster"), CLUSTER_ADDED( + "$4Successfully created the cluster.", "Cluster"), CLUSTER_DELETED( + "$4Successfully deleted the cluster.", "Cluster"), CLUSTER_RESIZED( + "$4Successfully resized the cluster.", "Cluster"), CLUSTER_ADDED_USER( + "$4Successfully added user to the cluster.", "Cluster"), CANNOT_KICK_PLAYER( + "$2You cannot kick that player", "Cluster"), CLUSTER_INVITED( + "$1You have been invited to the following cluster: $2%s", "Cluster"), CLUSTER_REMOVED( + "$1You have been removed from cluster: $2%s", "Cluster"), CLUSTER_KICKED_USER( + "$4Successfully kicked the user", "Cluster"), INVALID_CLUSTER( + "$1Invalid cluster name: $2%s", "Cluster"), CLUSTER_NOT_ADDED( + "$2That player was not added to the plot cluster", "Cluster"), CLUSTER_CANNOT_LEAVE( + "$1You must delete or transfer ownership before leaving", + "Cluster"), CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster", "Cluster"), CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", - "Cluster"), - - CLUSTER_REGENERATED("$4Successfully started cluster regeneration", + "Cluster"), CLUSTER_REGENERATED("$4Successfully started cluster regeneration", "Cluster"), CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"), - CLUSTER_INFO( "$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%", "Cluster"), 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 fac357c46..ed0eee71d 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 @@ -308,7 +308,6 @@ import java.util.concurrent.atomic.AtomicInteger; PlotSquared.debug("============ DATABASE ERROR ============"); PlotSquared.debug("There was an error updating the database."); PlotSquared.debug(" - It will be corrected on shutdown"); - PlotSquared.debug("========================================"); e.printStackTrace(); PlotSquared.debug("========================================"); } @@ -326,15 +325,15 @@ import java.util.concurrent.atomic.AtomicInteger; PreparedStatement statement = null; UniqueStatement task = null; UniqueStatement lastTask = null; - Iterator>> iter = + Iterator>> iterator = this.plotTasks.entrySet().iterator(); - while (iter.hasNext()) { + while (iterator.hasNext()) { try { - Entry> entry = iter.next(); + Entry> entry = iterator.next(); Plot plot = entry.getKey(); Queue tasks = entry.getValue(); if (tasks.isEmpty()) { - iter.remove(); + iterator.remove(); continue; } task = tasks.remove(); @@ -352,7 +351,7 @@ import java.util.concurrent.atomic.AtomicInteger; task.set(statement); task.addBatch(statement); try { - if (statement != null && statement.isClosed()) { + if (statement.isClosed()) { statement = null; } } catch (AbstractMethodError ignore) { @@ -1615,17 +1614,17 @@ import java.util.concurrent.atomic.AtomicInteger; PlotId plot_id = new PlotId(resultSet.getInt("plot_id_x"), resultSet.getInt("plot_id_z")); id = resultSet.getInt("id"); - String areaid = resultSet.getString("world"); - if (!areas.contains(areaid)) { + String areaID = resultSet.getString("world"); + if (!areas.contains(areaID)) { if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); continue; } else { - AtomicInteger value = noExist.get(areaid); + AtomicInteger value = noExist.get(areaID); if (value != null) { value.incrementAndGet(); } else { - noExist.put(areaid, new AtomicInteger(1)); + noExist.put(areaID, new AtomicInteger(1)); } } } @@ -1657,7 +1656,7 @@ import java.util.concurrent.atomic.AtomicInteger; .getTime(); } catch (ParseException e) { PlotSquared.debug( - "Could not parse date for plot: #" + id + "(" + areaid + ";" + "Could not parse date for plot: #" + id + "(" + areaID + ";" + plot_id + ") (" + parsable + ")"); time = System.currentTimeMillis() + id; } @@ -1665,7 +1664,7 @@ import java.util.concurrent.atomic.AtomicInteger; Plot p = new Plot(plot_id, user, new HashSet<>(), new HashSet<>(), new HashSet<>(), "", null, null, null, new boolean[] {false, false, false, false}, time, id); - HashMap map = newPlots.get(areaid); + HashMap map = newPlots.get(areaID); if (map != null) { Plot last = map.put(p.getId(), p); if (last != null) { @@ -1679,7 +1678,7 @@ import java.util.concurrent.atomic.AtomicInteger; } } else { map = new HashMap<>(); - newPlots.put(areaid, map); + newPlots.put(areaID, map); map.put(p.getId(), p); } plots.put(id, p); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index 1d18cbdcd..005a22d72 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.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.Location; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotManager; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; @@ -49,7 +54,7 @@ public class AugmentedUtils { queue = GlobalBlockQueue.IMP.getNewQueue(world, false); } LocalBlockQueue primaryMask; - // coords + // coordinates int bxx; int bzz; int txx; 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 4796e3644..44e1d1705 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,14 +3,7 @@ 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.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.PlotArea; -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.object.*; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -18,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.Sets; import com.sk89q.worldedit.world.block.BaseBlock; + import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -32,12 +26,11 @@ public class HybridPlotManager extends ClassicPlotManager { new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea))); String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plotArea.worldname + File.separator; - String newDir = - "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" - + File.separator; try { File sideroad = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem"); + String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + + "__TEMP_DIR__" + File.separator; if (sideroad.exists()) { files.add(new FileBytes(newDir + "sideroad.schem", Files.readAllBytes(sideroad.toPath()))); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java index 0d80cab31..3692efa51 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java @@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.listener; import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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.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.RegionWrapper; import java.util.HashSet; import java.util.UUID; @@ -68,7 +72,6 @@ public class WEManager { } boolean allowMember = player.hasPermission("plots.worldedit.member"); Plot plot = player.getCurrentPlot(); - HashSet allowed = new HashSet<>(); if (plot == null) { plot = player.getMeta("WorldEditRegionPlot"); } 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 e357de0b7..6900500f9 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 @@ -166,16 +166,16 @@ import java.util.Map.Entry; compile(); } final StringBuilder builder = new StringBuilder(); - Iterator> iter = blocks.entrySet().iterator(); - while (iter.hasNext()) { - Entry entry = iter.next(); + Iterator> iterator = blocks.entrySet().iterator(); + while (iterator.hasNext()) { + Entry entry = iterator.next(); PlotBlock block = entry.getKey(); builder.append(block.getRawId()); Double weight = entry.getValue(); if (weight != 1) { builder.append(":").append(weight.intValue()); } - if (iter.hasNext()) { + if (iterator.hasNext()) { builder.append(","); } } 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 e2f83172e..78c7675d2 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 @@ -2220,13 +2220,13 @@ public class Plot { if (!EventUtil.manager.callMerge(this, dir, max)) { return false; } - HashSet visited = new HashSet<>(); - HashSet merged; Set connected = this.getConnectedPlots(); - merged = connected.stream().map(Plot::getId).collect(Collectors.toCollection(HashSet::new)); + HashSet merged = + connected.stream().map(Plot::getId).collect(Collectors.toCollection(HashSet::new)); ArrayDeque frontier = new ArrayDeque<>(connected); Plot current; boolean toReturn = false; + HashSet visited = new HashSet<>(); while ((current = frontier.poll()) != null && max >= 0) { if (visited.contains(current)) { continue; @@ -2421,10 +2421,10 @@ public class Plot { regions_cache = null; HashSet tmpSet = new HashSet<>(); - ArrayDeque frontier = new ArrayDeque<>(); - HashSet queuecache = new HashSet<>(); tmpSet.add(this); Plot tmp; + HashSet queuecache = new HashSet<>(); + ArrayDeque frontier = new ArrayDeque<>(); if (merged[0]) { tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH)); if (!tmp.getMerged(Direction.SOUTH)) { @@ -2923,51 +2923,51 @@ public class Plot { plot.swapData(other, null); } // copy terrain - Runnable move = new Runnable() { - @Override public void run() { - if (regions.isEmpty()) { - Plot plot = destination.getRelative(0, 0); - for (Plot current : plot.getConnectedPlots()) { - getManager().claimPlot(current.getArea(), current); - Plot originPlot = originArea.getPlotAbs( - new PlotId(current.id.x - offset.x, current.id.y - offset.y)); - originPlot.getManager().unClaimPlot(originArea, originPlot, null); - } - plot.setSign(); - TaskManager.runTask(whenDone); - return; - } - final Runnable task = this; - RegionWrapper region = regions.poll(); - Location[] corners = region.getCorners(getWorldName()); - final Location pos1 = corners[0]; - final Location pos2 = corners[1]; - Location newPos = pos1.clone().add(offsetX, 0, offsetZ); - newPos.setWorld(destination.getWorldName()); - ChunkManager.manager.copyRegion(pos1, pos2, newPos, - () -> ChunkManager.manager.regenerateRegion(pos1, pos2, false, task)); - } - }; - Runnable swap = new Runnable() { - @Override public void run() { - if (regions.isEmpty()) { - TaskManager.runTask(whenDone); - return; - } - RegionWrapper region = regions.poll(); - Location[] corners = region.getCorners(getWorldName()); - Location pos1 = corners[0]; - Location pos2 = corners[1]; - Location pos3 = pos1.clone().add(offsetX, 0, offsetZ); - Location pos4 = pos2.clone().add(offsetX, 0, offsetZ); - pos3.setWorld(destination.getWorldName()); - pos4.setWorld(destination.getWorldName()); - ChunkManager.manager.swap(pos1, pos2, pos3, pos4, this); - } - }; if (occupied) { + Runnable swap = new Runnable() { + @Override public void run() { + if (regions.isEmpty()) { + TaskManager.runTask(whenDone); + return; + } + RegionWrapper region = regions.poll(); + Location[] corners = region.getCorners(getWorldName()); + Location pos1 = corners[0]; + Location pos2 = corners[1]; + Location pos3 = pos1.clone().add(offsetX, 0, offsetZ); + Location pos4 = pos2.clone().add(offsetX, 0, offsetZ); + pos3.setWorld(destination.getWorldName()); + pos4.setWorld(destination.getWorldName()); + ChunkManager.manager.swap(pos1, pos2, pos3, pos4, this); + } + }; swap.run(); } else { + Runnable move = new Runnable() { + @Override public void run() { + if (regions.isEmpty()) { + Plot plot = destination.getRelative(0, 0); + for (Plot current : plot.getConnectedPlots()) { + getManager().claimPlot(current.getArea(), current); + Plot originPlot = originArea.getPlotAbs( + new PlotId(current.id.x - offset.x, current.id.y - offset.y)); + originPlot.getManager().unClaimPlot(originArea, originPlot, null); + } + plot.setSign(); + TaskManager.runTask(whenDone); + return; + } + final Runnable task = this; + RegionWrapper region = regions.poll(); + Location[] corners = region.getCorners(getWorldName()); + final Location pos1 = corners[0]; + final Location pos2 = corners[1]; + Location newPos = pos1.clone().add(offsetX, 0, offsetZ); + newPos.setWorld(destination.getWorldName()); + ChunkManager.manager.copyRegion(pos1, pos2, newPos, + () -> ChunkManager.manager.regenerateRegion(pos1, pos2, false, task)); + } + }; move.run(); } return true; 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 9cdd5a4bd..253d74b40 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 @@ -10,7 +10,12 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.generator.GridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -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.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; @@ -844,11 +849,10 @@ public abstract class PlotArea { return false; } + manager.startPlotMerge(this, plotIds); final Set trusted = new HashSet<>(); final Set members = new HashSet<>(); final Set denied = new HashSet<>(); - - manager.startPlotMerge(this, plotIds); for (int x = pos1.x; x <= pos2.x; x++) { for (int y = pos1.y; y <= pos2.y; y++) { PlotId id = new PlotId(x, y); 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 a51ef110b..e1f6505f6 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 @@ -50,21 +50,21 @@ public class SinglePlotArea extends GridPlotWorld { // Duplicate 0;0 if (setup.type != 0) { File container = PlotSquared.imp().getWorldContainer(); - File dest = new File(container, worldName); - if (!dest.exists()) { + File destination = new File(container, worldName); + if (!destination.exists()) { File src = new File(container, "0,0"); if (src.exists()) { - if (!dest.exists()) { - dest.mkdirs(); + if (!destination.exists()) { + destination.mkdirs(); } File levelDat = new File(src, "level.dat"); if (levelDat.exists()) { try { Files.copy(levelDat.toPath(), - new File(dest, levelDat.getName()).toPath()); + new File(destination, levelDat.getName()).toPath()); File data = new File(src, "data"); if (data.exists()) { - File dataDest = new File(dest, "data"); + File dataDest = new File(destination, "data"); dataDest.mkdirs(); for (File file : data.listFiles()) { Files.copy(file.toPath(), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java index 95b303eea..f2e0b3c03 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java @@ -35,8 +35,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager { return true; } int mode = 0; - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; + for (char c : chars) { switch (mode) { case 0: mode = 1; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HastebinUtility.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HastebinUtility.java index d2495b646..3b0563a3d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HastebinUtility.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HastebinUtility.java @@ -1,6 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.util; -import java.io.*; +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; @@ -47,7 +52,6 @@ public class HastebinUtility { } public static String upload(final File file) throws IOException { - final StringBuilder content = new StringBuilder(); List lines = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(file))) { String line; @@ -56,6 +60,7 @@ public class HastebinUtility { lines.add(line); } } + final StringBuilder content = new StringBuilder(); for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) { content.append(lines.get(i)).append("\n"); } 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 cfc910748..2e1784b59 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 @@ -399,8 +399,6 @@ public class MainUtil { List uuids = new ArrayList<>(); PlotId id = null; - PlotArea area = null; - String alias = null; for (String term : split) { try { @@ -418,6 +416,8 @@ public class MainUtil { IntStream.range(0, size).mapToObj(i -> new ArrayList()) .collect(Collectors.toCollection(() -> new ArrayList<>(size))); + PlotArea area = null; + String alias = null; for (Plot plot : PlotSquared.get().getPlots()) { int count = 0; if (!uuids.isEmpty()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java index cf6bbee2d..621766c17 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java @@ -1,7 +1,15 @@ package com.github.intellectualsites.plotsquared.plot.util; -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.List; +import java.util.Map; /** * @author DPOH-VAR @@ -137,21 +145,22 @@ public class ReflectionUtils { } @SuppressWarnings("unchecked") - public static Constructor makeConstructor(Class clazz, Class... paramaterTypes) { + public static Constructor makeConstructor(Class clazz, Class... parameterTypes) { try { - return (Constructor) clazz.getConstructor(paramaterTypes); + return (Constructor) clazz.getConstructor(parameterTypes); } catch (NoSuchMethodException ignored) { + //todo print a constructor not found method return null; } } - public static T callConstructor(Constructor constructor, Object... paramaters) { + public static T callConstructor(Constructor constructor, Object... parameters) { if (constructor == null) { throw new RuntimeException("No such constructor"); } constructor.setAccessible(true); try { - return constructor.newInstance(paramaters); + return constructor.newInstance(parameters); } catch (InvocationTargetException ex) { throw new RuntimeException(ex.getCause()); } catch (IllegalAccessException | IllegalArgumentException | InstantiationException ex) { 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 cf04f7f94..d6df9d003 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,12 +7,25 @@ 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.*; +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; +import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; -import com.sk89q.jnbt.*; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.NBTInputStream; +import com.sk89q.jnbt.NBTOutputStream; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; -import com.sk89q.worldedit.extent.clipboard.io.*; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; +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.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; @@ -267,7 +280,7 @@ public abstract class SchematicHandler { * * @return Immutable collection with schematic names */ - public Collection getShematicNames() { + public Collection getSchematicNames() { final File parent = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS); final List names = new ArrayList<>(); 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 52e65a3fd..feb58f51f 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 @@ -9,8 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; 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 javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -85,7 +86,7 @@ public class UUIDHandler { implementation.add(toAdd); } - @Nonnull public static UUID getUUID(PlotPlayer player) { + @NotNull public static UUID getUUID(PlotPlayer player) { return implementation.getUUID(player); } @@ -96,7 +97,7 @@ public class UUIDHandler { return implementation.getUUID(player); } - public static String getName(UUID uuid) { + @Nullable public static String getName(UUID uuid) { if (implementation == null) { return null; } @@ -120,13 +121,13 @@ public class UUIDHandler { return check(implementation.getPlayer(name)); } - private static PlotPlayer check(PlotPlayer plr) { - if (plr != null && !plr.isOnline()) { - UUIDHandler.getPlayers().remove(plr.getName()); - PlotSquared.get().IMP.unregister(plr); - plr = null; + private static PlotPlayer check(@Nullable PlotPlayer player) { + if (player != null && !player.isOnline()) { + UUIDHandler.getPlayers().remove(player.getName()); + PlotSquared.get().IMP.unregister(player); + player = null; } - return plr; + return player; } public static UUID getUUIDFromString(String nameOrUUIDString) { 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 baf7523ca..9ccae793b 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 @@ -4,13 +4,23 @@ 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.OfflinePlotPlayer; +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.StringWrapper; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.google.common.base.Charsets; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; +import org.jetbrains.annotations.NotNull; -import java.util.*; +import javax.annotation.Nullable; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; public abstract class UUIDHandlerImplementation { @@ -216,7 +226,7 @@ public abstract class UUIDHandlerImplementation { this.uuidMap.clear(); } - public String getName(UUID uuid) { + @Nullable public String getName(UUID uuid) { if (uuid == null) { return null; } @@ -227,7 +237,7 @@ public abstract class UUIDHandlerImplementation { return null; } - public UUID getUUID(String name, RunnableVal ifFetch) { + @Nullable public UUID getUUID(String name, RunnableVal ifFetch) { if (name.isEmpty()) { return null; } @@ -255,7 +265,7 @@ public abstract class UUIDHandlerImplementation { return null; } - public UUID getUUID(PlotPlayer player) { + @NotNull public UUID getUUID(PlotPlayer player) { return this.uuidWrapper.getUUID(player); } @@ -263,7 +273,7 @@ public abstract class UUIDHandlerImplementation { return this.uuidWrapper.getUUID(player); } - public PlotPlayer getPlayer(UUID uuid) { + @Nullable public PlotPlayer getPlayer(UUID uuid) { String name = getName(uuid); if (name != null) { return getPlayer(name); 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 2e05542aa..3aaed57fb 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 @@ -3,9 +3,17 @@ 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.schematic.PlotItem; -import com.sk89q.jnbt.*; +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 java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; import java.net.URL; import java.util.Map; import java.util.Set; @@ -66,7 +74,6 @@ public abstract class WorldUtil { try (final ZipOutputStream zos = new ZipOutputStream(output)) { File dat = getDat(plot.getWorldName()); Location spawn = getSpawn(plot.getWorldName()); - byte[] buffer = new byte[1024]; if (dat != null) { ZipEntry ze = new ZipEntry("world" + File.separator + dat.getName()); zos.putNextEntry(ze); @@ -89,6 +96,7 @@ public abstract class WorldUtil { } } setSpawn(spawn); + byte[] buffer = new byte[1024]; for (Plot current : plot.getConnectedPlots()) { Location bot = current.getBottomAbs(); Location top = current.getTopAbs(); @@ -107,12 +115,12 @@ public abstract class WorldUtil { "world" + File.separator + "region" + File.separator + name); zos.putNextEntry(ze); - final FileInputStream in = new FileInputStream(file); - int len; - while ((len = in.read(buffer)) > 0) { - zos.write(buffer, 0, len); + try (FileInputStream in = new FileInputStream(file)) { + int len; + while ((len = in.read(buffer)) > 0) { + zos.write(buffer, 0, len); + } } - in.close(); zos.closeEntry(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java index a448eb127..6d75b6bfb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java @@ -81,52 +81,50 @@ public class GlobalBlockQueue { return false; } running.set(true); - TaskManager.runTaskRepeat(new Runnable() { - @Override public void run() { - if (inactiveQueues.isEmpty() && activeQueues.isEmpty()) { - lastSuccess = System.currentTimeMillis(); - tasks(); - return; - } - SET_TASK.value1 = 50 + Math.min( - (50 + GlobalBlockQueue.this.last) - (GlobalBlockQueue.this.last = - System.currentTimeMillis()), - GlobalBlockQueue.this.secondLast - System.currentTimeMillis()); - SET_TASK.value2 = getNextQueue(); - if (SET_TASK.value2 == null) { - return; - } - if (!PlotSquared.get().isMainThread(Thread.currentThread())) { - throw new IllegalStateException( - "This shouldn't be possible for placement to occur off the main thread"); - } - // Disable the async catcher as it can't discern async vs parallel - SET_TASK.value2.startSet(true); - try { - if (PARALLEL_THREADS <= 1) { - SET_TASK.run(); - } else { - ArrayList threads = new ArrayList<>(); - for (int i = 0; i < PARALLEL_THREADS; i++) { - threads.add(new Thread(SET_TASK)); - } - for (Thread thread : threads) { - thread.start(); - } - for (Thread thread : threads) { - try { - thread.join(); - } catch (InterruptedException e) { - e.printStackTrace(); - } + TaskManager.runTaskRepeat(() -> { + if (inactiveQueues.isEmpty() && activeQueues.isEmpty()) { + lastSuccess = System.currentTimeMillis(); + tasks(); + return; + } + SET_TASK.value1 = 50 + Math.min( + (50 + GlobalBlockQueue.this.last) - (GlobalBlockQueue.this.last = + System.currentTimeMillis()), + GlobalBlockQueue.this.secondLast - System.currentTimeMillis()); + SET_TASK.value2 = getNextQueue(); + if (SET_TASK.value2 == null) { + return; + } + if (!PlotSquared.get().isMainThread(Thread.currentThread())) { + throw new IllegalStateException( + "This shouldn't be possible for placement to occur off the main thread"); + } + // Disable the async catcher as it can't discern async vs parallel + SET_TASK.value2.startSet(true); + try { + if (PARALLEL_THREADS <= 1) { + SET_TASK.run(); + } else { + ArrayList threads = new ArrayList<>(); + for (int i = 0; i < PARALLEL_THREADS; i++) { + threads.add(new Thread(SET_TASK)); + } + for (Thread thread : threads) { + thread.start(); + } + for (Thread thread : threads) { + try { + thread.join(); + } catch (InterruptedException e) { + e.printStackTrace(); } } - } catch (Throwable e) { - e.printStackTrace(); - } finally { - // Enable it again (note that we are still on the main thread) - SET_TASK.value2.endSet(true); } + } catch (Throwable e) { + e.printStackTrace(); + } finally { + // Enable it again (note that we are still on the main thread) + SET_TASK.value2.endSet(true); } }, 1); return true; 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 cf4e025eb..2fbcdee01 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 @@ -169,13 +169,12 @@ public class ExpireManager { return new ArrayList<>(); } - boolean shouldCheckAccountAge = false; - long diff = getAge(plot); if (diff == 0) { return new ArrayList<>(); } // Filter out non old plots + boolean shouldCheckAccountAge = false; for (int i = 0; i < applicable.size(); i++) { ExpiryTask et = applicable.poll(); if (et.applies(diff)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java index 235b51a34..c2a0af542 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java @@ -2,12 +2,13 @@ package com.github.intellectualsites.plotsquared.plot.uuid; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import org.jetbrains.annotations.NotNull; import java.util.UUID; public abstract class UUIDWrapper { - public abstract UUID getUUID(PlotPlayer player); + @NotNull public abstract UUID getUUID(PlotPlayer player); public abstract UUID getUUID(OfflinePlotPlayer player); From 427504fd7c83e52f4d38490d797e1cd39511bb38 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 17 May 2019 14:26:47 -0400 Subject: [PATCH 003/258] Commented out Multiverse-Core and Bump to 1.14.1 --- Bukkit/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 2a6b17d65..1d03fd0f8 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -3,7 +3,7 @@ repositories { maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "http://nexus.hc.to/content/repositories/pub_releases" } maven { url "https://repo.codemc.org/repository/maven-public" } - maven { url 'http://repo.onarandombox.com/content/groups/public'} + //maven { url 'http://repo.onarandombox.com/content/groups/public'} maven { url 'https://papermc.io/repo/repository/maven-public/' } mavenLocal() } @@ -11,9 +11,9 @@ repositories { dependencies { implementation project(':Core') compile project(':Core') - compile 'com.destroystokyo.paper:paper-api:1.14-R0.1-SNAPSHOT' - implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' - implementation 'org.spigotmc:spigot-api:1.14-R0.1-SNAPSHOT' + compile 'com.destroystokyo.paper:paper-api:1.14.1-R0.1-SNAPSHOT' + //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' + implementation 'org.spigotmc:spigot-api:1.14.1-R0.1-SNAPSHOT' compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT') compile("net.milkbowl.vault:VaultAPI:1.7") { exclude module: 'bukkit' From 6f5cb30734ea8ce2092e577f7f8ed5ffbbfa93cc Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 17 May 2019 14:38:57 -0400 Subject: [PATCH 004/258] Minor message changes and variable changes --- .../plotsquared/bukkit/BukkitMain.java | 22 +---------- .../generator/BukkitAugmentedGenerator.java | 4 +- .../bukkit/generator/BukkitPlotGenerator.java | 8 ++-- .../generator/DelegatePlotGenerator.java | 39 +++++++++++-------- .../bukkit/generator/PlotBlockPopulator.java | 4 +- .../bukkit/util/block/GenChunk.java | 17 ++++---- .../plot/generator/AugmentedUtils.java | 3 +- .../object/worlds/DefaultPlotAreaManager.java | 6 ++- 8 files changed, 50 insertions(+), 53 deletions(-) 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 94f6adcb7..e473076ac 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 @@ -40,8 +40,6 @@ 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.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.extension.platform.Capability; import lombok.Getter; import lombok.NonNull; import org.bukkit.*; @@ -54,7 +52,6 @@ import org.bukkit.generator.ChunkGenerator; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import javax.annotation.Nullable; @@ -114,22 +111,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return Bukkit.getVersion(); } - private void init() { - try { - PluginManager manager = Bukkit.getPluginManager(); - System.out.println("[P2] Force loading WorldEdit"); - Plugin plugin = manager.getPlugin("WorldEdit"); - if (!manager.isPluginEnabled("WorldEdit")) { - manager.enablePlugin(WorldEditPlugin.getPlugin(WorldEditPlugin.class)); - } - System.out.println("[P2] Testing platform capabilities"); - WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS); - } catch (final Throwable throwable) { - throw new IllegalStateException( - "Failed to force load WorldEdit. Road schematics will fail to generate", throwable); - } - } - @Override public void onEnable() { this.pluginName = getDescription().getName(); PlotPlayer.registerConverter(Player.class, BukkitUtil::getPlayer); @@ -146,7 +127,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads"); System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/"); System.out.println("[P2] NOTE: This is only a recommendation"); - System.out.println("[P2] both Spigot and CraftBukkit are still supported."); + System.out.println("[P2] Spigot is still supported."); System.out .println("[P2] ==============================================================="); } @@ -158,6 +139,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain "You can't use this version of PlotSquared on a server less than Minecraft 1.13.2."); System.out .println("Please check the download page for the link to the legacy versions."); + System.out.println("The server will now be shutdown to prevent any corruption."); Bukkit.shutdown(); return; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java index 6942bf6ab..03b0c8123 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java @@ -4,6 +4,7 @@ import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; +import org.jetbrains.annotations.NotNull; import java.util.Random; @@ -24,7 +25,8 @@ public class BukkitAugmentedGenerator extends BlockPopulator { return generator; } - @Override public void populate(World world, Random random, Chunk source) { + @Override + public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk source) { AugmentedUtils.generate(world.getName(), source.getX(), source.getZ(), null); } } 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 b6a246f0d..1f1976889 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 @@ -123,19 +123,19 @@ public class BukkitPlotGenerator extends ChunkGenerator GenChunk result = new GenChunk(); if (this.getPlotGenerator() instanceof SingleWorldGenerator) { - if (result.getCd() != null) { + if (result.getChunkData() != null) { for (int cx = 0; cx < 16; cx++) { for (int cz = 0; cz < 16; cz++) { biome.setBiome(cx, cz, Biome.PLAINS); } } - return result.getCd(); + return result.getChunkData(); } } // Set the chunk location result.setChunk(new ChunkWrapper(world.getName(), x, z)); // Set the result data - result.setCd(createChunkData(world)); + result.setChunkData(createChunkData(world)); result.biomeGrid = biome; result.result = null; @@ -151,7 +151,7 @@ public class BukkitPlotGenerator extends ChunkGenerator e.printStackTrace(); } // Return the result data - return result.getCd(); + return result.getChunkData(); } private void generate(ChunkLoc loc, World world, ScopedLocalBlockQueue result) { 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 820a9fa42..8c1d97947 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 @@ -4,7 +4,12 @@ import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; 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.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import lombok.RequiredArgsConstructor; @@ -61,27 +66,27 @@ import java.util.Random; } @Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) { - World w = BukkitUtil.getWorld(world); + World world = BukkitUtil.getWorld(this.world); Location min = result.getMin(); - int cx = min.getX() >> 4; - int cz = min.getZ() >> 4; - Random r = new Random(MathMan.pair((short) cx, (short) cz)); - ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() { - @Override public void setBiome(int x, int z, Biome biome) { - result.setBiome(x, z, biome.name()); - } - - @Override @NotNull public Biome getBiome(int x, int z) { - return Biome.FOREST; - } - }; + int chunkX = min.getX() >> 4; + int chunkZ = min.getZ() >> 4; + Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ)); try { - chunkGenerator.generateChunkData(w, r, cx, cz, grid); + ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() { + @Override public void setBiome(int x, int z, Biome biome) { + result.setBiome(x, z, biome.name()); + } + + @Override @NotNull public Biome getBiome(int x, int z) { + return Biome.FOREST; + } + }; + chunkGenerator.generateChunkData(world, random, chunkX, chunkZ, grid); return; } catch (Throwable ignored) { } - for (BlockPopulator populator : chunkGenerator.getDefaultPopulators(w)) { - populator.populate(w, r, w.getChunkAt(cx, cz)); + for (BlockPopulator populator : chunkGenerator.getDefaultPopulators(world)) { + populator.populate(world, random, world.getChunkAt(chunkX, chunkZ)); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java index 4e2fee0b5..9236e184a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java @@ -11,6 +11,7 @@ import lombok.RequiredArgsConstructor; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; +import org.jetbrains.annotations.NotNull; import java.util.Random; @@ -19,7 +20,8 @@ import java.util.Random; private final IndependentPlotGenerator plotGenerator; private LocalBlockQueue queue; - @Override public void populate(final World world, final Random random, final Chunk source) { + @Override public void populate(@NotNull final World world, @NotNull final Random random, + @NotNull final Chunk source) { if (this.queue == null) { this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index 1049d902a..fc2bc3574 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -28,7 +28,7 @@ public class GenChunk extends ScopedLocalBlockQueue { public String world; public int chunkX; public int chunkZ; - @Getter @Setter private ChunkData cd = null; + @Getter @Setter private ChunkData chunkData = null; public GenChunk() { super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15)); @@ -88,7 +88,8 @@ public class GenChunk extends ScopedLocalBlockQueue { int maxX = Math.max(pos1.getX(), pos2.getX()); int maxY = Math.max(pos1.getY(), pos2.getY()); int maxZ = Math.max(pos1.getZ(), pos2.getZ()); - cd.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, block.to(Material.class)); + chunkData + .setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, block.to(Material.class)); } @Override public boolean setBiome(int x, int z, String biome) { @@ -105,10 +106,10 @@ public class GenChunk extends ScopedLocalBlockQueue { @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { if (this.result == null) { - this.cd.setBlock(x, y, z, id.to(Material.class)); + this.chunkData.setBlock(x, y, z, id.to(Material.class)); return true; } - this.cd.setBlock(x, y, z, id.to(Material.class)); + this.chunkData.setBlock(x, y, z, id.to(Material.class)); this.storeCache(x, y, z, id); return true; } @@ -125,10 +126,10 @@ public class GenChunk extends ScopedLocalBlockQueue { @Override public boolean setBlock(int x, int y, int z, BaseBlock id) { if (this.result == null) { - this.cd.setBlock(x, y, z, BukkitAdapter.adapt(id)); + this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); return true; } - this.cd.setBlock(x, y, z, BukkitAdapter.adapt(id)); + this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); this.storeCache(x, y, z, PlotBlock.get(id.getBlockType().getId())); return true; } @@ -136,7 +137,7 @@ public class GenChunk extends ScopedLocalBlockQueue { @Override public PlotBlock getBlock(int x, int y, int z) { int i = MainUtil.CACHE_I[y][x][z]; if (result == null) { - return PlotBlock.get(cd.getType(x, y, z)); + return PlotBlock.get(chunkData.getType(x, y, z)); } PlotBlock[] array = result[i]; if (array == null) { @@ -177,7 +178,7 @@ public class GenChunk extends ScopedLocalBlockQueue { } } } - toReturn.cd = this.cd; + toReturn.chunkData = this.chunkData; return toReturn; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index 005a22d72..a8fb953d9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlo 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 org.jetbrains.annotations.NotNull; import java.util.Set; @@ -24,7 +25,7 @@ public class AugmentedUtils { enabled = true; } - public static boolean generate(final String world, final int cx, final int cz, + public static boolean generate(@NotNull final String world, final int cx, final int cz, LocalBlockQueue queue) { if (!enabled) { return false; 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 9a9abca74..31a86b874 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 @@ -139,7 +139,11 @@ public class DefaultPlotAreaManager implements PlotAreaManager { return null; case 1: PlotArea pa = this.plotAreas[0]; - return pa.contains(location) ? pa : null; + if (pa.contains(location)) { + return pa; + } else { + return null; + } case 2: case 3: case 4: From 595a68ecbaf9e8eab48b0264d0759a793602a67f Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 17 May 2019 15:32:05 -0400 Subject: [PATCH 005/258] variable renames --- .../bukkit/generator/BukkitPlotGenerator.java | 6 ++-- .../plotsquared/bukkit/util/SendChunk.java | 8 ++--- .../plotsquared/plot/commands/Set.java | 15 +++++++--- .../plotsquared/plot/commands/Trim.java | 3 +- .../plot/generator/AugmentedUtils.java | 30 +++++++++---------- .../plot/generator/ClassicPlotManager.java | 1 - .../plotsquared/plot/object/Plot.java | 21 ++++++------- .../plotsquared/plot/util/ChunkManager.java | 22 +++++++++----- .../plot/util/block/BasicLocalBlockQueue.java | 24 +++++++-------- .../plot/util/block/LocalBlockQueue.java | 8 +++-- 10 files changed, 75 insertions(+), 63 deletions(-) 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 1f1976889..465fcab20 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 @@ -124,9 +124,9 @@ public class BukkitPlotGenerator extends ChunkGenerator GenChunk result = new GenChunk(); if (this.getPlotGenerator() instanceof SingleWorldGenerator) { if (result.getChunkData() != null) { - for (int cx = 0; cx < 16; cx++) { - for (int cz = 0; cz < 16; cz++) { - biome.setBiome(cx, cz, Biome.PLAINS); + for (int chunkX = 0; chunkX < 16; chunkX++) { + for (int chunkZ = 0; chunkZ < 16; chunkZ++) { + biome.setBiome(chunkX, chunkZ, Biome.PLAINS); } } return result.getChunkData(); 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 62d82cedb..6ed7317b6 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 @@ -88,14 +88,14 @@ public class SendChunk { if (location == null) { location = pp.getLocation(); } - int cx = location.getX() >> 4; - int cz = location.getZ() >> 4; + int chunkX = location.getX() >> 4; + int chunkZ = location.getZ() >> 4; Player player = ((BukkitPlayer) pp).player; Object entity = this.methodGetHandlePlayer.of(player).call(); for (Chunk chunk : list) { - int dx = Math.abs(cx - chunk.getX()); - int dz = Math.abs(cz - chunk.getZ()); + int dx = Math.abs(chunkX - chunk.getX()); + int dz = Math.abs(chunkZ - chunk.getZ()); if ((dx > view) || (dz > view)) { continue; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 6f9277166..8a3406cda 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -8,8 +8,17 @@ import com.github.intellectualsites.plotsquared.plot.config.Configuration.Unknow 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.util.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +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.PlotManager; +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.StringComparison; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import java.util.ArrayList; @@ -60,8 +69,6 @@ import java.util.stream.IntStream; MainUtil.sendMessage(player, Captions.NEED_BLOCK); return true; } - String[] split = material.split(","); - // blocks = Configuration.BLOCKLIST.parseString(material); try { bucket = Configuration.BLOCK_BUCKET.parseString(material); 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 291657454..680a77552 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 @@ -95,8 +95,7 @@ import java.util.Set; return false; } MainUtil.sendMessage(null, "Collecting region data..."); - ArrayList plots = new ArrayList<>(); - plots.addAll(PlotSquared.get().getPlots(world)); + ArrayList plots = new ArrayList<>(PlotSquared.get().getPlots(world)); if (ExpireManager.IMP != null) { plots.removeAll(ExpireManager.IMP.getPendingExpired()); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index a8fb953d9..998edae06 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -25,15 +25,15 @@ public class AugmentedUtils { enabled = true; } - public static boolean generate(@NotNull final String world, final int cx, final int cz, + public static boolean generate(@NotNull final String world, final int chunkX, final int chunkZ, LocalBlockQueue queue) { if (!enabled) { return false; } - final int bx = cx << 4; - final int bz = cz << 4; - RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15); + final int blockX = chunkX << 4; + final int blockZ = chunkZ << 4; + RegionWrapper region = new RegionWrapper(blockX, blockX + 15, blockZ, blockZ + 15); Set areas = PlotSquared.get().getPlotAreas(world, region); if (areas.isEmpty()) { return false; @@ -62,10 +62,10 @@ public class AugmentedUtils { int tzz; // gen if (area.TYPE == 2) { - bxx = Math.max(0, area.getRegion().minX - bx); - bzz = Math.max(0, area.getRegion().minZ - bz); - txx = Math.min(15, area.getRegion().maxX - bx); - tzz = Math.min(15, area.getRegion().maxZ - bz); + bxx = Math.max(0, area.getRegion().minX - blockX); + bzz = Math.max(0, area.getRegion().minZ - blockZ); + txx = Math.min(15, area.getRegion().maxX - blockX); + tzz = Math.min(15, area.getRegion().maxZ - blockZ); primaryMask = new DelegateLocalBlockQueue(queue) { @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { if (area.contains(x, z)) { @@ -94,8 +94,8 @@ public class AugmentedUtils { boolean has = false; for (int x = bxx; x <= txx; x++) { for (int z = bzz; z <= tzz; z++) { - int rx = x + bx; - int rz = z + bz; + int rx = x + blockX; + int rz = z + blockZ; boolean can = manager.getPlotId(area, rx, 0, rz) == null; if (can) { for (int y = 1; y < 128; y++) { @@ -112,7 +112,7 @@ public class AugmentedUtils { toReturn = true; secondaryMask = new DelegateLocalBlockQueue(primaryMask) { @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { - if (canPlace[x - bx][z - bz]) { + if (canPlace[x - blockX][z - blockZ]) { return super.setBlock(x, y, z, id); } return false; @@ -127,15 +127,15 @@ public class AugmentedUtils { for (int x = bxx; x <= txx; x++) { for (int z = bzz; z <= tzz; z++) { for (int y = 1; y < 128; y++) { - queue.setBlock(bx + x, y, bz + z, air); + queue.setBlock(blockX + x, y, blockZ + z, air); } } } toReturn = true; } - ScopedLocalBlockQueue scoped = - new ScopedLocalBlockQueue(secondaryMask, new Location(area.worldname, bx, 0, bz), - new Location(area.worldname, bx + 15, 255, bz + 15)); + ScopedLocalBlockQueue scoped = new ScopedLocalBlockQueue(secondaryMask, + new Location(area.worldname, blockX, 0, blockZ), + new Location(area.worldname, blockX + 15, 255, blockZ + 15)); generator.generateChunk(scoped, area); generator.populateChunk(scoped, area); } 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 bd465a12f..2ae0ca358 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 @@ -249,7 +249,6 @@ public class ClassicPlotManager extends SquarePlotManager { .subtract(plot.getMerged(Direction.WEST) ? 0 : 1, 0, plot.getMerged(Direction.NORTH) ? 0 : 1); Location top = plot.getExtendedTopAbs().add(1, 0, 1); - PseudoRandom random = new PseudoRandom(); LocalBlockQueue queue = plotArea.getQueue(false); int y = dpw.WALL_HEIGHT + 1; if (!plot.getMerged(Direction.NORTH)) { 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 78c7675d2..479bfb923 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 @@ -2410,9 +2410,7 @@ public class Plot { if (this.settings == null) { return Collections.singleton(this); } - boolean[] merged = this.getMerged(); - int hash = MainUtil.hash(merged); - if (hash == 0) { + if (!this.isMerged()) { return Collections.singleton(this); } if (connected_cache != null && connected_cache.contains(this)) { @@ -2425,7 +2423,7 @@ public class Plot { Plot tmp; HashSet queuecache = new HashSet<>(); ArrayDeque frontier = new ArrayDeque<>(); - if (merged[0]) { + if (this.getMerged(Direction.NORTH)) { tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH)); if (!tmp.getMerged(Direction.SOUTH)) { // invalid merge @@ -2441,7 +2439,7 @@ public class Plot { queuecache.add(tmp); frontier.add(tmp); } - if (merged[1]) { + if (this.getMerged(Direction.EAST)) { tmp = this.area.getPlotAbs(this.id.getRelative(Direction.EAST)); if (!tmp.getMerged(Direction.WEST)) { // invalid merge @@ -2457,7 +2455,7 @@ public class Plot { queuecache.add(tmp); frontier.add(tmp); } - if (merged[2]) { + if (this.getMerged(Direction.SOUTH)) { tmp = this.area.getPlotAbs(this.id.getRelative(Direction.SOUTH)); if (!tmp.getMerged(Direction.NORTH)) { // invalid merge @@ -2473,7 +2471,7 @@ public class Plot { queuecache.add(tmp); frontier.add(tmp); } - if (merged[3]) { + if (this.getMerged(Direction.WEST)) { tmp = this.area.getPlotAbs(this.id.getRelative(Direction.WEST)); if (!tmp.getMerged(Direction.EAST)) { // invalid merge @@ -2500,29 +2498,28 @@ public class Plot { } tmpSet.add(current); queuecache.remove(current); - merged = current.getMerged(); - if (merged[0]) { + if (current.getMerged(Direction.NORTH)) { tmp = current.area.getPlotAbs(current.id.getRelative(Direction.NORTH)); if (tmp != null && !queuecache.contains(tmp) && !tmpSet.contains(tmp)) { queuecache.add(tmp); frontier.add(tmp); } } - if (merged[1]) { + if (current.getMerged(Direction.EAST)) { tmp = current.area.getPlotAbs(current.id.getRelative(Direction.EAST)); if (tmp != null && !queuecache.contains(tmp) && !tmpSet.contains(tmp)) { queuecache.add(tmp); frontier.add(tmp); } } - if (merged[2]) { + if (current.getMerged(Direction.SOUTH)) { tmp = current.area.getPlotAbs(current.id.getRelative(Direction.SOUTH)); if (tmp != null && !queuecache.contains(tmp) && !tmpSet.contains(tmp)) { queuecache.add(tmp); frontier.add(tmp); } } - if (merged[3]) { + if (current.getMerged(Direction.WEST)) { tmp = current.area.getPlotAbs(current.id.getRelative(Direction.WEST)); if (tmp != null && !queuecache.contains(tmp) && !tmpSet.contains(tmp)) { queuecache.add(tmp); 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 a7c39cf18..101ec301a 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,13 +1,21 @@ 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.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; +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 java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; public abstract class ChunkManager { @@ -28,11 +36,11 @@ public abstract class ChunkManager { RunnableVal add, String world, ChunkLoc loc) { LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); if (PlotSquared.get().isAugmented(world)) { - int bx = loc.x << 4; - int bz = loc.z << 4; + int blockX = loc.x << 4; + int blockZ = loc.z << 4; ScopedLocalBlockQueue scoped = - new ScopedLocalBlockQueue(queue, new Location(world, bx, 0, bz), - new Location(world, bx + 15, 255, bz + 15)); + new ScopedLocalBlockQueue(queue, new Location(world, blockX, 0, blockZ), + new Location(world, blockX + 15, 255, blockZ + 15)); if (force != null) { force.run(scoped); } else { @@ -212,11 +220,11 @@ public abstract class ChunkManager { File folder = new File(PlotSquared.get().IMP.getWorldContainer(), world + File.separator + "region"); File[] regionFiles = folder.listFiles(); - HashSet chunks = new HashSet<>(); if (regionFiles == null) { throw new RuntimeException( "Could not find worlds folder: " + folder + " ? (no read access?)"); } + HashSet chunks = new HashSet<>(); for (File file : regionFiles) { String name = file.getName(); if (name.endsWith("mca")) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 282c21bc4..6bad71051 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -92,12 +92,12 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return false; } baseBlocks = true; - int cx = x >> 4; - int cz = z >> 4; - if (cx != lastX || cz != lastZ) { - lastX = cx; - lastZ = cz; - long pair = (long) (cx) << 32 | (cz) & 0xFFFFFFFFL; + int chunkX = x >> 4; + int chunkZ = z >> 4; + if (chunkX != lastX || chunkZ != lastZ) { + lastX = chunkX; + lastZ = chunkZ; + long pair = (long) (chunkX) << 32 | (chunkZ) & 0xFFFFFFFFL; lastWrappedChunk = this.blockChunks.get(pair); if (lastWrappedChunk == null) { lastWrappedChunk = this.getLocalChunk(x >> 4, z >> 4); @@ -121,12 +121,12 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { } else if (y < 0) { return false; } - int cx = x >> 4; - int cz = z >> 4; - if (cx != lastX || cz != lastZ) { - lastX = cx; - lastZ = cz; - long pair = (long) (cx) << 32 | (cz) & 0xFFFFFFFFL; + int chunkX = x >> 4; + int chunkZ = z >> 4; + if (chunkX != lastX || chunkZ != lastZ) { + lastX = chunkX; + lastZ = chunkZ; + long pair = (long) (chunkX) << 32 | (chunkZ) & 0xFFFFFFFFL; lastWrappedChunk = this.blockChunks.get(pair); if (lastWrappedChunk == null) { lastWrappedChunk = this.getLocalChunk(x >> 4, z >> 4); 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 16538784f..87c0fec56 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,6 +1,10 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.object.*; +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; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; @@ -106,8 +110,6 @@ public abstract class LocalBlockQueue { for (int y = pos1.getY(); y <= Math.min(255, pos2.getY()); y++) { for (int x = pos1.getX(); x <= pos2.getX(); x++) { for (int z = pos1.getZ(); z <= pos2.getZ(); z++) { - // int i = PseudoRandom.random.random(blocks.length); - // PlotBlock block = blocks[i]; setBlock(x, y, z, blocks.getBlock()); } } From 4e3a927323f0acf360024aed6a59aecfadb7a73e Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 17 May 2019 16:21:03 -0400 Subject: [PATCH 006/258] Modifications to the generator code --- .../plotsquared/bukkit/BukkitMain.java | 6 +- .../generator/DelegatePlotGenerator.java | 4 +- .../bukkit/util/block/BukkitLocalQueue.java | 77 +++---------------- .../plotsquared/plot/IPlotMain.java | 3 +- .../plotsquared/plot/PlotSquared.java | 2 +- .../plotsquared/plot/commands/Add.java | 12 +-- .../plotsquared/plot/commands/Area.java | 2 +- .../plotsquared/plot/commands/Trim.java | 8 +- .../plot/generator/ClassicPlotWorld.java | 4 +- .../plot/generator/GridPlotWorld.java | 3 +- .../plot/generator/HybridPlotWorld.java | 7 +- .../plot/generator/SquarePlotWorld.java | 3 +- .../plotsquared/plot/object/BlockBucket.java | 3 +- .../plotsquared/plot/object/PlotArea.java | 22 +----- .../plot/util/block/BasicLocalBlockQueue.java | 6 +- .../util/block/ScopedLocalBlockQueue.java | 7 +- 16 files changed, 57 insertions(+), 112 deletions(-) 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 e473076ac..e7d67c3ef 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 @@ -53,6 +53,7 @@ import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; import java.io.File; @@ -564,7 +565,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } @Override @Nullable - public final ChunkGenerator getDefaultWorldGenerator(final String worldName, final String id) { + public final ChunkGenerator getDefaultWorldGenerator(@NotNull final String worldName, + final String id) { final IndependentPlotGenerator result; if (id != null && id.equalsIgnoreCase("single")) { result = new SingleWorldGenerator(); @@ -681,7 +683,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain getServer().getPluginManager().registerEvents(new WorldEvents(), this); } - @Override public IndependentPlotGenerator getDefaultGenerator() { + @NotNull @Override public IndependentPlotGenerator getDefaultGenerator() { return new HybridGen(); } 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 8c1d97947..762e809af 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 @@ -18,6 +18,7 @@ import org.bukkit.block.Biome; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Range; import java.util.Random; @@ -73,7 +74,8 @@ import java.util.Random; Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ)); try { ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() { - @Override public void setBiome(int x, int z, Biome biome) { + @Override public void setBiome(@Range(from = 0, to = 15) int x, + @Range(from = 0, to = 15) int z, Biome biome) { result.setBiome(x, z, biome.name()); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 483fb51c0..97dfff961 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -6,7 +6,6 @@ import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQueue; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.BukkitAdapter; @@ -20,15 +19,10 @@ import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; -import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.util.Locale; public class BukkitLocalQueue extends BasicLocalBlockQueue { - private Field fieldNeighbors; - private Method chunkGetHandle; - public BukkitLocalQueue(String world) { super(world); } @@ -55,7 +49,11 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { @Override public void refreshChunk(int x, int z) { World worldObj = Bukkit.getWorld(getWorld()); - worldObj.refreshChunk(x, z); + if (worldObj != null) { + worldObj.refreshChunk(x, z); + } else { + PlotSquared.debug("Error Refreshing Chunk"); + } } @Override public void fixChunkLighting(int x, int z) { @@ -64,7 +62,11 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { @Override public final void regenChunk(int x, int z) { World worldObj = Bukkit.getWorld(getWorld()); - worldObj.regenerateChunk(x, z); + if (worldObj != null) { + worldObj.regenerateChunk(x, z); + } else { + PlotSquared.debug("Error Regenerating Chunk"); + } } @Override public final void setComponents(LocalChunk lc) { @@ -183,14 +185,12 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { World worldObj = Bukkit.getWorld(getWorld()); int bx = lc.getX() << 4; int bz = lc.getX() << 4; - String last = null; - Biome biome = null; for (int x = 0; x < lc.biomes.length; x++) { String[] biomes2 = lc.biomes[x]; if (biomes2 != null) { for (String biomeStr : biomes2) { if (biomeStr != null) { - biome = Biome.valueOf(biomeStr.toUpperCase()); + Biome biome = Biome.valueOf(biomeStr.toUpperCase()); worldObj.setBiome(bx, bz, biome); } } @@ -199,59 +199,4 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { } } - /** - * Exploiting a bug in the vanilla lighting algorithm for faster block placement - * - Could have been achieved without reflection by force unloading specific chunks - * - Much faster just setting the variable manually though - * - * @param chunk - * @return - */ - protected Object[] disableLighting(Chunk chunk) { - try { - if (chunkGetHandle == null) { - chunkGetHandle = chunk.getClass().getDeclaredMethod("getHandle"); - chunkGetHandle.setAccessible(true); - } - Object nmsChunk = chunkGetHandle.invoke(chunk); - if (fieldNeighbors == null) { - fieldNeighbors = nmsChunk.getClass().getDeclaredField("neighbors"); - fieldNeighbors.setAccessible(true); - } - Object value = fieldNeighbors.get(nmsChunk); - fieldNeighbors.set(nmsChunk, 0); - return new Object[] {nmsChunk, value}; - } catch (Throwable ignore) { - } - return null; - } - - protected void disableLighting(Object[] disableResult) { - if (disableResult != null) { - try { - fieldNeighbors.set(disableResult[0], 0); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - } - } - - protected void resetLighting(Object[] disableResult) { - if (disableResult != null) { - try { - fieldNeighbors.set(disableResult[0], disableResult[1]); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - protected void enableLighting(Object[] disableResult) { - if (disableResult != null) { - try { - fieldNeighbors.set(disableResult[0], 0x739C0); - } catch (Throwable ignore) { - } - } - } } 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 6ca241dcd..549da8c05 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 @@ -8,6 +8,7 @@ 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.block.QueueProvider; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.List; @@ -246,7 +247,7 @@ public interface IPlotMain extends ILogger { * * @return Default implementation generator */ - IndependentPlotGenerator getDefaultGenerator(); + @NotNull IndependentPlotGenerator getDefaultGenerator(); /** * Gets the class that will manage player titles. 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 7c94060fd..892a5bbe8 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 @@ -1333,8 +1333,8 @@ import java.util.zip.ZipInputStream; } String key = pair[0].toLowerCase(); String value = pair[1]; - String base = "worlds." + world + "."; try { + String base = "worlds." + world + "."; switch (key) { case "s": case "size": diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java index 5741fb7ba..57c910ea6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java @@ -36,25 +36,25 @@ import java.util.UUID; checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage()); final Set uuids = MainUtil.getUUIDsFromString(args[0]); checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]); - Iterator iter = uuids.iterator(); + Iterator iterator = uuids.iterator(); int size = plot.getTrusted().size() + plot.getMembers().size(); - while (iter.hasNext()) { - UUID uuid = iter.next(); + while (iterator.hasNext()) { + UUID uuid = iterator.next(); if (uuid == DBFunc.EVERYONE && !( Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) { MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid)); - iter.remove(); + iterator.remove(); continue; } if (plot.isOwner(uuid)) { MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); - iter.remove(); + iterator.remove(); continue; } if (plot.getMembers().contains(uuid)) { MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); - iter.remove(); + iterator.remove(); continue; } size += plot.getTrusted().contains(uuid) ? 0 : 1; 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 bfd42f36e..ed6a4a3dc 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 @@ -143,7 +143,6 @@ import java.util.Set; return true; } default: // Start creation - final SetupObject object = new SetupObject(); String[] split = args[1].split(":"); String id; if (split.length == 2) { @@ -151,6 +150,7 @@ import java.util.Set; } else { id = null; } + final SetupObject object = new SetupObject(); object.world = split[0]; final HybridPlotWorld pa = new HybridPlotWorld(object.world, id, PlotSquared.get().IMP.getDefaultGenerator(), null, null); 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 680a77552..3b3504c24 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 @@ -197,11 +197,9 @@ import java.util.Set; } }; } else { - regenTask = new Runnable() { - @Override public void run() { - Trim.TASK = false; - player.sendMessage("Trim done!"); - } + regenTask = () -> { + Trim.TASK = false; + player.sendMessage("Trim done!"); }; } ChunkManager.manager.deleteRegionFiles(world, viable, regenTask); 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 755f694d6..6bf38d22c 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 @@ -8,6 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; 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; @@ -32,7 +33,8 @@ import java.util.Locale; // PlotBlock.get((short) 155, (byte) 0); public boolean PLOT_BEDROCK = true; - public ClassicPlotWorld(String worldName, String id, IndependentPlotGenerator generator, + public ClassicPlotWorld(String worldName, String id, + @NotNull IndependentPlotGenerator generator, PlotId min, PlotId max) { super(worldName, id, generator, min, max); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java index 34dbef203..b0cc10323 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java @@ -2,12 +2,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import org.jetbrains.annotations.NotNull; public abstract class GridPlotWorld extends PlotArea { public short SIZE; - public GridPlotWorld(String worldName, String id, IndependentPlotGenerator generator, + public GridPlotWorld(String worldName, String id, @NotNull IndependentPlotGenerator generator, PlotId min, PlotId max) { super(worldName, id, generator, min, max); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index 880ddee35..e8f1ed06a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -21,6 +21,7 @@ import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.block.BaseBlock; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.HashMap; @@ -37,7 +38,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { public int SCHEM_Y; private Location SIGN_LOCATION; - public HybridPlotWorld(String worldName, String id, IndependentPlotGenerator generator, + public HybridPlotWorld(String worldName, String id, @NotNull IndependentPlotGenerator generator, PlotId min, PlotId max) { super(worldName, id, generator, min, max); } @@ -119,8 +120,8 @@ public class HybridPlotWorld extends ClassicPlotWorld { } try { setupSchematics(); - } catch (Exception ignored) { - ignored.printStackTrace(); + } catch (Exception event) { + event.printStackTrace(); PlotSquared.debug("&c - road schematics are disabled for this world."); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java index 5401d221a..c2d1ddb31 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java @@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import org.jetbrains.annotations.NotNull; public abstract class SquarePlotWorld extends GridPlotWorld { @@ -11,7 +12,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld { public int ROAD_OFFSET_X = 0; public int ROAD_OFFSET_Z = 0; - public SquarePlotWorld(String worldName, String id, IndependentPlotGenerator generator, + public SquarePlotWorld(String worldName, String id, @NotNull IndependentPlotGenerator generator, PlotId min, PlotId max) { super(worldName, id, generator, min, max); } 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 6900500f9..8dde0ee20 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 @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.RequiredArgsConstructor; +import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.Map.Entry; @@ -135,7 +136,7 @@ import java.util.Map.Entry; } } - @Override public Iterator iterator() { + @NotNull @Override public Iterator iterator() { return this.bucketIterator; } 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 253d74b40..785b20e1e 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 @@ -21,6 +21,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -76,11 +77,11 @@ public abstract class PlotArea { private QuadMap clusters; public PlotArea(@Nonnull final String worldName, @Nullable final String id, - @Nullable IndependentPlotGenerator generator, @Nullable final PlotId min, + @NotNull IndependentPlotGenerator generator, @Nullable final PlotId min, @Nullable final PlotId max) { this.worldname = worldName; this.id = id; - this.manager = generator != null ? generator.getNewPlotManager() : null; + this.manager = generator.getNewPlotManager(); this.generator = generator; if (min == null || max == null) { if (min != max) { @@ -94,28 +95,13 @@ public abstract class PlotArea { this.max = max; } this.worldhash = worldName.hashCode(); - if (Settings.Enabled_Components.PLOT_EXPIRY && generator != null) { + if (Settings.Enabled_Components.PLOT_EXPIRY) { blockBucketChunk = generator.generateBlockBucketChunk(this); } else { blockBucketChunk = null; } } - /** - * Create a new PlotArea object with no functionality/information. - * - Mainly used during startup before worlds are created as a temporary object - */ - public static PlotArea createGeneric(@Nonnull final String world) { - return new PlotArea(world, null, null, null, null) { - @Override public void loadConfiguration(ConfigurationSection config) { - } - - @Override public ConfigurationNode[] getSettingNodes() { - return null; - } - }; - } - public LocalBlockQueue getQueue(final boolean autoQueue) { return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 6bad71051..e35e81f6b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -181,16 +181,16 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { } - public abstract class LocalChunk { + public abstract class LocalChunk { public final BasicLocalBlockQueue parent; public final int z; public final int x; - public T[] blocks; + public B[] blocks; public BaseBlock[][] baseblocks; public String[][] biomes; - public LocalChunk(BasicLocalBlockQueue parent, int x, int z) { + public LocalChunk(BasicLocalBlockQueue parent, int x, int z) { this.parent = parent; this.x = x; this.z = z; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java index 352465aea..c9065f65e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java @@ -1,7 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.util.block; 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.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.object.PlotManager; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.sk89q.worldedit.world.block.BaseBlock; public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { From 5dd2610b5e11c91b230095a5d54195c932888d66 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 17 May 2019 18:49:09 -0400 Subject: [PATCH 007/258] Misc. changes and removal of title manager --- .../plotsquared/bukkit/BukkitMain.java | 5 ---- .../plotsquared/bukkit/chat/Reflection.java | 12 ++-------- .../bukkit/listeners/PlayerEvents.java | 4 ++-- .../bukkit/object/BukkitPlayer.java | 9 +++---- .../entity/ReplicatingEntityWrapper.java | 19 ++++++++------- .../bukkit/titles/DefaultTitle.java | 15 ------------ .../plotsquared/plot/IPlotMain.java | 7 ------ .../plotsquared/plot/PlotSquared.java | 2 -- .../plotsquared/plot/commands/DebugExec.java | 14 ++++++++--- .../plotsquared/plot/commands/FlagCmd.java | 18 ++++++++++---- .../plotsquared/plot/commands/ListCmd.java | 3 +-- .../plotsquared/plot/commands/Merge.java | 24 ++++++++++++------- .../plotsquared/plot/commands/Owner.java | 10 +++++--- .../plotsquared/plot/config/Captions.java | 12 +++++----- .../plotsquared/plot/database/SQLManager.java | 6 +---- .../plot/listener/PlotListener.java | 9 +++++-- .../plot/object/ConsolePlayer.java | 4 ++++ .../plotsquared/plot/object/Plot.java | 4 +--- .../plotsquared/plot/object/PlotPlayer.java | 15 +++++++++++- .../plotsquared/plot/object/Rating.java | 3 +-- .../plotsquared/plot/util/AbstractTitle.java | 20 ---------------- .../plotsquared/plot/util/ChunkManager.java | 2 +- .../plotsquared/plot/util/CommentManager.java | 8 +++++-- .../plotsquared/plot/util/ConsoleColors.java | 3 +-- .../plotsquared/plot/util/EntityUtil.java | 4 +--- .../plot/util/LegacyConverter.java | 6 ++--- 26 files changed, 112 insertions(+), 126 deletions(-) delete mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/AbstractTitle.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 e7d67c3ef..68169328d 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,6 @@ 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.titles.DefaultTitle; import com.github.intellectualsites.plotsquared.bukkit.util.*; import com.github.intellectualsites.plotsquared.bukkit.util.block.BukkitLocalQueue; import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper; @@ -766,10 +765,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return new BukkitSchematicHandler(); } - @Override public AbstractTitle initTitleManager() { - return new DefaultTitle(); - } - @Override @Nullable public PlotPlayer wrapPlayer(final Object player) { if (player instanceof Player) { return BukkitUtil.getPlayer((Player) player); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java index a92515221..f3f004284 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java @@ -43,10 +43,6 @@ public final class Reflection { */ public synchronized static String getVersion() { if (_versionString == null) { - if (Bukkit.getServer() == null) { - // The server hasn't started, static initializer call? - return null; - } String name = Bukkit.getServer().getClass().getPackage().getName(); _versionString = name.substring(name.lastIndexOf('.') + 1) + "."; } @@ -180,15 +176,11 @@ public final class Reflection { * @return A method object with the specified name declared by the specified class. */ public synchronized static Method getMethod(Class clazz, String name, Class... args) { - if (!_loadedMethods.containsKey(clazz)) { - _loadedMethods.put(clazz, new HashMap<>()); - } + _loadedMethods.computeIfAbsent(clazz, k -> new HashMap<>()); Map>, Method>> loadedMethodNames = _loadedMethods.get(clazz); - if (!loadedMethodNames.containsKey(name)) { - loadedMethodNames.put(name, new HashMap<>()); - } + loadedMethodNames.computeIfAbsent(name, k -> new HashMap<>()); Map>, Method> loadedSignatures = loadedMethodNames.get(name); ArrayWrapper> wrappedArg = new ArrayWrapper<>(args); 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 7a22be0fb..6c85a2265 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 @@ -999,7 +999,7 @@ import java.util.regex.Pattern; } else if ( (location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT) && !Permissions - .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { event.setCancelled(true); MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.s() .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); @@ -2984,7 +2984,7 @@ import java.util.regex.Pattern; Plot plot = area.getPlot(location); if (plot != null) { if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT) - && !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { + && !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { event.setCancelled(true); MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.s() .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 7b1ce2c54..7a8ad2fc5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -84,6 +84,11 @@ public class BukkitPlayer extends PlotPlayer { return true; } + @Override + public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { + player.sendTitle(title, subtitle, fadeIn, stay, fadeOut); + } + private void callEvent(final Event event) { RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (RegisteredListener listener : listeners) { @@ -219,8 +224,6 @@ public class BukkitPlayer extends PlotPlayer { this.player.setPlayerWeather(WeatherType.DOWNFALL); break; case RESET: - this.player.resetPlayerWeather(); - break; default: this.player.resetPlayerWeather(); break; @@ -254,8 +257,6 @@ public class BukkitPlayer extends PlotPlayer { this.player.setGameMode(GameMode.SPECTATOR); break; case SURVIVAL: - this.player.setGameMode(GameMode.SURVIVAL); - break; default: this.player.setGameMode(GameMode.SURVIVAL); break; 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 c7e0e04f6..769fcc9b3 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 @@ -1,7 +1,12 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import org.bukkit.*; +import org.bukkit.Art; +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Rotation; +import org.bukkit.TreeSpecies; +import org.bukkit.World; import org.bukkit.block.BlockFace; import org.bukkit.entity.*; import org.bukkit.inventory.EntityEquipment; @@ -576,14 +581,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { restoreAgeable((Ageable) entity); restoreLiving((LivingEntity) entity); return entity; - case GUARDIAN: - case ELDER_GUARDIAN: - restoreLiving((LivingEntity) entity); - return entity; - case SKELETON: - case WITHER_SKELETON: - restoreLiving((LivingEntity) entity); - return entity; case ARMOR_STAND: // CHECK positions ArmorStand stand = (ArmorStand) entity; @@ -679,6 +676,10 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { case BLAZE: case SNOWMAN: case SHULKER: + case GUARDIAN: + case ELDER_GUARDIAN: + case SKELETON: + case WITHER_SKELETON: restoreLiving((LivingEntity) entity); return entity; case IRON_GOLEM: diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle.java deleted file mode 100644 index e91f8bcae..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.titles; - -import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; -import org.bukkit.entity.Player; - -public class DefaultTitle extends AbstractTitle { - - @Override - public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) { - final Player playerObj = ((BukkitPlayer) player).player; - playerObj.sendTitle(head, sub, in, delay, out); - } -} 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 549da8c05..e1eb152b5 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 @@ -249,13 +249,6 @@ public interface IPlotMain extends ILogger { */ @NotNull IndependentPlotGenerator getDefaultGenerator(); - /** - * Gets the class that will manage player titles. - * - * @return - */ - AbstractTitle initTitleManager(); - List getPluginIds(); BlockRegistry getBlockRegistry(); 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 892a5bbe8..122822ffa 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 @@ -188,8 +188,6 @@ import java.util.zip.ZipInputStream; ChunkManager.manager = this.IMP.initChunkManager(); // Schematic handler SchematicHandler.manager = this.IMP.initSchematicHandler(); - // Titles - AbstractTitle.TITLE_CLASS = this.IMP.initTitleManager(); // Chat ChatManager.manager = this.IMP.initChatManager(); // Commands 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 4e533fe61..76d060ed3 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 @@ -17,12 +17,21 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; import com.google.common.io.Files; -import javax.script.*; +import javax.script.Bindings; +import javax.script.ScriptContext; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; +import javax.script.SimpleScriptContext; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.sql.Timestamp; -import java.util.*; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; @CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = {"exec", "$"}, @@ -107,7 +116,6 @@ import java.util.*; this.scope.put("WEManager", new WEManager()); } this.scope.put("TaskManager", TaskManager.IMP); - this.scope.put("TitleManager", AbstractTitle.TITLE_CLASS); this.scope.put("ConsolePlayer", ConsolePlayer.getConsole()); this.scope.put("SchematicHandler", SchematicHandler.manager); this.scope.put("ChunkManager", ChunkManager.manager); 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 a732df9a7..470d8d605 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 @@ -5,12 +5,22 @@ 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.flag.*; +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.flag.IntegerFlag; +import com.github.intellectualsites.plotsquared.plot.flag.ListFlag; +import com.github.intellectualsites.plotsquared.plot.flag.PlotBlockListFlag; 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.util.*; +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.PlotWeather; +import com.github.intellectualsites.plotsquared.plot.util.StringComparison; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.*; @@ -284,9 +294,7 @@ import java.util.*; HashMap> flags = new HashMap<>(); for (Flag flag1 : Flags.getFlags()) { String type = flag1.getClass().getSimpleName(); - if (!flags.containsKey(type)) { - flags.put(type, new ArrayList<>()); - } + flags.computeIfAbsent(type, k -> new ArrayList<>()); flags.get(type).add(flag1.getName()); } StringBuilder message = new StringBuilder(); 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 bd4613409..81834c353 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 @@ -209,8 +209,7 @@ public class ListCmd extends SubCommand { int p1s = p1.getSettings().getRatings().size(); int p2s = p2.getRatings().size(); if (!p1.getSettings().getRatings().isEmpty()) { - v1 = p1.getRatings().entrySet().stream() - .mapToDouble(entry -> entry.getValue().getAverageRating()) + v1 = p1.getRatings().values().stream().mapToDouble(Rating::getAverageRating) .map(av -> av * av).sum(); v1 /= p1s; v1 += p1s; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index 970a0d35c..2e68b739c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -3,8 +3,17 @@ package com.github.intellectualsites.plotsquared.plot.commands; 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.util.*; +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.util.CmdConfirm; +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.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.UUID; @@ -59,8 +68,7 @@ public class Merge extends SubCommand { } } final PlotArea plotArea = plot.getArea(); - Expression priceExr = - plotArea.PRICES.containsKey("merge") ? plotArea.PRICES.get("merge") : null; + Expression priceExr = plotArea.PRICES.getOrDefault("merge", null); final int size = plot.getConnectedPlots().size(); final double price = priceExr == null ? 0d : priceExr.evaluate((double) size); if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d @@ -97,9 +105,9 @@ public class Merge extends SubCommand { terrain = "true".equalsIgnoreCase(args[1]); } if (!terrain && !Permissions - .hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) { + .hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_MERGE_KEEPROAD.s()); + Captions.PERMISSION_MERGE_KEEP_ROAD.s()); return true; } if (plot.autoMerge(-1, maxSize, uuid, terrain)) { @@ -134,9 +142,9 @@ public class Merge extends SubCommand { } else { terrain = true; } - if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) { + if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_MERGE_KEEPROAD.s()); + Captions.PERMISSION_MERGE_KEEP_ROAD.s()); return true; } if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 89416512f..8247c0e83 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -5,7 +5,11 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; +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 com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.Set; import java.util.UUID; @@ -34,7 +38,7 @@ import java.util.UUID; if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value .equalsIgnoreCase("-")) { if (!Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) { + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER.s(), true)) { return false; } Set connected = plot.getConnectedPlots(); @@ -54,7 +58,7 @@ import java.util.UUID; Captions.ALREADY_OWNER.send(player, MainUtil.getName(uuid)); return false; } - if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER)) { + if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER)) { if (other == null) { Captions.INVALID_PLAYER_OFFLINE.send(player, value); return false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 0c6f501df..a606b5a3a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -60,8 +60,8 @@ public enum Captions { PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"), PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"), - PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), - PERMISSION_MERGE_KEEPROAD("plots.merge.keeproad", "static.permissions"), + PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), PERMISSION_MERGE_KEEP_ROAD( + "plots.merge.keeproad", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"), PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"), PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"), @@ -71,8 +71,8 @@ public enum Captions { PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"), PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"), PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"), - PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), - PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"), + PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT( + "plots.admin.build.heightlimit", "static.permissions"), PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"), PERMISSION_ADMIN_COMMAND_RATE("plots.admin.command.rate", "static.permissions"), PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"), @@ -141,8 +141,8 @@ public enum Captions { PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"), PERMISSION_LIST_AREA("plots.list.area", "static.permissions"), PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"), - PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), - PERMISSION_ADMIN_COMMAND_SETOWNER("plots.admin.command.setowner", "static.permissions"), + PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), PERMISSION_ADMIN_COMMAND_SET_OWNER( + "plots.admin.command.setowner", "static.permissions"), PERMISSION_COMMENT("plots.comment", "static.permissions"), PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"), PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"), 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 ed0eee71d..4ac78e122 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 @@ -2538,11 +2538,7 @@ import java.util.concurrent.atomic.AtomicInteger; id = resultSet.getInt("id"); String areaid = resultSet.getString("world"); if (!areas.contains(areaid)) { - if (noExist.containsKey(areaid)) { - noExist.put(areaid, noExist.get(areaid) + 1); - } else { - noExist.put(areaid, 1); - } + noExist.merge(areaid, 1, Integer::sum); } owner = resultSet.getString("owner"); user = uuids.get(owner); 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 c56763a76..5f2260922 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 @@ -5,7 +5,12 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; 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.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.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; @@ -171,7 +176,7 @@ public class PlotListener { .replaceFromMap(Captions.TITLE_ENTERED_PLOT.s(), replacements); String sub = StringMan .replaceFromMap(Captions.TITLE_ENTERED_PLOT_SUB.s(), replacements); - AbstractTitle.sendTitle(player, main, sub); + player.sendTitle(main, sub); } }, 20); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 6f386b3cb..9a2fb193b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -38,6 +38,10 @@ public class ConsolePlayer extends PlotPlayer { return true; } + @Override + public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { + } + @Override public Location getLocation() { return this.getMeta("location"); } 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 479bfb923..cd29dfe07 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 @@ -1360,9 +1360,7 @@ public class Plot { public Map getLikes() { final Map map = new HashMap<>(); final Map ratings = this.getRatings(); - ratings.forEach((uuid, rating) -> { - map.put(uuid, rating.getLike()); - }); + ratings.forEach((uuid, rating) -> map.put(uuid, rating.getLike())); return map; } 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 dd2dc28b5..0c7c4a936 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 @@ -16,7 +16,11 @@ import lombok.NonNull; import javax.annotation.Nonnull; import java.nio.ByteBuffer; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -340,6 +344,15 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { return result; } + public void sendTitle(String title, String subtitle) { + sendTitle(title, subtitle, 1, 2, 1); + } + + ; + + public abstract void sendTitle(String title, String subtitle, int fadeIn, int stay, + int fadeOut); + /** * Teleport this player to a location. * diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java index 00fe5bcc2..911b2e6c5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java @@ -5,7 +5,6 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map.Entry; import java.util.stream.IntStream; public class Rating { @@ -55,7 +54,7 @@ public class Rating { if (Settings.Ratings.USE_LIKES) { return getLike() ? 10 : 1; } - double total = this.ratingMap.entrySet().stream().mapToDouble(Entry::getValue).sum(); + double total = this.ratingMap.values().stream().mapToDouble(v -> v).sum(); return total / this.ratingMap.size(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/AbstractTitle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/AbstractTitle.java deleted file mode 100644 index a5f75c96a..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/AbstractTitle.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.util; - -import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; - -public abstract class AbstractTitle { - public static AbstractTitle TITLE_CLASS; - - public static void sendTitle(PlotPlayer player, String head, String sub) { - if (player instanceof ConsolePlayer) { - return; - } - if (TITLE_CLASS != null && !player.getAttribute("disabletitles")) { - TITLE_CLASS.sendTitle(player, head, sub, 1, 2, 1); - } - } - - public abstract void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, - int out); -} 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 101ec301a..a960bc6db 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 @@ -136,7 +136,7 @@ public abstract class ChunkManager { } /** - * The int[] will be in the form: [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] and will represent the bottom and top parts of the chunk + * The int[] will be in the form: [chunkX, chunkZ, pos1x, pos1z, pos2x, pos2z, isEdge] and will represent the bottom and top parts of the chunk * * @param pos1 * @param pos2 diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java index 416f0aa46..bd5356be1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java @@ -5,7 +5,11 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; 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.comment.*; +import com.github.intellectualsites.plotsquared.plot.object.comment.CommentInbox; +import com.github.intellectualsites.plotsquared.plot.object.comment.InboxOwner; +import com.github.intellectualsites.plotsquared.plot.object.comment.InboxPublic; +import com.github.intellectualsites.plotsquared.plot.object.comment.InboxReport; +import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import java.util.Collection; import java.util.HashMap; @@ -40,7 +44,7 @@ public class CommentManager { total = count.get(); } if ((size.decrementAndGet() == 0) && (total > 0)) { - AbstractTitle.sendTitle(player, "", + player.sendTitle("", Captions.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total)); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java index 5e9c87a7a..f8860887f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java @@ -34,8 +34,6 @@ public class ConsoleColors { public static ConsoleColor chatColor(final String color) { switch (color) { - case "&r": - return ConsoleColor.RESET; case "&7": case "&8": return ConsoleColor.WHITE; @@ -65,6 +63,7 @@ public class ConsoleColors { return ConsoleColor.ITALIC; case "&l": return ConsoleColor.BOLD; + case "&r": default: return ConsoleColor.RESET; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java index fa543b21a..51e093d46 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java @@ -15,9 +15,6 @@ import lombok.experimental.UtilityClass; private static int capNumeral(@NonNull final String flagName) { int i; switch (flagName) { - case "entity-cap": - i = 0; - break; case "mob-cap": i = 3; break; @@ -33,6 +30,7 @@ import lombok.experimental.UtilityClass; case "misc-cap": i = 5; break; + case "entity-cap": default: i = 0; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java index 55d86ce5a..dfbc0b3eb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java @@ -51,9 +51,7 @@ import java.util.Map; private BlockBucket blockListToBucket(@NonNull final PlotBlock[] blocks) { final Map counts = new HashMap<>(); for (final PlotBlock block : blocks) { - if (!counts.containsKey(block)) { - counts.put(block, 0); - } + counts.putIfAbsent(block, 0); counts.put(block, counts.get(block) + 1); } boolean includeRatios = false; @@ -66,7 +64,7 @@ import java.util.Map; final BlockBucket bucket = new BlockBucket(); if (includeRatios) { for (final Map.Entry count : counts.entrySet()) { - bucket.addBlock(count.getKey(), (int) (count.getValue())); + bucket.addBlock(count.getKey(), count.getValue()); } } else { counts.keySet().forEach(bucket::addBlock); From 8ff833de36b0ffb223ce2d33cd21ba8355d47e1b Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 17 May 2019 18:50:24 -0400 Subject: [PATCH 008/258] Added Paper to Platform --- .../com/github/intellectualsites/plotsquared/plot/Platform.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java index 9dfbf2ffb..1736edf6f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.plot; public enum Platform { - Bukkit, Sponge, Spigot + Bukkit, Sponge, Spigot, Paper } From fe471c35716b0bd9adad66c942688bbd31cdbce1 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 21 May 2019 18:32:26 -0400 Subject: [PATCH 009/258] new library in gradle and another change I can't remember. --- Core/build.gradle | 2 +- .../plot/util/SchematicHandler.java | 19 +++++++++---------- build.gradle | 1 + 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Core/build.gradle b/Core/build.gradle index 82f6abd3a..3949c948e 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -11,7 +11,7 @@ dependencies { testCompileOnly("org.projectlombok:lombok:1.18.6") annotationProcessor("org.projectlombok:lombok:1.18.6") testAnnotationProcessor("org.projectlombok:lombok:1.18.6") - + implementation 'net.kyori:text-adapter-bukkit:3.0.2' implementation 'com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT' implementation 'com.squareup.okhttp3:okhttp:3.14.0' implementation 'com.squareup.okio:okio:2.2.2' 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 d6df9d003..6ce59fe6c 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 @@ -28,6 +28,7 @@ import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader; import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; +import org.jetbrains.annotations.NotNull; import java.io.*; import java.net.URL; @@ -64,15 +65,16 @@ public abstract class SchematicHandler { Iterator i = plots.iterator(); final Plot plot = i.next(); i.remove(); - String o = UUIDHandler.getName(plot.guessOwner()); - if (o == null) { - o = "unknown"; + String owner = UUIDHandler.getName(plot.guessOwner()); + if (owner == null) { + owner = "unknown"; } final String name; if (namingScheme == null) { - name = plot.getId().x + ";" + plot.getId().y + ',' + plot.getArea() + ',' + o; + name = + plot.getId().x + ";" + plot.getId().y + ',' + plot.getArea() + ',' + owner; } else { - name = namingScheme.replaceAll("%owner%", o) + name = namingScheme.replaceAll("%owner%", owner) .replaceAll("%id%", plot.getId().toString()) .replaceAll("%idx%", plot.getId().x + "") .replaceAll("%idy%", plot.getId().y + "") @@ -323,7 +325,7 @@ public abstract class SchematicHandler { return null; } - public Schematic getSchematic(URL url) { + public Schematic getSchematic(@NotNull URL url) { try { ReadableByteChannel rbc = Channels.newChannel(url.openStream()); InputStream is = Channels.newInputStream(rbc); @@ -334,10 +336,7 @@ public abstract class SchematicHandler { return null; } - public Schematic getSchematic(InputStream is) { - if (is == null) { - return null; - } + public Schematic getSchematic(@NotNull InputStream is) { try { SpongeSchematicReader ssr = new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is))); diff --git a/build.gradle b/build.gradle index dddfa3ffd..c96224e82 100644 --- a/build.gradle +++ b/build.gradle @@ -67,6 +67,7 @@ subprojects { exclude(module: 'mockito-core') exclude(module: 'dummypermscompat') } + implementation 'net.kyori:text-api:3.0.0' //Minecraft uses Guava 21 as of 1.13. compile 'com.google.guava:guava:21.0' compileOnly 'org.jetbrains:annotations:17.0.0' From 1bd7c8ca5fa1133c0be162b55b7e7caece9fd3b9 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 21 May 2019 18:50:52 -0400 Subject: [PATCH 010/258] Variable renames --- .../plot/generator/HybridPlotManager.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 44e1d1705..93713ec9c 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 @@ -67,13 +67,13 @@ public class HybridPlotManager extends ClassicPlotManager { return true; } LocalBlockQueue queue = hpw.getQueue(false); - createSchemAbs(hpw, queue, pos1, pos2, true); + createSchemAbs(hpw, queue, pos1, pos2); queue.enqueue(); return true; } private void createSchemAbs(HybridPlotWorld hpw, LocalBlockQueue queue, Location pos1, - Location pos2, boolean clear) { + Location pos2) { int size = hpw.SIZE; int minY; if (Settings.Schematics.PASTE_ON_TOP) { @@ -119,7 +119,7 @@ public class HybridPlotManager extends ClassicPlotManager { return true; } LocalBlockQueue queue = hpw.getQueue(false); - createSchemAbs(hpw, queue, pos1, pos2, true); + createSchemAbs(hpw, queue, pos1, pos2); queue.enqueue(); return true; } @@ -134,9 +134,9 @@ public class HybridPlotManager extends ClassicPlotManager { pos1.setY(0); pos2.setY(Math.min(getWorldHeight(), 255)); LocalBlockQueue queue = hpw.getQueue(false); - createSchemAbs(hpw, queue, pos1, pos2, true); + createSchemAbs(hpw, queue, pos1, pos2); if (hpw.ROAD_SCHEMATIC_ENABLED) { - createSchemAbs(hpw, queue, pos1, pos2, true); + createSchemAbs(hpw, queue, pos1, pos2); } queue.enqueue(); return true; @@ -205,12 +205,12 @@ public class HybridPlotManager extends ClassicPlotManager { return true; } - public void pastePlotSchematic(HybridPlotWorld plotWorld, LocalBlockQueue queue, Location l1, - Location l2) { + public void pastePlotSchematic(HybridPlotWorld plotWorld, LocalBlockQueue queue, + Location bottom, Location top) { if (!plotWorld.PLOT_SCHEMATIC) { return; } - createSchemAbs(plotWorld, queue, l1, l2, false); + createSchemAbs(plotWorld, queue, bottom, top); } /** From fb478de164eac4521bbf5eba6e6c82c62bd31055 Mon Sep 17 00:00:00 2001 From: zombachu Date: Wed, 22 May 2019 06:09:31 -1000 Subject: [PATCH 011/258] Update outdated list of files to check on failed world load (#2365) --- .../github/intellectualsites/plotsquared/plot/PlotSquared.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7c94060fd..34c80de24 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 @@ -255,7 +255,7 @@ import java.util.zip.ZipInputStream; "&c`" + world + "` was not properly loaded - " + IMP.getPluginName() + " will now try to load it properly: "); debug( - "&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml"); + "&8 - &7Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); debug( "&8 - &7Your world management plugin may be faulty (or non existent)"); PlotSquared.this.IMP.setGenerator(world); From 95cb0d84f08e5782300a692314a971ca76d39006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Wed, 29 May 2019 13:01:29 +0200 Subject: [PATCH 012/258] Fix issue with road generation during unlink Roads should always be created with respect to `current`. --- .../intellectualsites/plotsquared/plot/object/Plot.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 e2f83172e..1b5d6186c 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 @@ -949,13 +949,13 @@ public class Plot { for (Plot current : plots) { if (current.getMerged(Direction.EAST)) { manager.createRoadEast(current.area, current); - if (getMerged(Direction.SOUTH)) { + if (current.getMerged(Direction.SOUTH)) { manager.createRoadSouth(current.area, current); - if (getMerged(Direction.SOUTHEAST)) { + if (current.getMerged(Direction.SOUTHEAST)) { manager.createRoadSouthEast(current.area, current); } } - } else if (getMerged(Direction.SOUTH)) { + } else if (current.getMerged(Direction.SOUTH)) { manager.createRoadSouth(current.area, current); } } From 41299e685156311d74661fb9aefa90325dcd47c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Wed, 29 May 2019 14:49:27 +0200 Subject: [PATCH 013/258] Fix issue with plot border during merge * `getExtendedTopAbs()` used wrong relative plot for calculating X position. * Not running `finishPlotMerge()` after every merge led to broken roads during a `merge all` --- .../plotsquared/plot/object/Plot.java | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) 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 1b5d6186c..5f1b02e6f 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 @@ -1669,7 +1669,7 @@ public class Plot { top.setZ(this.getRelative(Direction.SOUTH).getBottomAbs().getZ() - 1); } if (this.getMerged(Direction.EAST)) { - top.setX(this.getRelative(Direction.SOUTH).getBottomAbs().getX() - 1); + top.setX(this.getRelative(Direction.EAST).getBottomAbs().getX() - 1); } return top; } @@ -2243,6 +2243,13 @@ public class Plot { merged.add(current.getId()); merged.add(other.getId()); toReturn = true; + + if (removeRoads) { + ArrayList ids = new ArrayList<>(); + ids.add(current.getId()); + ids.add(other.getId()); + this.getManager().finishPlotMerge(this.area, ids); + } } } if (max >= 0 && (dir == -1 || dir == 1) && !current.getMerged(Direction.EAST)) { @@ -2255,6 +2262,13 @@ public class Plot { merged.add(current.getId()); merged.add(other.getId()); toReturn = true; + + if (removeRoads) { + ArrayList ids = new ArrayList<>(); + ids.add(current.getId()); + ids.add(other.getId()); + this.getManager().finishPlotMerge(this.area, ids); + } } } if (max >= 0 && (dir == -1 || dir == 2) && !getMerged(Direction.SOUTH)) { @@ -2267,6 +2281,13 @@ public class Plot { merged.add(current.getId()); merged.add(other.getId()); toReturn = true; + + if (removeRoads) { + ArrayList ids = new ArrayList<>(); + ids.add(current.getId()); + ids.add(other.getId()); + this.getManager().finishPlotMerge(this.area, ids); + } } } if (max >= 0 && (dir == -1 || dir == 3) && !getMerged(Direction.WEST)) { @@ -2279,13 +2300,16 @@ public class Plot { merged.add(current.getId()); merged.add(other.getId()); toReturn = true; + + if (removeRoads) { + ArrayList ids = new ArrayList<>(); + ids.add(current.getId()); + ids.add(other.getId()); + this.getManager().finishPlotMerge(this.area, ids); + } } } } - if (removeRoads && toReturn) { - ArrayList ids = new ArrayList<>(merged); - this.getManager().finishPlotMerge(this.area, ids); - } return toReturn; } From 475e9b50e1ad1429fc1108b832edf93f3463ae9e Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 31 May 2019 12:00:44 -0400 Subject: [PATCH 014/258] Fixes #2380 --- .../intellectualsites/plotsquared/plot/object/PlotPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0c7c4a936..23cf49e98 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 @@ -345,7 +345,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { } public void sendTitle(String title, String subtitle) { - sendTitle(title, subtitle, 1, 2, 1); + sendTitle(title, subtitle, 10, 50, 10); } ; From 427523644c6ba16df27af05b946293b2c135746b Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 31 May 2019 12:04:38 -0400 Subject: [PATCH 015/258] Removed unused imports --- .../plotsquared/bukkit/util/BukkitSetupUtils.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java index 6237f0ba3..958def626 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -9,10 +9,12 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.SetupObject; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.World; import org.bukkit.World.Environment; +import org.bukkit.WorldCreator; +import org.bukkit.WorldType; import org.bukkit.entity.Player; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; From 941821e453d7a506660a73c25058fcca0b2e5c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Thu, 30 May 2019 13:21:26 +0200 Subject: [PATCH 016/258] Convert all PlotBlocks to BaseBlocks in the BasicLocalBlockQueue The `BukkitLocalQueue` only supports using one of the sets (the removed `baseBlocks` variable in `BasicLocalBlockQueue` was the deciding factor for which one won out) which led to issues with missing blocks when trying to use both types at the same time, such as in the `HybridPlotManager`s `clearPlot` method, where `PlotBlock` is used to fill in the various layers, while the`createSchemAbs` method uses `BaseBlock` for its data. --- .../bukkit/util/block/BukkitLocalQueue.java | 30 +------- .../plot/util/block/BasicLocalBlockQueue.java | 77 +++++-------------- 2 files changed, 22 insertions(+), 85 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 97dfff961..f207ddbf5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -70,11 +70,7 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { } @Override public final void setComponents(LocalChunk lc) { - if (isBaseBlocks()) { - setBaseBlocks(lc); - } else { - setBlocks(lc); - } + setBaseBlocks(lc); } public World getBukkitWorld() { @@ -85,30 +81,6 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { return getBukkitWorld().getChunkAt(x, z); } - public void setBlocks(LocalChunk lc) { - World worldObj = Bukkit.getWorld(getWorld()); - Chunk chunk = worldObj.getChunkAt(lc.getX(), lc.getZ()); - chunk.load(true); - for (int layer = 0; layer < lc.blocks.length; layer++) { - PlotBlock[] blocksLayer = (PlotBlock[]) lc.blocks[layer]; - if (blocksLayer != null) { - for (int j = 0; j < blocksLayer.length; j++) { - if (blocksLayer[j] != null) { - PlotBlock block = blocksLayer[j]; - int x = MainUtil.x_loc[layer][j]; - int y = MainUtil.y_loc[layer][j]; - int z = MainUtil.z_loc[layer][j]; - Block existing = chunk.getBlock(x, y, z); - if (equals(block, existing)) { - continue; - } - setMaterial(block, existing); - } - } - } - } - } - public void setBaseBlocks(LocalChunk lc) { World worldObj = Bukkit.getWorld(getWorld()); Chunk chunk = worldObj.getChunkAt(lc.getX(), lc.getZ()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index e35e81f6b..fa137d463 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -1,11 +1,15 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; +import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; 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 java.util.concurrent.ConcurrentHashMap; @@ -20,7 +24,6 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { private LocalChunk lastWrappedChunk; private int lastX = Integer.MIN_VALUE; private int lastZ = Integer.MIN_VALUE; - @Getter private boolean baseBlocks = false; public BasicLocalBlockQueue(String world) { super(world); @@ -91,13 +94,12 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { if ((y > 255) || (y < 0)) { return false; } - baseBlocks = true; - int chunkX = x >> 4; - int chunkZ = z >> 4; - if (chunkX != lastX || chunkZ != lastZ) { - lastX = chunkX; - lastZ = chunkZ; - long pair = (long) (chunkX) << 32 | (chunkZ) & 0xFFFFFFFFL; + int cx = x >> 4; + int cz = z >> 4; + if (cx != lastX || cz != lastZ) { + lastX = cx; + lastZ = cz; + long pair = (long) (cx) << 32 | (cz) & 0xFFFFFFFFL; lastWrappedChunk = this.blockChunks.get(pair); if (lastWrappedChunk == null) { lastWrappedChunk = this.getLocalChunk(x >> 4, z >> 4); @@ -116,32 +118,18 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { } @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { - if (y > 255) { - return false; - } else if (y < 0) { - return false; + // Trying to mix PlotBlock and BaseBlock leads to all kinds of issues. + // Since BaseBlock has more features than PlotBlock, simply convert + // all PlotBlocks to BaseBlocks + if (id instanceof StringPlotBlock) { + StringPlotBlock stringPlotBlock = (StringPlotBlock) id; + return setBlock(x, y, z, BlockTypes.get(stringPlotBlock.getItemId()).getDefaultState().toBaseBlock()); + } else if (id instanceof LegacyPlotBlock) { + LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) id; + return setBlock(x, y, z, LegacyMapper.getInstance().getBlockFromLegacy(legacyPlotBlock.getId(), legacyPlotBlock.getData()).toBaseBlock()); + } else { + throw new RuntimeException("Unknown PlotBock class: " + id.getClass().getName()); } - int chunkX = x >> 4; - int chunkZ = z >> 4; - if (chunkX != lastX || chunkZ != lastZ) { - lastX = chunkX; - lastZ = chunkZ; - long pair = (long) (chunkX) << 32 | (chunkZ) & 0xFFFFFFFFL; - lastWrappedChunk = this.blockChunks.get(pair); - if (lastWrappedChunk == null) { - lastWrappedChunk = this.getLocalChunk(x >> 4, z >> 4); - lastWrappedChunk.setBlock(x & 15, y, z & 15, id); - LocalChunk previous = this.blockChunks.put(pair, lastWrappedChunk); - if (previous == null) { - chunks.add(lastWrappedChunk); - return true; - } - this.blockChunks.put(pair, previous); - lastWrappedChunk = previous; - } - } - lastWrappedChunk.setBlock(x & 15, y, z & 15, id); - return true; } @Override public final boolean setBiome(int x, int z, String biome) { @@ -186,7 +174,6 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { public final int z; public final int x; - public B[] blocks; public BaseBlock[][] baseblocks; public String[][] biomes; @@ -213,8 +200,6 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return z; } - public abstract void setBlock(final int x, final int y, final int z, final PlotBlock block); - public abstract void setBlock(final int x, final int y, final int z, final BaseBlock block); public void setBiome(int x, int z, String biome) { @@ -241,24 +226,9 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { public class BasicLocalChunk extends LocalChunk { public BasicLocalChunk(BasicLocalBlockQueue parent, int x, int z) { super(parent, x, z); - blocks = new PlotBlock[16][]; baseblocks = new BaseBlock[16][]; } - @Override public void setBlock(int x, int y, int z, PlotBlock block) { - this.setInternal(x, y, z, block); - } - - private void setInternal(final int x, final int y, final int z, final PlotBlock plotBlock) { - final int i = MainUtil.CACHE_I[y][x][z]; - final int j = MainUtil.CACHE_J[y][x][z]; - PlotBlock[] array = blocks[i]; - if (array == null) { - array = (blocks[i] = new PlotBlock[4096]); - } - array[j] = plotBlock; - } - @Override public void setBlock(int x, int y, int z, BaseBlock block) { this.setInternal(x, y, z, block); } @@ -272,10 +242,5 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { } array[j] = baseBlock; } - - public void setBlock(final int x, final int y, final int z, final int id, final int data) { - final PlotBlock block = PlotBlock.get(id, data); - this.setInternal(x, y, z, block); - } } } From b366b0d261c6508858f3d5c5b0543d673767ebca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Thu, 30 May 2019 13:22:21 +0200 Subject: [PATCH 017/258] Set unspecified blocks from the schematic to air If this isn't done, any blocks not specified in the schematic will remain after a clear, which is obviously undesirable. --- .../plotsquared/plot/generator/HybridPlotManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 93713ec9c..0155f9cec 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 @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.Sets; import com.sk89q.worldedit.world.block.BaseBlock; - +import com.sk89q.worldedit.world.block.BlockTypes; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -96,6 +96,9 @@ public class HybridPlotManager extends ClassicPlotManager { for (int y = 0; y < blocks.length; y++) { if (blocks[y] != null) { queue.setBlock(x, minY + y, z, blocks[y]); + } else { + // This is necessary, otherwise any blocks not specified in the schematic will remain after a clear + queue.setBlock(x, minY + y, z, BlockTypes.AIR.getDefaultState().toBaseBlock()); } } } From 19f8704cb49f0e9dde51f253f5c6a29a57cc089c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Thu, 30 May 2019 13:28:19 +0200 Subject: [PATCH 018/258] Remove leftovers from getting rid of PlotBlocks in LocalChunk --- .../bukkit/util/block/BukkitLocalQueue.java | 12 ++++++------ .../plot/util/block/BasicLocalBlockQueue.java | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index f207ddbf5..5d8f53355 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -21,14 +21,14 @@ import org.bukkit.block.data.BlockData; import java.util.Locale; -public class BukkitLocalQueue extends BasicLocalBlockQueue { +public class BukkitLocalQueue extends BasicLocalBlockQueue { public BukkitLocalQueue(String world) { super(world); } - @Override public LocalChunk getLocalChunk(int x, int z) { - return (LocalChunk) new BasicLocalChunk(this, x, z) { + @Override public LocalChunk getLocalChunk(int x, int z) { + return new BasicLocalChunk(this, x, z) { // Custom stuff? }; } @@ -69,7 +69,7 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { } } - @Override public final void setComponents(LocalChunk lc) { + @Override public final void setComponents(LocalChunk lc) { setBaseBlocks(lc); } @@ -81,7 +81,7 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { return getBukkitWorld().getChunkAt(x, z); } - public void setBaseBlocks(LocalChunk lc) { + public void setBaseBlocks(LocalChunk lc) { World worldObj = Bukkit.getWorld(getWorld()); Chunk chunk = worldObj.getChunkAt(lc.getX(), lc.getZ()); chunk.load(true); @@ -152,7 +152,7 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { legacyPlotBlock.id == 0 || legacyPlotBlock.data == block.getData()); } - public void setBiomes(LocalChunk lc) { + public void setBiomes(LocalChunk lc) { if (lc.biomes != null) { World worldObj = Bukkit.getWorld(getWorld()); int bx = lc.getX() << 4; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index fa137d463..551a9c44b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -15,7 +15,7 @@ import lombok.Getter; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; -public abstract class BasicLocalBlockQueue extends LocalBlockQueue { +public abstract class BasicLocalBlockQueue extends LocalBlockQueue { private final String world; private final ConcurrentHashMap blockChunks = new ConcurrentHashMap<>(); @@ -35,7 +35,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { @Override public abstract PlotBlock getBlock(int x, int y, int z); - public abstract void setComponents(LocalChunk lc); + public abstract void setComponents(LocalChunk lc); @Override public final String getWorld() { return world; @@ -62,7 +62,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return false; } - public final boolean execute(final LocalChunk lc) { + public final boolean execute(final LocalChunk lc) { if (lc == null) { return false; } @@ -149,7 +149,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return true; } - public final void setChunk(LocalChunk chunk) { + public final void setChunk(LocalChunk chunk) { LocalChunk previous = this.blockChunks.put(chunk.longHash(), chunk); if (previous != null) { chunks.remove(previous); @@ -169,7 +169,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { } - public abstract class LocalChunk { + public abstract class LocalChunk { public final BasicLocalBlockQueue parent; public final int z; public final int x; @@ -177,7 +177,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { public BaseBlock[][] baseblocks; public String[][] biomes; - public LocalChunk(BasicLocalBlockQueue parent, int x, int z) { + public LocalChunk(BasicLocalBlockQueue parent, int x, int z) { this.parent = parent; this.x = x; this.z = z; @@ -223,7 +223,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { } - public class BasicLocalChunk extends LocalChunk { + public class BasicLocalChunk extends LocalChunk { public BasicLocalChunk(BasicLocalBlockQueue parent, int x, int z) { super(parent, x, z); baseblocks = new BaseBlock[16][]; From bbff898073334a2cd7db4ea51953106ca0d1becd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Fri, 31 May 2019 06:06:09 +0200 Subject: [PATCH 019/258] Extract air block into variable to reduce unnecessary function calls --- .../plotsquared/plot/generator/HybridPlotManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 0155f9cec..9f77e56f7 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 @@ -81,6 +81,7 @@ public class HybridPlotManager extends ClassicPlotManager { } else { minY = 1; } + BaseBlock airBlock = BlockTypes.AIR.getDefaultState().toBaseBlock(); for (int x = pos1.getX(); x <= pos2.getX(); x++) { short absX = (short) ((x - hpw.ROAD_OFFSET_X) % size); if (absX < 0) { @@ -98,7 +99,7 @@ public class HybridPlotManager extends ClassicPlotManager { queue.setBlock(x, minY + y, z, blocks[y]); } else { // This is necessary, otherwise any blocks not specified in the schematic will remain after a clear - queue.setBlock(x, minY + y, z, BlockTypes.AIR.getDefaultState().toBaseBlock()); + queue.setBlock(x, minY + y, z, airBlock); } } } From 908a5784a18eda1f5325a5867c328b4b0abf7914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Fri, 31 May 2019 20:16:39 +0200 Subject: [PATCH 020/258] Cache conversions to BaseBlock and fix leaky abstraction --- .../plotsquared/plot/object/LegacyPlotBlock.java | 12 ++++++++++++ .../plotsquared/plot/object/PlotBlock.java | 2 ++ .../plotsquared/plot/object/StringPlotBlock.java | 10 +++++++++- .../plot/util/block/BasicLocalBlockQueue.java | 10 +--------- 4 files changed, 24 insertions(+), 10 deletions(-) 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 be551b372..38407a52f 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,6 +1,10 @@ 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; public class LegacyPlotBlock extends PlotBlock { @@ -15,6 +19,7 @@ public class LegacyPlotBlock extends PlotBlock { } } + @Setter private BaseBlock baseBlock = null; @Getter public final short id; @Getter public final byte data; @@ -27,6 +32,13 @@ public class LegacyPlotBlock extends PlotBlock { return this.id; } + @Override public BaseBlock getBaseBlock() { + if (baseBlock == null) { + baseBlock = LegacyMapper.getInstance().getBlockFromLegacy(id, data).toBaseBlock(); + } + return baseBlock; + } + @Override public boolean isAir() { return this.id == 0; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java index 79521908e..5b9de5852 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java @@ -133,4 +133,6 @@ public abstract class PlotBlock implements ConfigurationSerializable { public abstract Object getRawId(); + public abstract BaseBlock getBaseBlock(); + } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java index 706d1ae06..d4119ae92 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java @@ -1,6 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockTypes; import lombok.Getter; import lombok.NonNull; import lombok.Setter; @@ -15,7 +16,7 @@ public class StringPlotBlock extends PlotBlock { private static final Map STRING_PLOT_BLOCK_CACHE = new HashMap<>(); @Getter private final String nameSpace; @Getter private final String itemId; - @Getter @Setter private BaseBlock baseBlock = null; + @Setter private BaseBlock baseBlock = null; private boolean isForeign = false; public StringPlotBlock(@NonNull final String nameSpace, @NonNull final String itemId) { @@ -79,6 +80,13 @@ public class StringPlotBlock extends PlotBlock { return this.getItemId(); } + @Override public BaseBlock getBaseBlock() { + if (baseBlock == null) { + baseBlock = BlockTypes.get(itemId).getDefaultState().toBaseBlock(); + } + return baseBlock; + } + @Override public boolean equals(Object obj) { if (this == obj) { return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 551a9c44b..4ca62eb58 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -121,15 +121,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { // Trying to mix PlotBlock and BaseBlock leads to all kinds of issues. // Since BaseBlock has more features than PlotBlock, simply convert // all PlotBlocks to BaseBlocks - if (id instanceof StringPlotBlock) { - StringPlotBlock stringPlotBlock = (StringPlotBlock) id; - return setBlock(x, y, z, BlockTypes.get(stringPlotBlock.getItemId()).getDefaultState().toBaseBlock()); - } else if (id instanceof LegacyPlotBlock) { - LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) id; - return setBlock(x, y, z, LegacyMapper.getInstance().getBlockFromLegacy(legacyPlotBlock.getId(), legacyPlotBlock.getData()).toBaseBlock()); - } else { - throw new RuntimeException("Unknown PlotBock class: " + id.getClass().getName()); - } + return setBlock(x, y, z, id.getBaseBlock()); } @Override public final boolean setBiome(int x, int z, String biome) { From 6b3960fc3f0f98391d37b0bc0cc7a384d56a676c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Fri, 31 May 2019 13:16:05 +0200 Subject: [PATCH 021/258] Pass the PlotArea into the PlotManager --- .../bukkit/generator/DelegatePlotGenerator.java | 4 ++-- .../plotsquared/plot/PlotSquared.java | 2 +- .../plot/generator/ClassicPlotManager.java | 13 ++++++++++++- .../plotsquared/plot/generator/GridPlotManager.java | 5 ++++- .../plotsquared/plot/generator/HybridGen.java | 4 ++-- .../plot/generator/HybridPlotManager.java | 11 +++++++++++ .../plot/generator/IndependentPlotGenerator.java | 3 ++- .../plot/generator/SquarePlotManager.java | 11 +++++++++++ .../plotsquared/plot/object/PlotArea.java | 2 +- .../plotsquared/plot/object/PlotManager.java | 7 +++++++ .../plot/object/worlds/SinglePlotManager.java | 4 ++++ .../plot/object/worlds/SingleWorldGenerator.java | 4 ++-- 12 files changed, 59 insertions(+), 11 deletions(-) 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 762e809af..f07c65cbf 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 @@ -30,8 +30,8 @@ import java.util.Random; @Override public void initialize(PlotArea area) { } - @Override public PlotManager getNewPlotManager() { - return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotManager(); + @Override public PlotManager getNewPlotManager(PlotArea plotArea) { + return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotManager(plotArea); } @Override public String getName() { 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 a5d63d49b..e3164427c 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 @@ -1086,7 +1086,7 @@ import java.util.zip.ZipInputStream; } // Conventional plot generator PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null); - PlotManager plotManager = plotGenerator.getNewPlotManager(); + PlotManager plotManager = plotGenerator.getNewPlotManager(plotArea); PlotSquared.log(Captions.PREFIX + "&aDetected world load for '" + world + "'"); PlotSquared .log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator); 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 2ae0ca358..86836447b 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 @@ -13,8 +13,19 @@ import java.util.List; */ public class ClassicPlotManager extends SquarePlotManager { + private final ClassicPlotWorld classicPlotWorld; + + public ClassicPlotManager(PlotArea plotArea) { + super(plotArea); + if (plotArea instanceof ClassicPlotWorld){ + classicPlotWorld = (ClassicPlotWorld)plotArea; + } else { + throw new RuntimeException("ClassicPlotManager requires plotArea to be an instance of ClassicPlotWorld"); + } + } + @Override public boolean setComponent(PlotArea plotArea, PlotId plotId, String component, - BlockBucket blocks) { + BlockBucket blocks) { switch (component) { case "floor": setFloor(plotArea, plotId, blocks); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java index 4ea841c3c..a0ed41226 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java @@ -1,10 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; /** * A plot manager where plots tessellate in a grid formation symmetrical about x=z. */ public abstract class GridPlotManager extends PlotManager { - + public GridPlotManager(PlotArea plotArea) { + super(plotArea); + } } 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 66a32db4c..8d34f5d25 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 @@ -253,8 +253,8 @@ public class HybridGen extends IndependentPlotGenerator { return new HybridPlotWorld(world, id, this, min, max); } - @Override public PlotManager getNewPlotManager() { - return new HybridPlotManager(); + @Override public PlotManager getNewPlotManager(PlotArea plotArea) { + return new HybridPlotManager(plotArea); } @Override public void initialize(PlotArea area) { 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 9f77e56f7..f3b6f6fe3 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 @@ -21,6 +21,17 @@ public class HybridPlotManager extends ClassicPlotManager { public static boolean REGENERATIVE_CLEAR = true; + private final HybridPlotWorld hybridPlotWorld; + + public HybridPlotManager(PlotArea plotArea) { + super(plotArea); + if (plotArea instanceof HybridPlotWorld){ + hybridPlotWorld = (HybridPlotWorld)plotArea; + } else { + throw new RuntimeException("HybridPlotManager requires plotArea to be an instance of HybridPlotWorld"); + } + } + @Override public void exportTemplate(PlotArea plotArea) throws IOException { HashSet files = Sets.newHashSet( new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea))); 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 e06d7208e..44703be52 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 @@ -53,8 +53,9 @@ public abstract class IndependentPlotGenerator { * Return a new PlotManager object. * * @return + * @param plotArea */ - public abstract PlotManager getNewPlotManager(); + public abstract PlotManager getNewPlotManager(PlotArea plotArea); /** * If any additional setup options need to be changed before world creation. 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 5be65a394..f9b2f5437 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 @@ -14,6 +14,17 @@ import java.util.Iterator; */ public abstract class SquarePlotManager extends GridPlotManager { + private final SquarePlotWorld squarePlotWorld; + + public SquarePlotManager(PlotArea plotArea) { + super(plotArea); + if (plotArea instanceof SquarePlotWorld){ + squarePlotWorld = (SquarePlotWorld)plotArea; + } else { + throw new RuntimeException("SquarePlotManager requires plotArea to be an instance of SquarePlotWorld"); + } + } + @Override public boolean clearPlot(PlotArea plotArea, final Plot plot, final Runnable whenDone) { final HashSet regions = plot.getRegions(); 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 785b20e1e..25b22c1bf 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 @@ -81,7 +81,7 @@ public abstract class PlotArea { @Nullable final PlotId max) { this.worldname = worldName; this.id = id; - this.manager = generator.getNewPlotManager(); + this.manager = generator.getNewPlotManager(this); this.generator = generator; if (min == null || max == null) { if (min != max) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 7dc4185c8..32a1e0423 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -10,6 +10,13 @@ import java.util.List; public abstract class PlotManager { + private final PlotArea plotArea; + + public PlotManager(PlotArea plotArea) { + + this.plotArea = plotArea; + } + /* * Plot locations (methods with Abs in them will not need to consider mega * plots). 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 7146a898b..ab8a01078 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 @@ -10,6 +10,10 @@ import java.io.File; import java.util.List; public class SinglePlotManager extends PlotManager { + public SinglePlotManager(PlotArea plotArea) { + super(plotArea); + } + @Override public PlotId getPlotIdAbs(PlotArea plotArea, int x, int y, int z) { return new PlotId(0, 0); } 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 ba498f971..a821c03a4 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 @@ -81,8 +81,8 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { return ((SinglePlotAreaManager) PlotSquared.get().getPlotAreaManager()).getArea(); } - @Override public PlotManager getNewPlotManager() { - return new SinglePlotManager(); + @Override public PlotManager getNewPlotManager(PlotArea plotArea) { + return new SinglePlotManager(plotArea); } @Override public void initialize(PlotArea area) { From c5bca666188e6728a635340cf23b1cf5f69725b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Fri, 31 May 2019 15:05:37 +0200 Subject: [PATCH 022/258] Remove PlotArea parameter from PlotManager method calls As per the previous commit, all PlotManagers now have a reference to their managed PlotArea. --- .../plot/commands/DebugClaimTest.java | 2 +- .../plot/commands/DebugRoadRegen.java | 16 +- .../plotsquared/plot/commands/Set.java | 6 +- .../plotsquared/plot/commands/Template.java | 2 +- .../plot/generator/AugmentedUtils.java | 2 +- .../plot/generator/ClassicPlotManager.java | 337 +++++++++--------- .../plot/generator/HybridPlotManager.java | 119 +++---- .../plot/generator/HybridUtils.java | 6 +- .../plot/generator/SquarePlotManager.java | 81 ++--- .../plotsquared/plot/object/Plot.java | 62 ++-- .../plotsquared/plot/object/PlotArea.java | 16 +- .../plotsquared/plot/object/PlotCluster.java | 6 +- .../plotsquared/plot/object/PlotManager.java | 44 +-- .../plot/object/worlds/SinglePlotManager.java | 42 +-- 14 files changed, 354 insertions(+), 387 deletions(-) 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 9d5dc9d3d..41a5eda80 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 @@ -55,7 +55,7 @@ public class DebugClaimTest extends SubCommand { MainUtil.sendMessage(player, " - &cDB Already contains: " + plot.getId()); continue; } - Location loc = manager.getSignLoc(area, plot); + Location loc = manager.getSignLoc(plot); ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false); if (!result) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index fd0b29657..1880cd6b0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -2,11 +2,9 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; -import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; 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.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -18,20 +16,16 @@ public class DebugRoadRegen extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { Location loc = player.getLocation(); - PlotArea plotArea = loc.getPlotArea(); - if (!(plotArea instanceof HybridPlotWorld)) { - return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); - } + PlotManager manager = loc.getPlotArea().getPlotManager(); Plot plot = player.getCurrentPlot(); if (plot == null) { Captions.NOT_IN_PLOT.send(player); } else if (plot.isMerged()) { Captions.REQUIRES_UNMERGED.send(player); } else { - HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager(); - manager.createRoadEast(plotArea, plot); - manager.createRoadSouth(plotArea, plot); - manager.createRoadSouthEast(plotArea, plot); + manager.createRoadEast(plot); + manager.createRoadSouth(plot); + manager.createRoadSouthEast(plot); MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.getId() + "\n&6 - Result: &aSuccess"); MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 8a3406cda..7b01f57e1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -47,7 +47,7 @@ import java.util.stream.IntStream; @Override public boolean set(PlotPlayer player, final Plot plot, String value) { PlotArea plotArea = player.getLocation().getPlotArea(); PlotManager manager = player.getLocation().getPlotManager(); - String[] components = manager.getPlotComponents(plotArea, plot.getId()); + String[] components = manager.getPlotComponents(plot.getId()); boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(player.getUUID()); String[] args = value.split(" "); @@ -124,7 +124,7 @@ import java.util.stream.IntStream; Plot plot = player.getCurrentPlot(); if (plot != null) { newValues.addAll( - Arrays.asList(plot.getManager().getPlotComponents(plot.getArea(), plot.getId()))); + Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); } MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan .join(newValues, Captions.BLOCK_LIST_SEPARATER.formatted())); @@ -151,7 +151,7 @@ import java.util.stream.IntStream; } // components HashSet components = new HashSet<>( - Arrays.asList(plot.getManager().getPlotComponents(plot.getArea(), plot.getId()))); + Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); if (components.contains(args[0].toLowerCase())) { return this.component.onCommand(player, Arrays.copyOfRange(args, 0, args.length)); } 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 472542523..eb96f78cc 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 @@ -179,7 +179,7 @@ import java.util.zip.ZipOutputStream; final PlotManager manager = area.getPlotManager(); TaskManager.runTaskAsync(() -> { try { - manager.exportTemplate(area); + manager.exportTemplate(); } catch (Exception e) { // Must recover from any exception thrown a third party template manager e.printStackTrace(); MainUtil.sendMessage(player, "Failed: " + e.getMessage()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index 998edae06..fe0a614a2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -96,7 +96,7 @@ public class AugmentedUtils { for (int z = bzz; z <= tzz; z++) { int rx = x + blockX; int rz = z + blockZ; - boolean can = manager.getPlotId(area, rx, 0, rz) == null; + boolean can = manager.getPlotId(rx, 0, rz) == null; if (can) { for (int y = 1; y < 128; y++) { queue.setBlock(rx, y, rz, air); 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 86836447b..a822c3243 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 @@ -24,55 +24,53 @@ public class ClassicPlotManager extends SquarePlotManager { } } - @Override public boolean setComponent(PlotArea plotArea, PlotId plotId, String component, + @Override public boolean setComponent(PlotId plotId, String component, BlockBucket blocks) { switch (component) { case "floor": - setFloor(plotArea, plotId, blocks); + setFloor(plotId, blocks); return true; case "wall": - setWallFilling(plotArea, plotId, blocks); + setWallFilling(plotId, blocks); return true; case "all": - setAll(plotArea, plotId, blocks); + setAll(plotId, blocks); return true; case "air": - setAir(plotArea, plotId, blocks); + setAir(plotId, blocks); return true; case "main": - setMain(plotArea, plotId, blocks); + setMain(plotId, blocks); return true; case "middle": - setMiddle(plotArea, plotId, blocks); + setMiddle(plotId, blocks); return true; case "outline": - setOutline(plotArea, plotId, blocks); + setOutline(plotId, blocks); return true; case "border": - setWall(plotArea, plotId, blocks); + setWall(plotId, blocks); return true; } return false; } - @Override public boolean unClaimPlot(PlotArea plotArea, Plot plot, Runnable whenDone) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - setWallFilling(dpw, plot.getId(), dpw.WALL_FILLING); - setWall(dpw, plot.getId(), dpw.WALL_BLOCK); + @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { + setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING); + setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); GlobalBlockQueue.IMP.addTask(whenDone); return true; } - public boolean setFloor(PlotArea plotArea, PlotId plotId, BlockBucket blocks) { - Plot plot = plotArea.getPlotAbs(plotId); - LocalBlockQueue queue = plotArea.getQueue(false); + public boolean setFloor(PlotId plotId, BlockBucket blocks) { + Plot plot = classicPlotWorld.getPlotAbs(plotId); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); if (plot.isBasePlot()) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; for (RegionWrapper region : plot.getRegions()) { Location pos1 = - new Location(plotArea.worldname, region.minX, dpw.PLOT_HEIGHT, region.minZ); + new Location(classicPlotWorld.worldname, region.minX, classicPlotWorld.PLOT_HEIGHT, region.minZ); Location pos2 = - new Location(plotArea.worldname, region.maxX, dpw.PLOT_HEIGHT, region.maxZ); + new Location(classicPlotWorld.worldname, region.maxX, classicPlotWorld.PLOT_HEIGHT, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } } @@ -80,87 +78,83 @@ public class ClassicPlotManager extends SquarePlotManager { return true; } - public boolean setAll(PlotArea plotArea, PlotId plotId, BlockBucket blocks) { - Plot plot = plotArea.getPlotAbs(plotId); + public boolean setAll(PlotId plotId, BlockBucket blocks) { + Plot plot = classicPlotWorld.getPlotAbs(plotId); if (!plot.isBasePlot()) { return false; } - LocalBlockQueue queue = plotArea.getQueue(false); - int maxY = plotArea.getPlotManager().getWorldHeight(); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); + int maxY = getWorldHeight(); for (RegionWrapper region : plot.getRegions()) { - Location pos1 = new Location(plotArea.worldname, region.minX, 1, region.minZ); - Location pos2 = new Location(plotArea.worldname, region.maxX, maxY, region.maxZ); + Location pos1 = new Location(classicPlotWorld.worldname, region.minX, 1, region.minZ); + Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } queue.enqueue(); return true; } - public boolean setAir(PlotArea plotArea, PlotId plotId, BlockBucket blocks) { - Plot plot = plotArea.getPlotAbs(plotId); + public boolean setAir(PlotId plotId, BlockBucket blocks) { + Plot plot = classicPlotWorld.getPlotAbs(plotId); if (!plot.isBasePlot()) { return false; } - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - LocalBlockQueue queue = plotArea.getQueue(false); - int maxY = plotArea.getPlotManager().getWorldHeight(); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); + int maxY = getWorldHeight(); for (RegionWrapper region : plot.getRegions()) { Location pos1 = - new Location(plotArea.worldname, region.minX, dpw.PLOT_HEIGHT + 1, region.minZ); - Location pos2 = new Location(plotArea.worldname, region.maxX, maxY, region.maxZ); + new Location(classicPlotWorld.worldname, region.minX, classicPlotWorld.PLOT_HEIGHT + 1, region.minZ); + Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } queue.enqueue(); return true; } - public boolean setMain(PlotArea plotArea, PlotId plotId, BlockBucket blocks) { - Plot plot = plotArea.getPlotAbs(plotId); + public boolean setMain(PlotId plotId, BlockBucket blocks) { + Plot plot = classicPlotWorld.getPlotAbs(plotId); if (!plot.isBasePlot()) { return false; } - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - LocalBlockQueue queue = plotArea.getQueue(false); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); for (RegionWrapper region : plot.getRegions()) { - Location pos1 = new Location(plotArea.worldname, region.minX, 1, region.minZ); + Location pos1 = new Location(classicPlotWorld.worldname, region.minX, 1, region.minZ); Location pos2 = - new Location(plotArea.worldname, region.maxX, dpw.PLOT_HEIGHT - 1, region.maxZ); + new Location(classicPlotWorld.worldname, region.maxX, classicPlotWorld.PLOT_HEIGHT - 1, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } queue.enqueue(); return true; } - public boolean setMiddle(PlotArea plotArea, PlotId plotId, BlockBucket blocks) { - Plot plot = plotArea.getPlotAbs(plotId); + public boolean setMiddle(PlotId plotId, BlockBucket blocks) { + Plot plot = classicPlotWorld.getPlotAbs(plotId); if (!plot.isBasePlot()) { return false; } Location[] corners = plot.getCorners(); - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - LocalBlockQueue queue = plotArea.getQueue(false); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); int x = MathMan.average(corners[0].getX(), corners[1].getX()); int z = MathMan.average(corners[0].getZ(), corners[1].getZ()); - queue.setBlock(x, dpw.PLOT_HEIGHT, z, blocks.getBlock()); + queue.setBlock(x, classicPlotWorld.PLOT_HEIGHT, z, blocks.getBlock()); queue.enqueue(); return true; } - public boolean setOutline(PlotArea plotArea, PlotId plotId, BlockBucket blocks) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - if (dpw.ROAD_WIDTH == 0) { + public boolean setOutline(PlotId plotId, BlockBucket blocks) { + if (classicPlotWorld.ROAD_WIDTH == 0) { return false; } - Plot plot = plotArea.getPlotAbs(plotId); + Plot plot = classicPlotWorld.getPlotAbs(plotId); Location bottom = plot.getBottomAbs(); Location top = plot.getExtendedTopAbs(); - LocalBlockQueue queue = plotArea.getQueue(false); - int maxY = plotArea.getPlotManager().getWorldHeight(); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); + int maxY = classicPlotWorld.getPlotManager().getWorldHeight(); if (!plot.getMerged(Direction.NORTH)) { int z = bottom.getZ(); for (int x = bottom.getX(); x <= top.getX(); x++) { - for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) { + for (int y = classicPlotWorld.PLOT_HEIGHT; y <= maxY; y++) { queue.setBlock(x, y, z, blocks.getBlock()); } } @@ -168,7 +162,7 @@ public class ClassicPlotManager extends SquarePlotManager { if (!plot.getMerged(Direction.WEST)) { int x = bottom.getX(); for (int z = bottom.getZ(); z <= top.getZ(); z++) { - for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) { + for (int y = classicPlotWorld.PLOT_HEIGHT; y <= maxY; y++) { queue.setBlock(x, y, z, blocks.getBlock()); } } @@ -177,7 +171,7 @@ public class ClassicPlotManager extends SquarePlotManager { if (!plot.getMerged(Direction.SOUTH)) { int z = top.getZ(); for (int x = bottom.getX(); x <= top.getX(); x++) { - for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) { + for (int y = classicPlotWorld.PLOT_HEIGHT; y <= maxY; y++) { queue.setBlock(x, y, z, blocks.getBlock()); } } @@ -185,15 +179,15 @@ public class ClassicPlotManager extends SquarePlotManager { if (!plot.getMerged(Direction.EAST)) { int x = top.getX(); for (int z = bottom.getZ(); z <= top.getZ(); z++) { - for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) { + for (int y = classicPlotWorld.PLOT_HEIGHT; y <= maxY; y++) { queue.setBlock(x, y, z, blocks.getBlock()); } } } if (plot.isBasePlot()) { for (RegionWrapper region : plot.getRegions()) { - Location pos1 = new Location(plotArea.worldname, region.minX, maxY, region.minZ); - Location pos2 = new Location(plotArea.worldname, region.maxX, maxY, region.maxZ); + Location pos1 = new Location(classicPlotWorld.worldname, region.minX, maxY, region.minZ); + Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } } @@ -201,21 +195,20 @@ public class ClassicPlotManager extends SquarePlotManager { return true; } - public boolean setWallFilling(PlotArea plotArea, PlotId plotId, BlockBucket blocks) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - if (dpw.ROAD_WIDTH == 0) { + public boolean setWallFilling(PlotId plotId, BlockBucket blocks) { + if (classicPlotWorld.ROAD_WIDTH == 0) { return false; } - Plot plot = plotArea.getPlotAbs(plotId); + Plot plot = classicPlotWorld.getPlotAbs(plotId); Location bot = plot.getExtendedBottomAbs() .subtract(plot.getMerged(Direction.WEST) ? 0 : 1, 0, plot.getMerged(Direction.NORTH) ? 0 : 1); Location top = plot.getExtendedTopAbs().add(1, 0, 1); - LocalBlockQueue queue = plotArea.getQueue(false); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); if (!plot.getMerged(Direction.NORTH)) { int z = bot.getZ(); for (int x = bot.getX(); x < top.getX(); x++) { - for (int y = 1; y <= dpw.WALL_HEIGHT; y++) { + for (int y = 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { queue.setBlock(x, y, z, blocks.getBlock()); } } @@ -223,7 +216,7 @@ public class ClassicPlotManager extends SquarePlotManager { if (!plot.getMerged(Direction.WEST)) { int x = bot.getX(); for (int z = bot.getZ(); z < top.getZ(); z++) { - for (int y = 1; y <= dpw.WALL_HEIGHT; y++) { + for (int y = 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { queue.setBlock(x, y, z, blocks.getBlock()); } } @@ -232,7 +225,7 @@ public class ClassicPlotManager extends SquarePlotManager { int z = top.getZ(); for (int x = bot.getX(); x < top.getX() + (plot.getMerged(Direction.EAST) ? 0 : 1); x++) { - for (int y = 1; y <= dpw.WALL_HEIGHT; y++) { + for (int y = 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { queue.setBlock(x, y, z, blocks.getBlock()); } } @@ -241,7 +234,7 @@ public class ClassicPlotManager extends SquarePlotManager { int x = top.getX(); for (int z = bot.getZ(); z < top.getZ() + (plot.getMerged(Direction.SOUTH) ? 0 : 1); z++) { - for (int y = 1; y <= dpw.WALL_HEIGHT; y++) { + for (int y = 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { queue.setBlock(x, y, z, blocks.getBlock()); } } @@ -250,18 +243,17 @@ public class ClassicPlotManager extends SquarePlotManager { return true; } - public boolean setWall(PlotArea plotArea, PlotId plotId, BlockBucket blocks) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - if (dpw.ROAD_WIDTH == 0) { + public boolean setWall(PlotId plotId, BlockBucket blocks) { + if (classicPlotWorld.ROAD_WIDTH == 0) { return false; } - Plot plot = plotArea.getPlotAbs(plotId); + Plot plot = classicPlotWorld.getPlotAbs(plotId); Location bot = plot.getExtendedBottomAbs() .subtract(plot.getMerged(Direction.WEST) ? 0 : 1, 0, plot.getMerged(Direction.NORTH) ? 0 : 1); Location top = plot.getExtendedTopAbs().add(1, 0, 1); - LocalBlockQueue queue = plotArea.getQueue(false); - int y = dpw.WALL_HEIGHT + 1; + LocalBlockQueue queue = classicPlotWorld.getQueue(false); + int y = classicPlotWorld.WALL_HEIGHT + 1; if (!plot.getMerged(Direction.NORTH)) { int z = bot.getZ(); for (int x = bot.getX(); x < top.getX(); x++) { @@ -295,145 +287,139 @@ public class ClassicPlotManager extends SquarePlotManager { /** * PLOT MERGING. */ - @Override public boolean createRoadEast(PlotArea plotArea, Plot plot) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - Location pos1 = getPlotBottomLocAbs(plotArea, plot.getId()); - Location pos2 = getPlotTopLocAbs(plotArea, plot.getId()); + @Override public boolean createRoadEast(Plot plot) { + Location pos1 = getPlotBottomLocAbs(plot.getId()); + Location pos2 = getPlotTopLocAbs(plot.getId()); int sx = pos2.getX() + 1; - int ex = sx + dpw.ROAD_WIDTH - 1; + int ex = sx + classicPlotWorld.ROAD_WIDTH - 1; int sz = pos1.getZ() - 2; int ez = pos2.getZ() + 2; - LocalBlockQueue queue = plotArea.getQueue(false); - int maxY = plotArea.getPlotManager().getWorldHeight(); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); + int maxY = getWorldHeight(); queue.setCuboid( - new Location(plotArea.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, - sz + 1), new Location(plotArea.worldname, ex, maxY, ez - 1), + new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, + sz + 1), new Location(classicPlotWorld.worldname, ex, maxY, ez - 1), PlotBlock.get((short) 0, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx, 0, sz + 1), - new Location(plotArea.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz + 1), - new Location(plotArea.worldname, sx, dpw.WALL_HEIGHT, ez - 1), dpw.WALL_FILLING); - queue.setCuboid(new Location(plotArea.worldname, sx, dpw.WALL_HEIGHT + 1, sz + 1), - new Location(plotArea.worldname, sx, dpw.WALL_HEIGHT + 1, ez - 1), dpw.WALL_BLOCK); - queue.setCuboid(new Location(plotArea.worldname, ex, 1, sz + 1), - new Location(plotArea.worldname, ex, dpw.WALL_HEIGHT, ez - 1), dpw.WALL_FILLING); - queue.setCuboid(new Location(plotArea.worldname, ex, dpw.WALL_HEIGHT + 1, sz + 1), - new Location(plotArea.worldname, ex, dpw.WALL_HEIGHT + 1, ez - 1), dpw.WALL_BLOCK); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz + 1), - new Location(plotArea.worldname, ex - 1, dpw.ROAD_HEIGHT, ez - 1), dpw.ROAD_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 0, sz + 1), + new Location(classicPlotWorld.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7, (byte) 0)); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), + new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), + new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, ex, 1, sz + 1), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING); + queue.setCuboid(new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); queue.enqueue(); return true; } - @Override public boolean createRoadSouth(PlotArea plotArea, Plot plot) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - Location pos1 = getPlotBottomLocAbs(plotArea, plot.getId()); - Location pos2 = getPlotTopLocAbs(plotArea, plot.getId()); + @Override public boolean createRoadSouth(Plot plot) { + Location pos1 = getPlotBottomLocAbs(plot.getId()); + Location pos2 = getPlotTopLocAbs(plot.getId()); int sz = pos2.getZ() + 1; - int ez = sz + dpw.ROAD_WIDTH - 1; + int ez = sz + classicPlotWorld.ROAD_WIDTH - 1; int sx = pos1.getX() - 2; int ex = pos2.getX() + 2; - LocalBlockQueue queue = plotArea.getQueue(false); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid( - new Location(plotArea.worldname, sx + 1, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, + new Location(classicPlotWorld.worldname, sx + 1, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), - new Location(plotArea.worldname, ex - 1, plotArea.getPlotManager().getWorldHeight(), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez), PlotBlock.get((short) 0, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz), - new Location(plotArea.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz), - new Location(plotArea.worldname, ex - 1, dpw.WALL_HEIGHT, sz), dpw.WALL_FILLING); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.WALL_HEIGHT + 1, sz), - new Location(plotArea.worldname, ex - 1, dpw.WALL_HEIGHT + 1, sz), dpw.WALL_BLOCK); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, ez), - new Location(plotArea.worldname, ex - 1, dpw.WALL_HEIGHT, ez), dpw.WALL_FILLING); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.WALL_HEIGHT + 1, ez), - new Location(plotArea.worldname, ex - 1, dpw.WALL_HEIGHT + 1, ez), dpw.WALL_BLOCK); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz + 1), - new Location(plotArea.worldname, ex - 1, dpw.ROAD_HEIGHT, ez - 1), dpw.ROAD_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz), + new Location(classicPlotWorld.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0)); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT, sz), classicPlotWorld.WALL_FILLING); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, sz), classicPlotWorld.WALL_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, ez), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT, ez), classicPlotWorld.WALL_FILLING); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.WALL_HEIGHT + 1, ez), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); queue.enqueue(); return true; } - @Override public boolean createRoadSouthEast(PlotArea plotArea, Plot plot) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - Location pos2 = getPlotTopLocAbs(plotArea, plot.getId()); + @Override public boolean createRoadSouthEast(Plot plot) { + Location pos2 = getPlotTopLocAbs(plot.getId()); int sx = pos2.getX() + 1; - int ex = sx + dpw.ROAD_WIDTH - 1; + int ex = sx + classicPlotWorld.ROAD_WIDTH - 1; int sz = pos2.getZ() + 1; - int ez = sz + dpw.ROAD_WIDTH - 1; - LocalBlockQueue queue = plotArea.getQueue(false); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.ROAD_HEIGHT + 1, sz + 1), - new Location(plotArea.worldname, ex - 1, dpw.getPlotManager().getWorldHeight(), ez - 1), + int ez = sz + classicPlotWorld.ROAD_WIDTH - 1; + LocalBlockQueue queue = classicPlotWorld.getQueue(false); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.ROAD_HEIGHT + 1, sz + 1), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez - 1), PlotBlock.get((short) 0, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz + 1), - new Location(plotArea.worldname, ex - 1, 0, ez - 1), + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz + 1), + new Location(classicPlotWorld.worldname, ex - 1, 0, ez - 1), PlotBlock.get((short) 7, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz + 1), - new Location(plotArea.worldname, ex - 1, dpw.ROAD_HEIGHT, ez - 1), dpw.ROAD_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); queue.enqueue(); return true; } - @Override public boolean removeRoadEast(PlotArea plotArea, Plot plot) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - Location pos1 = getPlotBottomLocAbs(plotArea, plot.getId()); - Location pos2 = getPlotTopLocAbs(plotArea, plot.getId()); + @Override public boolean removeRoadEast(Plot plot) { + Location pos1 = getPlotBottomLocAbs(plot.getId()); + Location pos2 = getPlotTopLocAbs(plot.getId()); int sx = pos2.getX() + 1; - int ex = sx + dpw.ROAD_WIDTH - 1; + int ex = sx + classicPlotWorld.ROAD_WIDTH - 1; int sz = pos1.getZ() - 1; int ez = pos2.getZ() + 1; - LocalBlockQueue queue = plotArea.getQueue(false); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid( - new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, + new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), - new Location(plotArea.worldname, ex, plotArea.getPlotManager().getWorldHeight(), ez), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), PlotBlock.get((short) 0, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz + 1), - new Location(plotArea.worldname, ex, dpw.PLOT_HEIGHT - 1, ez - 1), dpw.MAIN_BLOCK); - queue.setCuboid(new Location(plotArea.worldname, sx, dpw.PLOT_HEIGHT, sz + 1), - new Location(plotArea.worldname, ex, dpw.PLOT_HEIGHT, ez - 1), dpw.TOP_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), classicPlotWorld.TOP_BLOCK); queue.enqueue(); return true; } - @Override public boolean removeRoadSouth(PlotArea plotArea, Plot plot) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - Location pos1 = getPlotBottomLocAbs(plotArea, plot.getId()); - Location pos2 = getPlotTopLocAbs(plotArea, plot.getId()); + @Override public boolean removeRoadSouth(Plot plot) { + Location pos1 = getPlotBottomLocAbs(plot.getId()); + Location pos2 = getPlotTopLocAbs(plot.getId()); int sz = pos2.getZ() + 1; - int ez = sz + dpw.ROAD_WIDTH - 1; + int ez = sz + classicPlotWorld.ROAD_WIDTH - 1; int sx = pos1.getX() - 1; int ex = pos2.getX() + 1; - LocalBlockQueue queue = plotArea.getQueue(false); + LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid( - new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, + new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), - new Location(plotArea.worldname, ex, plotArea.getPlotManager().getWorldHeight(), ez), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), PlotBlock.get((short) 0, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz), - new Location(plotArea.worldname, ex - 1, dpw.PLOT_HEIGHT - 1, ez), dpw.MAIN_BLOCK); - queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.PLOT_HEIGHT, sz), - new Location(plotArea.worldname, ex - 1, dpw.PLOT_HEIGHT, ez), dpw.TOP_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); queue.enqueue(); return true; } - @Override public boolean removeRoadSouthEast(PlotArea plotArea, Plot plot) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; - Location location = getPlotTopLocAbs(dpw, plot.getId()); + @Override public boolean removeRoadSouthEast(Plot plot) { + Location location = getPlotTopLocAbs(plot.getId()); int sx = location.getX() + 1; - int ex = sx + dpw.ROAD_WIDTH - 1; + int ex = sx + classicPlotWorld.ROAD_WIDTH - 1; int sz = location.getZ() + 1; - int ez = sz + dpw.ROAD_WIDTH - 1; - LocalBlockQueue queue = plotArea.getQueue(false); - queue.setCuboid(new Location(plotArea.worldname, sx, dpw.ROAD_HEIGHT + 1, sz), - new Location(plotArea.worldname, ex, plotArea.getPlotManager().getWorldHeight(), ez), + int ez = sz + classicPlotWorld.ROAD_WIDTH - 1; + LocalBlockQueue queue = classicPlotWorld.getQueue(false); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT + 1, sz), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), PlotBlock.get((short) 0, (byte) 0)); - queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz), - new Location(plotArea.worldname, ex, dpw.ROAD_HEIGHT - 1, ez), dpw.MAIN_BLOCK); - queue.setCuboid(new Location(plotArea.worldname, sx, dpw.ROAD_HEIGHT, sz), - new Location(plotArea.worldname, ex, dpw.ROAD_HEIGHT, ez), dpw.TOP_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); + queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz), + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); queue.enqueue(); return true; } @@ -441,48 +427,47 @@ public class ClassicPlotManager extends SquarePlotManager { /** * Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED). */ - @Override public boolean finishPlotMerge(PlotArea plotArea, List plotIds) { - final BlockBucket block = ((ClassicPlotWorld) plotArea).CLAIMED_WALL_BLOCK; - plotIds.forEach(id -> setWall(plotArea, id, block)); + @Override public boolean finishPlotMerge(List plotIds) { + final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; + plotIds.forEach(id -> setWall(id, block)); if (Settings.General.MERGE_REPLACE_WALL) { - final BlockBucket wallBlock = ((ClassicPlotWorld) plotArea).WALL_FILLING; - plotIds.forEach(id -> setWallFilling(plotArea, id, wallBlock)); + final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING; + plotIds.forEach(id -> setWallFilling(id, wallBlock)); } return true; } - @Override public boolean finishPlotUnlink(PlotArea plotArea, List plotIds) { - final BlockBucket block = ((ClassicPlotWorld) plotArea).CLAIMED_WALL_BLOCK; - plotIds.forEach(id -> setWall(plotArea, id, block)); + @Override public boolean finishPlotUnlink(List plotIds) { + final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; + plotIds.forEach(id -> setWall(id, block)); return true; } - @Override public boolean startPlotMerge(PlotArea plotArea, List plotIds) { + @Override public boolean startPlotMerge(List plotIds) { return true; } - @Override public boolean startPlotUnlink(PlotArea plotArea, List plotIds) { + @Override public boolean startPlotUnlink(List plotIds) { return true; } - @Override public boolean claimPlot(PlotArea plotArea, Plot plot) { - final BlockBucket claim = ((ClassicPlotWorld) plotArea).CLAIMED_WALL_BLOCK; - setWall(plotArea, plot.getId(), claim); + @Override public boolean claimPlot(Plot plot) { + final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + setWall(plot.getId(), claim); return true; } - @Override public String[] getPlotComponents(PlotArea plotArea, PlotId plotId) { + @Override public String[] getPlotComponents(PlotId plotId) { return new String[] {"main", "floor", "air", "all", "border", "wall", "outline", "middle"}; } /** * Remove sign for a plot. */ - @Override public Location getSignLoc(PlotArea plotArea, Plot plot) { - ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; + @Override public Location getSignLoc(Plot plot) { plot = plot.getBasePlot(false); Location bot = plot.getBottomAbs(); - return new Location(plotArea.worldname, bot.getX() - 1, dpw.ROAD_HEIGHT + 1, + return new Location(classicPlotWorld.worldname, bot.getX() - 1, classicPlotWorld.ROAD_HEIGHT + 1, bot.getZ() - 2); } } 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 f3b6f6fe3..0bbf67557 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 @@ -32,11 +32,11 @@ public class HybridPlotManager extends ClassicPlotManager { } } - @Override public void exportTemplate(PlotArea plotArea) throws IOException { + @Override public void exportTemplate() throws IOException { HashSet files = Sets.newHashSet( - new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea))); + new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(hybridPlotWorld))); String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator - + plotArea.worldname + File.separator; + + hybridPlotWorld.worldname + File.separator; try { File sideroad = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem"); @@ -59,51 +59,50 @@ public class HybridPlotManager extends ClassicPlotManager { } catch (IOException e) { e.printStackTrace(); } - Template.zipAll(plotArea.worldname, files); + Template.zipAll(hybridPlotWorld.worldname, files); } - @Override public boolean createRoadEast(PlotArea plotArea, Plot plot) { - super.createRoadEast(plotArea, plot); - HybridPlotWorld hpw = (HybridPlotWorld) plotArea; + @Override public boolean createRoadEast(Plot plot) { + super.createRoadEast(plot); PlotId id = plot.getId(); PlotId id2 = new PlotId(id.x + 1, id.y); - Location bot = getPlotBottomLocAbs(hpw, id2); - Location top = getPlotTopLocAbs(hpw, id); - Location pos1 = new Location(plotArea.worldname, top.getX() + 1, 0, bot.getZ() - 1); + Location bot = getPlotBottomLocAbs(id2); + Location top = getPlotTopLocAbs(id); + Location pos1 = new Location(hybridPlotWorld.worldname, top.getX() + 1, 0, bot.getZ() - 1); Location pos2 = - new Location(plotArea.worldname, bot.getX(), Math.min(getWorldHeight(), 255), + new Location(hybridPlotWorld.worldname, bot.getX(), Math.min(getWorldHeight(), 255), top.getZ() + 1); - MainUtil.resetBiome(plotArea, pos1, pos2); - if (!hpw.ROAD_SCHEMATIC_ENABLED) { + MainUtil.resetBiome(hybridPlotWorld, pos1, pos2); + if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { return true; } - LocalBlockQueue queue = hpw.getQueue(false); - createSchemAbs(hpw, queue, pos1, pos2); + LocalBlockQueue queue = hybridPlotWorld.getQueue(false); + createSchemAbs(queue, pos1, pos2); queue.enqueue(); return true; } - private void createSchemAbs(HybridPlotWorld hpw, LocalBlockQueue queue, Location pos1, + private void createSchemAbs(LocalBlockQueue queue, Location pos1, Location pos2) { - int size = hpw.SIZE; + int size = hybridPlotWorld.SIZE; int minY; if (Settings.Schematics.PASTE_ON_TOP) { - minY = hpw.SCHEM_Y; + minY = hybridPlotWorld.SCHEM_Y; } else { minY = 1; } BaseBlock airBlock = BlockTypes.AIR.getDefaultState().toBaseBlock(); for (int x = pos1.getX(); x <= pos2.getX(); x++) { - short absX = (short) ((x - hpw.ROAD_OFFSET_X) % size); + short absX = (short) ((x - hybridPlotWorld.ROAD_OFFSET_X) % size); if (absX < 0) { absX += size; } for (int z = pos1.getZ(); z <= pos2.getZ(); z++) { - short absZ = (short) ((z - hpw.ROAD_OFFSET_Z) % size); + short absZ = (short) ((z - hybridPlotWorld.ROAD_OFFSET_Z) % size); if (absZ < 0) { absZ += size; } - BaseBlock[] blocks = hpw.G_SCH.get(MathMan.pair(absX, absZ)); + BaseBlock[] blocks = hybridPlotWorld.G_SCH.get(MathMan.pair(absX, absZ)); if (blocks != null) { for (int y = 0; y < blocks.length; y++) { if (blocks[y] != null) { @@ -118,40 +117,38 @@ public class HybridPlotManager extends ClassicPlotManager { } } - @Override public boolean createRoadSouth(PlotArea plotArea, Plot plot) { - super.createRoadSouth(plotArea, plot); - HybridPlotWorld hpw = (HybridPlotWorld) plotArea; + @Override public boolean createRoadSouth(Plot plot) { + super.createRoadSouth(plot); PlotId id = plot.getId(); PlotId id2 = new PlotId(id.x, id.y + 1); - Location bot = getPlotBottomLocAbs(hpw, id2); - Location top = getPlotTopLocAbs(hpw, id); - Location pos1 = new Location(plotArea.worldname, bot.getX() - 1, 0, top.getZ() + 1); + Location bot = getPlotBottomLocAbs(id2); + Location top = getPlotTopLocAbs(id); + Location pos1 = new Location(hybridPlotWorld.worldname, bot.getX() - 1, 0, top.getZ() + 1); Location pos2 = - new Location(plotArea.worldname, top.getX() + 1, Math.min(getWorldHeight(), 255), + new Location(hybridPlotWorld.worldname, top.getX() + 1, Math.min(getWorldHeight(), 255), bot.getZ()); - MainUtil.resetBiome(plotArea, pos1, pos2); - if (!hpw.ROAD_SCHEMATIC_ENABLED) { + MainUtil.resetBiome(hybridPlotWorld, pos1, pos2); + if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { return true; } - LocalBlockQueue queue = hpw.getQueue(false); - createSchemAbs(hpw, queue, pos1, pos2); + LocalBlockQueue queue = hybridPlotWorld.getQueue(false); + createSchemAbs(queue, pos1, pos2); queue.enqueue(); return true; } - @Override public boolean createRoadSouthEast(PlotArea plotArea, Plot plot) { - super.createRoadSouthEast(plotArea, plot); - HybridPlotWorld hpw = (HybridPlotWorld) plotArea; + @Override public boolean createRoadSouthEast(Plot plot) { + super.createRoadSouthEast(plot); PlotId id = plot.getId(); PlotId id2 = new PlotId(id.x + 1, id.y + 1); - Location pos1 = getPlotTopLocAbs(hpw, id).add(1, 0, 1); - Location pos2 = getPlotBottomLocAbs(hpw, id2); + Location pos1 = getPlotTopLocAbs(id).add(1, 0, 1); + Location pos2 = getPlotBottomLocAbs(id2); pos1.setY(0); pos2.setY(Math.min(getWorldHeight(), 255)); - LocalBlockQueue queue = hpw.getQueue(false); - createSchemAbs(hpw, queue, pos1, pos2); - if (hpw.ROAD_SCHEMATIC_ENABLED) { - createSchemAbs(hpw, queue, pos1, pos2); + LocalBlockQueue queue = hybridPlotWorld.getQueue(false); + createSchemAbs(queue, pos1, pos2); + if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { + createSchemAbs(queue, pos1, pos2); } queue.enqueue(); return true; @@ -164,27 +161,26 @@ public class HybridPlotManager extends ClassicPlotManager { * don't need to do something quite as complex unless you happen to have 512x512 sized plots. *

*/ - @Override public boolean clearPlot(final PlotArea plotArea, Plot plot, - final Runnable whenDone) { - final String world = plotArea.worldname; - final HybridPlotWorld dpw = (HybridPlotWorld) plotArea; + @Override public boolean clearPlot(Plot plot, + final Runnable whenDone) { + final String world = hybridPlotWorld.worldname; Location pos1 = plot.getBottomAbs(); Location pos2 = plot.getExtendedTopAbs(); // If augmented final boolean canRegen = - (plotArea.TYPE == 0) && (plotArea.TERRAIN == 0) && REGENERATIVE_CLEAR; + (hybridPlotWorld.TYPE == 0) && (hybridPlotWorld.TERRAIN == 0) && REGENERATIVE_CLEAR; // The component blocks - final BlockBucket plotfloor = dpw.TOP_BLOCK; - final BlockBucket filling = dpw.MAIN_BLOCK; + final BlockBucket plotfloor = hybridPlotWorld.TOP_BLOCK; + final BlockBucket filling = hybridPlotWorld.MAIN_BLOCK; final PlotBlock bedrock; - if (dpw.PLOT_BEDROCK) { + if (hybridPlotWorld.PLOT_BEDROCK) { bedrock = PlotBlock.get((short) 7, (byte) 0); } else { bedrock = PlotBlock.get((short) 0, (byte) 0); } final PlotBlock air = PlotBlock.get((short) 0, (byte) 0); - final String biome = dpw.PLOT_BIOME; - final LocalBlockQueue queue = plotArea.getQueue(false); + final String biome = hybridPlotWorld.PLOT_BIOME; + final LocalBlockQueue queue = hybridPlotWorld.getQueue(false); ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run(int[] value) { // If the chunk isn't near the edge and it isn't an augmented world we can just regen the whole chunk @@ -201,16 +197,16 @@ public class HybridPlotManager extends ClassicPlotManager { queue.setCuboid(bot, top, bedrock); // Each component has a different layer bot.setY(1); - top.setY(dpw.PLOT_HEIGHT); + top.setY(hybridPlotWorld.PLOT_HEIGHT); queue.setCuboid(bot, top, filling); - bot.setY(dpw.PLOT_HEIGHT); - top.setY(dpw.PLOT_HEIGHT + 1); + bot.setY(hybridPlotWorld.PLOT_HEIGHT); + top.setY(hybridPlotWorld.PLOT_HEIGHT + 1); queue.setCuboid(bot, top, plotfloor); - bot.setY(dpw.PLOT_HEIGHT + 1); + bot.setY(hybridPlotWorld.PLOT_HEIGHT + 1); top.setY(getWorldHeight()); queue.setCuboid(bot, top, air); // And finally set the schematic, the y value is unimportant for this function - pastePlotSchematic(dpw, queue, bot, top); + pastePlotSchematic(queue, bot, top); } }, () -> { queue.enqueue(); @@ -220,19 +216,18 @@ public class HybridPlotManager extends ClassicPlotManager { return true; } - public void pastePlotSchematic(HybridPlotWorld plotWorld, LocalBlockQueue queue, + public void pastePlotSchematic(LocalBlockQueue queue, Location bottom, Location top) { - if (!plotWorld.PLOT_SCHEMATIC) { + if (!hybridPlotWorld.PLOT_SCHEMATIC) { return; } - createSchemAbs(plotWorld, queue, bottom, top); + createSchemAbs(queue, bottom, top); } /** * Remove sign for a plot. */ - @Override public Location getSignLoc(PlotArea plotArea, Plot plot) { - HybridPlotWorld dpw = (HybridPlotWorld) plotArea; - return dpw.getSignLocation(plot); + @Override public Location getSignLoc(Plot plot) { + return hybridPlotWorld.getSignLocation(plot); } } 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 de6c3390b..f98d6ae88 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 @@ -298,8 +298,8 @@ public abstract class HybridUtils { } } PlotManager manager = area.getPlotManager(); - PlotId id1 = manager.getPlotId(plotWorld, x, 0, z); - PlotId id2 = manager.getPlotId(plotWorld, ex, 0, ez); + PlotId id1 = manager.getPlotId(x, 0, z); + PlotId id2 = manager.getPlotId(ex, 0, ez); x -= plotWorld.ROAD_OFFSET_X; z -= plotWorld.ROAD_OFFSET_Z; LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(plotWorld.worldname, false); @@ -332,7 +332,7 @@ public abstract class HybridUtils { boolean condition; if (toCheck) { condition = manager - .getPlotId(plotWorld, x + X + plotWorld.ROAD_OFFSET_X, 1, + .getPlotId(x + X + plotWorld.ROAD_OFFSET_X, 1, z + Z + plotWorld.ROAD_OFFSET_Z) == null; // condition = MainUtil.isPlotRoad(new Location(plotworld.worldname, x + X, 1, z + Z)); } else { 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 f9b2f5437..967802b24 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 @@ -26,7 +26,7 @@ public abstract class SquarePlotManager extends GridPlotManager { } @Override - public boolean clearPlot(PlotArea plotArea, final Plot plot, final Runnable whenDone) { + public boolean clearPlot(final Plot plot, final Runnable whenDone) { final HashSet regions = plot.getRegions(); Runnable run = new Runnable() { @Override public void run() { @@ -48,39 +48,37 @@ public abstract class SquarePlotManager extends GridPlotManager { return true; } - @Override public Location getPlotTopLocAbs(PlotArea plotArea, PlotId plotId) { - SquarePlotWorld dpw = (SquarePlotWorld) plotArea; + @Override public Location getPlotTopLocAbs(PlotId plotId) { int px = plotId.x; int pz = plotId.y; - int x = (dpw.ROAD_OFFSET_X + (px * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH))) - (int) Math - .floor(dpw.ROAD_WIDTH / 2) - 1; - int z = (dpw.ROAD_OFFSET_Z + (pz * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH))) - (int) Math - .floor(dpw.ROAD_WIDTH / 2) - 1; - return new Location(plotArea.worldname, x, Math.min(getWorldHeight(), 255), z); + int x = (squarePlotWorld.ROAD_OFFSET_X + (px * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - (int) Math + .floor(squarePlotWorld.ROAD_WIDTH / 2) - 1; + int z = (squarePlotWorld.ROAD_OFFSET_Z + (pz * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - (int) Math + .floor(squarePlotWorld.ROAD_WIDTH / 2) - 1; + return new Location(squarePlotWorld.worldname, x, Math.min(getWorldHeight(), 255), z); } - @Override public PlotId getPlotIdAbs(PlotArea plotArea, int x, int y, int z) { - SquarePlotWorld dpw = (SquarePlotWorld) plotArea; - if (dpw.ROAD_OFFSET_X != 0) { - x -= dpw.ROAD_OFFSET_X; + @Override public PlotId getPlotIdAbs(int x, int y, int z) { + if (squarePlotWorld.ROAD_OFFSET_X != 0) { + x -= squarePlotWorld.ROAD_OFFSET_X; } - if (dpw.ROAD_OFFSET_Z != 0) { - z -= dpw.ROAD_OFFSET_Z; + if (squarePlotWorld.ROAD_OFFSET_Z != 0) { + z -= squarePlotWorld.ROAD_OFFSET_Z; } int pathWidthLower; int end; - if (dpw.ROAD_WIDTH == 0) { + if (squarePlotWorld.ROAD_WIDTH == 0) { pathWidthLower = -1; - end = dpw.PLOT_WIDTH; + end = squarePlotWorld.PLOT_WIDTH; } else { - if ((dpw.ROAD_WIDTH % 2) == 0) { - pathWidthLower = (dpw.ROAD_WIDTH / 2) - 1; + if ((squarePlotWorld.ROAD_WIDTH % 2) == 0) { + pathWidthLower = (squarePlotWorld.ROAD_WIDTH / 2) - 1; } else { - pathWidthLower = dpw.ROAD_WIDTH / 2; + pathWidthLower = squarePlotWorld.ROAD_WIDTH / 2; } - end = pathWidthLower + dpw.PLOT_WIDTH; + end = pathWidthLower + squarePlotWorld.PLOT_WIDTH; } - int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH; + int size = squarePlotWorld.PLOT_WIDTH + squarePlotWorld.ROAD_WIDTH; int idx; if (x < 0) { idx = x / size; @@ -128,27 +126,23 @@ public abstract class SquarePlotManager extends GridPlotManager { return new PlotId(idx, idz); } - @Override public PlotId getPlotId(PlotArea plotArea, int x, int y, int z) { + @Override public PlotId getPlotId(int x, int y, int z) { try { - SquarePlotWorld dpw = (SquarePlotWorld) plotArea; - if (plotArea == null) { - return null; - } - x -= dpw.ROAD_OFFSET_X; - z -= dpw.ROAD_OFFSET_Z; - int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH; + x -= squarePlotWorld.ROAD_OFFSET_X; + z -= squarePlotWorld.ROAD_OFFSET_Z; + int size = squarePlotWorld.PLOT_WIDTH + squarePlotWorld.ROAD_WIDTH; int pathWidthLower; int end; - if (dpw.ROAD_WIDTH == 0) { + if (squarePlotWorld.ROAD_WIDTH == 0) { pathWidthLower = -1; - end = dpw.PLOT_WIDTH; + end = squarePlotWorld.PLOT_WIDTH; } else { - if ((dpw.ROAD_WIDTH % 2) == 0) { - pathWidthLower = (dpw.ROAD_WIDTH / 2) - 1; + if ((squarePlotWorld.ROAD_WIDTH % 2) == 0) { + pathWidthLower = (squarePlotWorld.ROAD_WIDTH / 2) - 1; } else { - pathWidthLower = dpw.ROAD_WIDTH / 2; + pathWidthLower = squarePlotWorld.ROAD_WIDTH / 2; } - end = pathWidthLower + dpw.PLOT_WIDTH; + end = pathWidthLower + squarePlotWorld.PLOT_WIDTH; } int dx; int rx; @@ -176,7 +170,7 @@ public abstract class SquarePlotManager extends GridPlotManager { if (hash == 0) { return id; } - Plot plot = plotArea.getOwnedPlotAbs(id); + Plot plot = squarePlotWorld.getOwnedPlotAbs(id); // Not merged, and standing on road if (plot == null) { return null; @@ -210,7 +204,7 @@ public abstract class SquarePlotManager extends GridPlotManager { PlotSquared.debug("invalid location: " + Arrays.toString(merged)); } catch (Exception ignored) { PlotSquared.debug( - "Invalid plot / road width in settings.yml for world: " + plotArea.worldname); + "Invalid plot / road width in settings.yml for world: " + squarePlotWorld.worldname); } return null; } @@ -218,14 +212,13 @@ public abstract class SquarePlotManager extends GridPlotManager { /** * Get the bottom plot loc (some basic math). */ - @Override public Location getPlotBottomLocAbs(PlotArea plotArea, PlotId plotId) { - SquarePlotWorld dpw = (SquarePlotWorld) plotArea; + @Override public Location getPlotBottomLocAbs(PlotId plotId) { int px = plotId.x; int pz = plotId.y; - int x = (dpw.ROAD_OFFSET_X + (px * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH))) - dpw.PLOT_WIDTH - - (int) Math.floor(dpw.ROAD_WIDTH / 2); - int z = (dpw.ROAD_OFFSET_Z + (pz * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH))) - dpw.PLOT_WIDTH - - (int) Math.floor(dpw.ROAD_WIDTH / 2); - return new Location(plotArea.worldname, x, plotArea.MIN_BUILD_HEIGHT, z); + int x = (squarePlotWorld.ROAD_OFFSET_X + (px * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - squarePlotWorld.PLOT_WIDTH + - (int) Math.floor(squarePlotWorld.ROAD_WIDTH / 2); + int z = (squarePlotWorld.ROAD_OFFSET_Z + (pz * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - squarePlotWorld.PLOT_WIDTH + - (int) Math.floor(squarePlotWorld.ROAD_WIDTH / 2); + return new Location(squarePlotWorld.worldname, x, squarePlotWorld.MIN_BUILD_HEIGHT, 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 2b1f8259b..4c0d35cba 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 @@ -854,9 +854,9 @@ public class Plot { }; for (Plot current : plots) { if (isDelete || current.owner == null) { - manager.unClaimPlot(Plot.this.area, current, null); + manager.unClaimPlot(current, null); } else { - manager.claimPlot(Plot.this.area, current); + manager.claimPlot(current); } } GlobalBlockQueue.IMP.addTask(run); @@ -868,7 +868,7 @@ public class Plot { .regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, this); return; } - manager.clearPlot(Plot.this.area, current, this); + manager.clearPlot(current, this); } }; run.run(); @@ -943,20 +943,20 @@ public class Plot { } PlotManager manager = this.area.getPlotManager(); if (createRoad) { - manager.startPlotUnlink(this.area, ids); + manager.startPlotUnlink(ids); } if (this.area.TERRAIN != 3 && createRoad) { for (Plot current : plots) { if (current.getMerged(Direction.EAST)) { - manager.createRoadEast(current.area, current); + manager.createRoadEast(current); if (current.getMerged(Direction.SOUTH)) { - manager.createRoadSouth(current.area, current); + manager.createRoadSouth(current); if (current.getMerged(Direction.SOUTHEAST)) { - manager.createRoadSouthEast(current.area, current); + manager.createRoadSouthEast(current); } } } else if (current.getMerged(Direction.SOUTH)) { - manager.createRoadSouth(current.area, current); + manager.createRoadSouth(current); } } } @@ -972,7 +972,7 @@ public class Plot { }); } if (createRoad) { - manager.finishPlotUnlink(this.area, ids); + manager.finishPlotUnlink(ids); } return true; } @@ -992,7 +992,7 @@ public class Plot { } PlotManager manager = this.area.getPlotManager(); if (this.area.ALLOW_SIGNS) { - Location loc = manager.getSignLoc(this.area, this); + Location loc = manager.getSignLoc(this); String id = this.id.x + ";" + this.id.y; String[] lines = new String[] {Captions.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), @@ -1207,7 +1207,7 @@ public class Plot { int y = isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), loc.getX(), loc.getZ()) : 62; if (area.ALLOW_SIGNS) { - y = Math.max(y, getManager().getSignLoc(area, this).getY()); + y = Math.max(y, getManager().getSignLoc(this).getY()); } loc.setY(1 + y); return loc; @@ -1220,7 +1220,7 @@ public class Plot { PlotManager manager = getManager(); int y = isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), x, z) : 62; if (area.ALLOW_SIGNS && (y <= 0 || y >= 255)) { - y = Math.max(y, manager.getSignLoc(area, this).getY() - 1); + y = Math.max(y, manager.getSignLoc(this).getY() - 1); } return new Location(getWorldName(), x, y + 1, z); } @@ -1413,7 +1413,7 @@ public class Plot { if (!this.area.ALLOW_SIGNS) { return; } - Location loc = manager.getSignLoc(this.area, this); + Location loc = manager.getSignLoc(this); LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); queue.setBlock(loc.getX(), loc.getY(), loc.getZ(), PlotBlock.get("air")); queue.flush(); @@ -1496,7 +1496,7 @@ public class Plot { } }); } - plotworld.getPlotManager().claimPlot(plotworld, this); + plotworld.getPlotManager().claimPlot(this); return true; } @@ -1565,7 +1565,7 @@ public class Plot { * Returns the top location for the plot. */ public Location getTopAbs() { - Location top = this.area.getPlotManager().getPlotTopLocAbs(this.area, this.id); + Location top = getManager().getPlotTopLocAbs(this.id); top.setWorld(getWorldName()); return top; } @@ -1576,7 +1576,7 @@ public class Plot { * Returns the bottom location for the plot. */ public Location getBottomAbs() { - Location loc = this.area.getPlotManager().getPlotBottomLocAbs(this.area, this.id); + Location loc = getManager().getPlotBottomLocAbs(this.id); loc.setWorld(getWorldName()); return loc; } @@ -1724,7 +1724,7 @@ public class Plot { Location pos2 = new Location(this.getWorldName(), bot.getX(), MAX_HEIGHT, top.getZ()); ChunkManager.manager.regenerateRegion(pos1, pos2, true, null); } else { - this.area.getPlotManager().removeRoadEast(this.area, this); + this.area.getPlotManager().removeRoadEast(this); } } @@ -2124,7 +2124,7 @@ public class Plot { return null; } try { - final Location loc = this.getManager().getSignLoc(this.area, this); + final Location loc = this.getManager().getSignLoc(this); String[] lines = TaskManager.IMP.sync(new RunnableVal() { @Override public void run(String[] value) { ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false); @@ -2193,7 +2193,7 @@ public class Plot { Location pos2 = new Location(this.getWorldName(), top.getX(), MAX_HEIGHT, bot.getZ()); ChunkManager.manager.regenerateRegion(pos1, pos2, true, null); } else { - this.getManager().removeRoadSouth(this.area, this); + this.getManager().removeRoadSouth(this); } } @@ -2246,7 +2246,7 @@ public class Plot { ArrayList ids = new ArrayList<>(); ids.add(current.getId()); ids.add(other.getId()); - this.getManager().finishPlotMerge(this.area, ids); + this.getManager().finishPlotMerge(ids); } } } @@ -2265,7 +2265,7 @@ public class Plot { ArrayList ids = new ArrayList<>(); ids.add(current.getId()); ids.add(other.getId()); - this.getManager().finishPlotMerge(this.area, ids); + this.getManager().finishPlotMerge(ids); } } } @@ -2284,7 +2284,7 @@ public class Plot { ArrayList ids = new ArrayList<>(); ids.add(current.getId()); ids.add(other.getId()); - this.getManager().finishPlotMerge(this.area, ids); + this.getManager().finishPlotMerge(ids); } } } @@ -2303,7 +2303,7 @@ public class Plot { ArrayList ids = new ArrayList<>(); ids.add(current.getId()); ids.add(other.getId()); - this.getManager().finishPlotMerge(this.area, ids); + this.getManager().finishPlotMerge(ids); } } } @@ -2372,7 +2372,7 @@ public class Plot { pos2.setY(MAX_HEIGHT); ChunkManager.manager.regenerateRegion(pos1, pos2, true, null); } else { - this.area.getPlotManager().removeRoadSouthEast(this.area, this); + this.area.getPlotManager().removeRoadSouthEast(this); } } @@ -2813,15 +2813,15 @@ public class Plot { */ public boolean setComponent(String component, BlockBucket blocks) { if (StringMan - .isEqualToAny(component, getManager().getPlotComponents(this.area, this.getId()))) { + .isEqualToAny(component, getManager().getPlotComponents(this.getId()))) { EventUtil.manager.callComponentSet(this, component); } - return this.getManager().setComponent(this.area, this.getId(), component, blocks); + return this.getManager().setComponent(this.getId(), component, blocks); } public int getDistanceFromOrigin() { - Location bot = getManager().getPlotBottomLocAbs(this.area, id); - Location top = getManager().getPlotTopLocAbs(this.area, id); + Location bot = getManager().getPlotBottomLocAbs(id); + Location top = getManager().getPlotTopLocAbs(id); return Math.max(Math.max(Math.abs(bot.getX()), Math.abs(bot.getZ())), Math.max(Math.abs(top.getX()), Math.abs(top.getZ()))); } @@ -2967,10 +2967,10 @@ public class Plot { if (regions.isEmpty()) { Plot plot = destination.getRelative(0, 0); for (Plot current : plot.getConnectedPlots()) { - getManager().claimPlot(current.getArea(), current); + getManager().claimPlot(current); Plot originPlot = originArea.getPlotAbs( new PlotId(current.id.x - offset.x, current.id.y - offset.y)); - originPlot.getManager().unClaimPlot(originArea, originPlot, null); + originPlot.getManager().unClaimPlot(originPlot, null); } plot.setSign(); TaskManager.runTask(whenDone); @@ -3056,7 +3056,7 @@ public class Plot { @Override public void run() { if (regions.isEmpty()) { for (Plot current : getConnectedPlots()) { - destination.getManager().claimPlot(destination.getArea(), destination); + destination.getManager().claimPlot(destination); } destination.setSign(); TaskManager.runTask(whenDone); 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 25b22c1bf..885371c0e 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 @@ -144,8 +144,8 @@ public abstract class PlotArea { private RegionWrapper getRegionAbs() { if (this.region == null) { if (this.min != null) { - Location bot = getPlotManager().getPlotBottomLocAbs(this, this.min); - Location top = getPlotManager().getPlotTopLocAbs(this, this.max); + Location bot = getPlotManager().getPlotBottomLocAbs(this.min); + Location top = getPlotManager().getPlotTopLocAbs(this.max); this.region = new RegionWrapper(bot.getX() - 1, top.getX() + 1, bot.getZ() - 1, top.getZ() + 1); } @@ -422,7 +422,7 @@ public abstract class PlotArea { */ @Nullable public Plot getPlotAbs(@Nonnull final Location location) { final PlotId pid = - this.manager.getPlotId(this, location.getX(), location.getY(), location.getZ()); + this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { return null; } @@ -437,7 +437,7 @@ public abstract class PlotArea { */ @Nullable public Plot getPlot(@Nonnull final Location location) { final PlotId pid = - this.manager.getPlotId(this, location.getX(), location.getY(), location.getZ()); + this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { return null; } @@ -452,7 +452,7 @@ public abstract class PlotArea { */ @Nullable public Plot getOwnedPlot(@Nonnull final Location location) { final PlotId pid = - this.manager.getPlotId(this, location.getX(), location.getY(), location.getZ()); + this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { return null; } @@ -468,7 +468,7 @@ public abstract class PlotArea { */ @Nullable public Plot getOwnedPlotAbs(@Nonnull final Location location) { final PlotId pid = - this.manager.getPlotId(this, location.getX(), location.getY(), location.getZ()); + this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { return null; } @@ -835,7 +835,7 @@ public abstract class PlotArea { return false; } - manager.startPlotMerge(this, plotIds); + manager.startPlotMerge(plotIds); final Set trusted = new HashSet<>(); final Set members = new HashSet<>(); final Set denied = new HashSet<>(); @@ -887,7 +887,7 @@ public abstract class PlotArea { } } } - manager.finishPlotMerge(this, plotIds); + manager.finishPlotMerge(plotIds); return true; } 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 a1134cbce..0b9427839 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 @@ -132,7 +132,7 @@ public class PlotCluster { toReturn = center.getHome(); if (toReturn.getY() == 0) { PlotManager manager = this.area.getPlotManager(); - Location loc = manager.getSignLoc(this.area, center); + Location loc = manager.getSignLoc(center); toReturn.setY(loc.getY()); } } else { @@ -157,12 +157,12 @@ public class PlotCluster { public Location getClusterBottom() { PlotManager manager = this.area.getPlotManager(); - return manager.getPlotBottomLocAbs(this.area, getP1()); + return manager.getPlotBottomLocAbs(getP1()); } public Location getClusterTop() { PlotManager manager = this.area.getPlotManager(); - return manager.getPlotTopLocAbs(this.area, getP2()); + return manager.getPlotTopLocAbs(getP2()); } public boolean intersects(PlotId pos1, PlotId pos2) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 32a1e0423..f00fb40db 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -21,61 +21,61 @@ public abstract class PlotManager { * Plot locations (methods with Abs in them will not need to consider mega * plots). */ - public abstract PlotId getPlotIdAbs(PlotArea plotArea, int x, int y, int z); + public abstract PlotId getPlotIdAbs(int x, int y, int z); - public abstract PlotId getPlotId(PlotArea plotArea, int x, int y, int z); + public abstract PlotId getPlotId(int x, int y, int z); // If you have a circular plot, just return the corner if it were a square - public abstract Location getPlotBottomLocAbs(PlotArea plotArea, PlotId plotId); + public abstract Location getPlotBottomLocAbs(PlotId plotId); // the same applies here - public abstract Location getPlotTopLocAbs(PlotArea plotArea, PlotId plotId); + public abstract Location getPlotTopLocAbs(PlotId plotId); /* * Plot clearing (return false if you do not support some method) */ - public abstract boolean clearPlot(PlotArea plotArea, Plot plot, Runnable whenDone); + public abstract boolean clearPlot(Plot plot, Runnable whenDone); - public abstract boolean claimPlot(PlotArea plotArea, Plot plot); + public abstract boolean claimPlot(Plot plot); - public abstract boolean unClaimPlot(PlotArea plotArea, Plot plot, Runnable whenDone); + public abstract boolean unClaimPlot(Plot plot, Runnable whenDone); - public abstract Location getSignLoc(PlotArea plotArea, Plot plot); + public abstract Location getSignLoc(Plot plot); /* * Plot set functions (return false if you do not support the specific set * method). */ - public abstract String[] getPlotComponents(PlotArea plotArea, PlotId plotId); + public abstract String[] getPlotComponents(PlotId plotId); - public abstract boolean setComponent(PlotArea plotArea, PlotId plotId, String component, - BlockBucket blocks); + public abstract boolean setComponent(PlotId plotId, String component, + BlockBucket blocks); /* * PLOT MERGING (return false if your generator does not support plot * merging). */ - public abstract boolean createRoadEast(PlotArea plotArea, Plot plot); + public abstract boolean createRoadEast(Plot plot); - public abstract boolean createRoadSouth(PlotArea plotArea, Plot plot); + public abstract boolean createRoadSouth(Plot plot); - public abstract boolean createRoadSouthEast(PlotArea plotArea, Plot plot); + public abstract boolean createRoadSouthEast(Plot plot); - public abstract boolean removeRoadEast(PlotArea plotArea, Plot plot); + public abstract boolean removeRoadEast(Plot plot); - public abstract boolean removeRoadSouth(PlotArea plotArea, Plot plot); + public abstract boolean removeRoadSouth(Plot plot); - public abstract boolean removeRoadSouthEast(PlotArea plotArea, Plot plot); + public abstract boolean removeRoadSouthEast(Plot plot); - public abstract boolean startPlotMerge(PlotArea plotArea, List plotIds); + public abstract boolean startPlotMerge(List plotIds); - public abstract boolean startPlotUnlink(PlotArea plotArea, List plotIds); + public abstract boolean startPlotUnlink(List plotIds); - public abstract boolean finishPlotMerge(PlotArea plotArea, List plotIds); + public abstract boolean finishPlotMerge(List plotIds); - public abstract boolean finishPlotUnlink(PlotArea plotArea, List plotIds); + public abstract boolean finishPlotUnlink(List plotIds); - public void exportTemplate(PlotArea plotArea) throws IOException { + public void exportTemplate() throws IOException { HashSet files = new HashSet<>(Collections.singletonList( new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea)))); 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 ab8a01078..9998f88f2 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 @@ -14,23 +14,23 @@ public class SinglePlotManager extends PlotManager { super(plotArea); } - @Override public PlotId getPlotIdAbs(PlotArea plotArea, int x, int y, int z) { + @Override public PlotId getPlotIdAbs(int x, int y, int z) { return new PlotId(0, 0); } - @Override public PlotId getPlotId(PlotArea plotArea, int x, int y, int z) { + @Override public PlotId getPlotId(int x, int y, int z) { return new PlotId(0, 0); } - @Override public Location getPlotBottomLocAbs(PlotArea plotArea, PlotId plotId) { + @Override public Location getPlotBottomLocAbs(PlotId plotId) { return new Location(plotId.toCommaSeparatedString(), -30000000, 0, -30000000); } - @Override public Location getPlotTopLocAbs(PlotArea plotArea, PlotId plotId) { + @Override public Location getPlotTopLocAbs(PlotId plotId) { return new Location(plotId.toCommaSeparatedString(), 30000000, 0, 30000000); } - @Override public boolean clearPlot(PlotArea plotArea, Plot plot, final Runnable whenDone) { + @Override public boolean clearPlot(Plot plot, final Runnable whenDone) { SetupUtils.manager.unload(plot.getWorldName(), false); final File worldFolder = new File(PlotSquared.get().IMP.getWorldContainer(), plot.getWorldName()); @@ -43,68 +43,68 @@ public class SinglePlotManager extends PlotManager { return true; } - @Override public boolean claimPlot(PlotArea plotArea, Plot plot) { + @Override public boolean claimPlot(Plot plot) { // TODO return true; } - @Override public boolean unClaimPlot(PlotArea plotArea, Plot plot, Runnable whenDone) { + @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { if (whenDone != null) { whenDone.run(); } return true; } - @Override public Location getSignLoc(PlotArea plotArea, Plot plot) { + @Override public Location getSignLoc(Plot plot) { return null; } - @Override public String[] getPlotComponents(PlotArea plotArea, PlotId plotId) { + @Override public String[] getPlotComponents(PlotId plotId) { return new String[0]; } - @Override public boolean setComponent(PlotArea plotArea, PlotId plotId, String component, - BlockBucket blocks) { + @Override public boolean setComponent(PlotId plotId, String component, + BlockBucket blocks) { return false; } - @Override public boolean createRoadEast(PlotArea plotArea, Plot plot) { + @Override public boolean createRoadEast(Plot plot) { return false; } - @Override public boolean createRoadSouth(PlotArea plotArea, Plot plot) { + @Override public boolean createRoadSouth(Plot plot) { return false; } - @Override public boolean createRoadSouthEast(PlotArea plotArea, Plot plot) { + @Override public boolean createRoadSouthEast(Plot plot) { return false; } - @Override public boolean removeRoadEast(PlotArea plotArea, Plot plot) { + @Override public boolean removeRoadEast(Plot plot) { return false; } - @Override public boolean removeRoadSouth(PlotArea plotArea, Plot plot) { + @Override public boolean removeRoadSouth(Plot plot) { return false; } - @Override public boolean removeRoadSouthEast(PlotArea plotArea, Plot plot) { + @Override public boolean removeRoadSouthEast(Plot plot) { return false; } - @Override public boolean startPlotMerge(PlotArea plotArea, List plotIds) { + @Override public boolean startPlotMerge(List plotIds) { return false; } - @Override public boolean startPlotUnlink(PlotArea plotArea, List plotIds) { + @Override public boolean startPlotUnlink(List plotIds) { return false; } - @Override public boolean finishPlotMerge(PlotArea plotArea, List plotIds) { + @Override public boolean finishPlotMerge(List plotIds) { return false; } - @Override public boolean finishPlotUnlink(PlotArea plotArea, List plotIds) { + @Override public boolean finishPlotUnlink(List plotIds) { return false; } } From d106262454f4b470ad3c6d0ffad3302e131a6052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Fri, 31 May 2019 15:32:24 +0200 Subject: [PATCH 023/258] Have PlotAreas create their own PlotManager Leads to cleaner code, less need for instanceof and casting, as a PlotArea knows which kind of PlotManager it needs to make --- .../bukkit/generator/DelegatePlotGenerator.java | 4 ---- .../plotsquared/plot/PlotSquared.java | 2 +- .../plotsquared/plot/generator/ClassicPlotManager.java | 10 +++------- .../plotsquared/plot/generator/HybridGen.java | 4 ---- .../plotsquared/plot/generator/HybridPlotManager.java | 10 +++------- .../plotsquared/plot/generator/HybridPlotWorld.java | 6 ++++++ .../plot/generator/IndependentPlotGenerator.java | 8 -------- .../plotsquared/plot/generator/SquarePlotManager.java | 10 +++------- .../plotsquared/plot/object/PlotArea.java | 4 +++- .../plotsquared/plot/object/PlotManager.java | 1 - .../plotsquared/plot/object/worlds/SinglePlotArea.java | 5 +++++ .../plot/object/worlds/SingleWorldGenerator.java | 4 ---- 12 files changed, 24 insertions(+), 44 deletions(-) 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 f07c65cbf..c8b57dc78 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 @@ -30,10 +30,6 @@ import java.util.Random; @Override public void initialize(PlotArea area) { } - @Override public PlotManager getNewPlotManager(PlotArea plotArea) { - return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotManager(plotArea); - } - @Override public String getName() { return this.chunkGenerator.getClass().getName(); } 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 e3164427c..589309385 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 @@ -1086,7 +1086,7 @@ import java.util.zip.ZipInputStream; } // Conventional plot generator PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null); - PlotManager plotManager = plotGenerator.getNewPlotManager(plotArea); + PlotManager plotManager = plotArea.getPlotManager(); PlotSquared.log(Captions.PREFIX + "&aDetected world load for '" + world + "'"); PlotSquared .log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator); 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 a822c3243..6d5e159f8 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 @@ -15,13 +15,9 @@ public class ClassicPlotManager extends SquarePlotManager { private final ClassicPlotWorld classicPlotWorld; - public ClassicPlotManager(PlotArea plotArea) { - super(plotArea); - if (plotArea instanceof ClassicPlotWorld){ - classicPlotWorld = (ClassicPlotWorld)plotArea; - } else { - throw new RuntimeException("ClassicPlotManager requires plotArea to be an instance of ClassicPlotWorld"); - } + public ClassicPlotManager(ClassicPlotWorld classicPlotWorld) { + super(classicPlotWorld); + this.classicPlotWorld = classicPlotWorld; } @Override public boolean setComponent(PlotId plotId, String component, 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 8d34f5d25..81d76b929 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 @@ -253,10 +253,6 @@ public class HybridGen extends IndependentPlotGenerator { return new HybridPlotWorld(world, id, this, min, max); } - @Override public PlotManager getNewPlotManager(PlotArea plotArea) { - return new HybridPlotManager(plotArea); - } - @Override public void initialize(PlotArea area) { // All initialization is done in the PlotArea class } 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 0bbf67557..ac10f7aab 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 @@ -23,13 +23,9 @@ public class HybridPlotManager extends ClassicPlotManager { private final HybridPlotWorld hybridPlotWorld; - public HybridPlotManager(PlotArea plotArea) { - super(plotArea); - if (plotArea instanceof HybridPlotWorld){ - hybridPlotWorld = (HybridPlotWorld)plotArea; - } else { - throw new RuntimeException("HybridPlotManager requires plotArea to be an instance of HybridPlotWorld"); - } + public HybridPlotManager(HybridPlotWorld hybridPlotWorld) { + super(hybridPlotWorld); + this.hybridPlotWorld = hybridPlotWorld; } @Override public void exportTemplate() throws IOException { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index e8f1ed06a..101b6fcb3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -7,6 +7,7 @@ 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.schematic.Schematic; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -43,6 +44,11 @@ public class HybridPlotWorld extends ClassicPlotWorld { super(worldName, id, generator, min, max); } + @Override + protected PlotManager createManager() { + return new HybridPlotManager(this); + } + public static byte wrap(byte data, int start) { if ((data >= start) && (data < (start + 4))) { data = (byte) ((((data - start) + 2) & 3) + start); 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 44703be52..459aee272 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 @@ -49,14 +49,6 @@ public abstract class IndependentPlotGenerator { */ public abstract PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max); - /** - * Return a new PlotManager object. - * - * @return - * @param plotArea - */ - public abstract PlotManager getNewPlotManager(PlotArea plotArea); - /** * If any additional setup options need to be changed before world creation. * - e.g. If setup doesn't support some standard options 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 967802b24..be19930fd 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 @@ -16,13 +16,9 @@ public abstract class SquarePlotManager extends GridPlotManager { private final SquarePlotWorld squarePlotWorld; - public SquarePlotManager(PlotArea plotArea) { - super(plotArea); - if (plotArea instanceof SquarePlotWorld){ - squarePlotWorld = (SquarePlotWorld)plotArea; - } else { - throw new RuntimeException("SquarePlotManager requires plotArea to be an instance of SquarePlotWorld"); - } + public SquarePlotManager(SquarePlotWorld squarePlotWorld) { + super(squarePlotWorld); + this.squarePlotWorld = squarePlotWorld; } @Override 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 885371c0e..3ed1e2c95 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 @@ -81,7 +81,7 @@ public abstract class PlotArea { @Nullable final PlotId max) { this.worldname = worldName; this.id = id; - this.manager = generator.getNewPlotManager(this); + this.manager = createManager(); this.generator = generator; if (min == null || max == null) { if (min != max) { @@ -102,6 +102,8 @@ public abstract class PlotArea { } } + protected abstract PlotManager createManager(); + public LocalBlockQueue getQueue(final boolean autoQueue) { return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index f00fb40db..ac2a57058 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -13,7 +13,6 @@ public abstract class PlotManager { private final PlotArea plotArea; public PlotManager(PlotArea plotArea) { - this.plotArea = plotArea; } 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 e1f6505f6..41801c087 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 @@ -26,6 +26,11 @@ public class SinglePlotArea extends GridPlotWorld { this.DEFAULT_HOME = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE); } + @Override + protected PlotManager createManager() { + return new SinglePlotManager(this); + } + @Override public void loadConfiguration(ConfigurationSection config) { VOID = config.getBoolean("void", false); } 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 a821c03a4..9ba3df278 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 @@ -81,10 +81,6 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { return ((SinglePlotAreaManager) PlotSquared.get().getPlotAreaManager()).getArea(); } - @Override public PlotManager getNewPlotManager(PlotArea plotArea) { - return new SinglePlotManager(plotArea); - } - @Override public void initialize(PlotArea area) { } From a94c588a1727696ec6a744b7b1f63b4d834e40a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Fri, 31 May 2019 21:16:29 +0200 Subject: [PATCH 024/258] Check if location has PlotArea to avoid NPE --- .../plotsquared/plot/commands/DebugRoadRegen.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index 1880cd6b0..7d69db823 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -4,6 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -16,13 +17,17 @@ public class DebugRoadRegen extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { Location loc = player.getLocation(); - PlotManager manager = loc.getPlotArea().getPlotManager(); + PlotArea area = loc.getPlotArea(); + if (area == null) { + return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); + } Plot plot = player.getCurrentPlot(); if (plot == null) { Captions.NOT_IN_PLOT.send(player); } else if (plot.isMerged()) { Captions.REQUIRES_UNMERGED.send(player); } else { + PlotManager manager = area.getPlotManager(); manager.createRoadEast(plot); manager.createRoadSouth(plot); manager.createRoadSouthEast(plot); From 7f404e1cf50f7a675d8334d9efd8630ae8233bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Sat, 1 Jun 2019 14:43:29 +0200 Subject: [PATCH 025/258] Fix plot walls after running regenallroads Also clears whatever was above the plot wall, such as pieces of the road. --- .../plot/generator/ClassicPlotManager.java | 32 +++++++++++++++++++ .../plot/generator/HybridUtils.java | 8 +++++ .../plotsquared/plot/object/PlotManager.java | 2 ++ .../plot/object/worlds/SinglePlotManager.java | 2 ++ .../plot/util/block/LocalBlockQueue.java | 24 ++++++++++---- 5 files changed, 62 insertions(+), 6 deletions(-) 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 6d5e159f8..baa0575e3 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 @@ -250,17 +250,28 @@ public class ClassicPlotManager extends SquarePlotManager { Location top = plot.getExtendedTopAbs().add(1, 0, 1); LocalBlockQueue queue = classicPlotWorld.getQueue(false); int y = classicPlotWorld.WALL_HEIGHT + 1; + StringPlotBlock air = PlotBlock.get("air"); if (!plot.getMerged(Direction.NORTH)) { int z = bot.getZ(); for (int x = bot.getX(); x < top.getX(); x++) { queue.setBlock(x, y, z, blocks.getBlock()); } + // Replace all blocks above the wall with air + queue.setCuboid( + new Location(top.getWorld(), top.getX(), y + 1, bot.getZ()), + new Location(bot.getWorld(), bot.getX(), 255, bot.getZ()), + air); } if (!plot.getMerged(Direction.WEST)) { int x = bot.getX(); for (int z = bot.getZ(); z < top.getZ(); z++) { queue.setBlock(x, y, z, blocks.getBlock()); } + // Replace all blocks above the wall with air + queue.setCuboid( + new Location(top.getWorld(), bot.getX(), y + 1, top.getZ()), + new Location(bot.getWorld(), bot.getX(), 255, bot.getZ()), + air); } if (!plot.getMerged(Direction.SOUTH)) { int z = top.getZ(); @@ -268,6 +279,11 @@ public class ClassicPlotManager extends SquarePlotManager { x < top.getX() + (plot.getMerged(Direction.EAST) ? 0 : 1); x++) { queue.setBlock(x, y, z, blocks.getBlock()); } + // Replace all blocks above the wall with air + queue.setCuboid( + new Location(top.getWorld(), top.getX(), y + 1, top.getZ()), + new Location(bot.getWorld(), bot.getX(), 255, top.getZ()), + air); } if (!plot.getMerged(Direction.EAST)) { int x = top.getX(); @@ -275,6 +291,11 @@ public class ClassicPlotManager extends SquarePlotManager { z < top.getZ() + (plot.getMerged(Direction.SOUTH) ? 0 : 1); z++) { queue.setBlock(x, y, z, blocks.getBlock()); } + // Replace all blocks above the wall with air + queue.setCuboid( + new Location(top.getWorld(), top.getX(), y + 1, top.getZ()), + new Location(bot.getWorld(), top.getX(), 255, bot.getZ()), + air); } queue.enqueue(); return true; @@ -439,6 +460,17 @@ public class ClassicPlotManager extends SquarePlotManager { return true; } + @Override public boolean regenerateAllPlotWalls() { + for (Plot plot : classicPlotWorld.getPlots()) { + if (plot.hasOwner()) { + setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK); + } else { + setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); + } + } + return true; + } + @Override public boolean startPlotMerge(List plotIds) { return true; } 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 f98d6ae88..a586af012 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 @@ -153,6 +153,9 @@ public abstract class HybridUtils { PlotSquared.debug("PROGRESS: " + 100 * (2048 - chunks.size()) / 2048 + "%"); } if (regions.isEmpty() && chunks.isEmpty()) { + PlotSquared.debug("&3Regenerating plot walls"); + regeneratePlotWalls(area); + HybridUtils.UPDATE = false; PlotSquared.debug(Captions.PREFIX.s() + "Finished road conversion"); // CANCEL TASK @@ -377,4 +380,9 @@ public abstract class HybridUtils { } return false; } + + public boolean regeneratePlotWalls(final PlotArea area) { + PlotManager plotManager = area.getPlotManager(); + return plotManager.regenerateAllPlotWalls(); + } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index ac2a57058..74f0eddb7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -85,4 +85,6 @@ public abstract class PlotManager { return 255; } + public abstract boolean regenerateAllPlotWalls(); + } 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 9998f88f2..0c5a7e866 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 @@ -107,4 +107,6 @@ public class SinglePlotManager extends PlotManager { @Override public boolean finishPlotUnlink(List plotIds) { return false; } + + @Override public boolean regenerateAllPlotWalls() { return false; } } 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 87c0fec56..53196966e 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 @@ -97,9 +97,15 @@ public abstract class LocalBlockQueue { } public void setCuboid(Location pos1, Location pos2, PlotBlock block) { - for (int y = pos1.getY(); y <= Math.min(255, pos2.getY()); y++) { - for (int x = pos1.getX(); x <= pos2.getX(); x++) { - for (int z = pos1.getZ(); z <= pos2.getZ(); z++) { + int yMin = Math.min(pos1.getY(), pos2.getY()); + int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY())); + int xMin = Math.min(pos1.getX(), pos2.getX()); + int xMax = Math.max(pos1.getX(), pos2.getX()); + int zMin = Math.min(pos1.getZ(), pos2.getZ()); + int zMax = Math.max(pos1.getZ(), pos2.getZ()); + for (int y = yMin; y <= yMax; y++) { + for (int x = xMin; x <= xMax; x++) { + for (int z = zMin; z <= zMax; z++) { setBlock(x, y, z, block); } } @@ -107,9 +113,15 @@ public abstract class LocalBlockQueue { } public void setCuboid(Location pos1, Location pos2, BlockBucket blocks) { - for (int y = pos1.getY(); y <= Math.min(255, pos2.getY()); y++) { - for (int x = pos1.getX(); x <= pos2.getX(); x++) { - for (int z = pos1.getZ(); z <= pos2.getZ(); z++) { + int yMin = Math.min(pos1.getY(), pos2.getY()); + int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY())); + int xMin = Math.min(pos1.getX(), pos2.getX()); + int xMax = Math.max(pos1.getX(), pos2.getX()); + int zMin = Math.min(pos1.getZ(), pos2.getZ()); + int zMax = Math.max(pos1.getZ(), pos2.getZ()); + for (int y = yMin; y <= yMax; y++) { + for (int x = xMin; x <= xMax; x++) { + for (int z = zMin; z <= zMax; z++) { setBlock(x, y, z, blocks.getBlock()); } } From d6401d1638c2a17b5044036b76504ee55b315b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Sat, 1 Jun 2019 14:45:36 +0200 Subject: [PATCH 026/258] Allow running the road regeneration on a single region The plot-based road regeneration from before does not have the same behavior as the real road regeneration code. This new debug operation will regenerate the roads within the region the player is standing using the same code that regenerates all roads. This makes it much easier to tell if things are working correctly and as expected. --- .../plot/commands/DebugRoadRegen.java | 73 ++++++++++++++++++- .../plot/generator/HybridUtils.java | 10 +++ 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index 7d69db823..d6029186f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -2,6 +2,9 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; +import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; +import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; +import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; @@ -9,13 +12,37 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -@CommandDeclaration(command = "debugroadregen", usage = "/plot debugroadregen", +import java.util.Arrays; + +@CommandDeclaration(command = "debugroadregen", usage = DebugRoadRegen.USAGE, requiredType = RequiredType.NONE, - description = "Regenerate all roads based on the road schematic", + description = "Regenerate roads in the plot or region the user is, based on the road schematic", category = CommandCategory.DEBUG, permission = "plots.debugroadregen") public class DebugRoadRegen extends SubCommand { + public static final String USAGE = "/plot debugroadregen "; @Override public boolean onCommand(PlotPlayer player, String[] args) { + if (args.length < 1) { + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + DebugRoadRegen.USAGE); + return false; + } + String kind = args[0].toLowerCase(); + switch (kind) { + case "plot": + return regenPlot(player); + + case "region": + return regenRegion(player, Arrays.copyOfRange(args, 1, args.length)); + + default: + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + DebugRoadRegen.USAGE); + return false; + } + } + + public boolean regenPlot(PlotPlayer player) { Location loc = player.getLocation(); PlotArea area = loc.getPlotArea(); if (area == null) { @@ -37,4 +64,46 @@ public class DebugRoadRegen extends SubCommand { } return true; } + + public boolean regenRegion(PlotPlayer player, String[] args) { + int height = 0; + if (args.length == 1) { + try { + height = Integer.parseInt(args[0]); + } catch (NumberFormatException ignored) { + MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + DebugRoadRegen.USAGE); + return false; + } + } else if (args.length != 0) { + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + DebugRoadRegen.USAGE); + return false; + } + + Location loc = player.getLocation(); + PlotArea area = loc.getPlotArea(); + if (area == null) { + return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); + } + Plot plot = player.getCurrentPlot(); + PlotManager manager = area.getPlotManager(); + if (!(manager instanceof HybridPlotManager)) { + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD); + return true; + } + MainUtil + .sendMessage(player, "&cIf no schematic is set, the following will not do anything"); + MainUtil.sendMessage(player, + "&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic"); + MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads"); + boolean result = HybridUtils.manager.scheduleSingleRegionRoadUpdate(plot, height); + if (!result) { + MainUtil.sendMessage(player, + "&cCannot schedule mass schematic update! (Is one already in progress?)"); + return false; + } + return true; + } } 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 a586af012..a0b12d511 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 @@ -130,6 +130,16 @@ public abstract class HybridUtils { return scheduleRoadUpdate(area, regions, extend); } + public boolean scheduleSingleRegionRoadUpdate(Plot plot, int extend) { + if (HybridUtils.UPDATE) { + return false; + } + HybridUtils.UPDATE = true; + Set regions = new HashSet<>(); + regions.add(ChunkManager.manager.getChunkChunk(plot.getCenter())); + return scheduleRoadUpdate(plot.getArea(), regions, extend); + } + public boolean scheduleRoadUpdate(final PlotArea area, Set rgs, final int extend) { HybridUtils.regions = rgs; HybridUtils.area = area; From 485415c551d6b0a2afc6d4b2d4bda56a5696fdee Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 23 Jun 2019 14:17:44 +0100 Subject: [PATCH 027/258] 1.14 id support (#2403) * Plausible fix for 1.14 support. - Allow 1.14 blocks to be specified in LegacyBlocks, but only saved if the server version is 1.14. - No snazzy config conversion, but it seems most people managed to figure it out on their own anyway * Ignore the "severe" output because of new 1.13/14 blocks --- .../bukkit/util/BukkitLegacyMappings.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) 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 061712d02..78b919672 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 @@ -1,5 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; @@ -126,7 +127,7 @@ public final class BukkitLegacyMappings extends LegacyMappings { new LegacyBlock(43, 6, "double_step", "smooth_quartz"), new LegacyBlock(43, 8, "double_step", "smooth_stone"), new LegacyBlock(43, 9, "double_step", "smooth_sandstone"), - new LegacyBlock(44, "step", "stone_slab"), + new LegacyBlock(44, "step", "stone_slab", "smooth_stone_slab"), new LegacyBlock(44, 1, "step", "sandstone_slab"), new LegacyBlock(44, 2, "step", "petrified_oak_slab"), new LegacyBlock(44, 3, "step", "cobblestone_slab"), @@ -147,7 +148,7 @@ public final class BukkitLegacyMappings extends LegacyMappings { new LegacyBlock(58, "workbench", "crafting_table"), new LegacyBlock(59, "crops", "wheat"), new LegacyBlock(60, "soil", "farmland"), new LegacyBlock(61, "furnace"), new LegacyBlock(62, "burning_furnace"), - new LegacyBlock(63, "sign_post", "sign"), + new LegacyBlock(63, "sign_post", "sign", "oak_sign"), new LegacyBlock(64, "wooden_door", "oak_door"), new LegacyBlock(65, "ladder"), new LegacyBlock(66, "rails", "rail"), new LegacyBlock(67, "cobblestone_stairs"), new LegacyBlock(68, "wall_sign"), new LegacyBlock(69, "lever"), @@ -688,9 +689,7 @@ public final class BukkitLegacyMappings extends LegacyMappings { final LegacyBlock missingBlock = new LegacyBlock(material.getId(), materialName, materialName); missing.add(missingBlock); - } catch (Exception e) { - Bukkit.getLogger().severe( - "Error creating legacy block: " + materialName + ". Possibly a new block."); + } catch (Exception ignored) { } } } @@ -713,9 +712,8 @@ public final class BukkitLegacyMappings extends LegacyMappings { try { material = Material.getMaterial(legacyBlock.getLegacyName(), true); } catch (NoSuchMethodError error) { - PlotSquared.log( - "You can't use this version of PlotSquared on a server " - + "less than Minecraft 1.13.2"); + PlotSquared.log("You can't use this version of PlotSquared on a server " + + "less than Minecraft 1.13.2"); Bukkit.shutdown(); break; } @@ -831,6 +829,20 @@ public final class BukkitLegacyMappings extends LegacyMappings { this(numericalId, dataValue, legacyName, legacyName); } + LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName, + @NonNull final String newName, @NonNull final String new14Name) { + this(numericalId, dataValue, legacyName, + PlotSquared.get().IMP.getServerVersion()[1] == 13 ? newName : new14Name); + } + + LegacyBlock(final int numericalId, @NonNull final String legacyName, + @NonNull final String newName, @NonNull final String new14Name) { + this(numericalId, 0, legacyName, + Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1].equals("13") ? + newName : + new14Name); + } + LegacyBlock(final int numericalId, @NonNull final String legacyName, @NonNull final String newName) { this(numericalId, 0, legacyName, newName); From 83d1f1d629c193e8e3fc5982beea9a1728de6304 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 24 Jun 2019 13:37:59 +0100 Subject: [PATCH 028/258] 1.14 id support (#2404) * Plausible fix for 1.14 support. - Allow 1.14 blocks to be specified in LegacyBlocks, but only saved if the server version is 1.14. - No snazzy config conversion, but it seems most people managed to figure it out on their own anyway * Ignore the "severe" output because of new 1.13/14 blocks * fix oak_wall_sign for 1.14 --- .../plotsquared/bukkit/util/BukkitLegacyMappings.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 78b919672..2217c7eff 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 @@ -151,7 +151,8 @@ public final class BukkitLegacyMappings extends LegacyMappings { new LegacyBlock(63, "sign_post", "sign", "oak_sign"), new LegacyBlock(64, "wooden_door", "oak_door"), new LegacyBlock(65, "ladder"), new LegacyBlock(66, "rails", "rail"), new LegacyBlock(67, "cobblestone_stairs"), - new LegacyBlock(68, "wall_sign"), new LegacyBlock(69, "lever"), + new LegacyBlock(68, "wall_sign", "wall_sign", "oak_wall_sign"), + new LegacyBlock(69, "lever"), new LegacyBlock(70, "stone_plate", "stone_pressure_plate"), new LegacyBlock(71, "iron_door_block", "iron_door"), new LegacyBlock(72, "wood_plate", "oak_pressure_plate"), From 3074e45d2c8cc5105c709076ea20e99e622cb9c7 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 25 Jun 2019 11:43:28 +0200 Subject: [PATCH 029/258] Fixed #2325 The permission node does not exist on PlotMe anymore --- Bukkit/src/main/resources/plugin.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index d9cd4e9d4..4c6f33b10 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -251,9 +251,6 @@ permissions: plotme.limit.10: children: plots.plot.10: true - plotme.admin.home.other: - children: - plots.plot.: true plotme.admin.clear: children: plots.admin.command.clear: true From 246845607f6a687125f5f0cc7276a6b95fb8522f Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 27 Jun 2019 15:18:54 +0100 Subject: [PATCH 030/258] Let's first test against Material.matchMaterial for material matching (: Also update some dependencies --- Bukkit/build.gradle | 6 +++--- .../plotsquared/bukkit/util/BukkitLegacyMappings.java | 6 +++++- build.gradle | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 1d03fd0f8..1732ebb8b 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -11,10 +11,10 @@ repositories { dependencies { implementation project(':Core') compile project(':Core') - compile 'com.destroystokyo.paper:paper-api:1.14.1-R0.1-SNAPSHOT' + compile 'com.destroystokyo.paper:paper-api:1.14.3-R0.1-SNAPSHOT' //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' - implementation 'org.spigotmc:spigot-api:1.14.1-R0.1-SNAPSHOT' - compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT') + implementation 'org.spigotmc:spigot-api:1.14.3-R0.1-SNAPSHOT' + compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0') compile("net.milkbowl.vault:VaultAPI:1.7") { exclude module: 'bukkit' } 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 2217c7eff..44c262b10 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 @@ -7,6 +7,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -15,6 +16,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; + import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -769,7 +771,9 @@ public final class BukkitLegacyMappings extends LegacyMappings { idDataPair = new IdDataPair(Integer.parseInt(string), 0); } PlotBlock plotBlock; - if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.keySet().contains(workingString.toLowerCase())) { + if (Material.matchMaterial(workingString) != null) { + return PlotBlock.get(workingString); + } else if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.keySet().contains(workingString.toLowerCase())) { return PlotBlock.get(workingString); } else if ((plotBlock = fromLegacyToString(idDataPair)) != null) { return plotBlock; diff --git a/build.gradle b/build.gradle index c96224e82..ce53e06c8 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ subprojects { } dependencies { - implementation('com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT') { + implementation('com.sk89q.worldedit:worldedit-core:7.0.0') { exclude(module: 'bukkit-classloader-check') exclude(module: 'mockito-core') exclude(module: 'dummypermscompat') From 095dccd30f07af2f58775393704bb5a77434640a Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 28 Jun 2019 13:59:57 +0100 Subject: [PATCH 031/258] Revert changes to intersection generation --- .../plot/generator/ClassicPlotManager.java | 21 ------------------- 1 file changed, 21 deletions(-) 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 baa0575e3..118733f36 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 @@ -250,28 +250,17 @@ public class ClassicPlotManager extends SquarePlotManager { Location top = plot.getExtendedTopAbs().add(1, 0, 1); LocalBlockQueue queue = classicPlotWorld.getQueue(false); int y = classicPlotWorld.WALL_HEIGHT + 1; - StringPlotBlock air = PlotBlock.get("air"); if (!plot.getMerged(Direction.NORTH)) { int z = bot.getZ(); for (int x = bot.getX(); x < top.getX(); x++) { queue.setBlock(x, y, z, blocks.getBlock()); } - // Replace all blocks above the wall with air - queue.setCuboid( - new Location(top.getWorld(), top.getX(), y + 1, bot.getZ()), - new Location(bot.getWorld(), bot.getX(), 255, bot.getZ()), - air); } if (!plot.getMerged(Direction.WEST)) { int x = bot.getX(); for (int z = bot.getZ(); z < top.getZ(); z++) { queue.setBlock(x, y, z, blocks.getBlock()); } - // Replace all blocks above the wall with air - queue.setCuboid( - new Location(top.getWorld(), bot.getX(), y + 1, top.getZ()), - new Location(bot.getWorld(), bot.getX(), 255, bot.getZ()), - air); } if (!plot.getMerged(Direction.SOUTH)) { int z = top.getZ(); @@ -279,11 +268,6 @@ public class ClassicPlotManager extends SquarePlotManager { x < top.getX() + (plot.getMerged(Direction.EAST) ? 0 : 1); x++) { queue.setBlock(x, y, z, blocks.getBlock()); } - // Replace all blocks above the wall with air - queue.setCuboid( - new Location(top.getWorld(), top.getX(), y + 1, top.getZ()), - new Location(bot.getWorld(), bot.getX(), 255, top.getZ()), - air); } if (!plot.getMerged(Direction.EAST)) { int x = top.getX(); @@ -291,11 +275,6 @@ public class ClassicPlotManager extends SquarePlotManager { z < top.getZ() + (plot.getMerged(Direction.SOUTH) ? 0 : 1); z++) { queue.setBlock(x, y, z, blocks.getBlock()); } - // Replace all blocks above the wall with air - queue.setCuboid( - new Location(top.getWorld(), top.getX(), y + 1, top.getZ()), - new Location(bot.getWorld(), top.getX(), 255, bot.getZ()), - air); } queue.enqueue(); return true; From 23b88a375da7587175c6662bdd3d9d96e7fe7060 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 12 Jul 2019 02:18:08 +1000 Subject: [PATCH 032/258] player interact ignore cancel --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6c85a2265..f7210f108 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 @@ -1834,7 +1834,7 @@ import java.util.regex.Pattern; } } - @EventHandler(priority = EventPriority.LOW, ignoreCancelled = false) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); PlotPlayer pp = BukkitUtil.getPlayer(player); From feda094273a95b53401c188dd0f0b7df75132354 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 20 Jul 2019 01:29:30 +0200 Subject: [PATCH 033/258] Add kelp-grow flag Simply as the name says, add a controlled way to let kelp grow. --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 5 +++++ .../intellectualsites/plotsquared/plot/flag/Flags.java | 1 + 2 files changed, 6 insertions(+) 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 f7210f108..0d936b469 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 @@ -1223,6 +1223,11 @@ import java.util.regex.Pattern; event.setCancelled(true); } break; + case KELP: + if (Flags.KELP_GROW.isFalse(plot)) { + event.setCancelled(true); + } + break; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index 12d9e2b06..fc203a00b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -46,6 +46,7 @@ public final class Flags { public static final BooleanFlag GRASS_GROW = new BooleanFlag("grass-grow"); public static final BooleanFlag VINE_GROW = new BooleanFlag("vine-grow"); public static final BooleanFlag MYCEL_GROW = new BooleanFlag("mycel-grow"); + public static final BooleanFlag KELP_GROW = new BooleanFlag("kelp-grow"); public static final BooleanFlag DISABLE_PHYSICS = new BooleanFlag("disable-physics"); public static final BooleanFlag LIQUID_FLOW = new BooleanFlag("liquid-flow"); public static final BooleanFlag SNOW_MELT = new BooleanFlag("snow-melt"); From e8df39d3c4b68847623281a9c58789cda97cb202 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 21 Jul 2019 20:40:04 -0400 Subject: [PATCH 034/258] Fixes #2435 --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f7210f108..84cfc2e04 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 @@ -2379,7 +2379,7 @@ import java.util.regex.Pattern; Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(pp.getUUID())) { - if (Flags.USE.contains(plot, PlotBlock.get(event.getBucket().getId(), 0))) { + if (Flags.USE.contains(plot, PlotBlock.get(event.getBucket().name()))) { return; } if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { From d6779d977a8c767699a4847282ac2fd01f9fef88 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 21 Jul 2019 20:43:36 -0400 Subject: [PATCH 035/258] Fixes #2423 --- .../plotsquared/bukkit/uuid/FileUUIDHandler.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 8d2726bfd..64a6db419 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -210,14 +210,15 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } if (getUUIDMap().isEmpty()) { - for (OfflinePlotPlayer op : FileUUIDHandler.this.uuidWrapper.getOfflinePlayers()) { - long last = op.getLastPlayed(); + for (OfflinePlotPlayer offlinePlotPlayer : FileUUIDHandler.this.uuidWrapper + .getOfflinePlayers()) { + long last = offlinePlotPlayer.getLastPlayed(); if (last != 0) { - String name = op.getName(); + String name = offlinePlotPlayer.getName(); StringWrapper wrap = new StringWrapper(name); if (!toAdd.containsKey(wrap)) { - UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op); - toAdd.put(wrap, uuid); + UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(offlinePlotPlayer); + toAdd.putIfAbsent(wrap, uuid); if (ExpireManager.IMP != null) { ExpireManager.IMP.storeDate(uuid, last); } From dbf5084fa139f271a626614f6b55b8b6584bf6fe Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 25 Jul 2019 20:02:39 +0200 Subject: [PATCH 036/258] Reformat debugpaste And upgrade from IC -> IS --- .../plotsquared/plot/commands/DebugPaste.java | 25 ++++++++++--------- .../plotsquared/plot/commands/PluginCmd.java | 2 +- README.md | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 7fe7bfdd1..ba4e1b4ff 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -17,6 +17,8 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.nio.file.Files; import java.util.List; import java.util.stream.Collectors; @@ -47,11 +49,11 @@ import java.util.stream.Collectors; "# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your " + "problem\n\n"); b.append("# Server Information\n"); - b.append("server.version: ").append(PlotSquared.get().IMP.getServerImplementation()) + b.append("Server Version: ").append(PlotSquared.get().IMP.getServerImplementation()) .append("\n"); b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';') .append(!Settings.UUID.OFFLINE).append('\n'); - b.append("plugins:"); + b.append("Plugins:"); for (String id : PlotSquared.get().IMP.getPluginIds()) { String[] split = id.split(":"); String[] split2 = split[0].split(";"); @@ -63,16 +65,15 @@ import java.util.stream.Collectors; } b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); Runtime runtime = Runtime.getRuntime(); - b.append("memory.free: ").append(runtime.freeMemory()).append('\n'); - b.append("memory.max: ").append(runtime.maxMemory()).append('\n'); - b.append("java.specification.version: '") - .append(System.getProperty("java.specification.version")).append("'\n"); - b.append("java.vendor: '").append(System.getProperty("java.vendor")).append("'\n"); - b.append("java.version: '").append(System.getProperty("java.version")) - .append("'\n"); - b.append("os.arch: '").append(System.getProperty("os.arch")).append("'\n"); - b.append("os.name: '").append(System.getProperty("os.name")).append("'\n"); - b.append("os.version: '").append(System.getProperty("os.version")).append("'\n\n"); + RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); + b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n'); + b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n'); + b.append("Java Name: ").append(rb.getVmName()).append('\n'); + b.append("Java Version: '").append(System.getProperty("java.version")).append("'\n"); + b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n"); + b.append("Operating System: '").append(System.getProperty("os.name")).append("'\n"); + b.append("OS Version: ").append(System.getProperty("os.version")).append('\n'); + b.append("OS Arch: ").append(System.getProperty("os.arch")).append('\n'); b.append("# Okay :D Great. You are now ready to create your bug report!"); b.append( "\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index 81047ec9b..d284ce708 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -21,7 +21,7 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21"); MainUtil.sendMessage(player, - "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki"); + "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki"); MainUtil.sendMessage(player, "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); } diff --git a/README.md b/README.md index a00ec16ee..85ceaea93 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ is to provide a lag-free and smooth experience. * [[Jenkins (Dev Builds)](https://ci.athion.net/job/PlotSquared-Breaking/)] [[Jenkins (Releases)](https://ci.athion.net/job/PlotSquared-Releases/)] * [Spigot Page](https://www.spigotmc.org/resources/plotsquared.1177/) * [Discord](https://discord.gg/ngZCzbU) -* [Wiki](https://github.com/intellectualcrafters/plotsquared/wiki) +* [Wiki](https://github.com/IntellectualSites/PlotSquared/wiki) ### Developer Resources * [[JavaDoc](https://ci.athion.net/job/PlotSquared-Breaking/javadoc/)] From 16fcb2f505d63c3585ae921a900cab211de9fe74 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 30 Jul 2019 23:58:48 +0200 Subject: [PATCH 037/258] Update DebugUUID.java --- .../plotsquared/bukkit/commands/DebugUUID.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fdee5edf6..bb5930228 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 @@ -63,7 +63,7 @@ import java.util.Map.Entry; if (args.length != 2 || !"-o".equals(args[1])) { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot uuidconvert " + args[0] + " - o"); + "/plot uuidconvert " + args[0] + " -o"); MainUtil.sendMessage(player, "&cBe aware of the following!"); MainUtil.sendMessage(player, "&8 - &cUse the database command or another method to backup your plots beforehand"); From 1eba425087b2a97d8e082b208e06b79562b5c12e Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 3 Aug 2019 23:18:50 +0200 Subject: [PATCH 038/258] Migrate Templates to new format --- .../bug-issue-report-for-plotsquared.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md new file mode 100644 index 000000000..7badf3ae8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -0,0 +1,40 @@ +--- +name: Bug/Issue report for PlotSquared +about: Bug / Issue report about this plugin +title: '' +labels: '' +assignees: '' + +--- + +__*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and will receive limited support. Please consider upgrading to 1.13 for future support. Plugins exist for 1.13+ that bring back old behaviors found in 1.8*__ +# Bug report template + + + +**[REQUIRED] PlotSquared Version Number:** + +**[REQUIRED] Spigot/Paper Version Number:** + + +**[REQUIRED] Minecraft Version Number:** + +**Links to worlds.yml file and settings.yml file:** + + +**[REQUIRED] Description of the problem:** + +**Any relevant console output or screenshots:** + +**Plugins being used on the server:** + + +**How to replicate:** + + +**Checklist**: + +- [] I included all information required in the sections above +- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) +- [] I made sure I am using an up-to-date version of PlotSquared +- [] I made sure the bug/error is not caused by any other plugin From 59517647b5d469dcb71b0b0460643f27d44a40d3 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 3 Aug 2019 23:20:21 +0200 Subject: [PATCH 039/258] Remove old files --- .github/CONTRIBUTING.md | 2 - pom.xml | 103 ---------------------------------------- 2 files changed, 105 deletions(-) delete mode 100644 .github/CONTRIBUTING.md delete mode 100644 pom.xml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 9e26f91a6..000000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,2 +0,0 @@ -### Bugs -Please provide a `/plot debugpaste` if you are reporting a bug. diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 498ef295f..000000000 --- a/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - 4.0.0 - com.intellectualcrafters - - UTF-8 - - PlotSquared - 3.5.1-SNAPSHOT - PlotSquared - jar - - PlotSquared-Bukkit-${project.version} - Bukkit/src - - - true - - **/*.* - - Bukkit/src/main/resources/ - - - true - - **/*.* - - Core/src/main/resources/ - - - - - maven-compiler-plugin - 2.3.2 - - - **/Sponge/src/main/**/*.* - - 1.7 - 1.7 - - - - org.codehaus.mojo - build-helper-maven-plugin - - - generate-sources - - add-source - - - - Core/src - - - - - - - - - - spigot-repo - http://hub.spigotmc.org/nexus/content/groups/public/ - - - sk80q - http://maven.sk89q.com/artifactory/repo/ - - - vault - http://nexus.hc.to/content/repositories/pub_releases/ - - - empcraft-repo - http://empcraft.com/maven2 - - - - - org.spigotmc - spigot-api - 1.12-R0.1-SNAPSHOT - provided - - - com.sk89q - worldedit - 6.0.0-SNAPSHOT - jar - compile - - - net.milkbowl.vault - VaultAPI - 1.5 - provided - - - From 01dfdbe2ef5b8dbe2d3d622a36ed1071d7b35406 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sat, 3 Aug 2019 23:26:16 -0400 Subject: [PATCH 040/258] Merge with breaking --- .../plotsquared/plot/commands/DebugImportWorlds.java | 2 +- .../intellectualsites/plotsquared/plot/commands/Help.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index 6ce41e749..978c95e34 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -40,7 +40,7 @@ import java.util.concurrent.CompletableFuture; if (container.equals(new File("."))) { player.sendMessage( "World container must be configured to be a separate directory to your base files!"); - return; + return CompletableFuture.completedFuture(false); } for (File folder : container.listFiles()) { String name = folder.getName(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index afd0ec320..9e37441f5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -83,9 +83,10 @@ public class Help extends Command { .replaceAll(Captions.HELP_INFO_ITEM.s(), "%category%", c.toString().toLowerCase(), "%category_desc%", c.toString())); } - builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all") + builder.append("\n") + .append(Captions.HELP_INFO_ITEM.s().replaceAll("%category%", "all") .replaceAll("%category_desc%", "Display all commands")); - builder.append("\n").append(C.HELP_FOOTER.s()); + builder.append("\n").append(Captions.HELP_FOOTER.s()); MainUtil.sendMessage(player, builder.toString(), false); return true; } From 7542dbeab8a5e90f9461575f06d4fe3b6539b21c Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 4 Aug 2019 18:40:39 +0200 Subject: [PATCH 041/258] Fix gradle script --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index ce53e06c8..5739869c8 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ def revision = "" def buildNumber = "" def date = "" ext { - git = Grgit.open(dir: '.git') + git = Grgit.open(dir: new File(rootDir.toString()+'/.git')) date = git.head().getDate().format("yy.MM.dd") revision = "-${git.head().abbreviatedId}" parents = git.head().parentIds; @@ -43,7 +43,6 @@ ext { } } -// version = String.format("%s.%s%s%s", rootVersion, date, revision, buildNumber) version = String.format("%s.%s", rootVersion, buildNumber) description = rootProject.name From bd51292f4c806223b847986316541f358c745c66 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 5 Aug 2019 13:33:27 -0400 Subject: [PATCH 042/258] Get chunks asynchronously --- Bukkit/build.gradle | 10 +++--- .../plotsquared/bukkit/BukkitMain.java | 31 ++++++++++--------- .../bukkit/util/block/BukkitLocalQueue.java | 16 +++++++--- .../plot/util/block/BasicLocalBlockQueue.java | 17 ++++------ 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 9d00d7b99..6946b457b 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -10,14 +10,16 @@ repositories { mavenLocal() } +apply plugin: "com.github.johnrengelman.shadow" + dependencies { implementation project(':Core') compile project(':Core') - compile 'com.destroystokyo.paper:paper-api:1.14.3-R0.1-SNAPSHOT' + compile 'com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT' //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' - implementation 'org.spigotmc:spigot-api:1.14.3-R0.1-SNAPSHOT' + implementation 'org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT' compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0') - compile "io.papermc:paperlib:1.0.1" + compile "io.papermc:paperlib:1.0.2" compile("net.milkbowl.vault:VaultAPI:1.7") { exclude module: 'bukkit' } @@ -47,7 +49,7 @@ shadowJar { include(dependency('com.squareup.okhttp3:okhttp:3.14.0')) include(dependency('com.squareup.okio:okio:2.2.2')) include(dependency('org.jetbrains.kotlin:kotlin-stdlib:1.3.30')) - include(dependency("io.papermc:paperlib:1.0.1")) + include(dependency("io.papermc:paperlib:1.0.2")) } relocate 'io.papermc.lib', 'com.github.intellectualsites.plotsquared.bukkit.paperlib' // relocate('org.mcstats', 'com.plotsquared.stats') 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 89bd5678b..b5e4ecf1b 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 @@ -1,11 +1,19 @@ package com.github.intellectualsites.plotsquared.bukkit; import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; -import com.github.intellectualsites.plotsquared.bukkit.listeners.*; -import com.github.intellectualsites.plotsquared.bukkit.titles.DefaultTitle_111; +import com.github.intellectualsites.plotsquared.bukkit.listeners.ChunkListener; +import com.github.intellectualsites.plotsquared.bukkit.listeners.EntitySpawnListener; +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.block.BukkitLocalQueue; -import com.github.intellectualsites.plotsquared.bukkit.uuid.*; +import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper; +import com.github.intellectualsites.plotsquared.bukkit.uuid.FileUUIDHandler; +import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; +import com.github.intellectualsites.plotsquared.bukkit.uuid.OfflineUUIDWrapper; +import com.github.intellectualsites.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.IPlotMain; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -16,7 +24,12 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.HybridGen; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry; +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.SetupObject; 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; @@ -26,12 +39,9 @@ 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.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.extension.platform.Capability; import io.papermc.lib.PaperLib; import lombok.Getter; import lombok.NonNull; -import org.bukkit.Location; import org.bukkit.*; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Entity; @@ -56,13 +66,6 @@ import java.util.UUID; import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; -import javax.annotation.Nullable; -import java.io.File; -import java.lang.reflect.Method; -import java.util.*; - -import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; - public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { @Getter private static WorldEdit worldEdit; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 5d8f53355..28bb36efa 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -10,6 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQ import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; +import io.papermc.lib.PaperLib; import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -20,6 +21,7 @@ import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; import java.util.Locale; +import java.util.concurrent.ExecutionException; public class BukkitLocalQueue extends BasicLocalBlockQueue { @@ -69,7 +71,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { } } - @Override public final void setComponents(LocalChunk lc) { + @Override public final void setComponents(LocalChunk lc) + throws ExecutionException, InterruptedException { setBaseBlocks(lc); } @@ -77,14 +80,17 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { return Bukkit.getWorld(getWorld()); } - public Chunk getChunk(int x, int z) { - return getBukkitWorld().getChunkAt(x, z); + public Chunk getChunk(int x, int z) throws ExecutionException, InterruptedException { + return PaperLib.getChunkAtAsync(getBukkitWorld(), x, z).get(); } - public void setBaseBlocks(LocalChunk lc) { + public void setBaseBlocks(LocalChunk lc) throws ExecutionException, InterruptedException { World worldObj = Bukkit.getWorld(getWorld()); + if (worldObj == null) { + throw new NullPointerException("World cannot be null."); + } + PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true).get(); Chunk chunk = worldObj.getChunkAt(lc.getX(), lc.getZ()); - chunk.load(true); for (int layer = 0; layer < lc.baseblocks.length; layer++) { BaseBlock[] blocksLayer = lc.baseblocks[layer]; if (blocksLayer != null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 4ca62eb58..6993c3208 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -1,19 +1,16 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; 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 org.jetbrains.annotations.NotNull; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; +import java.util.concurrent.ExecutionException; public abstract class BasicLocalBlockQueue extends LocalBlockQueue { @@ -35,7 +32,8 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { @Override public abstract PlotBlock getBlock(int x, int y, int z); - public abstract void setComponents(LocalChunk lc); + public abstract void setComponents(LocalChunk lc) + throws ExecutionException, InterruptedException; @Override public final String getWorld() { return world; @@ -62,10 +60,8 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return false; } - public final boolean execute(final LocalChunk lc) { - if (lc == null) { - return false; - } + public final boolean execute(@NotNull LocalChunk lc) + throws ExecutionException, InterruptedException { this.setComponents(lc); return true; } @@ -154,7 +150,6 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { while (next()) { - ; } } }); From 20dd98d3b9686fcd29586219f77397f588a3710e Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Mon, 21 Jan 2019 09:20:33 +0100 Subject: [PATCH 043/258] Use PaperLib and make command task return completable futures --- Bukkit/build.gradle | 12 ++- .../plotsquared/bukkit/BukkitMain.java | 19 +---- .../bukkit/events/PlayerPlotTrustedEvent.java | 3 - .../bukkit/object/BukkitPlayer.java | 76 +++++++++--------- .../plotsquared/commands/Command.java | 34 +++++--- .../plotsquared/plot/commands/Add.java | 5 +- .../plotsquared/plot/commands/Buy.java | 4 +- .../plotsquared/plot/commands/Clear.java | 5 +- .../plotsquared/plot/commands/DebugExec.java | 4 +- .../plot/commands/DebugImportWorlds.java | 6 +- .../plotsquared/plot/commands/Grant.java | 9 ++- .../plotsquared/plot/commands/Help.java | 79 ++++++++++--------- .../plotsquared/plot/commands/Leave.java | 4 +- .../plot/commands/MainCommand.java | 55 +++++++------ .../plotsquared/plot/commands/Near.java | 5 +- .../plotsquared/plot/commands/Relight.java | 17 ++-- .../plotsquared/plot/commands/SubCommand.java | 6 +- .../plotsquared/plot/commands/Trust.java | 5 +- .../plotsquared/plot/commands/Visit.java | 23 +++--- .../plot/object/ConsolePlayer.java | 10 +-- .../plotsquared/plot/object/PlotPlayer.java | 14 ++-- 21 files changed, 213 insertions(+), 182 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 1732ebb8b..9d00d7b99 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -2,9 +2,11 @@ repositories { maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "http://nexus.hc.to/content/repositories/pub_releases" } - maven { url "https://repo.codemc.org/repository/maven-public" } - //maven { url 'http://repo.onarandombox.com/content/groups/public'} - maven { url 'https://papermc.io/repo/repository/maven-public/' } + maven { url = "https://repo.codemc.org/repository/maven-public" } + maven { + name 'papermc' + url 'https://papermc.io/repo/repository/maven-public/' + } mavenLocal() } @@ -15,6 +17,7 @@ dependencies { //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' implementation 'org.spigotmc:spigot-api:1.14.3-R0.1-SNAPSHOT' compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0') + compile "io.papermc:paperlib:1.0.1" compile("net.milkbowl.vault:VaultAPI:1.7") { exclude module: 'bukkit' } @@ -44,7 +47,10 @@ shadowJar { include(dependency('com.squareup.okhttp3:okhttp:3.14.0')) include(dependency('com.squareup.okio:okio:2.2.2')) include(dependency('org.jetbrains.kotlin:kotlin-stdlib:1.3.30')) + include(dependency("io.papermc:paperlib:1.0.1")) } + relocate 'io.papermc.lib', 'com.github.intellectualsites.plotsquared.bukkit.paperlib' + // relocate('org.mcstats', 'com.plotsquared.stats') archiveName = "${parent.name}-${project.name}-${parent.version}.jar" destinationDir = file '../target' } 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 68169328d..b5e4ecf1b 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 @@ -39,6 +39,7 @@ 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.sk89q.worldedit.WorldEdit; +import io.papermc.lib.PaperLib; import lombok.Getter; import lombok.NonNull; import org.bukkit.*; @@ -114,23 +115,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public void onEnable() { this.pluginName = getDescription().getName(); PlotPlayer.registerConverter(Player.class, BukkitUtil::getPlayer); - - if (Bukkit.getVersion().contains("git-Spigot")) { - // Uses System.out.println because the logger isn't initialized yet - System.out - .println("[P2] ========================== USE PAPER =========================="); - System.out.println("[P2] Paper offers a more complete API for us to work with"); - System.out.println("[P2] and we may come to rely on it in the future."); - System.out.println("[P2] It is also recommended out of a performance standpoint as"); - System.out - .println("[P2] it contains many improvements missing from Spigot and Bukkit."); - System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads"); - System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/"); - System.out.println("[P2] NOTE: This is only a recommendation"); - System.out.println("[P2] Spigot is still supported."); - System.out - .println("[P2] ==============================================================="); - } + PaperLib.suggestPaper(this); new PlotSquared(this, "Bukkit"); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java index 6d9805660..f2f9efe71 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java @@ -6,9 +6,6 @@ import org.bukkit.event.HandlerList; import java.util.UUID; -/** - * - */ public class PlayerPlotTrustedEvent extends PlotEvent { private static final HandlerList handlers = new HandlerList(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 7a8ad2fc5..7a34a9fdc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -6,12 +6,9 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.EconHandler; -import com.github.intellectualsites.plotsquared.plot.util.MathMan; -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.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.*; +import com.google.common.base.Preconditions; +import io.papermc.lib.PaperLib; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; @@ -20,11 +17,11 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventException; import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.RegisteredListener; import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Set; import java.util.UUID; @@ -42,21 +39,23 @@ public class BukkitPlayer extends PlotPlayer { *

Please do not use this method. Instead use * BukkitUtil.getPlayer(Player), as it caches player objects.

* - * @param player + * @param player Bukkit player instance */ - public BukkitPlayer(Player player) { + public BukkitPlayer(@Nonnull final Player player) { + Preconditions.checkNotNull(player, "Bukkit player instance cannot be null"); this.player = player; super.populatePersistentMetaMap(); } - public BukkitPlayer(Player player, boolean offline) { + public BukkitPlayer(@Nonnull final Player player, final boolean offline) { + Preconditions.checkNotNull(player, "Bukkit player instance cannot be null"); this.player = player; this.offline = offline; super.populatePersistentMetaMap(); } @Override public Location getLocation() { - Location location = super.getLocation(); + final Location location = super.getLocation(); return location == null ? BukkitUtil.getLocation(this.player) : location; } @@ -71,9 +70,10 @@ public class BukkitPlayer extends PlotPlayer { return this.player.getLastPlayed(); } - @Override public boolean canTeleport(Location loc) { - org.bukkit.Location to = BukkitUtil.getLocation(loc); - org.bukkit.Location from = player.getLocation(); + @Override public boolean canTeleport(@Nonnull final Location loc) { + Preconditions.checkNotNull(loc, "Bukkit location cannot be null"); + final org.bukkit.Location to = BukkitUtil.getLocation(loc); + final org.bukkit.Location from = player.getLocation(); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); callEvent(event); if (event.isCancelled() || !event.getTo().equals(to)) { @@ -90,32 +90,34 @@ public class BukkitPlayer extends PlotPlayer { } private void callEvent(final Event event) { - RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); - for (RegisteredListener listener : listeners) { + Preconditions.checkNotNull(event, "Event cannot be null"); + + final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); + for (final RegisteredListener listener : listeners) { if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) { continue; } try { listener.callEvent(event); - } catch (EventException e) { + } catch (final EventException e) { e.printStackTrace(); } } } - @Override public boolean hasPermission(String permission) { + @Override public boolean hasPermission(final String permission) { if (this.offline && EconHandler.manager != null) { return EconHandler.manager.hasPermission(getName(), permission); } return this.player.hasPermission(permission); } - @Override public int hasPermissionRange(String stub, int range) { + @Override public int hasPermissionRange(final String stub, final int range) { if (hasPermission(Captions.PERMISSION_ADMIN.s())) { return Integer.MAX_VALUE; } - String[] nodes = stub.split("\\."); - StringBuilder n = new StringBuilder(); + final String[] nodes = stub.split("\\."); + final StringBuilder n = new StringBuilder(); for (int i = 0; i < (nodes.length - 1); i++) { n.append(nodes[i]).append("."); if (!stub.equals(n + Captions.PERMISSION_STAR.s())) { @@ -131,7 +133,7 @@ public class BukkitPlayer extends PlotPlayer { if (CHECK_EFFECTIVE) { boolean hasAny = false; String stubPlus = stub + "."; - Set effective = player.getEffectivePermissions(); + final Set effective = player.getEffectivePermissions(); if (!effective.isEmpty()) { for (PermissionAttachmentInfo attach : effective) { String permStr = attach.getPermission(); @@ -170,11 +172,11 @@ public class BukkitPlayer extends PlotPlayer { return max; } - @Override public boolean isPermissionSet(String permission) { + @Override public boolean isPermissionSet(final String permission) { return this.player.isPermissionSet(permission); } - @Override public void sendMessage(String message) { + @Override public void sendMessage(final String message) { if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || ( System.currentTimeMillis() - this.getMeta("lastMessageTime") > 5000)) { setMeta("lastMessage", message); @@ -183,14 +185,13 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void teleport(Location location) { + @Override public void teleport(@Nonnull final Location location) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { return; } - this.player.teleport( - new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, - location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch()), - TeleportCause.COMMAND); + final org.bukkit.Location bukkitLocation = new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, + location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch()); + PaperLib.teleportAsync(player, bukkitLocation); } @Override public String getName() { @@ -208,14 +209,14 @@ public class BukkitPlayer extends PlotPlayer { this.player.setCompassTarget( new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX(), location.getY(), location.getZ())); - } @Override public Location getLocationFull() { return BukkitUtil.getLocationFull(this.player); } - @Override public void setWeather(PlotWeather weather) { + @Override public void setWeather(@Nonnull final PlotWeather weather) { + Preconditions.checkNotNull(weather, "Specified weather cannot be null"); switch (weather) { case CLEAR: this.player.setPlayerWeather(WeatherType.CLEAR); @@ -230,7 +231,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public PlotGameMode getGameMode() { + @Nonnull @Override public PlotGameMode getGameMode() { switch (this.player.getGameMode()) { case ADVENTURE: return PlotGameMode.ADVENTURE; @@ -245,7 +246,8 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void setGameMode(PlotGameMode gameMode) { + @Override public void setGameMode(@Nonnull final PlotGameMode gameMode) { + Preconditions.checkNotNull(gameMode, "Specified gamemode cannot be null"); switch (gameMode) { case ADVENTURE: this.player.setGameMode(GameMode.ADVENTURE); @@ -263,7 +265,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void setTime(long time) { + @Override public void setTime(final long time) { if (time != Long.MAX_VALUE) { this.player.setPlayerTime(time, false); } else { @@ -279,7 +281,9 @@ public class BukkitPlayer extends PlotPlayer { this.player.setAllowFlight(fly); } - @Override public void playMusic(Location location, PlotBlock id) { + @Override public void playMusic(@Nonnull final Location location, @Nonnull final PlotBlock id) { + Preconditions.checkNotNull(location, "Specified location cannot be null"); + Preconditions.checkNotNull(id, "Specified block cannot be null"); if (PlotBlock.isEverything(id) || id.isAir()) { // Let's just stop all the discs because why not? for (final Sound sound : Arrays.stream(Sound.values()) @@ -294,7 +298,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void kick(String message) { + @Override public void kick(final String message) { this.player.kickPlayer(message); } 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 277ebe2e7..e379edbac 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 @@ -20,6 +20,7 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.*; +import java.util.concurrent.CompletableFuture; public abstract class Command { @@ -72,14 +73,16 @@ public abstract class Command { && types[2] == String[].class && types[3] == RunnableVal3.class && types[4] == RunnableVal2.class) { Command tmp = new Command(this, true) { - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { try { method.invoke(Command.this, this, player, args, confirm, whenDone); + return CompletableFuture.completedFuture(true); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } + return CompletableFuture.completedFuture(false); } }; tmp.init(method.getAnnotation(CommandDeclaration.class)); @@ -261,9 +264,10 @@ public abstract class Command { * @param player Caller * @param args Arguments * @param confirm Instance, Success, Failure - * @return + * @return CompletableFuture true if the command executed fully, false in + * any other case */ - public void execute(PlotPlayer player, String[] args, + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { if (args.length == 0 || args[0] == null) { @@ -272,18 +276,18 @@ public abstract class Command { } else { Captions.COMMAND_SYNTAX.send(player, getUsage()); } - return; + return CompletableFuture.completedFuture(false); } if (this.allCommands.isEmpty()) { player.sendMessage( "Not Implemented: https://github.com/IntellectualSites/PlotSquared/issues/new"); - return; + return CompletableFuture.completedFuture(false); } Command cmd = getCommand(args[0]); if (cmd == null) { if (this.parent != null) { Captions.COMMAND_SYNTAX.send(player, getUsage()); - return; + return CompletableFuture.completedFuture(false); } // Help command try { @@ -293,7 +297,7 @@ public abstract class Command { // This will default certain syntax to the help command // e.g. /plot, /plot 1, /plot claiming MainCommand.getInstance().help.execute(player, args, null, null); - return; + return CompletableFuture.completedFuture(false); } catch (IllegalArgumentException ignored) { } // Command recommendation @@ -302,13 +306,16 @@ public abstract class Command { if (commands.isEmpty()) { MainUtil.sendMessage(player, Captions.DID_YOU_MEAN, MainCommand.getInstance().help.getUsage()); - return; + return CompletableFuture.completedFuture(false); } - String[] allargs = - Arrays.stream(args).map(String::toLowerCase).distinct().toArray(String[]::new); + HashSet setArgs = new HashSet<>(args.length); + for (String arg : args) { + setArgs.add(arg.toLowerCase()); + } + String[] allArgs = setArgs.toArray(new String[0]); int best = 0; for (Command current : commands) { - int match = getMatch(allargs, current); + int match = getMatch(allArgs, current); if (match > best) { cmd = current; } @@ -317,17 +324,18 @@ public abstract class Command { cmd = new StringComparison<>(args[0], this.allCommands).getMatchObject(); } MainUtil.sendMessage(player, Captions.DID_YOU_MEAN, cmd.getUsage()); - return; + return CompletableFuture.completedFuture(false); } String[] newArgs = Arrays.copyOfRange(args, 1, args.length); if (!cmd.checkArgs(player, newArgs) || !cmd.canExecute(player, true)) { - return; + return CompletableFuture.completedFuture(false); } try { cmd.execute(player, newArgs, confirm, whenDone); } catch (CommandException e) { e.perform(player); } + return CompletableFuture.completedFuture(true); } public boolean checkArgs(CommandCaller player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java index 57c910ea6..f6dba37a4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java @@ -15,6 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import java.util.Iterator; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "add", description = "Allow a user to build in a plot while you are online", @@ -25,7 +26,7 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); @@ -78,5 +79,7 @@ import java.util.UUID; MainUtil.sendMessage(player, Captions.MEMBER_ADDED); } }, null); + + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java index 6398b30be..dbfd37768 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.Optional; import java.util.Set; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "buy", description = "Buy the plot you are standing on", usage = "/plot buy", permission = "plots.buy", category = CommandCategory.CLAIMING, @@ -23,7 +24,7 @@ import java.util.Set; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, final RunnableVal2 whenDone) { @@ -65,5 +66,6 @@ import java.util.Set; player.deposit(price); whenDone.run(Buy.this, CommandResult.FAILURE); }); + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java index 6bde7ffd0..b45c52f65 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java @@ -14,6 +14,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; +import java.util.concurrent.CompletableFuture; + @CommandDeclaration(command = "clear", description = "Clear the plot you stand on", permission = "plots.clear", category = CommandCategory.APPEARANCE, usage = "/plot clear", aliases = "reset", confirmation = true) public class Clear extends Command { @@ -25,7 +27,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage()); @@ -59,5 +61,6 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue plot.addRunning(); } }, null); + return CompletableFuture.completedFuture(true); } } 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 76d060ed3..7e8e9cf34 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 @@ -32,6 +32,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = {"exec", "$"}, @@ -284,7 +285,7 @@ import java.util.UUID; System.getProperty("line.separator")); new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null, RequiredType.NONE, CommandCategory.DEBUG) { - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { try { @@ -295,6 +296,7 @@ import java.util.UUID; e.printStackTrace(); MainUtil.sendMessage(player, Captions.COMMAND_WENT_WRONG); } + return CompletableFuture.completedFuture(true); } }; return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index ddac91e4d..6ce41e749 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -16,6 +16,7 @@ import com.google.common.base.Charsets; import java.io.File; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "debugimportworlds", permission = "plots.admin", description = "Import worlds by player name", requiredType = RequiredType.CONSOLE, @@ -24,14 +25,14 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { // UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)) PlotAreaManager pam = PlotSquared.get().getPlotAreaManager(); if (!(pam instanceof SinglePlotAreaManager)) { player.sendMessage("Must be a single plot area!"); - return; + return CompletableFuture.completedFuture(false); } SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea(); PlotId id = new PlotId(0, 0); @@ -64,5 +65,6 @@ import java.util.UUID; } } player.sendMessage("Done!"); + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index a3e46dd08..60ecbeab0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING, usage = "/plot grant [player]", permission = "plots.grant", @@ -23,7 +24,7 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { checkTrue(args.length >= 1 && args.length <= 2, Captions.COMMAND_SYNTAX, getUsage()); @@ -33,7 +34,7 @@ import java.util.UUID; case "check": if (!Permissions.hasPermission(player, Captions.PERMISSION_GRANT.f(arg0))) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_GRANT.f(arg0)); - return; + return CompletableFuture.completedFuture(false); } if (args.length > 2) { break; @@ -46,7 +47,7 @@ import java.util.UUID; } if (uuid == null) { Captions.INVALID_PLAYER.send(player, args[1]); - return; + return CompletableFuture.completedFuture(false); } MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal() { @Override public void run(byte[] array) { @@ -77,7 +78,9 @@ import java.util.UUID; } } }); + return CompletableFuture.completedFuture(true); } Captions.COMMAND_SYNTAX.send(player, getUsage()); + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index 97c793221..bb13524da 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -12,6 +12,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.helpmenu.HelpMenu; +import java.util.concurrent.CompletableFuture; + @CommandDeclaration(command = "help", description = "Get this help menu", aliases = {"he", "?"}, category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use") public class Help extends Command { @@ -23,72 +25,73 @@ public class Help extends Command { return true; } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { switch (args.length) { case 0: - displayHelp(player, null, 0); - return; + return displayHelp(player, null, 0); case 1: if (MathMan.isInteger(args[0])) { try { - displayHelp(player, null, Integer.parseInt(args[0])); + return displayHelp(player, null, Integer.parseInt(args[0])); } catch (NumberFormatException ignored) { - displayHelp(player, null, 1); + return displayHelp(player, null, 1); } } else { - displayHelp(player, args[0], 1); + return displayHelp(player, args[0], 1); } - return; case 2: if (MathMan.isInteger(args[1])) { try { - displayHelp(player, args[0], Integer.parseInt(args[1])); + return displayHelp(player, args[0], Integer.parseInt(args[1])); } catch (NumberFormatException ignored) { - displayHelp(player, args[0], 1); + return displayHelp(player, args[0], 1); } } - return; + return CompletableFuture.completedFuture(false); default: Captions.COMMAND_SYNTAX.send(player, getUsage()); } + return CompletableFuture.completedFuture(true); } - public void displayHelp(CommandCaller player, String cat, int page) { - CommandCategory catEnum = null; - if (cat != null) { - if (StringMan.isEqualIgnoreCase(cat, "all")) { - catEnum = null; - } else { - for (CommandCategory c : CommandCategory.values()) { - if (StringMan.isEqualIgnoreCaseToAny(cat, c.name(), c.toString())) { - catEnum = c; - cat = c.name(); - break; + public CompletableFuture displayHelp(final CommandCaller player, final String catRaw, final int page) { + return CompletableFuture.supplyAsync(() -> { + String cat = catRaw; + + CommandCategory catEnum = null; + if (cat != null) { + if (!StringMan.isEqualIgnoreCase(cat, "all")) { + for (CommandCategory c : CommandCategory.values()) { + if (StringMan.isEqualIgnoreCaseToAny(cat, c.name(), c.toString())) { + catEnum = c; + cat = c.name(); + break; + } + } + if (catEnum == null) { + cat = null; } } - if (catEnum == null) { - cat = null; - } } - } - if (cat == null && page == 0) { - StringBuilder builder = new StringBuilder(); + if (cat == null && page == 0) { + StringBuilder builder = new StringBuilder(); builder.append(Captions.HELP_HEADER.s()); - for (CommandCategory c : CommandCategory.values()) { - builder.append("\n" + StringMan - .replaceAll(Captions.HELP_INFO_ITEM.s(), "%category%", - c.toString().toLowerCase(), "%category_desc%", c.toString())); - } + for (CommandCategory c : CommandCategory.values()) { + builder.append("\n").append(StringMan + .replaceAll(Captions.HELP_INFO_ITEM.s(), "%category%", c.toString().toLowerCase(), + "%category_desc%", c.toString())); + } builder.append("\n").append(Captions.HELP_INFO_ITEM.s().replaceAll("%category%", "all") .replaceAll("%category_desc%", Captions.HELP_DISPLAY_ALL_COMMANDS.s())); builder.append("\n" + Captions.HELP_FOOTER.s()); - MainUtil.sendMessage(player, builder.toString(), false); - return; - } - page--; - new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages() - .generatePage(page, getParent().toString()).render(); + MainUtil.sendMessage(player, builder.toString(), false); + return true; + } + new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages() + .generatePage(page - 1, getParent().toString()).render(); + return true; + }); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index be29265bf..cbc227bd3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "leave", description = "Removes self from being trusted or a member of the plot", @@ -20,7 +21,7 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); @@ -44,5 +45,6 @@ import java.util.UUID; MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, 1); } } + return CompletableFuture.completedFuture(true); } } 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 d1daa73cd..31e599976 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 @@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import java.util.Arrays; +import java.util.concurrent.CompletableFuture; /** * PlotSquared command class. @@ -176,6 +177,8 @@ public class MainCommand extends Command { @Override public void run(Command cmd, CommandResult result) { // Post command stuff!? } + }).thenAccept(result -> { + // TODO: Something with the command result }); } catch (CommandException e) { e.perform(player); @@ -184,7 +187,7 @@ public class MainCommand extends Command { return true; } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { // Clear perm caching // @@ -215,37 +218,32 @@ public class MainCommand extends Command { args = Arrays.copyOfRange(args, 1, args.length); } if (args.length >= 2 && !args[0].isEmpty() && args[0].charAt(0) == '-') { - switch (args[0].substring(1)) { - case "f": - confirm = new RunnableVal3() { - @Override - public void run(Command cmd, Runnable success, Runnable failure) { - if (EconHandler.manager != null) { - PlotArea area = player.getApplicablePlotArea(); - if (area != null) { - Expression priceEval = - area.PRICES.get(cmd.getFullId()); - Double price = - priceEval != null ? priceEval.evaluate(0d) : 0d; - if (price != 0d - && EconHandler.manager.getMoney(player) < price) { - if (failure != null) { - failure.run(); - } - return; + if ("f".equals(args[0].substring(1))) { + confirm = new RunnableVal3() { + @Override public void run(Command cmd, Runnable success, Runnable failure) { + if (EconHandler.manager != null) { + PlotArea area = player.getApplicablePlotArea(); + if (area != null) { + Expression priceEval = area.PRICES.get(cmd.getFullId()); + Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; + if (price != 0d + && EconHandler.manager.getMoney(player) < price) { + if (failure != null) { + failure.run(); } + return; } } - if (success != null) { - success.run(); - } } - }; - args = Arrays.copyOfRange(args, 1, args.length); - break; - default: - Captions.INVALID_COMMAND_FLAG.send(player); - return; + if (success != null) { + success.run(); + } + } + }; + args = Arrays.copyOfRange(args, 1, args.length); + } else { + Captions.INVALID_COMMAND_FLAG.send(player); + return CompletableFuture.completedFuture(false); } } } @@ -275,6 +273,7 @@ public class MainCommand extends Command { player.setMeta(PlotPlayer.META_LAST_PLOT, plot); } } + return CompletableFuture.completedFuture(true); } @Override public boolean canExecute(CommandCaller player, boolean message) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java index 3d73c7bbe..d897fb3cf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java @@ -9,6 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import java.util.concurrent.CompletableFuture; + @CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players", usage = "/plot near", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) public class Near extends Command { @@ -16,10 +18,11 @@ public class Near extends Command { super(MainCommand.getInstance(), true); } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); Captions.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", ")); + return CompletableFuture.completedFuture(true); } } 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 65656117a..321f91d24 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 @@ -7,7 +7,7 @@ import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; -import java.util.HashSet; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight", category = CommandCategory.DEBUG) public class Relight extends Command { @@ -15,25 +15,24 @@ import java.util.HashSet; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { final Plot plot = player.getCurrentPlot(); if (plot == null) { Captions.NOT_IN_PLOT.send(player); - return; + return CompletableFuture.completedFuture(false); } - HashSet regions = plot.getRegions(); final LocalBlockQueue queue = plot.getArea().getQueue(false); ChunkManager.chunkTask(plot, new RunnableVal() { @Override public void run(int[] value) { queue.fixChunkLighting(value[0], value[1]); } - }, new Runnable() { - @Override public void run() { - plot.refreshChunks(); - Captions.SET_BLOCK_ACTION_FINISHED.send(player); - } + }, () -> { + plot.refreshChunks(); + Captions.SET_BLOCK_ACTION_FINISHED.send(player); }, 5); + + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java index 91dd83069..458442ff2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java @@ -7,6 +7,8 @@ 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 java.util.concurrent.CompletableFuture; + /** * SubCommand class * @@ -28,10 +30,10 @@ public abstract class SubCommand extends Command { return true; } - @Override public void execute(PlotPlayer player, String[] args, + @Override public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { - onCommand(player, args); + return CompletableFuture.completedFuture(onCommand(player, args)); } public abstract boolean onCommand(PlotPlayer player, String[] args); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java index 81a508ee3..630e636d6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java @@ -15,6 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import java.util.Iterator; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.PLAYER, usage = "/plot trust ", @@ -25,7 +26,7 @@ import java.util.UUID; super(MainCommand.getInstance(), true); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { final Plot currentPlot = player.getCurrentPlot(); @@ -81,5 +82,7 @@ import java.util.UUID; MainUtil.sendMessage(player, Captions.TRUSTED_ADDED); } }, null); + + return CompletableFuture.completedFuture(true); } } 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 f5dc5710e..c9e7ed8e8 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 @@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.*; +import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "visit", permission = "plots.visit", description = "Visit someones plot", usage = "/plot visit [|||] [#]", @@ -26,7 +27,7 @@ import java.util.*; return tabOf(player, args, space, getUsage()); } - @Override public void execute(final PlotPlayer player, String[] args, + @Override public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, final RunnableVal2 whenDone) throws CommandException { if (args.length == 1 && args[0].contains(":")) { @@ -41,7 +42,7 @@ import java.util.*; if (!MathMan.isInteger(args[1])) { Captions.NOT_VALID_NUMBER.send(player, "(1, ∞)"); Captions.COMMAND_SYNTAX.send(player, getUsage()); - return; + return CompletableFuture.completedFuture(false); } page = Integer.parseInt(args[2]); case 2: @@ -50,12 +51,12 @@ import java.util.*; if (sortByArea == null) { Captions.NOT_VALID_NUMBER.send(player, "(1, ∞)"); Captions.COMMAND_SYNTAX.send(player, getUsage()); - return; + return CompletableFuture.completedFuture(false); } UUID user = UUIDHandler.getUUIDFromString(args[0]); if (user == null) { Captions.COMMAND_SYNTAX.send(player, getUsage()); - return; + return CompletableFuture.completedFuture(false); } unsorted = PlotSquared.get().getBasePlots(user); shouldSortByArea = true; @@ -93,7 +94,7 @@ import java.util.*; } if (unsorted == null || unsorted.isEmpty()) { Captions.FOUND_NO_PLOTS.send(player); - return; + return CompletableFuture.completedFuture(false); } unsorted = new ArrayList<>(unsorted); if (unsorted.size() > 1) { @@ -101,7 +102,7 @@ import java.util.*; } if (page < 1 || page > unsorted.size()) { Captions.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")"); - return; + return CompletableFuture.completedFuture(false); } List plots; if (shouldSortByArea) { @@ -114,23 +115,23 @@ import java.util.*; if (!plot.hasOwner()) { if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_UNOWNED)) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_UNOWNED); - return; + return CompletableFuture.completedFuture(false); } } else if (plot.isOwner(player.getUUID())) { if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OWNED) && !Permissions .hasPermission(player, Captions.PERMISSION_HOME)) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OWNED); - return; + return CompletableFuture.completedFuture(false); } } else if (plot.isAdded(player.getUUID())) { if (!Permissions.hasPermission(player, Captions.PERMISSION_SHARED)) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_SHARED); - return; + return CompletableFuture.completedFuture(false); } } else { if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OTHER)) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OTHER); - return; + return CompletableFuture.completedFuture(false); } } confirm.run(this, () -> { @@ -140,6 +141,8 @@ import java.util.*; whenDone.run(Visit.this, CommandResult.FAILURE); } }, () -> whenDone.run(Visit.this, CommandResult.FAILURE)); + + return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 9a2fb193b..9f4677f4f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -34,7 +34,7 @@ public class ConsolePlayer extends PlotPlayer { return instance; } - @Override public boolean canTeleport(Location loc) { + @Override public boolean canTeleport(@Nonnull Location loc) { return true; } @@ -100,14 +100,14 @@ public class ConsolePlayer extends PlotPlayer { return RequiredType.CONSOLE; } - @Override public void setWeather(PlotWeather weather) { + @Override public void setWeather(@Nonnull PlotWeather weather) { } - @Override public PlotGameMode getGameMode() { + @Nonnull @Override public PlotGameMode getGameMode() { return PlotGameMode.NOT_SET; } - @Override public void setGameMode(PlotGameMode gameMode) { + @Override public void setGameMode(@Nonnull PlotGameMode gameMode) { } @Override public void setTime(long time) { @@ -120,7 +120,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setFlight(boolean fly) { } - @Override public void playMusic(Location location, PlotBlock id) { + @Override public void playMusic(@Nonnull Location location, @Nonnull PlotBlock id) { } @Override public void kick(String message) { 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 23cf49e98..19441a2d1 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 @@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAre import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; +import com.google.common.base.Preconditions; import lombok.NonNull; import javax.annotation.Nonnull; @@ -333,8 +334,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { */ @Override @Nonnull public abstract UUID getUUID(); - public boolean canTeleport(Location loc) { - Location current = getLocationFull(); + public boolean canTeleport(@Nonnull final Location loc) { + Preconditions.checkNotNull(loc, "Specified location cannot be null"); + final Location current = getLocationFull(); teleport(loc); boolean result = true; if (!getLocation().equals(loc)) { @@ -416,21 +418,21 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @param weather the weather visible to the player */ - public abstract void setWeather(PlotWeather weather); + public abstract void setWeather(@Nonnull PlotWeather weather); /** * Get this player's gamemode. * * @return the gamemode of the player. */ - public abstract PlotGameMode getGameMode(); + @Nonnull public abstract PlotGameMode getGameMode(); /** * Set this player's gameMode. * * @param gameMode the gamemode to set */ - public abstract void setGameMode(PlotGameMode gameMode); + public abstract void setGameMode(@Nonnull PlotGameMode gameMode); /** * Set this player's local time (ticks). @@ -459,7 +461,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @param location where to play the music * @param id the record item id */ - public abstract void playMusic(Location location, PlotBlock id); + public abstract void playMusic(@Nonnull Location location, @Nonnull PlotBlock id); /** * Check if this player is banned. From 1295f7c4bf3a1102f57815286a39001ba65df264 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sat, 3 Aug 2019 23:26:16 -0400 Subject: [PATCH 044/258] Merge with breaking --- .../plotsquared/plot/commands/DebugImportWorlds.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index 6ce41e749..978c95e34 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -40,7 +40,7 @@ import java.util.concurrent.CompletableFuture; if (container.equals(new File("."))) { player.sendMessage( "World container must be configured to be a separate directory to your base files!"); - return; + return CompletableFuture.completedFuture(false); } for (File folder : container.listFiles()) { String name = folder.getName(); From cdc01a5bc43e2a48127e7fb97e45c0ee7f3ccdaa Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 25 Jul 2019 20:02:39 +0200 Subject: [PATCH 045/258] Reformat debugpaste And upgrade from IC -> IS --- .../plotsquared/plot/commands/DebugPaste.java | 25 ++++++++++--------- .../plotsquared/plot/commands/PluginCmd.java | 2 +- README.md | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 7fe7bfdd1..ba4e1b4ff 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -17,6 +17,8 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.nio.file.Files; import java.util.List; import java.util.stream.Collectors; @@ -47,11 +49,11 @@ import java.util.stream.Collectors; "# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your " + "problem\n\n"); b.append("# Server Information\n"); - b.append("server.version: ").append(PlotSquared.get().IMP.getServerImplementation()) + b.append("Server Version: ").append(PlotSquared.get().IMP.getServerImplementation()) .append("\n"); b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';') .append(!Settings.UUID.OFFLINE).append('\n'); - b.append("plugins:"); + b.append("Plugins:"); for (String id : PlotSquared.get().IMP.getPluginIds()) { String[] split = id.split(":"); String[] split2 = split[0].split(";"); @@ -63,16 +65,15 @@ import java.util.stream.Collectors; } b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); Runtime runtime = Runtime.getRuntime(); - b.append("memory.free: ").append(runtime.freeMemory()).append('\n'); - b.append("memory.max: ").append(runtime.maxMemory()).append('\n'); - b.append("java.specification.version: '") - .append(System.getProperty("java.specification.version")).append("'\n"); - b.append("java.vendor: '").append(System.getProperty("java.vendor")).append("'\n"); - b.append("java.version: '").append(System.getProperty("java.version")) - .append("'\n"); - b.append("os.arch: '").append(System.getProperty("os.arch")).append("'\n"); - b.append("os.name: '").append(System.getProperty("os.name")).append("'\n"); - b.append("os.version: '").append(System.getProperty("os.version")).append("'\n\n"); + RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); + b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n'); + b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n'); + b.append("Java Name: ").append(rb.getVmName()).append('\n'); + b.append("Java Version: '").append(System.getProperty("java.version")).append("'\n"); + b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n"); + b.append("Operating System: '").append(System.getProperty("os.name")).append("'\n"); + b.append("OS Version: ").append(System.getProperty("os.version")).append('\n'); + b.append("OS Arch: ").append(System.getProperty("os.arch")).append('\n'); b.append("# Okay :D Great. You are now ready to create your bug report!"); b.append( "\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index 81047ec9b..d284ce708 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -21,7 +21,7 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21"); MainUtil.sendMessage(player, - "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki"); + "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki"); MainUtil.sendMessage(player, "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); } diff --git a/README.md b/README.md index a00ec16ee..85ceaea93 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ is to provide a lag-free and smooth experience. * [[Jenkins (Dev Builds)](https://ci.athion.net/job/PlotSquared-Breaking/)] [[Jenkins (Releases)](https://ci.athion.net/job/PlotSquared-Releases/)] * [Spigot Page](https://www.spigotmc.org/resources/plotsquared.1177/) * [Discord](https://discord.gg/ngZCzbU) -* [Wiki](https://github.com/intellectualcrafters/plotsquared/wiki) +* [Wiki](https://github.com/IntellectualSites/PlotSquared/wiki) ### Developer Resources * [[JavaDoc](https://ci.athion.net/job/PlotSquared-Breaking/javadoc/)] From cd26b1647dbfb8bf4c053085243111ee8a901301 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 20 Jul 2019 01:29:30 +0200 Subject: [PATCH 046/258] Add kelp-grow flag Simply as the name says, add a controlled way to let kelp grow. --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 5 +++++ .../intellectualsites/plotsquared/plot/flag/Flags.java | 1 + 2 files changed, 6 insertions(+) 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 84cfc2e04..b9c1b72c0 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 @@ -1223,6 +1223,11 @@ import java.util.regex.Pattern; event.setCancelled(true); } break; + case KELP: + if (Flags.KELP_GROW.isFalse(plot)) { + event.setCancelled(true); + } + break; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index 12d9e2b06..fc203a00b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -46,6 +46,7 @@ public final class Flags { public static final BooleanFlag GRASS_GROW = new BooleanFlag("grass-grow"); public static final BooleanFlag VINE_GROW = new BooleanFlag("vine-grow"); public static final BooleanFlag MYCEL_GROW = new BooleanFlag("mycel-grow"); + public static final BooleanFlag KELP_GROW = new BooleanFlag("kelp-grow"); public static final BooleanFlag DISABLE_PHYSICS = new BooleanFlag("disable-physics"); public static final BooleanFlag LIQUID_FLOW = new BooleanFlag("liquid-flow"); public static final BooleanFlag SNOW_MELT = new BooleanFlag("snow-melt"); From 0c8b11ceddf5f31bd5a732ec94dff2b08dd85ab2 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 30 Jul 2019 23:58:48 +0200 Subject: [PATCH 047/258] Update DebugUUID.java --- .../plotsquared/bukkit/commands/DebugUUID.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fdee5edf6..bb5930228 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 @@ -63,7 +63,7 @@ import java.util.Map.Entry; if (args.length != 2 || !"-o".equals(args[1])) { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot uuidconvert " + args[0] + " - o"); + "/plot uuidconvert " + args[0] + " -o"); MainUtil.sendMessage(player, "&cBe aware of the following!"); MainUtil.sendMessage(player, "&8 - &cUse the database command or another method to backup your plots beforehand"); From d3e37e5eab1220e3b69045360b2c2256adac4bb9 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 3 Aug 2019 23:18:50 +0200 Subject: [PATCH 048/258] Migrate Templates to new format --- .../bug-issue-report-for-plotsquared.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md new file mode 100644 index 000000000..7badf3ae8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -0,0 +1,40 @@ +--- +name: Bug/Issue report for PlotSquared +about: Bug / Issue report about this plugin +title: '' +labels: '' +assignees: '' + +--- + +__*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and will receive limited support. Please consider upgrading to 1.13 for future support. Plugins exist for 1.13+ that bring back old behaviors found in 1.8*__ +# Bug report template + + + +**[REQUIRED] PlotSquared Version Number:** + +**[REQUIRED] Spigot/Paper Version Number:** + + +**[REQUIRED] Minecraft Version Number:** + +**Links to worlds.yml file and settings.yml file:** + + +**[REQUIRED] Description of the problem:** + +**Any relevant console output or screenshots:** + +**Plugins being used on the server:** + + +**How to replicate:** + + +**Checklist**: + +- [] I included all information required in the sections above +- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) +- [] I made sure I am using an up-to-date version of PlotSquared +- [] I made sure the bug/error is not caused by any other plugin From 3e8b8a757541513235fabe2c587f65bd3c60765d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 3 Aug 2019 23:20:21 +0200 Subject: [PATCH 049/258] Remove old files --- .github/CONTRIBUTING.md | 2 - pom.xml | 103 ---------------------------------------- 2 files changed, 105 deletions(-) delete mode 100644 .github/CONTRIBUTING.md delete mode 100644 pom.xml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 9e26f91a6..000000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,2 +0,0 @@ -### Bugs -Please provide a `/plot debugpaste` if you are reporting a bug. diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 498ef295f..000000000 --- a/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - 4.0.0 - com.intellectualcrafters - - UTF-8 - - PlotSquared - 3.5.1-SNAPSHOT - PlotSquared - jar - - PlotSquared-Bukkit-${project.version} - Bukkit/src - - - true - - **/*.* - - Bukkit/src/main/resources/ - - - true - - **/*.* - - Core/src/main/resources/ - - - - - maven-compiler-plugin - 2.3.2 - - - **/Sponge/src/main/**/*.* - - 1.7 - 1.7 - - - - org.codehaus.mojo - build-helper-maven-plugin - - - generate-sources - - add-source - - - - Core/src - - - - - - - - - - spigot-repo - http://hub.spigotmc.org/nexus/content/groups/public/ - - - sk80q - http://maven.sk89q.com/artifactory/repo/ - - - vault - http://nexus.hc.to/content/repositories/pub_releases/ - - - empcraft-repo - http://empcraft.com/maven2 - - - - - org.spigotmc - spigot-api - 1.12-R0.1-SNAPSHOT - provided - - - com.sk89q - worldedit - 6.0.0-SNAPSHOT - jar - compile - - - net.milkbowl.vault - VaultAPI - 1.5 - provided - - - From 9e8a6c702d48038385a0292111f2d8866ab330da Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 4 Aug 2019 18:40:39 +0200 Subject: [PATCH 050/258] Fix gradle script --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index ce53e06c8..5739869c8 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ def revision = "" def buildNumber = "" def date = "" ext { - git = Grgit.open(dir: '.git') + git = Grgit.open(dir: new File(rootDir.toString()+'/.git')) date = git.head().getDate().format("yy.MM.dd") revision = "-${git.head().abbreviatedId}" parents = git.head().parentIds; @@ -43,7 +43,6 @@ ext { } } -// version = String.format("%s.%s%s%s", rootVersion, date, revision, buildNumber) version = String.format("%s.%s", rootVersion, buildNumber) description = rootProject.name From fe83ef09755957c689f0b00117ff2421f5e885f6 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 5 Aug 2019 13:33:27 -0400 Subject: [PATCH 051/258] Get chunks asynchronously --- Bukkit/build.gradle | 10 ++++++---- .../bukkit/util/block/BukkitLocalQueue.java | 16 +++++++++++----- .../plot/util/block/BasicLocalBlockQueue.java | 17 ++++++----------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 9d00d7b99..6946b457b 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -10,14 +10,16 @@ repositories { mavenLocal() } +apply plugin: "com.github.johnrengelman.shadow" + dependencies { implementation project(':Core') compile project(':Core') - compile 'com.destroystokyo.paper:paper-api:1.14.3-R0.1-SNAPSHOT' + compile 'com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT' //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' - implementation 'org.spigotmc:spigot-api:1.14.3-R0.1-SNAPSHOT' + implementation 'org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT' compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0') - compile "io.papermc:paperlib:1.0.1" + compile "io.papermc:paperlib:1.0.2" compile("net.milkbowl.vault:VaultAPI:1.7") { exclude module: 'bukkit' } @@ -47,7 +49,7 @@ shadowJar { include(dependency('com.squareup.okhttp3:okhttp:3.14.0')) include(dependency('com.squareup.okio:okio:2.2.2')) include(dependency('org.jetbrains.kotlin:kotlin-stdlib:1.3.30')) - include(dependency("io.papermc:paperlib:1.0.1")) + include(dependency("io.papermc:paperlib:1.0.2")) } relocate 'io.papermc.lib', 'com.github.intellectualsites.plotsquared.bukkit.paperlib' // relocate('org.mcstats', 'com.plotsquared.stats') diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 5d8f53355..28bb36efa 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -10,6 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQ import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; +import io.papermc.lib.PaperLib; import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -20,6 +21,7 @@ import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; import java.util.Locale; +import java.util.concurrent.ExecutionException; public class BukkitLocalQueue extends BasicLocalBlockQueue { @@ -69,7 +71,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { } } - @Override public final void setComponents(LocalChunk lc) { + @Override public final void setComponents(LocalChunk lc) + throws ExecutionException, InterruptedException { setBaseBlocks(lc); } @@ -77,14 +80,17 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { return Bukkit.getWorld(getWorld()); } - public Chunk getChunk(int x, int z) { - return getBukkitWorld().getChunkAt(x, z); + public Chunk getChunk(int x, int z) throws ExecutionException, InterruptedException { + return PaperLib.getChunkAtAsync(getBukkitWorld(), x, z).get(); } - public void setBaseBlocks(LocalChunk lc) { + public void setBaseBlocks(LocalChunk lc) throws ExecutionException, InterruptedException { World worldObj = Bukkit.getWorld(getWorld()); + if (worldObj == null) { + throw new NullPointerException("World cannot be null."); + } + PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true).get(); Chunk chunk = worldObj.getChunkAt(lc.getX(), lc.getZ()); - chunk.load(true); for (int layer = 0; layer < lc.baseblocks.length; layer++) { BaseBlock[] blocksLayer = lc.baseblocks[layer]; if (blocksLayer != null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 4ca62eb58..6993c3208 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -1,19 +1,16 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; 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 org.jetbrains.annotations.NotNull; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; +import java.util.concurrent.ExecutionException; public abstract class BasicLocalBlockQueue extends LocalBlockQueue { @@ -35,7 +32,8 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { @Override public abstract PlotBlock getBlock(int x, int y, int z); - public abstract void setComponents(LocalChunk lc); + public abstract void setComponents(LocalChunk lc) + throws ExecutionException, InterruptedException; @Override public final String getWorld() { return world; @@ -62,10 +60,8 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return false; } - public final boolean execute(final LocalChunk lc) { - if (lc == null) { - return false; - } + public final boolean execute(@NotNull LocalChunk lc) + throws ExecutionException, InterruptedException { this.setComponents(lc); return true; } @@ -154,7 +150,6 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { while (next()) { - ; } } }); From 392ef51a6f7859053c509cb9151774d043b899bb Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 5 Aug 2019 14:37:56 -0400 Subject: [PATCH 052/258] Revert broken async chunk change --- .../bukkit/util/block/BukkitLocalQueue.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 28bb36efa..5e26a26e3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQ import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; -import io.papermc.lib.PaperLib; import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -76,20 +75,12 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { setBaseBlocks(lc); } - public World getBukkitWorld() { - return Bukkit.getWorld(getWorld()); - } - - public Chunk getChunk(int x, int z) throws ExecutionException, InterruptedException { - return PaperLib.getChunkAtAsync(getBukkitWorld(), x, z).get(); - } - public void setBaseBlocks(LocalChunk lc) throws ExecutionException, InterruptedException { World worldObj = Bukkit.getWorld(getWorld()); if (worldObj == null) { throw new NullPointerException("World cannot be null."); } - PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true).get(); + //PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true).get(); Chunk chunk = worldObj.getChunkAt(lc.getX(), lc.getZ()); for (int layer = 0; layer < lc.baseblocks.length; layer++) { BaseBlock[] blocksLayer = lc.baseblocks[layer]; From e4a345880e6bc19c0c0af9f435074d57dc77ec97 Mon Sep 17 00:00:00 2001 From: Leomixer17 Date: Sat, 6 Jul 2019 01:16:45 +0200 Subject: [PATCH 053/258] Update addsigns.js --- Core/src/main/resources/addsigns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/resources/addsigns.js b/Core/src/main/resources/addsigns.js index a1d2b8714..52f85a9d3 100644 --- a/Core/src/main/resources/addsigns.js +++ b/Core/src/main/resources/addsigns.js @@ -4,7 +4,7 @@ This script will fix all signs in the world. var plots = PS.sortPlotsByTemp(PS.getPlots()); for (var i = 0; i < plots.size(); i++) { var plot = plots.get(i); - if (!plot.isMerged() || !plot.getMerged(0)) { + if (plot.isBasePlot()) { plot.setSign(); PS.class.static.log('&cSetting sign for: ' + plot); } From 520be48198f21eb151cce64476302bc3e8441fb0 Mon Sep 17 00:00:00 2001 From: Leomixer17 Date: Sat, 6 Jul 2019 01:24:15 +0200 Subject: [PATCH 054/258] Create fixborders.js --- Core/src/main/resources/fixborders.js | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Core/src/main/resources/fixborders.js diff --git a/Core/src/main/resources/fixborders.js b/Core/src/main/resources/fixborders.js new file mode 100644 index 000000000..779b54c61 --- /dev/null +++ b/Core/src/main/resources/fixborders.js @@ -0,0 +1,35 @@ +/* +Need to script something quick with PlotSquared? +/plot debugexec runasync fixborder.js + + +The following utility classes are usable: + - PS + - TaskManager + - TitleManager + - ConsolePlayer + - SchematicHandler + - ChunkManager + - BlockManager + - SetupUtils + - EventUtil + - UUIDHandler + - DBFunc + - HybridUtils + - IMP ( BukkitMain or SpongeMain) + - MainCommand + - MainUtil + - Settings + - StringMan + - MathMan + - C ( use C_ ) + - Permissions ( use Permissions_ ) + + For more information see: https://github.com/IntellectualSites/PlotSquared/wiki/Scripting +*/ +var plots = PS.sortPlotsByTemp(PS.getPlots()); +PS.class.static.log("Attempting to fix border for " + plots.size() + " plots"); +for (var i = 0; i < plots.size(); i++) { + var plot = plots.get(i); + plot.setComponent("border", "%s0"); +} From 5b8f6e466ac7ff5d67fda68a44b0181e3d4929ea Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 6 Aug 2019 15:05:04 -0400 Subject: [PATCH 055/258] Minor gradle edit --- Bukkit/build.gradle | 36 +++++++++++++++++------------------ Core/build.gradle | 38 ++++++++++++++++++------------------- build.gradle | 46 ++++++++++++++++++++++----------------------- 3 files changed, 60 insertions(+), 60 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 6946b457b..81eda9923 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -4,8 +4,8 @@ repositories { maven { url "http://nexus.hc.to/content/repositories/pub_releases" } maven { url = "https://repo.codemc.org/repository/maven-public" } maven { - name 'papermc' - url 'https://papermc.io/repo/repository/maven-public/' + name "papermc" + url "https://papermc.io/repo/repository/maven-public/" } mavenLocal() } @@ -13,15 +13,15 @@ repositories { apply plugin: "com.github.johnrengelman.shadow" dependencies { - implementation project(':Core') - compile project(':Core') - compile 'com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT' + implementation project(":Core") + compile project(":Core") + compile "com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT" //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' - implementation 'org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT' - compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0') + implementation "org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT" + compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile "io.papermc:paperlib:1.0.2" compile("net.milkbowl.vault:VaultAPI:1.7") { - exclude module: 'bukkit' + exclude module: "bukkit" } } @@ -29,8 +29,8 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 processResources { - from('src/main/resources') { - include 'plugin.yml' + from("src/main/resources") { + include "plugin.yml" expand( name: project.parent.name, version: project.parent.version @@ -42,19 +42,19 @@ jar.enabled = false shadowJar { dependencies { - include(dependency(':Core')) + include(dependency(":Core")) // update notification stuff - include(dependency('com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT')) - include(dependency('com.squareup.retrofit2:retrofit:2.4.0')) - include(dependency('com.squareup.okhttp3:okhttp:3.14.0')) - include(dependency('com.squareup.okio:okio:2.2.2')) - include(dependency('org.jetbrains.kotlin:kotlin-stdlib:1.3.30')) + include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) + include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) + include(dependency("com.squareup.okhttp3:okhttp:3.14.0")) + include(dependency("com.squareup.okio:okio:2.2.2")) + include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.30")) include(dependency("io.papermc:paperlib:1.0.2")) } - relocate 'io.papermc.lib', 'com.github.intellectualsites.plotsquared.bukkit.paperlib' + relocate "io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib" // relocate('org.mcstats', 'com.plotsquared.stats') archiveName = "${parent.name}-${project.name}-${parent.version}.jar" - destinationDir = file '../target' + destinationDir = file "../target" } shadowJar.doLast { diff --git a/Core/build.gradle b/Core/build.gradle index 3949c948e..9f3e57006 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -1,29 +1,29 @@ repositories { - maven { url 'https://jitpack.io' } + maven { url "https://jitpack.io" } } dependencies { - implementation 'org.yaml:snakeyaml:1.23' + implementation "org.yaml:snakeyaml:1.23" //keep inline with Minecraft which uses gson 2.8.0 - implementation 'com.google.code.gson:gson:2.8.0' + implementation "com.google.code.gson:gson:2.8.0" implementation("org.projectlombok:lombok:1.18.6") compileOnly("org.projectlombok:lombok:1.18.6") testCompileOnly("org.projectlombok:lombok:1.18.6") annotationProcessor("org.projectlombok:lombok:1.18.6") testAnnotationProcessor("org.projectlombok:lombok:1.18.6") - implementation 'net.kyori:text-adapter-bukkit:3.0.2' - implementation 'com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT' - implementation 'com.squareup.okhttp3:okhttp:3.14.0' - implementation 'com.squareup.okio:okio:2.2.2' - implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.30' + implementation "net.kyori:text-adapter-bukkit:3.0.2" + implementation "com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT" + implementation "com.squareup.okhttp3:okhttp:3.14.0" + implementation "com.squareup.okio:okio:2.2.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.30" } sourceCompatibility = 1.8 targetCompatibility = 1.8 processResources { - from('src/main/resources') { - include 'plugin.properties' + from("src/main/resources") { + include "plugin.properties" expand( version: "${project.parent.version}", name: project.parent.name, @@ -34,21 +34,21 @@ processResources { } jar.setArchiveName("PlotSquared-API-${project.parent.version}.jar") -jar.destinationDir = file '../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/' + project.parent.version +jar.destinationDir = file "../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/" + project.parent.version task createPom { doLast { pom { project { - groupId 'com.github.intellectualsites.plotsquared' - artifactId 'PlotSquared-API' + groupId "com.github.intellectualsites.plotsquared" + artifactId "PlotSquared-API" version project.parent.version } }.writeTo("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/${project.parent.version}/PlotSquared-API-${project.parent.version}.pom") pom { project { - groupId 'com.github.intellectualsites.plotsquared' - artifactId 'PlotSquared-API' - version 'latest' + groupId "com.github.intellectualsites.plotsquared" + artifactId "PlotSquared-API" + version "latest" } }.writeTo("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/latest/PlotSquared-API-latest.pom") } @@ -58,9 +58,9 @@ task copyFiles { doLast { copy { from "../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/${project.parent.version}/" - into '../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/latest/' - include('*.jar') - rename("PlotSquared-API-${project.parent.version}.jar", 'PlotSquared-API-latest.jar') + into "../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/latest/" + include("*.jar") + rename("PlotSquared-API-${project.parent.version}.jar", "PlotSquared-API-latest.jar") } } } diff --git a/build.gradle b/build.gradle index 5739869c8..e753e2a85 100644 --- a/build.gradle +++ b/build.gradle @@ -7,32 +7,32 @@ buildscript { jcenter() } dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:5.0.0' + classpath "com.github.jengelman.gradle.plugins:shadow:5.0.0" } configurations.all { resolutionStrategy { - force 'org.ow2.asm:asm:7.1' + force "org.ow2.asm:asm:7.1" } } } plugins { - id 'maven-publish' + id "maven-publish" id "org.ajoberstar.grgit" version "3.1.1" } -group = 'com.github.intellectualsites.plotsquared' +group = "com.github.intellectualsites.plotsquared" def rootVersion = "4" def revision = "" def buildNumber = "" def date = "" ext { - git = Grgit.open(dir: new File(rootDir.toString()+'/.git')) + git = Grgit.open(dir: new File(rootDir.toString()+"/.git")) date = git.head().getDate().format("yy.MM.dd") revision = "-${git.head().abbreviatedId}" parents = git.head().parentIds; - if (project.hasProperty('buildnumber')) { + if (project.hasProperty("buildnumber")) { buildNumber = "$buildnumber" } else { index = -2042; // Offset to match CI @@ -48,28 +48,28 @@ version = String.format("%s.%s", rootVersion, buildNumber) description = rootProject.name subprojects { - apply plugin: 'java' - apply plugin: 'maven' - apply plugin: 'eclipse' - apply plugin: 'idea' - apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: "java" + apply plugin: "maven" + apply plugin: "eclipse" + apply plugin: "idea" + apply plugin: "com.github.johnrengelman.shadow" - group = 'com.github.intellectualsites.plotsquared' + group = "com.github.intellectualsites.plotsquared" clean.doFirst { delete "../target" } dependencies { - implementation('com.sk89q.worldedit:worldedit-core:7.0.0') { - exclude(module: 'bukkit-classloader-check') - exclude(module: 'mockito-core') - exclude(module: 'dummypermscompat') + implementation("com.sk89q.worldedit:worldedit-core:7.0.0") { + exclude(module: "bukkit-classloader-check") + exclude(module: "mockito-core") + exclude(module: "dummypermscompat") } - implementation 'net.kyori:text-api:3.0.0' + implementation "net.kyori:text-api:3.0.0" //Minecraft uses Guava 21 as of 1.13. - compile 'com.google.guava:guava:21.0' - compileOnly 'org.jetbrains:annotations:17.0.0' + compile "com.google.guava:guava:21.0" + compileOnly "org.jetbrains:annotations:17.0.0" compile("org.projectlombok:lombok:1.18.6") compileOnly("org.projectlombok:lombok:1.18.6") testCompileOnly("org.projectlombok:lombok:1.18.6") @@ -82,16 +82,16 @@ subprojects { mavenCentral() maven { url "http://maven.sk89q.com/repo/" } maven { url "http://repo.maven.apache.org/maven2" } - maven { url 'https://jitpack.io' } + maven { url "https://jitpack.io" } } } -task aggregatedJavadocs(type: Javadoc, description: 'Generate javadocs from all child projects as if it was a single project', group: 'Documentation') { +task aggregatedJavadocs(type: Javadoc, description: "Generate javadocs from all child projects as if it was a single project", group: "Documentation") { destinationDir = file("./docs/javadoc") title = "$project.name $version API" options.author true - options.links 'http://docs.spring.io/spring/docs/4.3.x/javadoc-api/', 'http://docs.oracle.com/javase/8/docs/api/', 'http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/', 'http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/' - options.addStringOption('Xdoclint:none', '-quiet') + options.links "http://docs.spring.io/spring/docs/4.3.x/javadoc-api/", "http://docs.oracle.com/javase/8/docs/api/", "http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/", "http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/" + options.addStringOption("Xdoclint:none", "-quiet") delete "./docs" From 539ad9f05c8e918423c73ebb037ebc980aa74812 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 6 Aug 2019 16:08:56 -0400 Subject: [PATCH 056/258] Small changes --- .../plotsquared/bukkit/BukkitMain.java | 2 +- .../plotsquared/bukkit/chat/MessagePart.java | 3 +- .../bukkit/object/BukkitPlayer.java | 31 ++++------ .../bukkit/util/BukkitChunkManager.java | 3 +- .../bukkit/util/BukkitLegacyMappings.java | 16 ++--- .../plotsquared/bukkit/util/BukkitUtil.java | 61 +++++++++++-------- .../bukkit/uuid/FileUUIDHandler.java | 4 +- .../plotsquared/commands/Command.java | 6 +- .../plotsquared/plot/commands/Help.java | 2 +- .../plotsquared/plot/commands/ListCmd.java | 8 +-- .../collection/FlatRandomCollection.java | 2 +- .../plotsquared/plot/util/MainUtil.java | 2 +- .../plotsquared/plot/util/StringMan.java | 24 ++++---- .../plot/util/UUIDHandlerImplementation.java | 1 - 14 files changed, 76 insertions(+), 89 deletions(-) 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 b5e4ecf1b..e32b26cb2 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 @@ -699,7 +699,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + "Bukkit"); } else { - PlotSquared.log(Captions.PREFIX + " &6" + getPluginName() + " is using online UUIDs"); + PlotSquared.log(Captions.PREFIX + " " + getPluginName() + " is using online UUIDs"); } if (Settings.UUID.USE_SQLUUIDHANDLER) { return new SQLUUIDHandler(wrapper); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java index 43cf15e08..64bdda48d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java @@ -123,8 +123,7 @@ final class MessagePart implements JsonRepresentedObject, ConfigurationSerializa if (insertionData != null) { json.name("insertion").value(insertionData); } - if (translationReplacements.size() > 0 && text != null && TextualComponent - .isTranslatableText(text)) { + if (translationReplacements.size() > 0 && TextualComponent.isTranslatableText(text)) { json.name("with").beginArray(); for (JsonRepresentedObject obj : translationReplacements) { obj.writeJson(json); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 7a34a9fdc..5587a698d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -6,8 +6,12 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.*; -import com.google.common.base.Preconditions; +import com.github.intellectualsites.plotsquared.plot.util.EconHandler; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +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.UUIDHandler; import io.papermc.lib.PaperLib; import org.bukkit.GameMode; import org.bukkit.Material; @@ -41,14 +45,12 @@ public class BukkitPlayer extends PlotPlayer { * * @param player Bukkit player instance */ - public BukkitPlayer(@Nonnull final Player player) { - Preconditions.checkNotNull(player, "Bukkit player instance cannot be null"); + public BukkitPlayer(@NotNull final Player player) { this.player = player; super.populatePersistentMetaMap(); } - public BukkitPlayer(@Nonnull final Player player, final boolean offline) { - Preconditions.checkNotNull(player, "Bukkit player instance cannot be null"); + public BukkitPlayer(@NotNull final Player player, final boolean offline) { this.player = player; this.offline = offline; super.populatePersistentMetaMap(); @@ -70,8 +72,7 @@ public class BukkitPlayer extends PlotPlayer { return this.player.getLastPlayed(); } - @Override public boolean canTeleport(@Nonnull final Location loc) { - Preconditions.checkNotNull(loc, "Bukkit location cannot be null"); + @Override public boolean canTeleport(@NotNull final Location loc) { final org.bukkit.Location to = BukkitUtil.getLocation(loc); final org.bukkit.Location from = player.getLocation(); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); @@ -89,9 +90,7 @@ public class BukkitPlayer extends PlotPlayer { player.sendTitle(title, subtitle, fadeIn, stay, fadeOut); } - private void callEvent(final Event event) { - Preconditions.checkNotNull(event, "Event cannot be null"); - + private void callEvent(@NotNull final Event event) { final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (final RegisteredListener listener : listeners) { if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) { @@ -215,8 +214,7 @@ public class BukkitPlayer extends PlotPlayer { return BukkitUtil.getLocationFull(this.player); } - @Override public void setWeather(@Nonnull final PlotWeather weather) { - Preconditions.checkNotNull(weather, "Specified weather cannot be null"); + @Override public void setWeather(@NotNull final PlotWeather weather) { switch (weather) { case CLEAR: this.player.setPlayerWeather(WeatherType.CLEAR); @@ -246,8 +244,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void setGameMode(@Nonnull final PlotGameMode gameMode) { - Preconditions.checkNotNull(gameMode, "Specified gamemode cannot be null"); + @Override public void setGameMode(@NotNull final PlotGameMode gameMode) { switch (gameMode) { case ADVENTURE: this.player.setGameMode(GameMode.ADVENTURE); @@ -281,9 +278,7 @@ public class BukkitPlayer extends PlotPlayer { this.player.setAllowFlight(fly); } - @Override public void playMusic(@Nonnull final Location location, @Nonnull final PlotBlock id) { - Preconditions.checkNotNull(location, "Specified location cannot be null"); - Preconditions.checkNotNull(id, "Specified block cannot be null"); + @Override public void playMusic(@NotNull final Location location, @NotNull final PlotBlock id) { if (PlotBlock.isEverything(id) || id.isAir()) { // Let's just stop all the discs because why not? for (final Sound sound : Arrays.stream(Sound.values()) 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 744f4b6e9..c3b7521f2 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 @@ -673,8 +673,7 @@ public class BukkitChunkManager extends ChunkManager { //todo optimize maxY void saveBlocks(BukkitWorld world, int maxY, int x, int z, int offsetX, int offsetZ) { maxY = Math.min(255, maxY); - BaseBlock[] ids; - ids = new BaseBlock[maxY + 1]; + BaseBlock[] ids = new BaseBlock[maxY + 1]; for (short y = 0; y <= maxY; y++) { BaseBlock block = world.getFullBlock(BlockVector3.at(x, y, z)); ids[y] = block; 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 44c262b10..0331e948a 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 @@ -1,22 +1,11 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; - -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; - import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -26,6 +15,9 @@ import lombok.ToString; import org.bukkit.Bukkit; import org.bukkit.Material; +import java.util.*; +import java.util.stream.Collectors; + /** * Borrowed from https://github.com/Phoenix616/IDConverter/blob/master/mappings/src/main/java/de/themoep/idconverter/IdMappings.java * Original License: @@ -773,7 +765,7 @@ public final class BukkitLegacyMappings extends LegacyMappings { PlotBlock plotBlock; if (Material.matchMaterial(workingString) != null) { return PlotBlock.get(workingString); - } else if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.keySet().contains(workingString.toLowerCase())) { + } else if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.containsKey(workingString.toLowerCase())) { return PlotBlock.get(workingString); } else if ((plotBlock = fromLegacyToString(idDataPair)) != null) { return plotBlock; 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 66b509615..283e68688 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 @@ -5,14 +5,22 @@ 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.schematic.PlotItem; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.StringComparison; +import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.worldedit.bukkit.BukkitWorld; import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.World; -import org.bukkit.block.*; +import org.bukkit.block.Biome; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.block.Sign; import org.bukkit.block.data.Directional; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -21,7 +29,12 @@ import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Set; @SuppressWarnings({"unused", "WeakerAccess"}) public class BukkitUtil extends WorldUtil { @@ -215,7 +228,11 @@ import java.util.*; public static List getEntities(@NonNull final String worldName) { World world = getWorld(worldName); - return world != null ? world.getEntities() : new ArrayList(); + if (world != null) { + return world.getEntities(); + } else { + return new ArrayList<>(); + } } public static Location getLocation(@NonNull final Entity entity) { @@ -270,19 +287,17 @@ import java.util.*; int air = 1; for (int y = bukkitWorld.getMaxHeight() - 1; y >= 0; y--) { Block block = bukkitWorld.getBlockAt(x, y, z); - if (block != null) { - Material type = block.getType(); - if (type.isSolid()) { - if (air > 1) { - return y; - } - air = 0; - } else { - if (block.isLiquid()) { - return y; - } - air++; + Material type = block.getType(); + if (type.isSolid()) { + if (air > 1) { + return y; } + air = 0; + } else { + if (block.isLiquid()) { + return y; + } + air++; } } return bukkitWorld.getMaxHeight() - 1; @@ -291,11 +306,9 @@ import java.util.*; @Override @Nullable public String[] getSign(@NonNull final Location location) { Block block = getWorld(location.getWorld()) .getBlockAt(location.getX(), location.getY(), location.getZ()); - if (block != null) { - if (block.getState() instanceof Sign) { - Sign sign = (Sign) block.getState(); - return sign.getLines(); - } + if (block.getState() instanceof Sign) { + Sign sign = (Sign) block.getState(); + return sign.getLines(); } return null; } @@ -377,9 +390,6 @@ import java.util.*; public boolean addItems(@NonNull final String worldName, @NonNull final PlotItem items) { final World world = getWorld(worldName); final Block block = world.getBlockAt(items.x, items.y, items.z); - if (block == null) { - return false; - } final BlockState state = block.getState(); if (state instanceof InventoryHolder) { InventoryHolder holder = (InventoryHolder) state; @@ -457,9 +467,6 @@ import java.util.*; @Override public PlotBlock getBlock(@NonNull final Location location) { final World world = getWorld(location.getWorld()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); - if (block == null) { - return StringPlotBlock.EVERYTHING; - } return PlotBlock.get(block.getType().name()); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 64a6db419..38b30d3b4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -48,7 +48,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { world = worlds.get(0).getName(); } TaskManager.runTaskAsync(() -> { - PlotSquared.debug(Captions.PREFIX + "&6Starting player data caching for: " + world); + PlotSquared.debug(Captions.PREFIX + "Starting player data caching for: " + world); File uuidFile = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt"); if (uuidFile.exists()) { try { @@ -83,7 +83,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { HashBiMap toAdd = HashBiMap.create(new HashMap<>()); if (Settings.UUID.NATIVE_UUID_PROVIDER) { HashSet all = UUIDHandler.getAllUUIDS(); - PlotSquared.debug("&aFast mode UUID caching enabled!"); + PlotSquared.debug("Fast mode UUID caching enabled!"); File playerDataFolder = new File(container, world + File.separator + "playerdata"); String[] dat = playerDataFolder.list(new DatFileFilter()); boolean check = all.isEmpty(); 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 e379edbac..d3afeae73 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 @@ -249,11 +249,11 @@ public abstract class Command { } if (page == 0 && totalPages != 0) { // Next new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1") - .command(baseCommand + " " + (0 + 2)).text(Captions.CLICKABLE.s()).color("$2") + .command(baseCommand + " " + 2).text(Captions.CLICKABLE.s()).color("$2") .send(player); return; } - if (page == totalPages && totalPages != 0) { // Back + if (totalPages != 0) { // Back new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ") .color("$3").text("->").color("$3").text(Captions.CLICKABLE.s()).color("$2") .send(player); @@ -387,7 +387,7 @@ public abstract class Command { String[] split = usage[i].split("\\|| |\\>|\\<|\\[|\\]|\\{|\\}|\\_|\\/"); for (String aSplit : split) { for (String arg : args) { - if (StringMan.isEqualIgnoreCase(arg, aSplit)) { + if (arg.equalsIgnoreCase(aSplit)) { count += 5 - i + require; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index 08c3dd36d..0a5515370 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -62,7 +62,7 @@ public class Help extends Command { CommandCategory catEnum = null; if (cat != null) { - if (!StringMan.isEqualIgnoreCase(cat, "all")) { + if (!"all".equalsIgnoreCase(cat)) { for (CommandCategory c : CommandCategory.values()) { if (StringMan.isEqualIgnoreCaseToAny(cat, c.name(), c.toString())) { catEnum = c; 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 81834c353..33957d617 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 @@ -16,7 +16,6 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import java.util.ArrayList; import java.util.Arrays; -import java.util.Iterator; import java.util.List; import java.util.Map.Entry; import java.util.Optional; @@ -348,12 +347,7 @@ public class ListCmd extends SubCommand { public void displayPlots(final PlotPlayer player, List plots, int pageSize, int page, PlotArea area, String[] args, boolean sort) { // Header - Iterator iterator = plots.iterator(); - while (iterator.hasNext()) { - if (!iterator.next().isBasePlot()) { - iterator.remove(); - } - } + plots.removeIf(plot -> !plot.isBasePlot()); if (sort) { plots = PlotSquared.get().sortPlots(plots, SortType.CREATION_DATE, area); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java index dd7803d66..341fbb4f3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java @@ -13,7 +13,7 @@ public class FlatRandomCollection extends RandomCollection { super(weights, random); int max = 0; int[] counts = new int[weights.size()]; - Double[] weightDoubles = weights.values().toArray(new Double[weights.size()]); + Double[] weightDoubles = weights.values().toArray(new Double[0]); for (int i = 0; i < weightDoubles.length; i++) { int weight = (int) (weightDoubles[i] * 100); counts[i] = weight; 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 2e1784b59..b94006533 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 @@ -500,7 +500,7 @@ public class MainUtil { } for (Plot p : plots) { String name = p.getAlias(); - if (!name.isEmpty() && StringMan.isEqualIgnoreCase(name, arg)) { + if (!name.isEmpty() && name.equalsIgnoreCase(arg)) { return p; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java index c7f30e1fa..047b4a71f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java @@ -1,8 +1,15 @@ package com.github.intellectualsites.plotsquared.plot.util; +import org.jetbrains.annotations.NotNull; + import java.lang.reflect.Array; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.Iterator; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; public class StringMan { @@ -145,12 +152,7 @@ public class StringMan { public static String joinOrdered(Collection collection, String delimiter) { Object[] array = collection.toArray(); - Arrays.sort(array, new Comparator() { - @Override public int compare(Object a, Object b) { - return a.hashCode() - b.hashCode(); - } - - }); + Arrays.sort(array, Comparator.comparingInt(Object::hashCode)); return join(array, delimiter); } @@ -186,8 +188,8 @@ public class StringMan { n = m; m = t.length(); } - int p[] = new int[n + 1]; - int d[] = new int[n + 1]; + int[] p = new int[n + 1]; + int[] d = new int[n + 1]; int i; for (i = 0; i <= n; i++) { p[i] = i; @@ -235,9 +237,9 @@ public class StringMan { return false; } - public static boolean isEqualIgnoreCaseToAny(String a, String... args) { + public static boolean isEqualIgnoreCaseToAny(@NotNull String a, String... args) { for (String arg : args) { - if (StringMan.isEqualIgnoreCase(a, arg)) { + if (a.equalsIgnoreCase(arg)) { return true; } } 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 9ccae793b..55ff35c95 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 @@ -30,7 +30,6 @@ public abstract class UUIDHandlerImplementation { protected UUIDWrapper uuidWrapper; private boolean cached = false; private BiMap uuidMap = HashBiMap.create(new HashMap<>()); - // private BiMap nameMap = uuidMap.inverse(); public UUIDHandlerImplementation(UUIDWrapper wrapper) { this.uuidWrapper = wrapper; From 8f685b754acb9c297c1f6ea9d1a629c98bc77aa0 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 6 Aug 2019 20:35:36 -0400 Subject: [PATCH 057/258] Modifications to formatting and UUID Handler Fixes #2423 --- .../bukkit/listeners/ChunkListener.java | 18 +- .../bukkit/listeners/PlayerEvents.java | 12 +- .../bukkit/object/BukkitPlayer.java | 6 +- .../bukkit/uuid/FileUUIDHandler.java | 7 + .../plotsquared/api/PlotAPI.java | 2 +- .../plotsquared/commands/Command.java | 25 +- .../plotsquared/plot/PlotSquared.java | 41 +- .../plotsquared/plot/commands/Alias.java | 5 +- .../plotsquared/plot/commands/Area.java | 6 +- .../plotsquared/plot/commands/Biome.java | 10 +- .../plotsquared/plot/commands/Cluster.java | 5 +- .../plot/commands/CommandCategory.java | 4 +- .../plotsquared/plot/commands/Copy.java | 2 +- .../plotsquared/plot/commands/Debug.java | 8 +- .../plotsquared/plot/commands/DebugPaste.java | 4 +- .../plotsquared/plot/commands/Deny.java | 2 +- .../plotsquared/plot/commands/Download.java | 8 +- .../plot/commands/GenerateDocs.java | 6 +- .../plotsquared/plot/commands/Help.java | 9 +- .../plotsquared/plot/commands/Inbox.java | 3 +- .../plotsquared/plot/commands/Info.java | 41 +- .../plotsquared/plot/commands/Kick.java | 2 +- .../plotsquared/plot/commands/ListCmd.java | 16 +- .../plotsquared/plot/commands/Merge.java | 10 +- .../plotsquared/plot/commands/Move.java | 4 +- .../plotsquared/plot/commands/Owner.java | 4 +- .../plotsquared/plot/commands/Set.java | 3 +- .../plotsquared/plot/commands/Swap.java | 2 +- .../plotsquared/plot/config/Captions.java | 698 +++++++----------- .../plot/generator/HybridUtils.java | 8 +- .../plot/listener/PlotListener.java | 32 +- .../plotsquared/plot/object/Plot.java | 2 +- .../plotsquared/plot/object/PlotPlayer.java | 6 +- .../plotsquared/plot/util/CommentManager.java | 4 +- .../plotsquared/plot/util/EventUtil.java | 184 ++--- .../plotsquared/plot/util/MainUtil.java | 34 +- .../plotsquared/plot/util/Permissions.java | 10 +- .../plotsquared/plot/util/UUIDHandler.java | 2 +- .../plot/util/helpmenu/HelpObject.java | 2 +- .../plot/util/helpmenu/HelpPage.java | 7 +- 40 files changed, 546 insertions(+), 708 deletions(-) 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 c55e4f440..c93767ea5 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 @@ -223,8 +223,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (!chunk.isLoaded()) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared - .debug(Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(Captions.PREFIX.getTranslated() + + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -232,8 +232,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (tiles.length == 0) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared - .debug(Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(Captions.PREFIX.getTranslated() + + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -243,8 +243,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (i >= tiles.length) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared.debug( - Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(Captions.PREFIX.getTranslated() + + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -268,13 +268,15 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils } } PlotSquared.debug( - Captions.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() + Captions.PREFIX.getTranslated() + "&a detected unsafe chunk and processed: " + ( + chunk.getX() << 4) + "," + (chunk.getX() << 4)); } if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { PlotSquared.debug( - Captions.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + Captions.PREFIX.getTranslated() + "&c detected unsafe chunk: " + (chunk.getX() + << 4) + "," + (chunk.getX() << 4)); cleanChunk(chunk); return true; 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 b9c1b72c0..938cc8b9a 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 @@ -637,7 +637,7 @@ import java.util.regex.Pattern; EventUtil.manager.doJoinTask(pp); }, 20); - if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.s()) + if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.getTranslated()) && PlotSquared.get().getUpdateUtility() != null) { final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class); @@ -941,7 +941,7 @@ import java.util.regex.Pattern; } event.setCancelled(true); String message = event.getMessage(); - String format = Captions.PLOT_CHAT_FORMAT.s(); + String format = Captions.PLOT_CHAT_FORMAT.getTranslated(); String sender = event.getPlayer().getDisplayName(); PlotId id = plot.getId(); Set recipients = event.getRecipients(); @@ -968,8 +968,8 @@ import java.util.regex.Pattern; receiver.sendMessage(full); } if (!spies.isEmpty()) { - String spyMessage = - Captions.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y) + String spyMessage = Captions.PLOT_CHAT_SPY_FORMAT.getTranslated() + .replace("%plot_id%", id.x + ";" + id.y) .replace("%sender%", sender).replace("%msg%", message); for (Player player : spies) { player.sendMessage(spyMessage); @@ -1001,7 +1001,7 @@ import java.util.regex.Pattern; && !Permissions .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { event.setCancelled(true); - MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.s() + MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.getTranslated() .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { @@ -2991,7 +2991,7 @@ import java.util.regex.Pattern; if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT) && !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { event.setCancelled(true); - MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.s() + MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.getTranslated() .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 5587a698d..d16038215 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -112,15 +112,15 @@ public class BukkitPlayer extends PlotPlayer { } @Override public int hasPermissionRange(final String stub, final int range) { - if (hasPermission(Captions.PERMISSION_ADMIN.s())) { + if (hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { return Integer.MAX_VALUE; } final String[] nodes = stub.split("\\."); final StringBuilder n = new StringBuilder(); for (int i = 0; i < (nodes.length - 1); i++) { n.append(nodes[i]).append("."); - if (!stub.equals(n + Captions.PERMISSION_STAR.s())) { - if (hasPermission(n + Captions.PERMISSION_STAR.s())) { + if (!stub.equals(n + Captions.PERMISSION_STAR.getTranslated())) { + if (hasPermission(n + Captions.PERMISSION_STAR.getTranslated())) { return Integer.MAX_VALUE; } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 38b30d3b4..440aca318 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -218,6 +218,13 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { StringWrapper wrap = new StringWrapper(name); if (!toAdd.containsKey(wrap)) { UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(offlinePlotPlayer); + if (toAdd.containsValue(uuid)) { + StringWrapper duplicate = toAdd.inverse().get(uuid); + PlotSquared.debug( + "The UUID: " + uuid.toString() + " is already mapped to " + + duplicate + + "\n It cannot be added to the Map with a key of " + wrap); + } toAdd.putIfAbsent(wrap, uuid); if (ExpireManager.IMP != null) { ExpireManager.IMP.storeDate(uuid, last); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java index d2b4e7343..610362953 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java @@ -165,7 +165,7 @@ import java.util.UUID; * @see Captions */ public void sendConsoleMessage(Captions caption) { - sendConsoleMessage(caption.s()); + sendConsoleMessage(caption.getTranslated()); } /** 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 d3afeae73..945d2d374 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 @@ -38,19 +38,19 @@ public abstract class Command { private RequiredType required; private String usage; private String description; - private String perm; + private String permission; private boolean confirmation; private CommandCategory category; private Argument[] arguments; - public Command(Command parent, boolean isStatic, String id, String perm, RequiredType required, - CommandCategory cat) { + public Command(Command parent, boolean isStatic, String id, String permission, + RequiredType required, CommandCategory category) { this.parent = parent; this.isStatic = isStatic; this.id = id; - this.perm = perm; + this.permission = permission; this.required = required; - this.category = cat; + this.category = category; this.aliases = Arrays.asList(id); if (this.parent != null) { this.parent.register(this); @@ -154,7 +154,7 @@ public abstract class Command { public void init(CommandDeclaration declaration) { this.id = declaration.command(); - this.perm = declaration.permission(); + this.permission = declaration.permission(); this.required = declaration.requiredType(); this.category = declaration.category(); List aliasOptions = new ArrayList<>(); @@ -204,8 +204,8 @@ public abstract class Command { } public String getPermission() { - if (this.perm != null && !this.perm.isEmpty()) { - return this.perm; + if (this.permission != null && !this.permission.isEmpty()) { + return this.permission; } if (this.parent == null) { return "plots.use"; @@ -244,18 +244,19 @@ public abstract class Command { if (page < totalPages && page > 0) { // Back | Next new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ") .color("$3").text("->").color("$1").command(baseCommand + " " + (page + 2)) - .text(Captions.CLICKABLE.s()).color("$2").send(player); + .text(Captions.CLICKABLE.getTranslated()).color("$2").send(player); return; } if (page == 0 && totalPages != 0) { // Next new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1") - .command(baseCommand + " " + 2).text(Captions.CLICKABLE.s()).color("$2") + .command(baseCommand + " " + 2).text(Captions.CLICKABLE.getTranslated()).color("$2") .send(player); return; } if (totalPages != 0) { // Back new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ") - .color("$3").text("->").color("$3").text(Captions.CLICKABLE.s()).color("$2") + .color("$3").text("->").color("$3").text(Captions.CLICKABLE.getTranslated()) + .color("$2") .send(player); } } @@ -489,7 +490,7 @@ public abstract class Command { return null; } List result = new ArrayList<>(); - int index = input.length - (space ? 0 : 1); + int index = input.length; for (String arg : args) { arg = arg.replace(getCommandString() + " ", ""); String[] split = arg.split(" "); 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 589309385..2f8fc8235 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 @@ -54,8 +54,7 @@ import java.util.zip.ZipInputStream; * An implementation of the core, with a static getter for easy access. */ @SuppressWarnings({"unused", "WeakerAccess"}) public class PlotSquared { - private static final Set EMPTY_SET = Collections. - unmodifiableSet(Collections.emptySet()); + private static final Set EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet()); private static PlotSquared instance; // Implementation public final IPlotMain IMP; @@ -217,21 +216,6 @@ import java.util.zip.ZipInputStream; .runTask(() -> EconHandler.manager = PlotSquared.this.IMP.getEconomyHandler()); } -/* // Check for updates - if (Settings.Enabled_Components.UPDATER) { - updater = new Updater(); - TaskManager.IMP.taskAsync(new Runnable() { - @Override public void run() { - updater.update(getPlatform(), getVersion()); - } - }); - TaskManager.IMP.taskRepeatAsync(new Runnable() { - @Override public void run() { - updater.update(getPlatform(), getVersion()); - } - }, 36000); - }*/ - // World generators: final ConfigurationSection section = this.worlds.getConfigurationSection("worlds"); if (section != null) { @@ -249,13 +233,14 @@ import java.util.zip.ZipInputStream; continue; } if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) { - debug( - "&c`" + world + "` was not properly loaded - " + IMP.getPluginName() + debug("`" + world + "` was not properly loaded - " + IMP.getPluginName() + " will now try to load it properly: "); debug( - "&8 - &7Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); + " - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); debug( - "&8 - &7Your world management plugin may be faulty (or non existent)"); + " - Your world management plugin may be faulty (or non existent)"); + debug( + " This message may also be a false positive and could be ignored."); PlotSquared.this.IMP.setGenerator(world); } } @@ -614,9 +599,7 @@ import java.util.zip.ZipInputStream; */ private void sortPlotsByHash(Plot[] input) { List[] bucket = new ArrayList[32]; - for (int i = 0; i < bucket.length; i++) { - bucket[i] = new ArrayList<>(); - } + Arrays.fill(bucket, new ArrayList<>()); boolean maxLength = false; int placement = 1; while (!maxLength) { @@ -1191,7 +1174,7 @@ import java.util.zip.ZipInputStream; "Invalid type for multi-area world. Expected `2`, got `" + 1 + "`"); } for (String areaId : areasSection.getKeys(false)) { - PlotSquared.log(Captions.PREFIX + "&3 - " + areaId); + PlotSquared.log(Captions.PREFIX + " - " + areaId); String[] split = areaId.split("(?<=[^;-])-"); if (split.length != 3) { throw new IllegalArgumentException("Invalid Area identifier: " + areaId @@ -1678,11 +1661,11 @@ import java.util.zip.ZipInputStream; .getString("configuration_version") .equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION)) { // Conversion needed - log(Captions.LEGACY_CONFIG_FOUND.s()); + log(Captions.LEGACY_CONFIG_FOUND.getTranslated()); try { com.google.common.io.Files .copy(this.worldsFile, new File(folder, "worlds.yml.old")); - log(Captions.LEGACY_CONFIG_BACKUP.s()); + log(Captions.LEGACY_CONFIG_BACKUP.getTranslated()); final ConfigurationSection worlds = this.worlds.getConfigurationSection("worlds"); final LegacyConverter converter = new LegacyConverter(worlds); @@ -1691,9 +1674,9 @@ import java.util.zip.ZipInputStream; .set("configuration_version", LegacyConverter.CONFIGURATION_VERSION); this.worlds.set("worlds", worlds); // Redundant, but hey... ¯\_(ツ)_/¯ this.worlds.save(this.worldsFile); - log(Captions.LEGACY_CONFIG_DONE.s()); + log(Captions.LEGACY_CONFIG_DONE.getTranslated()); } catch (final Exception e) { - log(Captions.LEGACY_CONFIG_CONVERSION_FAILED.s()); + log(Captions.LEGACY_CONFIG_CONVERSION_FAILED.getTranslated()); e.printStackTrace(); } // Disable plugin diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 8e0847f57..7f335cfa5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -101,13 +101,14 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; return false; } plot.setAlias(alias); - MainUtil.sendMessage(player, Captions.ALIAS_SET_TO.s().replaceAll("%alias%", alias)); + MainUtil.sendMessage(player, + Captions.ALIAS_SET_TO.getTranslated().replaceAll("%alias%", alias)); return true; } private boolean removeAlias(PlotPlayer player, Plot plot) { plot.setAlias(null); - MainUtil.sendMessage(player, Captions.ALIAS_REMOVED.s()); + MainUtil.sendMessage(player, Captions.ALIAS_REMOVED.getTranslated()); return true; } 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 ed6a4a3dc..f4c73a972 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 @@ -331,8 +331,8 @@ import java.util.Set; + "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + "\n$1Region: $2" + region + "\n$1Generator: $2" + generator; MainUtil.sendMessage(player, - Captions.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER - .s(), false); + Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n' + + Captions.PLOT_INFO_FOOTER.getTranslated(), false); return true; } case "l": @@ -394,7 +394,7 @@ import java.util.Set; .color("$1").text(" - ").color("$2") .text(area.TYPE + ":" + area.TERRAIN).color("$3"); } - }, "/plot area list", Captions.AREA_LIST_HEADER_PAGED.s()); + }, "/plot area list", Captions.AREA_LIST_HEADER_PAGED.getTranslated()); return true; case "regen": case "clear": diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java index b40167b4c..487c5d7c0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java @@ -16,10 +16,11 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; @Override public boolean set(final PlotPlayer player, final Plot plot, final String value) { int biome = WorldUtil.IMP.getBiomeFromString(value); if (biome == -1) { - String biomes = - StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s()); + String biomes = StringMan + .join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.getTranslated()); Captions.NEED_BIOME.send(player); - MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); + MainUtil.sendMessage(player, + Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes); return false; } if (plot.getRunning() > 0) { @@ -29,7 +30,8 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; plot.addRunning(); plot.setBiome(value.toUpperCase(), () -> { plot.removeRunning(); - MainUtil.sendMessage(player, Captions.BIOME_SET_TO.s() + value.toLowerCase()); + MainUtil + .sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase()); }); return true; } 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 32d7095a9..1bc8f779e 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 @@ -297,7 +297,8 @@ import java.util.UUID; Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea())); + Captions.PERMISSION_CLUSTER.getTranslated() + "." + (current + cluster + .getArea())); return false; } // resize cluster @@ -588,7 +589,7 @@ import java.util.UUID; String size = (cluster.getP2().x - cluster.getP1().x + 1) + "x" + ( cluster.getP2().y - cluster.getP1().y + 1); String rights = cluster.isAdded(player.getUUID()) + ""; - String message = Captions.CLUSTER_INFO.s(); + String message = Captions.CLUSTER_INFO.getTranslated(); message = message.replaceAll("%id%", id); message = message.replaceAll("%owner%", owner); message = message.replaceAll("%name%", name); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java index bebf77907..3958f2d39 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java @@ -16,7 +16,7 @@ import lombok.RequiredArgsConstructor; * Teleportation CommandConfig. * Such as: /plot visit */ - TELEPORT(Captions.COMMAND_CATEGORY_TELEPPORT), + TELEPORT(Captions.COMMAND_CATEGORY_TELEPORT), /** * Protection. */ @@ -53,6 +53,6 @@ import lombok.RequiredArgsConstructor; private final Captions caption; @Override public String toString() { - return this.caption.s(); + return this.caption.getTranslated(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index dd95a8c2f..2a34fdbf5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -19,7 +19,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index 527b67819..fdc44e5c7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -15,15 +15,15 @@ public class Debug extends SubCommand { if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { StringBuilder msg = new StringBuilder(); for (Captions caption : Captions.values()) { - msg.append(caption.s()).append("\n"); + msg.append(caption.getTranslated()).append("\n"); } MainUtil.sendMessage(player, msg.toString()); return true; } StringBuilder information = new StringBuilder(); - String header = Captions.DEBUG_HEADER.s(); - String line = Captions.DEBUG_LINE.s(); - String section = Captions.DEBUG_SECTION.s(); + String header = Captions.DEBUG_HEADER.getTranslated(); + String line = Captions.DEBUG_LINE.getTranslated(); + String section = Captions.DEBUG_SECTION.getTranslated(); information.append(header); information.append(getSection(section, "PlotArea")); information.append( diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index ba4e1b4ff..e9471e6e7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -124,8 +124,8 @@ import java.util.stream.Collectors; final String pasteId = jsonObject.get("paste_id").getAsString(); final String link = String.format("https://athion.net/ISPaster/paste/view/%s", pasteId); - player - .sendMessage(Captions.DEBUG_REPORT_CREATED.s().replace("%url%", link)); + player.sendMessage( + Captions.DEBUG_REPORT_CREATED.getTranslated().replace("%url%", link)); } else { final String responseMessage = jsonObject.get("response").getAsString(); MainUtil.sendMessage(player, String diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index fa6a1f96c..7bb0ab34a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -105,7 +105,7 @@ import java.util.UUID; WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn - player.kick(Captions.YOU_GOT_DENIED.s()); + player.kick(Captions.YOU_GOT_DENIED.getTranslated()); } else { player.teleport(newSpawn); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java index 43560b81f..14521b2c6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java @@ -8,7 +8,11 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; 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.util.*; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +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.WorldUtil; import com.sk89q.jnbt.CompoundTag; import java.net.URL; @@ -37,7 +41,7 @@ import java.net.URL; return false; } if ((!plot.isOwner(player.getUUID())) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java index 83161d73a..7a1d2cddc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java @@ -142,7 +142,7 @@ public class GenerateDocs { Matcher m2 = p2.matcher(line); while (m2.find()) { - perms.add(Captions.valueOf("PERMISSION_" + m2.group(1)).s()); + perms.add(Captions.valueOf("PERMISSION_" + m2.group(1)).getTranslated()); } if (line.contains("Permissions.hasPermission(")) { String[] split = line.split("Permissions.hasPermission"); @@ -151,7 +151,7 @@ public class GenerateDocs { String perm = method.split("[,|)]")[1].trim(); if (!perm.equalsIgnoreCase(perm)) { if (perm.startsWith("C.")) { - perm = Captions.valueOf(perm.split("\\.")[1]).s(); + perm = Captions.valueOf(perm.split("\\.")[1]).getTranslated(); } else { continue; } @@ -181,7 +181,7 @@ public class GenerateDocs { String perm = method.split("[,|)]")[1].trim(); if (!perm.equalsIgnoreCase(perm)) { if (perm.startsWith("C.")) { - perm = Captions.valueOf(perm.split("\\.")[1]).s(); + perm = Captions.valueOf(perm.split("\\.")[1]).getTranslated(); } else { continue; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index 0a5515370..47d9ea89b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -77,16 +77,17 @@ public class Help extends Command { } if (cat == null && page == 0) { StringBuilder builder = new StringBuilder(); - builder.append(Captions.HELP_HEADER.s()); + builder.append(Captions.HELP_HEADER.getTranslated()); for (CommandCategory c : CommandCategory.values()) { builder.append("\n").append(StringMan - .replaceAll(Captions.HELP_INFO_ITEM.s(), "%category%", c.toString().toLowerCase(), + .replaceAll(Captions.HELP_INFO_ITEM.getTranslated(), "%category%", + c.toString().toLowerCase(), "%category_desc%", c.toString())); } builder.append("\n") - .append(Captions.HELP_INFO_ITEM.s().replaceAll("%category%", "all") + .append(Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all") .replaceAll("%category_desc%", "Display all commands")); - builder.append("\n").append(Captions.HELP_FOOTER.s()); + builder.append("\n").append(Captions.HELP_FOOTER.getTranslated()); MainUtil.sendMessage(player, builder.toString(), false); return true; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 4a59850a9..8d427bbcd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -40,7 +40,8 @@ import java.util.List; } StringBuilder string = new StringBuilder(); string.append(StringMan - .replaceAll(Captions.COMMENT_LIST_HEADER_PAGED.s(), "%amount%", comments.length, "%cur", + .replaceAll(Captions.COMMENT_LIST_HEADER_PAGED.getTranslated(), "%amount%", + comments.length, "%cur", page + 1, "%max", totalPages + 1, "%word", "all") + '\n'); // This might work xD diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java index 51e5cd6c0..fe42e5dd4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java @@ -5,7 +5,11 @@ 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.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.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; @@ -53,7 +57,7 @@ public class Info extends SubCommand { plot = player.getCurrentPlot(); } if (plot == null) { - MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.s()); + MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.getTranslated()); return false; } @@ -70,7 +74,8 @@ public class Info extends SubCommand { boolean allowed = false; for (final String argument : args) { if (argument.equalsIgnoreCase("-f")) { - if (!player.hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.s())) { + if (!player + .hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_INFO_FORCE); return true; } @@ -125,7 +130,7 @@ public class Info extends SubCommand { plot.getId().x + ";" + plot.getId().y); return true; } - String info = Captions.PLOT_INFO.s(); + String info = Captions.PLOT_INFO.getTranslated(); boolean full; if (arg != null) { info = getCaption(arg); @@ -148,8 +153,8 @@ public class Info extends SubCommand { MainUtil.format(info, plot, player, full, new RunnableVal() { @Override public void run(String value) { MainUtil.sendMessage(player, - Captions.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER - .s(), false); + Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n' + + Captions.PLOT_INFO_FOOTER.getTranslated(), false); } }); return true; @@ -158,29 +163,29 @@ public class Info extends SubCommand { private String getCaption(String string) { switch (string) { case "trusted": - return Captions.PLOT_INFO_TRUSTED.s(); + return Captions.PLOT_INFO_TRUSTED.getTranslated(); case "alias": - return Captions.PLOT_INFO_ALIAS.s(); + return Captions.PLOT_INFO_ALIAS.getTranslated(); case "biome": - return Captions.PLOT_INFO_BIOME.s(); + return Captions.PLOT_INFO_BIOME.getTranslated(); case "denied": - return Captions.PLOT_INFO_DENIED.s(); + return Captions.PLOT_INFO_DENIED.getTranslated(); case "flags": - return Captions.PLOT_INFO_FLAGS.s(); + return Captions.PLOT_INFO_FLAGS.getTranslated(); case "id": - return Captions.PLOT_INFO_ID.s(); + return Captions.PLOT_INFO_ID.getTranslated(); case "size": - return Captions.PLOT_INFO_SIZE.s(); + return Captions.PLOT_INFO_SIZE.getTranslated(); case "members": - return Captions.PLOT_INFO_MEMBERS.s(); + return Captions.PLOT_INFO_MEMBERS.getTranslated(); case "owner": - return Captions.PLOT_INFO_OWNER.s(); + return Captions.PLOT_INFO_OWNER.getTranslated(); case "rating": - return Captions.PLOT_INFO_RATING.s(); + return Captions.PLOT_INFO_RATING.getTranslated(); case "likes": - return Captions.PLOT_INFO_LIKES.s(); + return Captions.PLOT_INFO_LIKES.getTranslated(); case "seen": - return Captions.PLOT_INFO_SEEN.s(); + return Captions.PLOT_INFO_SEEN.getTranslated(); default: return null; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java index b749eaba4..2ffb6aa6a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java @@ -79,7 +79,7 @@ import java.util.UUID; .getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn - player2.kick(Captions.YOU_GOT_KICKED.s()); + player2.kick(Captions.YOU_GOT_KICKED.getTranslated()); } else { player2.plotkick(newSpawn); } 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 33957d617..4917e2499 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 @@ -72,8 +72,8 @@ public class ListCmd extends SubCommand { } public void noArgs(PlotPlayer player) { - MainUtil.sendMessage(player, - Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(player))); + MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + Arrays + .toString(getArgumentList(player))); } @Override public boolean onCommand(PlotPlayer player, String[] args) { @@ -367,19 +367,19 @@ public class ListCmd extends SubCommand { color = "$1"; } PlotMessage trusted = new PlotMessage().text(Captions.color( - Captions.PLOT_INFO_TRUSTED.s() + Captions.PLOT_INFO_TRUSTED.getTranslated() .replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted())))) .color("$1"); PlotMessage members = new PlotMessage().text(Captions.color( - Captions.PLOT_INFO_MEMBERS.s() + Captions.PLOT_INFO_MEMBERS.getTranslated() .replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers())))) .color("$1"); String strFlags = StringMan.join(plot.getFlags().values(), ","); if (strFlags.isEmpty()) { - strFlags = Captions.NONE.s(); + strFlags = Captions.NONE.getTranslated(); } - PlotMessage flags = new PlotMessage().text(Captions - .color(Captions.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))) + PlotMessage flags = new PlotMessage().text(Captions.color( + Captions.PLOT_INFO_FLAGS.getTranslated().replaceAll("%flags%", strFlags))) .color("$1"); message.text("[").color("$3").text(i + "") .command("/plot visit " + plot.getArea() + ";" + plot.getId()) @@ -407,7 +407,7 @@ public class ListCmd extends SubCommand { prefix = ", "; } } - }, "/plot list " + args[0], Captions.PLOT_LIST_HEADER_PAGED.s()); + }, "/plot list " + args[0], Captions.PLOT_LIST_HEADER_PAGED.getTranslated()); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index 2e68b739c..fcf5650b2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -107,7 +107,7 @@ public class Merge extends SubCommand { if (!terrain && !Permissions .hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_MERGE_KEEP_ROAD.s()); + Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); return true; } if (plot.autoMerge(-1, maxSize, uuid, terrain)) { @@ -133,7 +133,7 @@ public class Merge extends SubCommand { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); MainUtil.sendMessage(player, - Captions.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw()))); + Captions.DIRECTION.getTranslated().replaceAll("%dir%", direction(loc.getYaw()))); return false; } final boolean terrain; @@ -144,7 +144,7 @@ public class Merge extends SubCommand { } if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_MERGE_KEEP_ROAD.s()); + Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); return true; } if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) { @@ -193,8 +193,8 @@ public class Merge extends SubCommand { MainUtil.sendMessage(player, Captions.SUCCESS_MERGE); }; if (hasConfirmation(player)) { - CmdConfirm.addPending(accepter, - Captions.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run); + CmdConfirm.addPending(accepter, Captions.MERGE_REQUEST_CONFIRM.getTranslated() + .replaceAll("%s", player.getName()), run); } else { run.run(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index e52ec1fcf..0e6d78247 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -21,7 +21,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } @@ -50,7 +50,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; return false; } if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s()))) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated()))) { Captions.PLOTWORLD_INCOMPATIBLE.send(player); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 8247c0e83..55dbdbda4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -37,8 +37,8 @@ import java.util.UUID; if (uuid == null || value.equalsIgnoreCase("-")) { if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value .equalsIgnoreCase("-")) { - if (!Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER.s(), true)) { + if (!Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER.getTranslated(), true)) { return false; } Set connected = plot.getConnectedPlots(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 7b01f57e1..982e03ae1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -126,7 +126,8 @@ import java.util.stream.IntStream; newValues.addAll( Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); } - MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan + MainUtil + .sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan .join(newValues, Captions.BLOCK_LIST_SEPARATER.formatted())); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java index da709d2a3..9f7f0b145 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java @@ -19,7 +19,7 @@ public class Swap extends SubCommand { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index a606b5a3a..5fd74a9ea 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -21,9 +21,7 @@ import java.util.Set; public enum Captions { //@formatter:off - /* - * Static flags - */ + // FLAG_USE("use", "static.flags"), FLAG_BREAK("break", "static.flags"), FLAG_PLACE("place", "static.flags"), @@ -44,9 +42,8 @@ public enum Captions { FLAG_TAMED_INTERACT("tamed-interact", "static.flags"), FLAG_DISABLE_PHYSICS("disable-physics", "static.flags"), FLAG_MOB_PLACE("mob-place", "static.flags"), - /* - * Static permission - */ + // + // PERMISSION_STAR("*", "static.permissions"), PERMISSION_ADMIN("plots.admin", "static.permissions"), PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned", "static.permissions"), @@ -162,37 +159,32 @@ public enum Captions { PERMISSION_ALIAS_SET_OBSOLETE("plots.set.alias", "static.permissions"), // Note this is for backwards compatibility PERMISSION_ALIAS_SET("plots.alias.set", "static.permissions"), PERMISSION_ALIAS_REMOVE("plots.alias.remove", "static.permissions"), - /* - * Static console - */ + // + // CONSOLE_JAVA_OUTDATED( "&cYour version of java is outdated. It is highly recommended that you update to Java 8 as it increases performance " + "and security. %s0 will require Java 8 in a future update.", "static.console"), CONSOLE_PLEASE_ENABLE_METRICS( "&dPlease enable metrics for %s0. Using metrics improves plugin stability, performance, and features. " + "Bug fixes and new features are influenced on metrics.", "static.console"), - /* - * Confirm - */ + // + // EXPIRED_CONFIRM("$2Confirmation has expired, please run the command again!", "Confirm"), FAILED_CONFIRM("$2You have no pending actions to confirm!", "Confirm"), REQUIRES_CONFIRM( "$2Are you sure you wish to execute: $1%s$2?&-$2This cannot be undone! If you are sure: $1/plot confirm", "Confirm"), - /* - * Move - */ + // + // MOVE_SUCCESS("$4Successfully moved plot.", "Move"), COPY_SUCCESS("$4Successfully copied plot.", "Move"), REQUIRES_UNOWNED("$2The location specified is already occupied.", "Move"), - /* - * Area Create - */ + // + // REQUIRES_UNMERGED("$2The plot cannot be merged", "debug"), SET_ATTRIBUTE("$4Successfully set %s0 set to %s1", "Set"), - /* - * Web - */ + // + // GENERATING_LINK("$1Processing plot...", "Web"), GENERATING_LINK_FAILED( "$2Failed to generate download link!", "Web"), @@ -201,13 +193,11 @@ public enum Captions { LOAD_FAILED("$2Failed to load schematic", "Web"), LOAD_LIST("$2To load a schematic, use $1/plot load #", "Web"), SAVE_SUCCESS("$1Successfully saved!", "Web"), - /* - * Compass - */ + // + // COMPASS_TARGET("$4Successfully targeted plot with compass", "Compass"), - /* - * Cluster - */ + // + // CLUSTER_AVAILABLE_ARGS( "$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, " + "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_LIST_HEADING( @@ -233,18 +223,15 @@ public enum Captions { CLUSTER_INFO( "$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%", "Cluster"), - /* - * Border - */ + // + // BORDER("$2You are outside the current map border", "Border"), - /* - * Un-claim - */ + // + // UNCLAIM_SUCCESS("$4You successfully unclaimed the plot.", "Unclaim"), UNCLAIM_FAILED( "$2Could not unclaim the plot", "Unclaim"), - /* - * WorldEdit masks - */ + // + // WORLDEDIT_DELAYED("$2Please wait while we process your WorldEdit action...", "WorldEdit Masks"), WORLDEDIT_RUN("$2Apologies for the delay. Now executing: %s", "WorldEdit Masks"), @@ -270,25 +257,20 @@ public enum Captions { GAMEMODE_WAS_BYPASSED("$1You bypassed the GameMode ($2{gamemode}$1) $1set for $2{plot}", "GameMode"), HEIGHT_LIMIT("$1This plot area has a height limit of $2{limit}", "Height Limit"), - /* - * Records - */ - RECORD_PLAY("$2%player $2started playing record $1%name", "Records"), NOTIFY_ENTER( - "$2%player $2entered your plot ($1%plot$2)", "Records"), - + // + // + NOTIFY_ENTER("$2%player $2entered your plot ($1%plot$2)", "Records"), NOTIFY_LEAVE("$2%player $2left your plot ($1%plot$2)", "Records"), - /* - * Swap - */ + // + // SWAP_OVERLAP("$2The proposed areas are not allowed to overlap", "Swap"), SWAP_DIMENSIONS( "$2The proposed areas must have comparable dimensions", "Swap"), SWAP_SYNTAX("$2/plot swap ", "Swap"), SWAP_SUCCESS("$4Successfully swapped plots", "Swap"), STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"), - /* - * Comment - */ + // + // INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"), NOT_VALID_INBOX_INDEX( "$2No comment at index %s", "Comment"), @@ -306,21 +288,18 @@ public enum Captions { COMMENT_HEADER("$2&m---------&r $1Comments $2&m---------&r", "Comment"), INBOX_EMPTY( "$2No comments", "Comment"), - /* - * Console - */ + // + // NOT_CONSOLE("$2For safety reasons, this command can only be executed by console.", "Console"), IS_CONSOLE("$2This command can only be executed by a player.", "Console"), - /* - Inventory - */ + // + // INVENTORY_USAGE("&cUsage: &6{usage}", "Inventory"), INVENTORY_DESC("&cDescription: &6{desc}", "Inventory"), INVENTORY_CATEGORY("&cCategory: &6{category}", "Inventory"), - /* - * Clipboard - */ + // + // CLIPBOARD_SET( "$2The current plot is now copied to your clipboard, use $1/plot paste$2 to paste it", "Clipboard"), PASTED( @@ -333,16 +312,15 @@ public enum Captions { CLIPBOARD_INFO( "$2Current Selection - Plot ID: $1%id$2, Width: $1%width$2, Total Blocks: $1%total$2", "Clipboard"), - /* - * Toggle - */ + // + // TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"), TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"), COMMAND_BLOCKED("$2That command is not allowed in this plot", "Blocked Command"), - /* - * Done - */ + // + // + DONE_ALREADY_DONE("$2This plot is already marked as done", "Done"), DONE_NOT_DONE( "$2This plot is not marked as done.", "Done"), @@ -351,10 +329,8 @@ public enum Captions { "Done"), DONE_SUCCESS("$1Successfully marked this plot as done.", "Done"), DONE_REMOVED("$1You may now continue building in this plot.", "Done"), - /* - * Ratings - */ - + // + // RATINGS_PURGED("$2Purged ratings for this plot", "Ratings"), RATING_NOT_VALID( "$2You need to specify a number between 1 and 10", "Ratings"), @@ -368,16 +344,12 @@ public enum Captions { "$2You can only rate finished plots.", "Ratings"), RATING_NOT_OWNED("$2You cannot rate a plot that is not claimed by anyone", "Ratings"), - /* - * Tutorial - */ - + // + // RATE_THIS("$2Rate this plot!", "Tutorial"), COMMENT_THIS( "$2Leave some feedback on this plot: %s", "Tutorial"), - /* - * Economy Stuff - */ - + // + // ECON_DISABLED("$2Economy is not enabled", "Economy"), CANNOT_AFFORD_PLOT( "$2You cannot afford to buy this plot. It costs $1%s", "Economy"), @@ -392,10 +364,8 @@ public enum Captions { "$1%s $2has been taken from your balance", "Economy"), REMOVED_GRANTED_PLOT("$2You used %s plot grant(s), you've got $1%s $2left", "Economy"), - /* - * Setup Stuff - */ - + // + // SETUP_INIT("$1Usage: $2/plot setup ", "Setup"), SETUP_STEP( "$3[$1Step %s0$3] $1%s1 $2- $1Expecting: $2%s2 $1Default: $2%s3", "Setup"), @@ -415,9 +385,8 @@ public enum Captions { + "$1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"), - /* - * Schematic Stuff - */ + // + // SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"), SCHEMATIC_MISSING_ARG( @@ -431,38 +400,29 @@ public enum Captions { "Schematics"), SCHEMATIC_PASTE_SUCCESS("$4The schematic pasted successfully", "Schematics"), SCHEMATIC_LIST("$4Saved Schematics: $1%s", "Schematics"), - - /* - * Title Stuff - */ - TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"), TITLE_ENTERED_PLOT_SUB("$4Owned by %s", - "Titles"), - - PREFIX_GREETING("$1%id%$2> ", "Titles"), PREFIX_FAREWELL("$1%id%$2> ", "Titles"), - /* - * Core Stuff - */ - - TASK_START("Starting task...", "Core"), PREFIX("$3[$1P2$3] $2", "Core"), - + // + // + TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"), + TITLE_ENTERED_PLOT_SUB("$4Owned by %s", "Titles"), + PREFIX_GREETING("$1%id%$2> ", "Titles"), + PREFIX_FAREWELL("$1%id%$2> ", "Titles"), + // + // + TASK_START("Starting task...", "Core"), + PREFIX("$3[$1P2$3] $2", "Core"), ENABLED("$1%s0 is now enabled", "Core"), - /* - * Reload - */ - - RELOADED_CONFIGS("$1Translations and world settings have been reloaded", - "Reload"), RELOAD_FAILED("$2Failed to reload file configurations", "Reload"), - /* - * BarAPI - */ - - DESC_SET("$2Plot description set", "Desc"), DESC_UNSET("$2Plot description unset", "Desc"), - + // + // + RELOADED_CONFIGS("$1Translations and world settings have been reloaded", "Reload"), + RELOAD_FAILED("$2Failed to reload file configurations", "Reload"), + // + // + DESC_SET("$2Plot description set", "Desc"), + DESC_UNSET("$2Plot description unset", "Desc"), MISSING_DESC("$2You need to specify a description", "Desc"), + // + // - /* - * Alias - */ ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), ALIAS_REMOVED("$2Plot alias removed", "Alias"), @@ -470,9 +430,8 @@ public enum Captions { "$2The alias must be < 50 characters in length", "Alias"), ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"), - /* - * Position - */ + // + // MISSING_POSITION("$2You need to specify a position. Possible values: $1none", "Position"), POSITION_SET("$1Home position set to your current location", "Position"), @@ -481,38 +440,25 @@ public enum Captions { "$2Use /plot set home [none]", "Position"), INVALID_POSITION("$2That is not a valid position value", "Position"), - /* - * Cap - */ - + // + // ENTITY_CAP("$2You are not allowed to spawn more mobs", "cap"), - /* - * Time - */ - - TIME_FORMAT("$1%hours%, %min%, %sec%", "Time"), - /* - * Permission - */ - + // + // NO_SCHEMATIC_PERMISSION("$2You don't have the permission required to use schematic $1%s", - "Permission"), NO_PERMISSION("$2You are lacking the permission node: $1%s", "Permission"), - - NO_PERMISSION_EVENT("$2You are lacking the permission node: $1%s", "Permission"), NO_PLOT_PERMS( - "$2You must be the plot owner to perform this action", "Permission"), - - CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots.", "Permission"), CANT_CLAIM_MORE_CLUSTERS( - "$2You can't claim more clusters.", "Permission"), + "Permission"), + NO_PERMISSION("$2You are lacking the permission node: $1%s", "Permission"), + NO_PERMISSION_EVENT("$2You are lacking the permission node: $1%s", "Permission"), + NO_PLOT_PERMS("$2You must be the plot owner to perform this action", "Permission"), + CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots.", "Permission"), + CANT_CLAIM_MORE_CLUSTERS("$2You can't claim more clusters.", "Permission"), CANT_TRANSFER_MORE_PLOTS("$2You can't send more plots to that user", "Permission"), CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once", "Permission"), - YOU_BE_DENIED("$2You are not allowed to enter this plot", "Permission"), - - /* - * Merge - */ + // + // MERGE_NOT_VALID("$2This merge request is no longer valid.", "Merge"), MERGE_ACCEPTED( "$2The merge request has been accepted", "Merge"), @@ -528,10 +474,8 @@ public enum Captions { UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"), UNLINK_SUCCESS( "$2Successfully unlinked plots.", "Merge"), - /* - * CommandConfig - */ - + // + // NOT_VALID_SUBCOMMAND("$2That is not a valid subcommand", "CommandConfig"), DID_YOU_MEAN( "$2Did you mean: $1%s", "CommandConfig"), @@ -540,100 +484,69 @@ public enum Captions { SUBCOMMAND_SET_OPTIONS_HEADER("$2Possible Values: ", "CommandConfig"), COMMAND_SYNTAX( "$1Usage: $2%s", "CommandConfig"), - /* - * Player not found - */ - - INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", - "Errors"), INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"), - + // + // + INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"), + INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"), INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"), - /* - * Command flag - */ - - INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"), /* - * Unknown Error - */ - - ERROR("$2An error occurred: %s", - "Errors"), // SETTINGS_PASTE_UPLOADED("$2settings.yml was uploaded to: $1%url%", "Paste"), - - // LATEST_LOG_UPLOADED("$2latest.log was uploaded to: $1%url%", "Paste"), + INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"), + ERROR("$2An error occurred: %s", "Errors"), + COMMAND_WENT_WRONG("$2Something went wrong when executing that command...", "Errors"), + NO_FREE_PLOTS("$2There are no free plots available", "Errors"), + NOT_IN_PLOT("$2You're not in a plot", "Errors"), + NOT_LOADED("$2The plot could not be loaded", "Errors"), + NOT_IN_CLUSTER( + "$2You must be within a plot cluster to perform that action", "Errors"), + NOT_IN_PLOT_WORLD("$2You're not in a plot area", "Errors"), + PLOTWORLD_INCOMPATIBLE("$2The two worlds must be compatible", "Errors"), + NOT_VALID_WORLD("$2That is not a valid world (case sensitive)", "Errors"), + NOT_VALID_PLOT_WORLD("$2That is not a valid plot area (case sensitive)", "Errors"), + NO_PLOTS("$2You don't have any plots", "Errors"), + WAIT_FOR_TIMER( + "$2A set block timer is bound to either the current plot or you. Please wait for it to finish", + "Errors"), + // DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"), - COMMAND_WENT_WRONG("$2Something went wrong when executing that command...", "Errors"), - /* - * purge - */ - PURGE_SUCCESS("$4Successfully purged %s plots", "Purge"), - /* - * trim - */ - TRIM_IN_PROGRESS("A world trim task is already in progress!", - "Trim"), NOT_VALID_HYBRID_PLOT_WORLD( - "The hybrid plot manager is required to perform this action", "Trim"), - /* - * No - */ - - NO_FREE_PLOTS("$2There are no free plots available", "Errors"), NOT_IN_PLOT( - "$2You're not in a plot", "Errors"), - - NOT_LOADED("$2The plot could not be loaded", "Errors"), NOT_IN_CLUSTER( - "$2You must be within a plot cluster to perform that action", "Errors"), - - NOT_IN_PLOT_WORLD("$2You're not in a plot area", "Errors"), PLOTWORLD_INCOMPATIBLE( - "$2The two worlds must be compatible", "Errors"), - - NOT_VALID_WORLD("$2That is not a valid world (case sensitive)", "Errors"), NOT_VALID_PLOT_WORLD( - "$2That is not a valid plot area (case sensitive)", "Errors"), - - NO_PLOTS("$2You don't have any plots", "Errors"), - /* - * Block List - */ + // + TRIM_IN_PROGRESS("A world trim task is already in progress!", "Trim"), + NOT_VALID_HYBRID_PLOT_WORLD("The hybrid plot manager is required to perform this action", "Trim"), + // + // BLOCK_LIST_SEPARATER("$1,$2 ", "Block List"), - /* - * Biome - */ + // + // NEED_BIOME("$2You need to specify a valid biome.", "Biome"), BIOME_SET_TO( "$2Plot biome set to $2", "Biome"), - /* - * Teleport / Entry - */ + // + // TELEPORTED_TO_PLOT("$1You have been teleported", "Teleport"), TELEPORTED_TO_ROAD( "$2You got teleported to the road", "Teleport"), TELEPORT_IN_SECONDS("$1Teleporting in %s seconds. Do not move...", "Teleport"), TELEPORT_FAILED( "$2Teleportation cancelled due to movement or damage", "Teleport"), - /* - * Set Block - */ + // + // SET_BLOCK_ACTION_FINISHED("$1The last setblock action is now finished.", "Set Block"), + // + // - /* - AllowUnsafe - */ DEBUGALLOWUNSAFE_ON("$2Unsafe actions allowed", "unsafe"), DEBUGALLOWUNSAFE_OFF( "$2Unsafe actions disabled", "unsafe"), - /* - * Debug - */ + // + // DEBUG_HEADER("$1Debug Information&-", "Debug"), DEBUG_SECTION("$2>> $1&l%val%", "Debug"), DEBUG_LINE("$2>> $1%var%$2:$1 %val%&-", "Debug"), - - /* - * Invalid - */ + // + // NOT_VALID_DATA("$2That's not a valid data id.", "Invalid"), NOT_VALID_BLOCK( "$2That's not a valid block: %s", "Invalid"), @@ -651,30 +564,26 @@ public enum Captions { "$2Found no plots with your search query", "Invalid"), FOUND_NO_PLOTS_FOR_PLAYER("$2No plots found for player: %s", "Invalid"), - /* - * Need - */ - NEED_PLOT_NUMBER("$2You've got to specify a plot number or alias", "Need"), NEED_BLOCK( - "$2You've got to specify a block", "Need"), - - NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"), NEED_PLOT_WORLD( - "$2You've got to specify a plot area.", "Need"), - + // + // + NEED_PLOT_NUMBER("$2You've got to specify a plot number or alias", "Need"), + NEED_BLOCK("$2You've got to specify a block", "Need"), + NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"), + NEED_PLOT_WORLD("$2You've got to specify a plot area.", "Need"), NEED_USER("$2You need to specify a username", "Need"), - /* - * Near - */ + // + // PLOT_NEAR("$1Players: %s0", "Near"), - /* - * Info - */ + // + // NONE("None", "Info"), NOW("Now", "Info"), NEVER("Never", "Info"), UNKNOWN("Unknown", "Info"), SERVER("Server", "Info"), - EVERYONE("Everyone", "Info"), PLOT_UNOWNED( + EVERYONE("Everyone", "Info"), + PLOT_UNOWNED( "$2The current plot must have an owner to perform this action", "Info"), PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), PLOT_INFO_HEADER( @@ -685,11 +594,12 @@ public enum Captions { PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner: $2%owner%$1&-" + "$1Biome: $2%biome%$1&-" + "$1Can Build: $2%build%$1&-" + "$1Rating: $2%rating%&-" + "$1Seen: $2%seen%&-" + "$1Trusted: $2%trusted%$1&-" + "$1Members: $2%members%$1&-" - + "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"), PLOT_INFO_FOOTER( + + "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"), + PLOT_INFO_FOOTER( "$3&m---------&r $1INFO $3&m---------", false, "Info"), - PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), PLOT_INFO_MEMBERS("$1Members:$2 %members%", - "Info"), + PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), + PLOT_INFO_MEMBERS("$1Members:$2 %members%", "Info"), PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"), PLOT_INFO_FLAGS("$1Flags:$2 %flags%", "Info"), @@ -704,195 +614,116 @@ public enum Captions { PLOT_INFO_SEEN("$1Seen:$2 %seen%", "Info"), PLOT_USER_LIST(" $1%user%$2,", "Info"), PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"), INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"), - /* - * Generating - */ - + // + // GENERATING_COMPONENT("$1Started generating component from your settings", "Working"), - /* - * Clearing - */ - - CLEARING_PLOT("$2Clearing plot async.", "Working"), CLEARING_DONE( - "$4Clear completed! Took %sms.", "Working"), - + CLEARING_PLOT("$2Clearing plot async.", "Working"), + CLEARING_DONE("$4Clear completed! Took %sms.", "Working"), DELETING_DONE("$4Delete completed! Took %sms.", "Working"), - /* - * Claiming - */ - - PLOT_NOT_CLAIMED("$2Plot not claimed", "Working"), PLOT_IS_CLAIMED( - "$2This plot is already claimed", "Working"), - + PLOT_NOT_CLAIMED("$2Plot not claimed", "Working"), + PLOT_IS_CLAIMED("$2This plot is already claimed", "Working"), CLAIMED("$4You successfully claimed the plot", "Working"), - /* - * List - */ - - COMMENT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% comments", - "List"), CLICKABLE(" (interactive)", "List"), - - AREA_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% areas", - "List"), PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", - "List"), - - PLOT_LIST_HEADER("$1List of %word% plots", "List"), PLOT_LIST_ITEM( - "$2>> $1%id$2:$1%world $2- $1%owner", "List"), - - PLOT_LIST_ITEM_ORDERED("$2[$1%in$2] >> $1%id$2:$1%world $2- $1%owner", - "List"), PLOT_LIST_FOOTER("$2>> $1%word% a total of $2%num% $1claimed %plot%.", "List"), - /* - * Left - */ - - LEFT_PLOT("$2You left a plot", "Left"), - /* - * Wait - */ - - WAIT_FOR_TIMER( - "$2A setblock timer is bound to either the current plot or you. Please wait for it to finish", - "Errors"), - /* - * Chat - */ - - PLOT_CHAT_SPY_FORMAT("$2[$1Plot Spy$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", - "Chat"), PLOT_CHAT_FORMAT("$2[$1Plot Chat$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", "Chat"), - - PLOT_CHAT_FORCED("$2This world forces everyone to use plot chat.", "Chat"), PLOT_CHAT_ON( - "$4Plot chat enabled.", "Chat"), - + // + // + COMMENT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% comments", "List"), + CLICKABLE(" (interactive)", "List"), + AREA_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% areas", "List"), + PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", "List"), + PLOT_LIST_HEADER("$1List of %word% plots", "List"), + PLOT_LIST_ITEM("$2>> $1%id$2:$1%world $2- $1%owner", "List"), + PLOT_LIST_ITEM_ORDERED("$2[$1%in$2] >> $1%id$2:$1%world $2- $1%owner", "List"), + PLOT_LIST_FOOTER("$2>> $1%word% a total of $2%num% $1claimed %plot%.", "List"), + // + // + PLOT_CHAT_SPY_FORMAT("$2[$1Plot Spy$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", "Chat"), + PLOT_CHAT_FORMAT("$2[$1Plot Chat$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", "Chat"), + PLOT_CHAT_FORCED("$2This world forces everyone to use plot chat.", "Chat"), + PLOT_CHAT_ON("$4Plot chat enabled.", "Chat"), PLOT_CHAT_OFF("$4Plot chat disabled.", "Chat"), - /* - * Denied - */ - - DENIED_REMOVED("$4You successfully undenied the player from this plot", "Deny"), DENIED_ADDED( - "$4You successfully denied the player from this plot", "Deny"), - - DENIED_NEED_ARGUMENT( - "$2Arguments are missing. $1/plot denied add $2or $1/plot denied remove ", - "Deny"), WAS_NOT_DENIED("$2That player was not denied on this plot", "Deny"), - - YOU_GOT_DENIED( - "$4You are denied from the plot you were previously on, and got teleported to spawn", - "Deny"), - /* - * Kick - */ - + // + // + DENIED_REMOVED("$4You successfully undenied the player from this plot", "Deny"), + DENIED_ADDED("$4You successfully denied the player from this plot", "Deny"), + DENIED_NEED_ARGUMENT("$2Arguments are missing. $1/plot denied add $2or $1/plot denied remove ", "Deny"), + WAS_NOT_DENIED("$2That player was not denied on this plot", "Deny"), + YOU_GOT_DENIED("$4You are denied from the plot you were previously on, and got teleported to spawn", "Deny"), + // YOU_GOT_KICKED("$4You got kicked!", "Kick"), - /* - * Rain - */ + // + FLAG_KEY("$2Key: %s", "Flag"), + FLAG_TYPE("$2Type: %s", "Flag"), + FLAG_DESC("$2Desc: %s", "Flag"), + NOT_VALID_FLAG("$2That is not a valid flag", "Flag"), + NOT_VALID_FLAG_SUGGESTED("$2That is not a valid flag. Did you mean: $1%s", "Flag"), + NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"), + FLAG_NOT_IN_PLOT("$2The plot does not have that flag", "Flag"), + FLAG_NOT_REMOVED("$2The flag could not be removed", "Flag"), + FLAG_NOT_ADDED("$2The flag could not be added", "Flag"), + FLAG_REMOVED("$4Successfully removed flag", "Flag"), + FLAG_ADDED("$4Successfully added flag", "Flag"), + FLAG_TUTORIAL_USAGE("$1Have an admin set the flag: $2%s", "CommandConfig"), + // + // + TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), + TRUSTED_REMOVED("$4You successfully removed a trusted user from the plot", "Trusted"), + WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), + PLOT_REMOVED_USER("$1Plot %s of which you were added to has been deleted due to owner inactivity", "Trusted"), + // + // + REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"), + ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"), - NEED_ON_OFF("$2You need to specify a value. Possible values: $1on$2, $1off", - "Rain"), SETTING_UPDATED("$4You successfully updated the setting", "Rain"), - /* - * Flag - */ - - FLAG_KEY("$2Key: %s", "Flag"), FLAG_TYPE("$2Type: %s", "Flag"), - - FLAG_DESC("$2Desc: %s", "Flag"), NOT_VALID_FLAG("$2That is not a valid flag", "Flag"), - - NOT_VALID_FLAG_SUGGESTED("$2That is not a valid flag. Did you mean: $1%s", - "Flag"), NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"), - - FLAG_NOT_IN_PLOT("$2The plot does not have that flag", "Flag"), FLAG_NOT_REMOVED( - "$2The flag could not be removed", "Flag"), - - FLAG_NOT_ADDED("$2The flag could not be added", "Flag"), FLAG_REMOVED( - "$4Successfully removed flag", "Flag"), - - FLAG_ADDED("$4Successfully added flag", "Flag"), FLAG_TUTORIAL_USAGE( - "$1Have an admin set the flag: $2%s", "CommandConfig"), - /* - * Trusted - */ - - TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), TRUSTED_REMOVED( - "$4You successfully removed a trusted user from the plot", "Trusted"), - - WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), PLOT_REMOVED_USER( - "$1Plot %s of which you were added to has been deleted due to owner inactivity", - "Trusted"), - /* - * Member - */ - - REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"), ALREADY_OWNER( - "$2That user is already the plot owner: %s0", "Member"), - - ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), MEMBER_ADDED( - "$4That user can now build while the plot owner is online", "Member"), - - MEMBER_REMOVED("$1You successfully removed a user from the plot", - "Member"), MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", - "Member"), + ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), + MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"), + MEMBER_REMOVED("$1You successfully removed a user from the plot", "Member"), + MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"), PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"), - /* - * Set Owner - */ - - SET_OWNER("$4You successfully set the plot owner", "Owner"), SET_OWNER_CANCELLED( - "$2The setowner action was cancelled", "Owner"), - + // + // + SET_OWNER("$4You successfully set the plot owner", "Owner"), + SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"), NOW_OWNER("$4You are now owner of plot %s", "Owner"), - /* - * Signs - */ - - OWNER_SIGN_LINE_1("$1ID: $1%id%", "Signs"), OWNER_SIGN_LINE_2("$1Owner:", "Signs"), - - OWNER_SIGN_LINE_3("$2%plr%", "Signs"), OWNER_SIGN_LINE_4("$3Claimed", "Signs"), - /* - * Help - */ - - HELP_HEADER("$3&m---------&r $1Plot\u00B2 Help $3&m---------", "Help"), HELP_PAGE_HEADER( - "$1Category: $2%category%$2,$1 Page: $2%current%$3/$2%max%$2", "Help"), - - HELP_FOOTER("$3&m---------&r $1Plot\u00B2 Help $3&m---------", "Help"), - - HELP_INFO_ITEM("$1/plot help %category% $3- $2%category_desc%", "Help"), HELP_ITEM( - "$1%usage% [%alias%]&- $3- $2%desc%&-", "Help"), - + // + // + OWNER_SIGN_LINE_1("$1ID: $1%id%", "Signs"), + OWNER_SIGN_LINE_2("$1Owner:", "Signs"), + OWNER_SIGN_LINE_3("$2%plr%", "Signs"), + OWNER_SIGN_LINE_4("$3Claimed", "Signs"), + // + // + HELP_HEADER("$3&m---------&r $1Plot² Help $3&m---------", "Help"), + HELP_PAGE_HEADER("$1Category: $2%category%$2,$1 Page: $2%current%$3/$2%max%$2", "Help"), + HELP_FOOTER("$3&m---------&r $1Plot² Help $3&m---------", "Help"), + HELP_INFO_ITEM("$1/plot help %category% $3- $2%category_desc%", "Help"), + HELP_ITEM("$1%usage% [%alias%]&- $3- $2%desc%&-", "Help"), HELP_DISPLAY_ALL_COMMANDS("Display all commands", "Help"), + DIRECTION("$1Current direction: %dir%", "Help"), + // BUCKET_ENTRIES_IGNORED( "$2Total bucket values add up to 1 or more. Blocks without a spcified chance will be ignored", "Generator_Bucket"), - /** * Command Categories */ - COMMAND_CATEGORY_CLAIMING("Claiming", "Category"), COMMAND_CATEGORY_TELEPPORT("Teleport", - "Category"), COMMAND_CATEGORY_SETTINGS("Protection", "Category"), COMMAND_CATEGORY_CHAT( - "Chat", "Category"), COMMAND_CATEGORY_SCHEMATIC("Web", - "Category"), COMMAND_CATEGORY_APPEARANCE("Cosmetic", "Category"), COMMAND_CATEGORY_INFO( - "Info", "Category"), COMMAND_CATEGORY_DEBUG("Debug", - "Category"), COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), + COMMAND_CATEGORY_CLAIMING("Claiming", "Category"), + COMMAND_CATEGORY_TELEPORT("Teleport", "Category"), + COMMAND_CATEGORY_SETTINGS("Protection", "Category"), + COMMAND_CATEGORY_CHAT("Chat", "Category"), + COMMAND_CATEGORY_SCHEMATIC("Web", "Category"), + COMMAND_CATEGORY_APPEARANCE("Cosmetic", "Category"), + COMMAND_CATEGORY_INFO("Info", "Category"), + COMMAND_CATEGORY_DEBUG("Debug", "Category"), + COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), - /* - * Direction - */ - - DIRECTION("$1Current direction: %dir%", "Help"), - /* - * Grant - */ - - GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), GRANTED_PLOT( - "$1You granted %s0 plot to $2%s1", "Grants"), + // + GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), + GRANTED_PLOT("$1You granted %s0 plot to $2%s1", "Grants"), GRANTED_PLOT_FAILED("$1Grant failed: $2%s", "Grants"), - /* - * Custom - */ + // /** * Legacy Configuration Conversion @@ -915,48 +746,25 @@ public enum Captions { public static final HashMap replacements = new HashMap<>(); - /** - * Default. - */ - private final String def; - /** - * What locale category should this translation fall under. - */ + private final String defaultString; private final String category; - /** - * Should the string be prefixed. - */ private final boolean prefix; - /** - * Translated. - */ - private String s; + private String translatedString; - /** - * Constructor. - * - * @param def default - * @param prefix use prefix - */ - Captions(String def, boolean prefix, String category) { - this.def = def; - this.s = def; + Captions(String defaultString, boolean prefix, String category) { + this.defaultString = defaultString; + this.translatedString = defaultString; this.prefix = prefix; this.category = category.toLowerCase(); } - /** - * Constructor. - * - * @param def default - */ - Captions(String def, String category) { - this(def, true, category.toLowerCase()); + Captions(String defaultString, String category) { + this(defaultString, true, category.toLowerCase()); } - public static String format(String m, Object... args) { + public static String format(String message, Object... args) { if (args.length == 0) { - return m; + return message; } Map map = new LinkedHashMap<>(); for (int i = args.length - 1; i >= 0; i--) { @@ -971,15 +779,15 @@ public enum Captions { map.put("%s", arg); } } - m = StringMan.replaceFromMap(m, map); - return m; + message = StringMan.replaceFromMap(message, map); + return message; } public static String format(Captions caption, Object... args) { - if (caption.usePrefix() && caption.s.length() > 0) { - return Captions.PREFIX.s() + format(caption.s, args); + if (caption.usePrefix() && caption.translatedString.length() > 0) { + return Captions.PREFIX.getTranslated() + format(caption.translatedString, args); } else { - return format(caption.s, args); + return format(caption.translatedString, args); } } @@ -1031,7 +839,7 @@ public enum Captions { yml.set(caption.category + '.' + caption.name().toLowerCase(), value); } captions.add(caption); - caption.s = value; + caption.translatedString = value; } else { toRemove.add(key); } @@ -1059,9 +867,11 @@ public enum Captions { continue; } changed = true; - yml.set(caption.category + '.' + caption.name().toLowerCase(), caption.def); + yml.set(caption.category + '.' + caption.name().toLowerCase(), + caption.defaultString); } - caption.s = StringMan.replaceFromMap(caption.s, replacements); + caption.translatedString = + StringMan.replaceFromMap(caption.translatedString, replacements); } if (changed) { yml.save(file); @@ -1072,15 +882,15 @@ public enum Captions { } public String f(final Object... args) { - return format(s(), args); + return format(getTranslated(), args); } @Override public String toString() { - return this.s; + return this.translatedString; } - public String s() { - return this.s; + public String getTranslated() { + return this.translatedString; } public boolean usePrefix() { @@ -1088,7 +898,7 @@ public enum Captions { } public String formatted() { - return StringMan.replaceFromMap(s(), replacements); + return StringMan.replaceFromMap(getTranslated(), replacements); } public String getCategory() { 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 a0b12d511..135149279 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 @@ -7,7 +7,11 @@ 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.util.*; +import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; +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 com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; @@ -167,7 +171,7 @@ public abstract class HybridUtils { regeneratePlotWalls(area); HybridUtils.UPDATE = false; - PlotSquared.debug(Captions.PREFIX.s() + "Finished road conversion"); + PlotSquared.debug(Captions.PREFIX.getTranslated() + "Finished road conversion"); // CANCEL TASK } else { final Runnable task = this; 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 5f2260922..50b2f5398 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 @@ -57,7 +57,9 @@ public class PlotListener { Optional greetingFlag = plot.getFlag(Flags.GREETING); if (greetingFlag.isPresent()) { greeting = greetingFlag.get(); - MainUtil.format(Captions.PREFIX_GREETING.s() + greeting, plot, player, false, + MainUtil + .format(Captions.PREFIX_GREETING.getTranslated() + greeting, plot, player, + false, new RunnableVal() { @Override public void run(String value) { MainUtil.sendMessage(player, value); @@ -72,8 +74,8 @@ public class PlotListener { for (UUID uuid : plot.getOwners()) { PlotPlayer owner = UUIDHandler.getPlayer(uuid); if (owner != null && !owner.getUUID().equals(player.getUUID())) { - MainUtil.sendMessage(owner, - Captions.NOTIFY_ENTER.s().replace("%player", player.getName()) + MainUtil.sendMessage(owner, Captions.NOTIFY_ENTER.getTranslated() + .replace("%player", player.getName()) .replace("%plot", plot.getId().toString())); } } @@ -99,7 +101,8 @@ public class PlotListener { player.setGameMode(gamemodeFlag.get()); } else { MainUtil.sendMessage(player, StringMan - .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", + .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), + "{plot}", plot.getId(), "{gamemode}", gamemodeFlag.get())); } } @@ -112,7 +115,8 @@ public class PlotListener { player.setGameMode(guestGamemodeFlag.get()); } else { MainUtil.sendMessage(player, StringMan - .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", + .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), + "{plot}", plot.getId(), "{gamemode}", guestGamemodeFlag.get())); } } @@ -160,8 +164,8 @@ public class PlotListener { CommentManager.sendTitle(player, plot); } if (titles) { - if (!Captions.TITLE_ENTERED_PLOT.s().isEmpty() || !Captions.TITLE_ENTERED_PLOT_SUB - .s().isEmpty()) { + if (!Captions.TITLE_ENTERED_PLOT.getTranslated().isEmpty() + || !Captions.TITLE_ENTERED_PLOT_SUB.getTranslated().isEmpty()) { TaskManager.runTaskLaterAsync(() -> { Plot lastPlot = player.getMeta(PlotPlayer.META_LAST_PLOT); if ((lastPlot != null) && plot.getId().equals(lastPlot.getId())) { @@ -173,9 +177,11 @@ public class PlotListener { replacements.put("%alias", plot.toString()); replacements.put("%s", MainUtil.getName(plot.getOwner())); String main = StringMan - .replaceFromMap(Captions.TITLE_ENTERED_PLOT.s(), replacements); + .replaceFromMap(Captions.TITLE_ENTERED_PLOT.getTranslated(), + replacements); String sub = StringMan - .replaceFromMap(Captions.TITLE_ENTERED_PLOT_SUB.s(), replacements); + .replaceFromMap(Captions.TITLE_ENTERED_PLOT_SUB.getTranslated(), + replacements); player.sendTitle(main, sub); } }, 20); @@ -207,14 +213,14 @@ public class PlotListener { player.setGameMode(pw.GAMEMODE); } else { MainUtil.sendMessage(player, StringMan - .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", + .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}", plot.toString(), "{gamemode}", pw.GAMEMODE.name().toLowerCase())); } } } Optional farewell = plot.getFlag(Flags.FAREWELL); farewell.ifPresent(s -> MainUtil - .format(Captions.PREFIX_FAREWELL.s() + s, plot, player, false, + .format(Captions.PREFIX_FAREWELL.getTranslated() + s, plot, player, false, new RunnableVal() { @Override public void run(String value) { MainUtil.sendMessage(player, value); @@ -226,8 +232,8 @@ public class PlotListener { for (UUID uuid : plot.getOwners()) { PlotPlayer owner = UUIDHandler.getPlayer(uuid); if ((owner != null) && !owner.getUUID().equals(player.getUUID())) { - MainUtil.sendMessage(owner, - Captions.NOTIFY_LEAVE.s().replace("%player", player.getName()) + MainUtil.sendMessage(owner, Captions.NOTIFY_LEAVE.getTranslated() + .replace("%player", player.getName()) .replace("%plot", plot.getId().toString())); } } 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 4c0d35cba..b1098e6f3 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 @@ -2136,7 +2136,7 @@ public class Plot { } loop: for (int i = 4; i > 0; i--) { - String caption = Captions.valueOf("OWNER_SIGN_LINE_" + i).s(); + String caption = Captions.valueOf("OWNER_SIGN_LINE_" + i).getTranslated(); int index = caption.indexOf("%plr%"); if (index < 0) { continue; 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 19441a2d1..09bc364f1 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 @@ -171,15 +171,15 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { } public int hasPermissionRange(String stub, int range) { - if (hasPermission(Captions.PERMISSION_ADMIN.s())) { + if (hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { return Integer.MAX_VALUE; } String[] nodes = stub.split("\\."); StringBuilder builder = new StringBuilder(); for (int i = 0; i < (nodes.length - 1); i++) { builder.append(nodes[i]).append("."); - if (!stub.equals(builder + Captions.PERMISSION_STAR.s())) { - if (hasPermission(builder + Captions.PERMISSION_STAR.s())) { + if (!stub.equals(builder + Captions.PERMISSION_STAR.getTranslated())) { + if (hasPermission(builder + Captions.PERMISSION_STAR.getTranslated())) { return Integer.MAX_VALUE; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java index bd5356be1..4eff629d6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java @@ -44,8 +44,8 @@ public class CommentManager { total = count.get(); } if ((size.decrementAndGet() == 0) && (total > 0)) { - player.sendTitle("", - Captions.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total)); + player.sendTitle("", Captions.INBOX_NOTIFICATION.getTranslated() + .replaceAll("%s", "" + total)); } } }); 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 6229e9332..0a5b77515 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 @@ -111,13 +111,13 @@ public abstract class EventUtil { return true; case BREAK_BLOCK: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } Optional> use = plot.getFlag(Flags.USE); @@ -137,126 +137,128 @@ public abstract class EventUtil { } } if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { + .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), + false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s() + '/' + Captions.FLAG_BREAK.s())); + Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_BREAK.getTranslated())); case BREAK_HANGING: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.HANGING_BREAK).orElse(false)) { return true; } if (plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_HANGING_BREAK.s())); + Captions.FLAG_HANGING_BREAK.getTranslated())); } - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); case BREAK_MISC: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.MISC_BREAK).orElse(false)) { return true; } if (plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_MISC_BREAK.s())); + Captions.FLAG_MISC_BREAK.getTranslated())); } - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); case BREAK_VEHICLE: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.VEHICLE_BREAK).orElse(false)) { return true; } if (plot.hasOwner()) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_VEHICLE_BREAK.s())); + Captions.FLAG_VEHICLE_BREAK.getTranslated())); } - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); case INTERACT_BLOCK: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } Optional> flagValue = plot.getFlag(Flags.USE); HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, Captions.FLAG_USE.s())); + .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, + Captions.FLAG_USE.getTranslated())); } return true; } case PLACE_BLOCK: { if (plot == null) { return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_ROAD.s(), + .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_BUILD_UNOWNED.getTranslated(), notifyPerms); } Optional> flagValue = plot.getFlag(Flags.PLACE); HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_OTHER.s(), false)) { + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_BUILD_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_PLACE.s())); + Captions.FLAG_PLACE.getTranslated())); } return true; } case TRIGGER_PHYSICAL: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), false); + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), false); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), false); } if (plot.getFlag(Flags.DEVICE_INTERACT).orElse(false)) { @@ -266,8 +268,8 @@ public abstract class EventUtil { HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } @@ -277,13 +279,13 @@ public abstract class EventUtil { } case INTERACT_HANGING: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) { @@ -293,26 +295,27 @@ public abstract class EventUtil { HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s() + '/' + Captions.FLAG_HANGING_INTERACT.s())); + Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_HANGING_INTERACT + .getTranslated())); } return true; } case INTERACT_MISC: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) { @@ -322,26 +325,27 @@ public abstract class EventUtil { HashSet value = flag.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s() + '/' + Captions.FLAG_MISC_INTERACT.s())); + Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_MISC_INTERACT + .getTranslated())); } return true; } case INTERACT_VEHICLE: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) { @@ -351,26 +355,27 @@ public abstract class EventUtil { HashSet value = flag.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s() + '/' + Captions.FLAG_VEHICLE_USE.s())); + Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_VEHICLE_USE + .getTranslated())); } return true; } case SPAWN_MOB: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) { @@ -380,26 +385,27 @@ public abstract class EventUtil { HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_MOB_PLACE.s() + '/' + Captions.FLAG_PLACE.s())); + Captions.FLAG_MOB_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE + .getTranslated())); } return true; } case PLACE_MISC: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) { @@ -409,27 +415,28 @@ public abstract class EventUtil { HashSet value = flag.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_MISC_PLACE.s() + '/' + Captions.FLAG_PLACE.s())); + Captions.FLAG_MISC_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE + .getTranslated())); } return true; } case PLACE_VEHICLE: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) { @@ -439,14 +446,15 @@ public abstract class EventUtil { HashSet value = flag.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_VEHICLE_PLACE.s() + '/' + Captions.FLAG_PLACE.s())); + Captions.FLAG_VEHICLE_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE + .getTranslated())); } return true; default: 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 b94006533..e45d70caf 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 @@ -88,7 +88,7 @@ public class MainUtil { public static void sendAdmin(final String s) { for (final PlotPlayer player : UUIDHandler.getPlayers().values()) { - if (player.hasPermission(Captions.PERMISSION_ADMIN.s())) { + if (player.hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { player.sendMessage(Captions.color(s)); } } @@ -331,17 +331,17 @@ public class MainUtil { */ @Nonnull public static String getName(UUID owner) { if (owner == null) { - return Captions.NONE.s(); + return Captions.NONE.getTranslated(); } if (owner.equals(DBFunc.EVERYONE)) { - return Captions.EVERYONE.s(); + return Captions.EVERYONE.getTranslated(); } if (owner.equals(DBFunc.SERVER)) { - return Captions.SERVER.s(); + return Captions.SERVER.getTranslated(); } String name = UUIDHandler.getName(owner); if (name == null) { - return Captions.UNKNOWN.s(); + return Captions.UNKNOWN.getTranslated(); } return name; } @@ -588,10 +588,11 @@ public class MainUtil { public static boolean sendMessage(CommandCaller player, String msg, boolean prefix) { if (!msg.isEmpty()) { if (player == null) { - String message = (prefix ? Captions.PREFIX.s() : "") + msg; + String message = (prefix ? Captions.PREFIX.getTranslated() : "") + msg; PlotSquared.log(message); } else { - player.sendMessage((prefix ? Captions.PREFIX.s() : "") + Captions.color(msg)); + player.sendMessage( + (prefix ? Captions.PREFIX.getTranslated() : "") + Captions.color(msg)); } } return true; @@ -617,7 +618,7 @@ public class MainUtil { */ public static boolean sendMessage(final CommandCaller player, final Captions caption, final Object... args) { - if (caption.s().isEmpty()) { + if (caption.getTranslated().isEmpty()) { return true; } TaskManager.runTaskAsync(() -> { @@ -713,7 +714,7 @@ public class MainUtil { public static void format(String info, final Plot plot, PlotPlayer player, final boolean full, final RunnableVal whenDone) { int num = plot.getConnectedPlots().size(); - String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : Captions.NONE.s(); + String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : Captions.NONE.getTranslated(); Location bot = plot.getCorners()[0]; String biome = WorldUtil.IMP.getBiome(plot.getWorldName(), bot.getX(), bot.getZ()); String trusted = getPlayerList(plot.getTrusted()); @@ -722,28 +723,27 @@ public class MainUtil { String seen; if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) { if (plot.isOnline()) { - seen = Captions.NOW.s(); + seen = Captions.NOW.getTranslated(); } else { int time = (int) (ExpireManager.IMP.getAge(plot) / 1000); if (time != 0) { seen = MainUtil.secToTime(time); } else { - seen = Captions.UNKNOWN.s(); + seen = Captions.UNKNOWN.getTranslated(); } } } else { - seen = Captions.NEVER.s(); + seen = Captions.NEVER.getTranslated(); } Optional descriptionFlag = plot.getFlag(Flags.DESCRIPTION); - String description = !descriptionFlag.isPresent() ? - Captions.NONE.s() : + String description = !descriptionFlag.isPresent() ? Captions.NONE.getTranslated() : Flags.DESCRIPTION.valueToString(descriptionFlag.get()); StringBuilder flags = new StringBuilder(); HashMap, Object> flagMap = FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true); if (flagMap.isEmpty()) { - flags.append(Captions.NONE.s()); + flags.append(Captions.NONE.getTranslated()); } else { String prefix = ""; for (Entry, Object> entry : flagMap.entrySet()) { @@ -837,11 +837,11 @@ public class MainUtil { public static String getPlayerList(Collection uuids) { ArrayList l = new ArrayList<>(uuids); if (l.size() < 1) { - return Captions.NONE.s(); + return Captions.NONE.getTranslated(); } List users = l.stream().map(MainUtil::getName).sorted().collect(Collectors.toList()); - String c = Captions.PLOT_USER_LIST.s(); + String c = Captions.PLOT_USER_LIST.getTranslated(); StringBuilder list = new StringBuilder(); for (int x = 0; x < users.size(); x++) { if (x + 1 == l.size()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java index 82f3eb879..c9a332bb9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java @@ -15,7 +15,7 @@ import java.util.HashMap; public class Permissions { public static boolean hasPermission(PlotPlayer player, Captions caption, boolean notify) { - return hasPermission(player, caption.s(), notify); + return hasPermission(player, caption.getTranslated(), notify); } /** @@ -26,7 +26,7 @@ public class Permissions { * @return */ public static boolean hasPermission(PlotPlayer player, Captions caption) { - return hasPermission(player, caption.s()); + return hasPermission(player, caption.getTranslated()); } /** @@ -68,7 +68,7 @@ public class Permissions { } else if (caller.isPermissionSet(permission)) { return false; } - if (caller.hasPermission(Captions.PERMISSION_ADMIN.s())) { + if (caller.hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { return true; } permission = permission.toLowerCase().replaceAll("^[^a-z|0-9|\\.|_|-]", ""); @@ -76,7 +76,7 @@ public class Permissions { StringBuilder n = new StringBuilder(); for (int i = 0; i <= (nodes.length - 1); i++) { n.append(nodes[i] + "."); - String combined = n + Captions.PERMISSION_STAR.s(); + String combined = n + Captions.PERMISSION_STAR.getTranslated(); if (!permission.equals(combined)) { if (caller.hasPermission(combined)) { return true; @@ -107,7 +107,7 @@ public class Permissions { } public static int hasPermissionRange(PlotPlayer player, Captions perm, int range) { - return hasPermissionRange(player, perm.s(), range); + return hasPermissionRange(player, perm.getTranslated(), range); } /** 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 feb58f51f..315687463 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 @@ -102,7 +102,7 @@ public class UUIDHandler { return null; } if (uuid != null && uuid.equals(DBFunc.SERVER)) { - return Captions.SERVER.s(); + return Captions.SERVER.getTranslated(); } return implementation.getName(uuid); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java index f753b21e9..9981dd0f1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java @@ -10,7 +10,7 @@ public class HelpObject { private final String _rendered; public HelpObject(final Command command, final String label) { - _rendered = StringMan.replaceAll(Captions.HELP_ITEM.s(), "%usage%", + _rendered = StringMan.replaceAll(Captions.HELP_ITEM.getTranslated(), "%usage%", command.getUsage().replaceAll("\\{label\\}", label), "[%alias%]", !command.getAliases().isEmpty() ? "(" + StringMan.join(command.getAliases(), "|") + ")" : diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java index 3f29aefb1..5b165d32a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java @@ -16,7 +16,7 @@ public class HelpPage { public HelpPage(CommandCategory category, int currentPage, int maxPages) { this.helpObjects = new ArrayList<>(); - this.header = Captions.HELP_PAGE_HEADER.s() + this.header = Captions.HELP_PAGE_HEADER.getTranslated() .replace("%category%", category == null ? "ALL" : category.toString()) .replace("%current%", (currentPage + 1) + "").replace("%max%", (maxPages + 1) + ""); } @@ -25,8 +25,9 @@ public class HelpPage { if (this.helpObjects.size() < 1) { MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0)"); } else { - String message = Captions.HELP_HEADER.s() + "\n" + this.header + "\n" + StringMan - .join(this.helpObjects, "\n") + "\n" + Captions.HELP_FOOTER.s(); + String message = + Captions.HELP_HEADER.getTranslated() + "\n" + this.header + "\n" + StringMan + .join(this.helpObjects, "\n") + "\n" + Captions.HELP_FOOTER.getTranslated(); MainUtil.sendMessage(player, message, false); } } From e6a7f4e5a70a99b2a028e97bf428453e52e76594 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 6 Aug 2019 20:45:01 -0400 Subject: [PATCH 058/258] Add null checks to validation task Fixes #2407 --- .../plotsquared/plot/database/SQLManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 4ac78e122..49fbc0bc9 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 @@ -2853,6 +2853,16 @@ import java.util.concurrent.atomic.AtomicInteger; if (plot.temp == -1) { continue; } + if (plot.getArea() == null) { + PlotSquared.debug("CRITICAL ERROR IN VALIDATION TASK!"); + PlotSquared.debug("PLOT AREA CANNOT BE NULL! SKIPPING PLOT!"); + continue; + } + if (database == null) { + PlotSquared.debug("CRITICAL ERROR IN VALIDATION TASK!"); + PlotSquared.debug("DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!!"); + break; + } HashMap worldPlots = database.get(plot.getArea().toString()); if (worldPlots == null) { PlotSquared.debug("&8 - &7Creating plot (1): " + plot); From 165cf2681834308f5d1f68205da20db9767666b3 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 7 Aug 2019 03:43:49 +0200 Subject: [PATCH 059/258] Fix typo --- .../intellectualsites/plotsquared/plot/config/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index 3c492583c..c03a0b82c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -350,7 +350,7 @@ public class Settings extends Config { @Comment("Kill vehicles on roads") public static boolean KILL_ROAD_VEHICLES = false; @Comment("Notify a player of any missed comments upon plot entry") public static boolean COMMENT_NOTIFIER = false; - @Comment("Let player's claim entire worlds with PlotSquared") public static boolean WORLDS = + @Comment("Let players claim entire worlds with PlotSquared") public static boolean WORLDS = false; @Comment("Actively purge invalid database entries") public static boolean DATABASE_PURGER = false; From f3aa9c43efc63d9b196a8581928ade472c3592ec Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 6 Aug 2019 21:44:39 -0400 Subject: [PATCH 060/258] Fixed a potential NPE --- .../plotsquared/plot/listener/WESubscriber.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java index 8b3c5c624..3eac6aa62 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java @@ -29,6 +29,9 @@ public class WESubscriber { return; } World worldObj = event.getWorld(); + if (worldObj == null) { + return; + } String world = worldObj.getName(); Actor actor = event.getActor(); if (actor != null && actor.isPlayer()) { From 289f01f7a23ca3e7a21473f155a9b7d07100e2f7 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 6 Aug 2019 21:46:38 -0400 Subject: [PATCH 061/258] Import changes and variable renames --- .../plot/listener/WESubscriber.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java index 3eac6aa62..78379fd9e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java @@ -36,28 +36,28 @@ public class WESubscriber { Actor actor = event.getActor(); if (actor != null && actor.isPlayer()) { String name = actor.getName(); - PlotPlayer pp = PlotPlayer.wrap(name); + PlotPlayer plotPlayer = PlotPlayer.wrap(name); HashSet mask; - if (pp == null) { + if (plotPlayer == null) { Player player = (Player) actor; - Location loc = player.getLocation(); + Location location = player.getLocation(); com.github.intellectualsites.plotsquared.plot.object.Location pLoc = new com.github.intellectualsites.plotsquared.plot.object.Location( - player.getWorld().getName(), loc.getBlockX(), loc.getBlockX(), - loc.getBlockZ()); + player.getWorld().getName(), location.getBlockX(), location.getBlockX(), + location.getBlockZ()); Plot plot = pLoc.getPlot(); if (plot == null) { event.setExtent(new NullExtent()); return; } mask = plot.getRegions(); - } else if (pp.getAttribute("worldedit")) { + } else if (plotPlayer.getAttribute("worldedit")) { return; } else { - mask = WEManager.getMask(pp); + mask = WEManager.getMask(plotPlayer); if (mask.isEmpty()) { - if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) { - MainUtil.sendMessage(pp, Captions.WORLDEDIT_BYPASS); + if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) { + MainUtil.sendMessage(plotPlayer, Captions.WORLDEDIT_BYPASS); } if (PlotSquared.get().hasPlotArea(world)) { event.setExtent(new NullExtent()); From 5ddbf3def4cc216e97caf2a01ea17a22e1ae5c2d Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 7 Aug 2019 19:16:44 -0400 Subject: [PATCH 062/258] Update gradle --- Bukkit/build.gradle | 33 ++++++----- Core/build.gradle | 65 +++++++++++++-------- build.gradle | 69 +++++++++++++++-------- gradle/wrapper/gradle-wrapper.jar | Bin 55741 -> 55616 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 18 +++++- gradlew.bat | 18 +++++- 7 files changed, 142 insertions(+), 64 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 81eda9923..5fe453bd7 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -1,27 +1,30 @@ +plugins { + id "com.github.johnrengelman.shadow" +} repositories { - maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "http://nexus.hc.to/content/repositories/pub_releases" } + maven { url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } + maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url = "http://nexus.hc.to/content/repositories/pub_releases" } maven { url = "https://repo.codemc.org/repository/maven-public" } maven { - name "papermc" - url "https://papermc.io/repo/repository/maven-public/" + name = "papermc" + url = "https://papermc.io/repo/repository/maven-public/" } mavenLocal() } -apply plugin: "com.github.johnrengelman.shadow" dependencies { - implementation project(":Core") - compile project(":Core") - compile "com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT" + implementation(project(":Core")) + compile(project(":Core")) + compile("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' - implementation "org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT" + implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") - compile "io.papermc:paperlib:1.0.2" + compile("io.papermc:paperlib:1.0.2") + implementation ("net.kyori:text-adapter-bukkit:3.0.3") compile("net.milkbowl.vault:VaultAPI:1.7") { - exclude module: "bukkit" + exclude(module: "bukkit") } } @@ -30,7 +33,7 @@ targetCompatibility = 1.8 processResources { from("src/main/resources") { - include "plugin.yml" + include("plugin.yml") expand( name: project.parent.name, version: project.parent.version @@ -50,8 +53,10 @@ shadowJar { include(dependency("com.squareup.okio:okio:2.2.2")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.30")) include(dependency("io.papermc:paperlib:1.0.2")) + include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) } - relocate "io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib" + relocate('net.kyori.text', 'com.github.intellectualsites.plotsquared.formatting.text') + relocate("io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib") // relocate('org.mcstats', 'com.plotsquared.stats') archiveName = "${parent.name}-${project.name}-${parent.version}.jar" destinationDir = file "../target" diff --git a/Core/build.gradle b/Core/build.gradle index 9f3e57006..3cbf8f555 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -1,21 +1,23 @@ repositories { - maven { url "https://jitpack.io" } + maven { url = "https://jitpack.io" } } +def textVersion = "3.0.2" dependencies { - implementation "org.yaml:snakeyaml:1.23" - //keep inline with Minecraft which uses gson 2.8.0 - implementation "com.google.code.gson:gson:2.8.0" - implementation("org.projectlombok:lombok:1.18.6") - compileOnly("org.projectlombok:lombok:1.18.6") - testCompileOnly("org.projectlombok:lombok:1.18.6") - annotationProcessor("org.projectlombok:lombok:1.18.6") - testAnnotationProcessor("org.projectlombok:lombok:1.18.6") - implementation "net.kyori:text-adapter-bukkit:3.0.2" - implementation "com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT" - implementation "com.squareup.okhttp3:okhttp:3.14.0" - implementation "com.squareup.okio:okio:2.2.2" - implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.30" + implementation("org.yaml:snakeyaml:1.23") + implementation ("com.google.code.gson:gson:2.8.0") { + because("Minecraft uses GSON 2.8.0") + force = true + } + implementation("org.projectlombok:lombok:1.18.8") + compileOnly("org.projectlombok:lombok:1.18.8") + testCompileOnly("org.projectlombok:lombok:1.18.8") + annotationProcessor("org.projectlombok:lombok:1.18.8") + testAnnotationProcessor("org.projectlombok:lombok:1.18.8") + implementation ("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") + implementation ("com.squareup.okhttp3:okhttp:3.14.0") + implementation ("com.squareup.okio:okio:2.2.2") + implementation ("org.jetbrains.kotlin:kotlin-stdlib:1.3.30") } sourceCompatibility = 1.8 @@ -34,21 +36,21 @@ processResources { } jar.setArchiveName("PlotSquared-API-${project.parent.version}.jar") -jar.destinationDir = file "../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/" + project.parent.version +jar.destinationDir = file("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/" + project.parent.version) task createPom { doLast { pom { project { - groupId "com.github.intellectualsites.plotsquared" - artifactId "PlotSquared-API" - version project.parent.version + groupId = "com.github.intellectualsites.plotsquared" + artifactId = "PlotSquared-API" + version = project.parent.version } }.writeTo("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/${project.parent.version}/PlotSquared-API-${project.parent.version}.pom") pom { project { - groupId "com.github.intellectualsites.plotsquared" - artifactId "PlotSquared-API" - version "latest" + groupId = "com.github.intellectualsites.plotsquared" + artifactId = "PlotSquared-API" + version = "latest" } }.writeTo("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/latest/PlotSquared-API-latest.pom") } @@ -57,13 +59,30 @@ task createPom { task copyFiles { doLast { copy { - from "../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/${project.parent.version}/" - into "../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/latest/" + from("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/${project.parent.version}/") + into("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/latest/") include("*.jar") rename("PlotSquared-API-${project.parent.version}.jar", "PlotSquared-API-latest.jar") } } } +shadowJar { + dependencies { + include(dependency("net.kyori:text-api:3.0.2")) + include(dependency("net.kyori:text-serializer-gson:3.0.2")) + include(dependency("net.kyori:text-serializer-legacy:3.0.2")) + include(dependency("net.kyori:text-serializer-plain:3.0.2")) + } + relocate('net.kyori.text', 'com.github.intellectualsites.plotsquared.formatting.text') +} + +shadowJar.doLast { + task -> + ant.checksum file: task.archivePath +} + +build.dependsOn(shadowJar) + build.finalizedBy(copyFiles) copyFiles.dependsOn(createPom) diff --git a/build.gradle b/build.gradle index e753e2a85..64a344f80 100644 --- a/build.gradle +++ b/build.gradle @@ -7,11 +7,12 @@ buildscript { jcenter() } dependencies { - classpath "com.github.jengelman.gradle.plugins:shadow:5.0.0" + classpath("com.github.jengelman.gradle.plugins:shadow:5.0.0") } configurations.all { resolutionStrategy { - force "org.ow2.asm:asm:7.1" + force("org.ow2.asm:asm:7.1") + force("org.jetbrains:annotations:17.0.0") } } } @@ -28,7 +29,7 @@ def revision = "" def buildNumber = "" def date = "" ext { - git = Grgit.open(dir: new File(rootDir.toString()+"/.git")) + git = Grgit.open(dir: new File(rootDir.toString() + "/.git")) date = git.head().getDate().format("yy.MM.dd") revision = "-${git.head().abbreviatedId}" parents = git.head().parentIds; @@ -48,16 +49,16 @@ version = String.format("%s.%s", rootVersion, buildNumber) description = rootProject.name subprojects { - apply plugin: "java" - apply plugin: "maven" - apply plugin: "eclipse" - apply plugin: "idea" - apply plugin: "com.github.johnrengelman.shadow" + apply(plugin: "java") + apply(plugin: "maven") + apply(plugin: "eclipse") + apply(plugin: "idea") + apply(plugin: "com.github.johnrengelman.shadow") group = "com.github.intellectualsites.plotsquared" clean.doFirst { - delete "../target" + delete("../target") } dependencies { @@ -66,23 +67,45 @@ subprojects { exclude(module: "mockito-core") exclude(module: "dummypermscompat") } - implementation "net.kyori:text-api:3.0.0" - //Minecraft uses Guava 21 as of 1.13. - compile "com.google.guava:guava:21.0" - compileOnly "org.jetbrains:annotations:17.0.0" - compile("org.projectlombok:lombok:1.18.6") - compileOnly("org.projectlombok:lombok:1.18.6") - testCompileOnly("org.projectlombok:lombok:1.18.6") - annotationProcessor("org.projectlombok:lombok:1.18.6") - testAnnotationProcessor("org.projectlombok:lombok:1.18.6") - testImplementation "junit:junit:4.12" + implementation ("net.kyori:text-api:3.0.2") + implementation ("net.kyori:text-serializer-gson:3.0.2") + implementation ("net.kyori:text-serializer-legacy:3.0.2") + implementation ("net.kyori:text-serializer-plain:3.0.2") + implementation("com.google.guava:guava:21.0") { + because("Minecraft uses Guava 21 as of 1.13") + } + compileOnly("org.jetbrains:annotations:17.0.0") + compileClasspath("org.projectlombok:lombok:1.18.8") + testCompileOnly("org.projectlombok:lombok:1.18.8") + annotationProcessor("org.projectlombok:lombok:1.18.8") + testAnnotationProcessor("org.projectlombok:lombok:1.18.8") + testImplementation("junit:junit:4.12") + } + + configurations.all { + resolutionStrategy { + force("junit:junit:4.12") + force("com.google.guava:guava:21.0") + force("org.jetbrains:annotations:17.0.0") + force("com.google.code.findbugs:jsr305:3.0.2") + } } repositories { mavenCentral() - maven { url "http://maven.sk89q.com/repo/" } - maven { url "http://repo.maven.apache.org/maven2" } - maven { url "https://jitpack.io" } + maven { url = "http://maven.sk89q.com/repo/" } + maven { url = "http://repo.maven.apache.org/maven2" } + maven { url = "https://jitpack.io" } + } + + shadowJar { + dependencies { + include(dependency("net.kyori:text-api:3.0.2")) + } + relocate("io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib") + // relocate('org.mcstats', 'com.plotsquared.stats') + archiveName = "${parent.name}-${project.name}-${parent.version}.jar" + destinationDir = file "../target" } } @@ -93,7 +116,7 @@ task aggregatedJavadocs(type: Javadoc, description: "Generate javadocs from all options.links "http://docs.spring.io/spring/docs/4.3.x/javadoc-api/", "http://docs.oracle.com/javase/8/docs/api/", "http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/", "http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/" options.addStringOption("Xdoclint:none", "-quiet") - delete "./docs" + delete("./docs") subprojects.each { proj -> proj.tasks.withType(Javadoc).each { javadocTask -> diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 457aad0d98108420a977756b7145c93c8910b076..5c2d1cf016b3885f6930543d57b744ea8c220a1a 100644 GIT binary patch delta 19567 zcmYhiV{o8du(li9wr$(CZEIrtnV1th6WcZ>6Wg{mv7Pgtz3V&Y`?qSXTK%i5`>w0+ z?r8$=YXpZ>kq3u>OZGOh~=hd!cQmjp<%-CTWeE-^AiME;XgwO3=>%hlLUvROgMUVhTAE(G|m z(f%sRg_ag=iwu6~(OvuT*2?I|*@s*qCCpf4Y+Hq-VcuLEDttX|c*TY5jWiXms}33x zAYc9?o9CFVk0ORk%P{K-T>Y@%mo!4ycb7u=MO1@&RA!`8b;jmY<`biQ|=ATNSH5}lvH3WTcfE+$N?pyqGFtH1)m5?BafI$go6oYHP9es3` z!4)*xb@w6ZaJS2hkitpj_3`^HBKv zI1%Vu@8lI20iLQYPG8%YenP!U*#(z=Q}U@AKXEwy*5ODp-7TI z>d2j;Ysg!KKx0lI-}_626Tlcm`e+DZ#(7C5Njp#uf!Ui0_9imcSTI(b%FBL*jSFG}_;b6`2}2>gtygSxGI zX|wy_|00jHzRjchl2`rGzkJ}7e9a1~qYwC!=KQY8`c|Lf*0>M1>#fLgqRny45^H*s zRH$GnnMW~3dB4?F|M-ym$zWEVE6XjbiDHPxQNkDb!z@$HT&9L>DO1g9oDEzV2MuoA zRo8S}uH_${xE6lna7sPx4**fudi;$f+#-Y)U$H~-62E||aV$k&v12M_s??tK$Wy&F zYd)WA)k>y_R1vI-KGAt|x;;mZmsYfVM$ssjH{ppYClnjMrKgy_9RGrMd%>^rWOKIQ z%SPJ?d98D11N*YIJtxB^#@CU7wLw{BAyc7PfPW8h?Y7xmt|`B@4*2sd^Ic%`U~r=9 zNS075cl1NlV`O)4AmVLCvP+4$5&};KZZH`g9qFj%pHe5f1A46>me)E{$J0aeL953< z*=SattA;XyxAY#;5yhb-Skces?BC8g8kPKMcfUi|%Stwdpp(nR2S^^sheJhy+MM)l84WSFkxp*#{pneorG$)kOmoEvI!;3u94?fAP zZ@_>Wo%+yWQdR)>aj!1>ay%9KK|@sYKL!QF%cpUuAr17$i#d4ei?iRH$2v;YyJ_JU zy|5!c@Gq{%WuquJkVf|7(o9y(&E+^tjxS3$7U=@kecGQR!>mI_0eNax8i%8&eV&v@%fPCi>o zX8qX~4EMatnF{ozlPBhfWWe?mlJ;wR^m;8V>cqMXPm!D^ol2&HU$7>moA1K5`+Cs= zpr#_ZzfYk>JVUU z=e1g~dfM;pNRMATBvsxADGhHPZou0@&zeh78oNqs{ah;^rD_P;#+@=&?FynMyyv|p zc?CO?tuUYdBj&}xT0qIxVU71rKhA3U9&fEcA5OW4960Haku;pUy6`|=a}+3T*TQna zM5CQ)FNw1JJYLu^!l@!d1+sI|txf!fE0#~zZeKHUu&*Gg@WTrIK zL#JC)vaT|b6kj6@j^;X~7{<`kwua`_G2jx`%!f>>VECy;sXjCaenpckfTLKtr7E3@ z8Yt+YvSGl3D&8@PW5oG8m+U--#bN?UkL$cFfT-Dd6BfRFd~RAP-)q z+_k;mcZ+bfh$r>ZZPZ?8T%-2Vca6VjyJ6}c=vO|lX6VqqA{ROOS1gX*z^-MW$S`0w zNt3JgPOPFBL7C$^+aGab3eRjB$D|V7W|ODy3dkVoyGq2}8R+$c$afxQP>z&rB%r4~ z$kb5=$Zb#`QJABtJMWd230hAk1j-k(k?0te-)xJ0!S=s0lBZv26x*0qsijS5d?M?y zQIsM0#83{nt|zg(YJtdKrGv^7shHMBqt7I{Wi%a%F0IPVpf2HSPT}BR{nHsW(c0CX z1LSqtn9zgi%a9(P-5&{}5K1#_5{tmW15khAC917PQZVy54l1c^q_B?{k+H=ipfcl* zk-LS)kV!X#lbZ`fZm!Dc-8M_T?IW>@Gs+L?s3y9Lnlz{CmJd>Htq$-e==Ib?@y$21 z*UpM)2_EIh!VAa8>!7J?<)*`@4Tim{0Cmf)YWCeN;sYs^u%;DICx0VE{^U4v$wMw5=BtR$t>M}LNZN9bp)*mmgjryF;6BQU{|Mf-L<-f47u zP^97f5VY}YK_be&LO^v7YzidOYoIN&nR&nODD5_+0$3_W zOES1SBzDa!WXR4W)y~e&C_Hdt61c=aA_?&M3hp1#5*hT_YC4isTZX{PQ&!Ul1Totu z(k9F47DbkQS)qSuIi`eEbzV5z<(g5b*XUv(HfoEta@N;uB-w2wMRVB8UM_q)(4Xtw z)eDF*(5mklLc@DyBFdAlB555z0sdP@H{p?nSFvTUNAXK$3NjcC*w}7fvcU)non!KA z@++PD(ecw10`IP><=Sb2opSe1;a=i$RaUep@wPeKMKkr3Q_I>xK7Lr;gu%2U{HL)S zXFTYD;hc+3f7x@ns+mLjVD-QA`-rWNFlH7HQ-uE5hcU19Dg@LZZ+1qv+Ek4)-P(i572%~xBTU}Xk zq`0-H(11rdVLrRypcMaA2872W!DxoHXPyk z|1#a-e8JDIBkhAVH@cF-L$oh#X575?Tr{KC$`6WL4M$uQJ8PuxG8aw%1!>4-$4>7) zv(QN36n=`hWNbYnU3JBL@;~+_UL*x8db9@< zFE*avh_A;8Pxi*A(7a!d!&hyF{`^|23r8;U1Qt9Nt?R1=St4d{2-1+%Z=!XpFJPhB zbe67u*u%YBHDoavFF1w<6gaPrnmDYc|LyerZiMm&#_hS6YzD4OmU7Q41vyQD)k%|s zo2$y`6IKtxHVYIVIC|l5#R7fyb_b;F2yuNYm-mS(J1s54hUdlV%H^GN%_aJJkIHkw znSzR2^l}7;iTv9XDn7qTS=dbxnSd-UsJiOPSBfk!8`$hr`YJY?z`f(H$E-92y@4-$ zmVqw-VO`HLKQZN!dAIec^X@)83wfpIqfn`H=D?%#!oyz^Xd(?@UVvMjcnvsgkGR^I zf#^tIe4mX4UyVYVc5f7nWFn9vj+@<+W*wZviEDU^W6$Z#+!jQTXU-)VS>TC6E+i(V zJQ-pAsqGTosC)p=6T-a5&>IVVgZaA%tLzr=nBVTxMHL_k{GCjNi+y|+dF1fio4A8lIvVj7~%`iFnoE~^M0gA1$5ZL2tjfMJN>ze@#Q8#t%%MU1<; zSuAMz%t%L|{@I>bHGl9>NLQ!mw#vGh@mI;z4f@;j_FC!d@^~j#chjRqr46)aR}2-& zzJF%EoM##$NFU2Ncbz|WU&!0JbJ)4F;BtUs!Ue=#Gxt-U2hTsW# zW`BD&0GGgq0>kSjTa>!WjVQixHKUkl!F@^G-2$#E$_=$}TX3+)=l8a8U*abu!CE{v zjtL*E*WL*SSFfSD=Ma9mRjd|9?5YA)?{$+3tqUBY^RY|kfeBQE5=R7*wKE0a-h8)k zI=-u;>~`9Y=k?A*REv-knY4QK19ke@Vs_&S`Mp0-=?OubE9{MpM>c$0dlpEghh7~2 zJD+NrmvZ3vJY{Ob<1Pofs&7;pO%=0C5wfl;;63ap$`vm{Q#S2OWJH>wIeRUe@c3jf3cKuP7<1)Co*5G+n0QL zgGD1YS2le*fHW4a{T!!UVt5!04NrscOD0fqVyNy=DkC3ts=96tiyd0)|vU3~)+#Wc*e zi97S~JR^u^*K^g^!-*_5uHe_s50HPAE0b{OIh}*Be+SH&5(|HwvMf;W5x_KAhl0jdcQ28_2B{iiruAz?=I<`Wxm zB9(t^h(Y|EvDxSkeM^5tB<-j34HFc8Ui)Qi$}BRi-EwF=6xu7LX=3ngtcZU8EvZEI z;_yGTBzbNeH@O368T?mH~VO05m>e zFANulEY~2m_<0kc9Yu@`$up04N^;^Y}JXYYc62s=UCds|(OF~lQ5YjWn zaATUk_kk(9m24QAVdO3zc98AW|2bB~eUwqH-eJ@Au)@w($#>!SH)E<`o5?zRsda^0 z4$dPsgWXtM*S5dsHhWC#B$JO-2Sd-rO=_@VjZXSeq~*k4F;Oi#^iuO_`S`fush=b) z8L$WSo7KSnKV)UioyI1}637Js$J4^tbD7}*C^J1x4x zB!jj{i^O}vAQxPU4Pg;jq9s#lI=1<#tctMd*qX#R-@oF8!KTKI%8QE{0_N{dGph{j zo)yYY)B0b;TO*e3bJpCYJ@mFVI2ZKEaNv*+6&(SFG1m^&w214=$G!*mZ`RaM+8qW4 zrHmsHg@F}LfAIlsPJek3>sO1lwn*xJoAE3!g+J%2&x3vLjz3W20t(r}k=)%%(C_E- zsN|>_Hneo?#@(Bu2`Sxtl#tdOC4~%Iik;X~$N0H|V^B~A?d1zxFxs8)iKN(%w0gvP zmfwM^xJe;O`+Q_=M1nz5@E#rtlWOFtKKPf`KJe_WYl)@Cn0fXavRYhk*d5fHZ>$y#B(CqpafJLR545g87?F~f+BF>ef3p{~V%&;G0V8Y=gY=83)Aa+j~x?xiEB z%|&m38Q}v>TX&XUv@WJKfE^6-X%pS`*LzosI(gRyQY@m80<-s(T6vOA4lJra-zeab zQT?Rwd~92oc$A{Me>AP|>>0veJG+Mwl{vZmuLjMdzT)EuT`*J6t(A9I#yI< z{ah}*Rhj0kkAhCBhk4a6B;;vLgRb+5h0;GH&flJKs(DJ&Ed-vNgq|SUH@}E@238LH(zTVL!K}wt=?bjOYp))ksZwW`f8D+Y692M9B zGl-G7hQuWEP4D0wJ=ie9Sdo$)o-SMQSOk4Y0+aDrB!tm>3oi;UB`6uFf0Y2-XyJ zC(o;cuU#l^q%AQ$lCmMRl)+ zsWxDn?}JHaV;Cpl23;%C#OPs)MDkrG~`@fo7ra2dP z87v40A{Gb;-TyQ-@W6!%;v&&0IN6`T`qj>`eK+ZfLKn8ZJpiNhK zqZ(a|$bWcO1p8?$$_?uoB*ZYQ-@0~-{iWBObRVlzyS3Y-H@!|C_;GlnhxvTq0cUhQ zg8$)N1Q*0j>)jL`<{c9a>0K4vR-wZHdNl$LNAz%TN!RZk5$&~ac=vD1)jOVG``?J9 zFjGbO;QQgnC!G-R6S;EKL}v(wNbQzI3e#WauO;R`7s(;R_Vba5qwx5bTUAKn!)W$dZ- zX*;b}#!nxqjA^3L+F0AqDUPr1r(R=)nK=V)6E}QH82%Idi{8|Kd_QV1X}H#XKg0C# zd}KddV?Or$_OlZ+`JQ3U8hKa^OrETibC$#8?9-*_EVcw05m!q+f?aTT+Vi}D;@2JJ z3q1?FfB7O{A>HYSh*CFgt}8M{=Cr~XWS35E#pMt)gjlPEtV@M`nUR=;0XoE{*u^Nd z9Zk9=hx?(EQD@CT^uvx59aeCS`PbIv4N5ti9hEY=jH8ZzcfpClI2T%%Tj3pu-bgE| zIBUcO&cO-keBwf0Tl~d>nq<9u;t%8XxS{Ofvw0-|`v-CAB?o$Q6PY6tf{f*fuO#U{ zgR8M(+I--0WT`{)M@;t%GKQ;cTU*{Qyjotk-s#=b&(9%8ly+JJoP_?&*qU=W*Hj~w z!EF_S>Gf){SGLkH`PB~>tCB^=bX3^^$Mv?hm>1%i^ z>J?nT!3!6A&V^GO!^l^KU@MVehdQyVtI=O>2(2*cIJ>AyeX5o-DN+r;$!1K>&4*lF z*Iq4|AO&#bNUnPYHplZ%yr)9x0rbRW6Y`Qhn$wk8i88SP?pwyUKQAh55matBxNwb1 zZfj{}uFLA-wb}vM|%DL)bM`iN>>j0L{CqTfDDBOq4`2i!Wb%Tx=zh5?4 zcq_hGQ3i!8fhasMgZUvgz@Q40k7w6k?i^yKKBo?A+ILZG{`T#M+xnM?HqgIK%Qt_V*=UP!>omi^gOPsooq6Vy@iCa~! zLY8OwPJSY6I15JViDTp!93gj&$}&Jry8JrpGNBM!XfHeRkb+ui{JYXvH6dbaLUyBY*0t2DYBrAzK4vKU02 zA5F>RD?`))+nqtt5x>&%l=r4U6SEK7*ubjbGBH*dKGi}B-6X>)-^{WPcqDLTP>~%O zLCaQNrdJ*0-Y>I`UXeDC`g!MVPvXGJi=DpMu4Zn*Oyk9OXHj!&pXsyld%sUi&}8-X z((Fm6i^ic)u5|?7K1V`xTHF+JZB~T?JL8H{YMX!FGo~6R$e9%)px$}^N*>>v1PQ}S ztPQ1_*0vzo?j#Hf`!QqQ#2eUIu#2%w_IwHNGlKM}ruV7EN>P^nX~v^9`yg&)dqCS? zvzGhAh;k*-E#^eCbQSU!QNoZzWil>Cx^@#^>G7af>HMIpnqHeX!B&R$@v%Z@!vj+{ zCB4O3$pn9z6|T68;WlGW)C-1S^g< z&rGH!BcQe-!+JpHtd}X`AJMCk%eAEcc}jj<9h%eA%2`P?3TFT741O|<uWf?^f3NNC@Owd@d)u4)Y;M3KuBVveR{N%{+XY9R ziI?G>M~i0=<;iW)0E(aw{Y5`Yh=2l{JI1eE1JhPpS_Mm&4{S#X>8MLeb&eaMWDWbl za#tATA=OyQ(pWdYvTO!>)|V|KOZ1VaLn^6E_AW?u(bYP?LqLb=c^NX`7p{U+EzaLq zE6VZ&J=W+f*xIzJ^>Qq=i{14Rcy6Q`}>7-enU=zJ{dj?$kJ) zsgo%^oOVR(1|nr~_N!s3-`25ACh)cSODKG1&A- zcO1+Aq`W%;`3eyQs-&=CV2S}$96JG2j?hn0niLP{y0{43k^9Ac2qm;ju*Vqkzs?kd zykJy+UY|y#c;%{T=h^sNG4^_gMFv>#r0Y|JCX>>R6Nd@a6o-B~l#4^B&HCFeDqzE5 zrT)D4SY!p{Qki?J`&!nTE6qOAI=-2(C|BaT4=ev;A7ZP#k!cJ&4AOfDY4=W&`Ly+H zA^H&wl{mHh$c|b_admSHn?>$9i(TCLR`q-#oVe9fyRC%CCUzDW|K8J(4xXwo<_K03 z{tmyh=%ayW`=>W_)KxcFL+FRQjA-(eACcN)w&MU}l}lW)PccZYh{@K3Tyy$_2ta1h z1{xIfN2TdFM7b%U@|-|!KFdHy)Vhbtj1rXY`SxhvlJk!3@4f0c{+WG(mg{0o>syMz zDf7yXD&=EiMt?udYCnWjxGOjhT8zqZY3t=(A!_8GkiUW|5n8um&KwVU&qnjrD+Pm@ z&V~gVyH%dmtAltaTU@-DoLy%z^`KZI%w7toqIL5y)diz3CF%;wO)qHTrpE-@&l!H3 z(8<@9eIx&`%1dB6`_I(j%UlTkf4M|7${7Gg3=k0aWM*ywj0i&5$WRIy4p#-*L2v6Zqe8cVc_^^fyVCq1DPn3noDH+OV(%Z>e&K74QtE1;Ss z>zF&KzUdCGoH|@}BkPDav0(8v2B+-h(wj}Riwig74lF=0IWG_~rR0*?Mq@I$END!7 zxY4F}R3uFtxutP5m1MHVBHbB;opgBj_QP8Yi*ZjKsuu%^G4zKWI;)0c=4G9<@#&o} z96n4F$8ttj$8@!x2Q^ZAn2vgpJuIG`9P}j>m~hrGVeEzm)Pj$2+%(3PDpz1mt!UNIsNMorfmx16FGM2y(ve#Lq@nC zj*eD&9D&?5$wXULpSjbnxZo8?|b^>G7Csz#&uL^ zVyur3v%F;-%-gHC4=9S(rk1KxdD3IlAf4;&Am=b?P7wI%AkkU7^TpYJ5{{%?v5l^|tYrK16%E$tzph zfPZs$d~PW8hF>z$JUDY73hHc%)ip}76HJ#`b6T)i;!~mp0*nj6OJ{ENHo@Cx@WbXo z4sX#SDs>O94?5LG@IR=WjxuQ$2|PeYdD9{KLCt9wIv|b7R?_8N?OWkj*w?Da0&{FF z3`wfF2gRp+-D|={8$<@nAXk3O{q(2i11_cXLDI5QT&x=uSzxZVddq8ZeLYC5SQy7? z{zCnO4QYkYJ5Zg1k?4fnI_EOu7B#XoW?*GY;%N{VImZ(WsLdRJNQzgL*Hn_%eQ76Hi$o<5g)BjOLh}Q1IONC!R2}pH>P<}BZ=Se2 z)od@g6>$&0isCw^?qq5#^!kHMSj#15iyMj2SEv z+8TUg>1i^2#_il8aDilO7v*!ZDu0l#x;Y|Q!m&a8Atg|WymY&ZDQ*#7V&18`0Lz10 zSi0oPfe|?b(eGUNcacOXt?!3_<&Id`m2uIJKzh7k1c1V^n8e1hhYStTHr!OH9vZbr zq^t)wkw?+8st7fzYT_U$ACQdN$Q(w zMHK;OTyW!s*^5THjct1^2QQ^y35gq`VfDmtD(c3CZqS-QnW3~Zwu3(N zREg)o!ectgs+Gg-4QR_^)VEYh9;;!a>ecW_rr?l0%Hvbt~&qOj_(mPt(HU&T7~Q?#;^3rdrVO z&B|3hBlOiSG4j zNgfg3Pu*NT%yCFVLXM8N-PF+S47XMJLw`feQM#?=-{jEk40%;`$6Twv8hur8JXdsQ z*J-|5KR~&P0^j4DxAmwnXB8P!%}4I)NKU?jyE&P}*=LW^4;kD9tlc!ih>R#tc6&?; zF=Pc&6j`Z0KhV~een@mP!WUNa9tcZ>GdJKCdum@Q4htyY%gY657g z-{7yOD*vCzbemOo17M#l z|1E@&GATcC%_J^Jm&N7fO-mRVjif#N$&B_ZfPI6a;-hzD{i2%+(8>^`cYO4-3W`g$ z3~L0&0hFOg^7kJg1!_l`b>3bYA=?lz*JrNM(4o(ZrZ*tvO-;MVwRVR50y}i`(Tl_Gf>h8w}2-@v=e(ey1k`XU( z5&iFPt8=wT3~UP$qkZJU5UaFFnscm2%Z(Q$8a;ebwEC+@p!nWS#fRTl$T)B)Y+5}) z_o5M)yrcFy^T7o-9ZMM}cYV)K_lF+l1^%1UHjC6FWBgjS_&s~qeBR_=4W3H=FJ_&ml`z zT+TzM(_r5^c*)-I-=URL(l0iVZ(B~{22iGH` zO;0;-GYbqK#SpIE!}oGAF;_!+-Fp79l93HVf_GH{`nfM4!(2bvd`%EI>qsJS6H`CA zSvw$Ga2pN=QOlQX*jX9r>2sD3-K+_hR|A+Rcoc%f=?Kg^5_$HAoN~N+< zc}XT3>$ZE(9;~)!#tP4Z zdtEL7c~*++&Ck)O7_%f@=&PuL{1*!3tG<5QmO=;`pZsVFZqX9hD&rN`ukkZf7LE-! z08cHO;M=YJXXEYh5{x>RR0OW7UzTjckBOETBH#`h5R$<(sEuVP!RsnE;ulA-GDVHF zevDq`C@^Ajb@V{ktiAisOr`#Sx2HU!F~)anD}~*jLvTado zcmwqf&Hg;3f}ANC+Tv&=nko-3jIe<)lG0ukd~zJGa2_>R2t)rI5S%u`+t4_4@g<-f zDiKWCP&^V}58)rG;05$S;FPMepY13zg}5YpD`DtQ46Ji*pj}$qu^{9s8?oIidn%xv95emprSxA%8f3v>fii&z=mAmhc`tCzti6 zQ*mHE&kjOufW4opKGawBC;ph}Or=WoCD`Jy4H8@ll;5GIB#L0f7E{_@dUllMR;>7$ zqMq$Ls$T%CVzs*(5}g$A+br9h-}AT`x-oAmQ)^oIHFnu%eRAO)t4d9smnL(2W1MC6 znnuKUJ@)LXcG4Oznz1i621^xfLA1`4BsSyDu7aW4ainJ1QoZKW2y=@oMqk}QW0z*b$e`jPNN-)Og>TbPDwyKavM-Dp2!1CiLbkoiguPX{>4#5OR;)lWgg zp6bQ?qDuWmi*5^NHH5_2F)BY|!;$O9LLOAW%>RI~idu`KD(uv1ht}@d4ir8L+>-?(|Ozc zapEXWSuin+nraJBF~icTEp|K)a(yb&=ES5Hgq|h08!fFS=P)b?QHP3Ll}DzQ@Q3BY zpt6(8E3GU{BBHCSPmkW2>`XicQ)}WroKyuAWTWx3FHSQyRu5?$>|K2?$aKTZnWxYt zrrWN|ApO+pY1tb5VYxO%2TT?lB58;QQ*du~I=pkic66csRD|al*!m`;2ha(ERS@Vj zL?Z1e7T3wj8jHtg&B<>MCO1yDjVQ!-?Zi5LIH4${-@Evdk)Bj}M}uoW&5QAj(xL&Z zSeL~e-WnV!M0zG|jLwJsLsukDwzcL;VG9Qrr9=F(jJG_K-c7|jzUm6W z{Ghw|rajr^AO=(YPcb)vcp|yYCZGnVN(=W50diU6p^SzZ%vh6hy0hoJKZz3U$kyIw zi+}p76j0;JWqi;=1dbyZ|LNOVc!&isOPj*Yi|ikWp)Qmp5!M&veH4dy<^4{ZeH~9r zEET7v%Nxhinh2n#DuQ`Um(GWYDjW8X;RY3P9v*U<3)8i@9@QL@{qyF;t)EnKBr<$y z>I=kB5o_!!odp$rh$yXF!o1?E8nUO?e|l2{Stt%LWmzN|#%N0%e>V4KbIAZBYluG$ zNX?q&NIRJ#p-CA z)e3wI$vGec0+P}fs8JcU%Wo0FmJyjD)>h7bNkBObqSwhpW4r*FNI zb3LeeFS;DM)QNtZH@;Ko0MWysW(S}ws>3`nVqyrXQnS|zbr@-ep$U9OJflf@U}#-e z5o843OblFtl?d@^z8mvnl%tB&n3<;xnF7!^7o=T>E%;-m8$AP5+u;>W@48u5$8d8W zruH8K!Q=4tLov>c=?OqYZW-@vZaok3#*z6l@tHD;8AN~OAuj&%WIp#9qx#PmPH>vh^eNaS z$yZ;fKj{-`9i{U6IDuwDOKou%+VPrF$fs-@3E2u=dk^61{2iw6Lacm!Iq$aG;A_X` z8~OH2UBmBNYAEJVKCes!wvblw(ELiUlyD@uRhn98cId1P=>Fqq%dlzOZ7H3#hQ-2o`wnHrV4**fpz{iT zL1l5|bq08I*(OMDdDv~2vP=?(_nFI?2h2`f7>E6p7;0r87|L{iS{gY(QdrB;l~H1z zS~M`C6TV-e7n@s4i%nG(5W>bVmE%UhY~;qKR5wng79N68Ryn(f&S>rJo0Z|7EpSZ3 zb+Ki!)8BI$J5FcMPr_C^b9J%PhOjRPMYGYwMBtA3YpGVq#f^%gw0>>%C7($TeuMrG zRcr#}tHAzS5(B1ins6*+$y@z|JNir6qx$g|KFmS|9{hDmj9U~_h^#>_?j5s zhDr6L42-j2i1S!6jC<@g(Hd&?X;4vjl%h0`MNFpI453@?YbpEMpMe+22MPf|im=QyjjG zlN~pXztxnA91QUwEz^TzL3eSU*D(Jn*c5L%<0tiE6U{DRo0hGhfMo{orr>BU*@oSm z+RT)!3(MG3z83x)`@Z-P1q-Iw zath24|Iy8}-6qm~V%h9e`3hO{4Tty6tZ8+W$n%o-RBnJ7s&2GiOi!gadX_Rer1nnt zgnJrUGZxWtnaG(|jP8=_Ce)C@ON%NEA=+2AN2NqF`ZLVFUp$9c)9c?M(7i|umAxno zowS$i!~0k4)B6K8`}qF!vpPPWK49Z`wE0)mH>`?|gJR>YTrpmL%rwWRt;aeHMawiq zfkFt{YaQd{3 z3xwlU41%J+QaSG$Z`WFLE|T_cdYd&45*;cP|5>Slt+wDW2XM6|F%GwdnrXt`Qdr(v ze?^?CSrU2b?D}KAuv7Nk!`vAo?sgOeMw??>bK0CJk7@_sAuyW81sByl6AfN76=ydt zb3&mOYQO^^5Bcflgm1IT7$HN(H)yaQtua|gem4q_$9tcsy}eysH*+fdJ@A&9nV;;R z;697D*sI}u`>ArXegJ+BdzVVO*PO^h!SR3(2b-ii(G>Wz^I;%BB<(dz#=>47q7}s7 zu27{8t!7=Ln=|A*sj^x!3u`LyT>T@QE*7FzKL-X{G0U}F0|r?g|}Ju1x& zrTaoM-D!?8fFml{M$Ro9Uz9SkHv&sAEX&bh@5y@3@wr7oGFa}|J?WCsgsO&4$}5la zQ*nl|(KkC2=;QqmTdc!zjrx74Jx<$9NUR(A{rhyUCICLHI*>CI{MG;Pln6*XwFODXpP}l?hF9MDU1XWI41E_PYi{1XnBE~P;mUnBGXu*W zkGlYU-Tk`f-TH9h$!D9tIGKm$Q}o(5_xb(eM6l=X8rvAE9`ZZsHZoRP+*?5ubDQqK z0WO%QOr(F~_0R?P8fGttZM$R_VY?HwJu40qUHmLP=hNrptBu4ZOCyQ0W0KDewt&O4)N4ja-*;yq|-gl9^z z6wvR`oph*zDR4ZL)|tFpjfjHGrWHVu?_Vyq%cy94en^q z_Q0s<5OVUGTNa~?7*DpV*32ys{pvy=G4U3< zGTS+<&v>WipYeUt}^W)zc3L(>ITsA4=5=C;-h{(8oFO}vE1rdxC?ToJE0)cF?U=cGUy zi3z-YTSQgEBPY;G7fCxYF$ottGPNoUr!Sjkah;VN`Es_(H`#BYxxm>h^XTfIkcXtO z5XitPwxQFQj+G;SF^>0ZW5Oj2c+UQ&$UaGY-!xHisE*mL-h>hk&};+D%HBAn*7n@4 zl@jOQGPFiFPYw95Va_6%HAd%&8B_|&Drn+lU~(;FaJ6acXc`nJt~l>}%ox|IC?v7? zTiS~Y$+#L}V5h#jJV)W28ss9iZumF2yt*0|uQU+$vnkf=Iy0XbiNZDf@plS_4I6#( z6Iy=B_UPE5=^5sbQQiQfIJD@xf4Ke#C2`qib6!RUW>s2~rz*l$0V({c(bxNa43~JE zdHmHxm~{jHGzt2CXc9=Y!Ts_O3@)OpJ$R>}xTIY|Vyvrr0X0%h9FfHowve?XfSt-! zxg|e-VMYJfGk6#(#jM)MQn62sG;E70Y{~UVN}gU!a~c<#$NHFjU``5#zm^PTK?EKa zK%Pu(!3m5*9;L-0?jBXeUBrFQR|ZVbd&jhh6n`+v!fo-H9TK?6ZFjlQ zAhpZ8a5ZeS?U)sZVcWq{WoFI3LT1cd!vyeKIFx~73FFG`I6q206(?uYc8ZuHte2LD z45boVeb~5CCZ($GAcG&nl(JE6EPDU@e=4~acqp?rJ{aRt?w7pfGM817nJg7bC1P1d z*e*g!X!u;h=t3B?nDV3sPs7)me-8Z!wqG4t-2I;aYTeN9wZS`#z-#IUa*?zz8 z`+di6yzl&<=lP%KJm2c5c8Skw9*$}d@z;BN&=zH=zFf5U!>YPRuX-FhuHWIW z&$GQ46O?^9JnvAdW80rzTXj-*@po@6J$c+nY^xT%U3*nyZNgtR%4~IQQTZn0H+7jW zPDsK+vWW$!*czL4#q}mu%7t#mb+YcMuA+^cf1Ca*yYbs!Erm1A7FyQ0lnOpp+t{pT zR0Q1)bg|c^M5SIDY zJ5fD5%lpJYlP!7m@19<#9oN*&Urp4L+Zw-J9K_@@}{(n04-lj74)@2A*7I z66=a1I;ZuYEtfuBd8X3OhU^u#chw3ut&RCKL`I_~2M=s=tZ}r>uOn7?rns#XQ69g) z?a9s=E-AkfK3p+Z?V|QYu~3$EWaa%;Ynz*$%{l6q&G*x=%fg)C(qKV|mO)&Arv`1x zcM(1&PR^d&i~@S8*{ZqPIr^nbu7{|+z0@;3S5QeXimlXgT4DTSuD+X94x`m`);gZb z&Xq68^>E)_PZ{}P{;lfo>Q3n&Jh4vrENYrz{c_AFi=VRQ7$re#z7}^t7NdT_x5jz* zy}%>-sX^A3iS}V!TSFiJZQFCw5`VOD%FBD zX%Br^N<|Txr`Ed%HXYhPPb{UU+AoV1UMyKoyXx@Val!dMLf7Yl3!!}nnireLTMyoS zI!NuKe?QVUqKrS?$P+$DBlD(Mz=R=Y@IxbjIFTiwN1LkmD~~4+F`73Uidacu5wVf< zZAoDX36V+kgs`NrxX5I977veX_}0p12q#BJvgJufj6h^G1{aQ;=v=szma)i2R}kuP}_+CV(~1nK}O;)Ib4qvhD(Q#NxBT< ze>}Djoj!o4eidY7mRPk`A0lO482{;|KVc>O?i(~D_}JKi+!PD$Dw#}d6Z+J>wA={B z#Q=UR2*9O>0>h@E*KcjzHm60%te+G=JIjgqg~vw!kJu?G8>*meE$;A9bFAnRUM@qY zO!t+`=w7}abN#$=EqNcxlfpnH_;e~SJTCa@wwW@{2OiwkG(b#;p%`U{86zpWiIGPQ zkg#D)INIG4Iz~FEp`!)q4Z;WDX{1p%fQ1qU3R={OJg%7%D4J^o&bC;KCVo-l8`7I@@webvTnDK`H!f{98-^OV4WOHnYo zs(~9_Yc)VlNLrB-S4?nBXkz{ak-~;A1)@{fC=o_h8><}@-9c=%WS}RU0VH>@nJN=Q zLgD3l1)?oLS7?Wv*~7rVIw6Ww1RZi41C9`Pa-R^<`Z6H))fW!RU*?)aAdnS!U(bgI zrohjEBzKVGjlqp;qlL!}`4(?MY?~gcozsSDQD@?qMY|SgYD0qq^y9eUiZR?|)}%%$ z{LV8@439i+{AyhP=QUg_srazB?UZth-3>LOR6e%Y8`W zPOk5#Oq@iwgFHE~b=K8EOnBA3f>)i#c6*L3d$iFj}0_u1vT9} zgM$2jyGcR+=g1oR|BT7tp!lF@jU=FQ5TIzuj*$BZ|M#NhnGV5Z!{3g8XxX{ne#k|U z0)2#LT`Djfb7))PxtTt*e_l4*GYxusf506HZ(Jm<^~B zNh@hHFezBTb72RhZc;TnBFu>lqxo5l?FU5Oh){&EU}=tP7P?nb*t#^?m1X@zqiZ~( z;700=N}6SnMW1&rH70)D5@so!6Hns|TgxpvHo0C09pSaMlcE4X0K=Wbe#Rt7GTpkS zn^gy*Y+^VE0W;e74GVSy<%m4Fxj4sk!Wl9t!AkJ7y-c)T7&I#;IdnxQ+@!x5NRb-W zip*OhaTujYz>nl~PFx~1{Um(ta>~9b$=ONkBwRZ&dCR2vz#{4T5N|gQ=CMp4OE7ph z2scF20vuC|Gsp#i){f5fRA3v{e~3Ke?GfbGF?E@&VeDzVj>_7(olvstAt@Z|VTA7k zsluVn5#(etGDm{VFyB;Q{*6`Y5>fIbt^_(`MAhJ(x<-8m6Ze|d2mJJdrSl@=dfxu= zmbGnx)=ufdOE)ao1~N_R3-o{DJAXK3k3GB!-QEW-*QXDT2ES20o z7ky23NR!n88AV*~kbKTI7Y8j~(yE*GCa}hb(=M67Dm%~KyHqZlOR4wed9JoeDHqK9 zA?~O9=X?8SD81)pjS*y(LORl%`wN9`KjC3QgZ@ zBX2^P0^{T1yL%Lx{0RA#G&|%vy^cM9#B|HXOLv%ma-QNCrEx_ z!dtu zrS4kJW#;2GQmL|o918_`ZheV5{Y_#fuIolhyr?;!b$%NUva5fZ5>qcI70e9bZM=t` zXCc`rZ1UdM87C!+-H}Z-t>0hVBrY6UtxTojlZ0U zu57;t39yxln1K^g*xaP@>k1|JT{sgjEFjN0gzgkeBmhoM4A18h-%*)0DVX%TBp3Os zqn0q)^*i_2KW|K>2MT855^6)Lxu-?E6;ne2#in&-*G*|V7bPQ~PVWs!CR_I6%tmvB zMCfO*=I(8@eR?VGX4pCu;uF~FMaluzoCmOJm`i_h?kHLLW3N|Hb!(*^KN|L}6|CLo z6U;@l;Q&_bCDRG+BHUCC>jZ9)-64iscsdSQHVQaoMq@RHa@ihhXG6ET0Q<_*+Ba#c z(a^AHlMY?%W=i&R6n^NF|me#K0AKh|ramyL!sy z-05l+=4tA5(6H?Jp6tSNZhsNEef4F6b93{NGS2ao6oL25Q@LE*B^Q28P^lcc0#rpi zF(rFZKsy8H*x>&DTIs&-oZN|G^RisJ{Plep_F-X0_FWi$s&UMfuwiSJ3ti6ehT20t z1OPJ`gCNL)xCVz18}_DekZq^!MxjN4rd}}#w_!MG`!fl`k+zfKXZuCp@pC%=T`nGL`Nvjtt1%94(jeBjnrwu`g`qXq_tt?3eD_aJtg4XEYTRMKb z@$v;{*%5lFF{_}M^$q!!@n;5j6+l`J@-|AL)-Cbe?6`{z1zBo*=|VSd6c3K`uFJn^ z=#&!`7@@GXG}#G}rn}wwZaWXneW{L^+IlxB2wfD>rOUVH2h{OrmB@dRANCuqUlmf} z1+o_x8|FRb00#Le=UEM@2D+?+(He*n#e{VJDiJJ+HUkwgB8$+FL=B>ZX_;%|V+l4=NG-uk*@-wJ1G^U=j*T(dX z?!@35x?}CU%Sbh}TQ{oR_kdLGsNWSR_Y0!e^ssTo2YEgW8jdv#)6c7_6Ror9ZC+Z# zHdVaOKuydf9sI=rP1)&BYCiydc>}{Q^QX)QQK(XUKr5@YMN&-A61j#Eb}oOh{@-Rk z`D57?&9+nX=OCnoG=u~bethBpl_f5bv(R3V+ zv{2C==V{N0tWYPfy@YJ?@ORM;i{~I}dhQSOBs6j@WuvT5_Dx5PQZR+J&kugJQ#p3o z#G{(h?9Nd;Mxbpr4#0gPs#Gsadzib_>J4=JPfD%h$8GGs#e!)fj!FkZrb;$GSAl8m zpA&Ll$O55_=g0C)>mIc~0y(aWm8L}s#)AiO1K7b|U-s*>Pw&tHZ+SJkW(^)>2UKwC zQq3!kqZF>loNqv5vv1kiABXG(V#)0F@kcz3BN>xaIXj0+alouWW2O01G-mFCN^um+ z8L%DwK2CQiyM@f^>vLGUgU2QX=(W|AUFD3E>X{XO69yONlQ^e`Ucu0%x*Qk)RTYe$8 z`i+N9qgfdQ1Ms4$9>sYS+9irmliX$dumDjd9={VE=L)U&rmiPckB9h@JL&ahxy2>9 z(#kRM$txE6N7UzF=Mvr2A}5l!I4Wy3K+~d>Vfv%~oaGYoO57#)(^9L>in66rUFoX8 zT(wNMoo8`JrSb3PWtm-}xU&5SrZRh@mS_$ST31NU1#p25-flQ`ulGCnO75^F@Wf8^ zm;H$HW)M_XJw|pDosJ77hMAT|idn9Dqx1{GLPL385>1~Lf5yEs{<1Qd%;2%wKYfWo z_K$yvDJH1#g#$NaxY1RsfZeP6fN&H{JUD=o~3D~L16&9+0 zH(%#(w`bK>?NK9i7#@&y#CW}7+Tu*sR{rR0ZcH_O&VSyf z^8lIIvjQLZx<%8v1Kjs)moo+C>Hwa$ZK_Yw z0?!M(A50-%SbJ082uytlEC~qn#D1^PVGHESe8HrzUU0i!%DuwpD@dd1PIv~x(7y1L zcW#>s)cda(C)<6{dnSU`j=h@o%^y1wQUIJ=7Js}Oph)X3bXT~LO~L_07bYe)4I)eD z&Zur3d8eb3uu(awQ=0Ie(FW296*fN@mL6cXa zO0iH^dx_YLS0sMf$?`sbh-Oyaw(UNgU)k`y_Pa@e@mQV%eG>3+SWSW8V-{iU?Es`y z%gUPqo3JFv6I7Hu^K!X0n15YZp3Y(8%Ulknx8dNn=H&{*E;30Ys=Y&F7NTgT zsvt?vfeRD06brob5y|vlo@l;s?LnW$Rm^RJFRw>ar-C|mU&UCTUwETcgMe`3oJ+VS z=#`HKu1zgeXi@97Rm?hj=obs85b$t=kv_9)-b#0bw3`_45)?O!U7WD}JrkI&?Ryk4 zwoGt|(|@3`XMek5v#hWcO_D)-l4zPyDQ`@r@r{(>nPNvWB@tO835?#Ue6}QDtI39E zcP+exc^q={O&I$!Q)SJM`TEVFQV6L={Pg=XZKiB zl(gC))L2aoYD|(VZo6R4R^e`v1)ZW$z0-8``%*t4+#*Sjrl$9}7|TWW4s1WP>kc4` zHqU*#ZoSu*Rx^hqTXeg0&0V)V+Oe1?pXlGP@Lz={zKMbJ;m}U$(f|@O7p3=U?li4h z#r^7@X?n16S7zmNq8+iSG>?F2jXPugnYx5Xn5pEw4Iol%KvbW>*i$te%i z(yz>E?1UC(x6tPOi?Y?odGj4tv(PCk^bsbn)z2|v61s~Wq0k`tiydP1xcMtfLMd90 z5YN`0GaOw*`UxqFHZ#33%zDCVMyl9V^C9my!%iXJnEzAjCf|-@C$C~H|34f`ad7x% zEhGqtZ*o7j0sux*-nMivi6k3ov{~gXsqOESh#u-<^tp4$O9xQv~(RJAwpPjesotqE$ualqeXAh9L zJqvFBkduvq1Bm7+D^Dc}wEP7}Aql+Ms=>0Q>!Ps#z}{2JPEIUGLq>_7yjc=HUFUB> zOEhT9BVGptJ2mu zDmR-fG*(itN(P!RNXEyFOa~A#r9dClZ|3ad0-zMwcN$#8R;ZVG6}bKFSDWn2oQOJ! z&l?{!Oy@Nw4x6KnYM6$YJ4`!=$pgEIi$%JJ#TK1P^x)x`qR3OJ+UI#F%o{OjSQ@3- ze}BgdfYnUsmzPwv`;FY6W>)E*KgyOJrVYM|v`{YFe=xGipwU?CtL%GooF z1Efo}(kKb9pLVCF`k+%otaj)a}ctlO&h9>HP&=9(+690QfHUw&NgJt?t5Z) zNx;FGH`HwjAPCk1!{=o?+3Qxzp8|iA0vZjVaZg9xeuX;?2@=LZVd09f-m>(N+^#NP z^QbjmCOyLWqI1Ie!q-7PcGuMs9lu}gCk1Mx2KoDL^>N;21v*q7>3GKWwL3iMPAk=P z>yrf*586*Nl;W=_VDeeLv*(~dEDy#+8KO-=M8tk(dWE{^e0NlfVPlb@6J&V{7HBql0%G&Zb;GRpwAzNmaS{m z<+lB9x`E6)q<$vtvf9O{wR!y;*veG8M+xa4bwPLfRlq5_(T*Mn_CWyCe*6`@UXi(l z|9gaj(Hw)%6mGi>ZbC^mfj7soAC{hviEwP{PAG z=H1n~_N2ZHdrJhEcI-oIr2Ha~(8*lN!)d0MHKkB(Eu&>rXF8Jd)SWpn2xve(@@;CR z@cZg6^jb(WSF>kf>sEd;%ZzlB9aWnly^L~Sfu~h-Ae5J(iJUvv+Xf|FHiKTN`!H=KKMkm?g-U+OD3Ql z;7S#SctELbE+k_qASwUnJs+iUqapakvBFf%0Ht>aPT_z5BEkHI{sj?Y0zM$Md`wbh z+;B_otR`90V9(en4B*r%=5)+yygqpSbN>nfc`E}~BwwKhH-8SbJ!thAOc?ibxU$#F z6vr+b0W|{?ySUy5)%}M)i7J8*3-yDU0pX5+@}oEdrrtSltYVj;h8I3I?V>4_GS<^_ zKfDuE8@>M;l}qRouVh9cX*nq7w1hJ_W^QQbbdkEKBBa+43ov_o;1;q!(s4*du8_X-##@4Ec#$_D&CfU~@@eC&ACO>LkndeiEDkhjR$` z^EzSuxbSxu!LmCzxYMcpv+9W=>i6S=5KBx#8FE|gwh{bWw6A!O{wL|W&&~cXFb7iZ zJA`p1mX<|Z8QKDdNX@y9PsYH<=&ts@9$%~AcZ3mv!Lo^vu(1+xE&Uus-mEXe|HZQU z3GBvMqDnBd|I6b?HSUl#p&xH{CDx;y*X? zN$d!>b-lYD-a8-9-aC`Yv;3b}0qn-XQS@9jMR;{-lQxI<+7NXrN;LhYp4~y5RDiaP zXrC_6V(>1h;p{sM#_jXr4YV#jv1ZZg5uU@nZkp{#4{FcWC@+LpesrE&g7Ihn_AU*E z8fKf#P3e163#5p2OjE z@_vo3*UF%}@qB~yaE0+f2T2A6uRFQ%QyqO@oqmrJ;h1e;5ZWq=36+3oMz zJbO@s(+GcEhsg84iD~?_1d*|}C>dM!BPeMEjgU{43rJ9Ci5{-ct!|;*JPp3q3sfJF z9o!#{bHiS9Bt;F=iJC*}B#O#AOjNs8oZ-|pG-#37TjPI4#Jdax(AZ0o%r)Z?&hH{N z%K`~(*piSm(OC{i=}DdZxB%8oIT05J2jX33W!+mhm(Qn(Sh4ppceG5s--3U~TU`10 zh5gwXM!~GJ9#Xw^3l{n#GU$0ol!D7r51f+2)rTY{BLYx3<*G=9HyfPz@|a#tv}*JA zEK5qa@NgGR1{YSlIS{Z@!>3oBSdzdmV4>gT$>~gN9n@73f}i2Ay#Q3lZRkdyx}xjO zVJ@c;`ngnwGMIm!$!jE=%y1a4Ts`3x*Yu9DuIQq(NJ*8~qBo0>8W5#4Qo~&H*aoB~ z$-ZGYKfm5I7p`(C2gOHnaQr;m=6-`=uAE4a0w{k~aU0{s+Q81?!kGM_tdXmYIe#Z% zb4a14MxO+VOx0^cdILH=DX1)@24{_$9fK! z^Kz256mZA$K*>iccD5xlCEwN0rxC>!#zRj{R&Jo-c%0LYgkFR4I0Y*TA1aDrx_~`&8Za!*#T|pgHZO%j;Qwk9Kkso zZ!db4oNEj987o)ifyHe!F zYFMq2`j7^c>S0m@jS~IYG1Wj>Bo4C%@&g;Q0iEKIFhK5gm_$ssBy!joy4xwwxRkW) zp_CK5k;Fv&S@FJZX=qp(cGifdE;2xqroL1!epr^4$#!mxIgAr2?mTjc>kFOBcI1~; zKDcK-IKt@kU%?EG9b!Hs@N;#F^Q;Hwrjt2jQd=wIOihO2nzX{v5Oc#~SieuhM zjYw|DYQP5EDpeqxG|?hexiAZdEVauPPB+E5STIFUk&@vruaXTpBJ-DQLE}v*2?U9l zJwY;egzxDr%~+eYzk2JiHZ@zaNmM(0*x@Ci>@qUhXhQPz`zY!eZK}vNY=1FYsf}}G z-?GmFU0RT(y7`mU&+5(pjXOknNk7MrOry@YDgg#*m=)lL;zl&l_%dlN#ry_kYwuWC z?as|=2S>a#A5E{rA08X>*dC&k_~tPPrQ)!eFN7=2-X@?A98Jlv%VKGxz1{vY--FRN zTV!NvA8?xZPRmZt5>kMrdpj$q_b)sCpfKQ z90HX7on+w6P}Ew!{T}$!f2Ma41sQ`a$NiRut{XM1??GsEf;K^M+3~>Q-buo;5^!Oq zKiUdG6=nw^C$O7FSWA+lGxjufl~#X5=YjtSqle^bq~&>WZCojObf`Lr*L5qZl_TVS zeeSfJi~4YXsjr_Kwp25zq!NvLprj|yat8oMRHQ)jGgT!sa-5PY`xXBxHLONn~?vv z=Cxt9RVepX!#k8_n&~dX*q5^SGN5Z=#?x_yk6qStTW%zv7h@vDC;fYRa@gZ~T@C=R zff~rp4`g*r@AUi$fQ{8TJZ_&`7c;SlVLu-#Yqbn;a4hB-RlIRBZwY;>JyF&kcCF(Z z#(Ze^I-xbdiOXuZ`8}KO|HjYI)fR=rHrN+U>k`?{9kIQ0S$P=hX;Ig%#yWV&6IUzs zV}Q__>1MGV%xRh>k$mvz`LzTetOLCS=pCBP|Iv=y$Mk1lt$FJtA6R!PShuXtzcHbH&?l#WR9KjUL)3h^iyHypx)O zVV5s5MZ{EiL6Z)rP+UI0^HElO{@^Q(AK+2lSNRCz?TP9^YeF+u2&N@(lLiF6C=_O; zxM<6Kl_o8pynw5eThV6^ZK@B~A!&1jdWmM{4+NoMynF3CJiT|zC2Nv#Vm7DMi1-Ii4ynGhWskprPvlS ztrSfVEZ3P+RpCwr;knPU@LQA~@YUM_rTf0!hB%~C84sKKp3Xii4T&^(erC{2wKU|@ z)K>jLwKh}C=F>)W3~6(OQGc@h=zC<8+g!nHVAih2jarE&XPnD?HNccte}1 zt7VM*U~t`c!q*C^Z2@@JIekYK)J03J)S=TahK1nowYR)c^djW_JyN#0eJzbvdg~PR zUorHRF#NjWl=w{-;(O~7t3-uguInHejZhbvoEr7Kr9q(k>UTF7y!o9tBi9g~#DD0; zRdAk3zNf{d>VhWo#M^^(e!;QlkHz5|V-M;`r+^x?*YSnMZ2|fznKqW27nK};H~LtV zCu(0?Kf0AV9_1}z$84dPxN*h{%UNifC5C?HHFjP#+PeqkHJa*A`fiJZZq#pm2f>#| zUvG`5`Qz*8Wa8{HGS)1tk{+{;T4$C{W}XRkbZ3IDj)hp7i976h;P&cGozZ5_E+7g? z!z7)%zgu9mHv#s@Ju9vT#k*p>7$UTUcDi`462(39MtmVWc!Nt}+^KH)DSt_Wcp$;( z-{G|jekWDr_vN0oA+8+>jtJ#v4QzL^LiA1dpn01SQO;8~R*+F1&_hy0iqTb^RaZ94 z%qx|F8zT>Ew$aj?n`p}(p}miHClygJDQ1*#9@baMHo~KNmc~9+{`{}bA=!%l>_7dB z3PaIv%>VmiM%UA(C;M+{OA7)*^uL-1hTqB59Jqkr0~DZ%NI{~>0U^VZ$odqF<72in zUBuAM*7WK&%{4mo+AEcorD}>OL{TC(&pMA)S>LlhtjSU=P-F3% zFWY)Ee3L(PFEfn>1iYf6=%0z%Ef0=X;*zY&SxO5rGvdjl(^zkK7eL_|HP4*b*Hnqk z!(#w1HZEiA=rpQl5nJ*mZ)REB8FwB{ti~SdCR*46rB!Ir=xkY0R?a?P8Ez*OI~0o*NB#(x_3oVs07 z{4;4l;k{{l>qB}N8+&{6d^UP}ZA!k5>@2R8;hKBfWZ=N`)uqSXABJrj+usd;#sI{~ z443;6ytC+eMKGhA|0rPWOiZx+rkt!=s5ke3AS=>~)To_k+qJixTduWJvA13gyE-H{ zZ}#sYj0v-_hgZVP(-1I#Y^fUf&__!*!RX;ftYizX>8MIKHycjIIy>D?p!-@!b8{6A zM_sLUXA*VUHJ)9zI>DT<-BGOgKLDY%&JbG{H(nIB_LycJ#C}IKqp>sOfSsLpij}b* z*Sh*P#*#Lex0i%!wCJOySMHyP)Y>#h2`Z#z?F^u4mS!g}Gef5+TX8oG9c1<|VJ~eU zMAhPn;XHWvB4)(s=f)%YcYyxU!`WZWZj1%l?Fm+;@<01v2`&uJ;h!TYKtLmGk8o{W z+Tp1!X01hoM!1eEFwyNhVH*jN<6^!U2XYw9C?7+!PVDPG_p}N3%3sr7c_eq3BM_v` zE49OdbOW5;EWgc>*%?))*3{4#;ks*sSnm zuEzIjYc?#A<)eql$hH7ST@858IXfmU0>wa_+I!{Vu^SrHV)C-r0mU3>k+=m_HbOBh z|8{NTT3cZLHF7Wnx3YWmzh@OPo0+IY{{r5Lv}v2yqKI(fWI5P$V=y}bZ--$38ihUq zO&nY0FwNB~#ox=duH?1Q;h?oz!Qg~6FG#XSrMQ0W1P@|g$dhT$7yvZqxCV7YUPb*A zPIM;w0!CM{r0-pP0Gr2M-&Pu(@+%76j``pG+o^N+tyXpl_iPQOl)YjY@G`Zaw9o>B zX^WxefXJXrO)i3`Gm7Q#vs~mYi&OgJ2wKB__ysRkkx~QgP)3Lfae$5_>%Nj-dEDc5YnjuT>n7j3xnnnkjCDzY%DgIF^>|5OAVE! zQwJpxoMn`OdI>7ZI2XxAic(f#>&8as2XQ&9<->X^;C4s76dizpf0I&@f2q^*Yw}S|^5E^l; z7D^soqxTjBr0-%+7tqP78auIS1(^A^`(7o`SN`fT;V^&n4$v-a&BVK#a~BxO&zd(| znBJQc5pSY3Lsr?))Q-zgB_%~EF^p4%L;8_K(Mnxrbdr~RBVRiyMXrJ#4)&%|+>mX# zr0+0=HS=M)J%ZobI#k@7MEmX;NGBco7)Y#bG8|F`s3$N>nwifA5wKaX_M5>*U~FYo zY@IclPa9WGW^^V+Ubl%TsQ+(vo9|t+U88ZylC@7|zALTFCM$#?ZhC!%F4Yi_(sqfH zzn}^%$zRqjRP*L-nmIS%Rlvx1f{Tvlj4*ebIomPoxokLXo6f!FkWz+?)6v%2v>dUA z1-x4u>u1WUoJo00mwKG>rFx$UrEV7pls{7O0T;v`@lzQ}9I9Le_zD(EeIYpbYn4?n zz648e7RYI?h)lN#D?dqll#i-jtwZY)<89QwnGMSB6<)bZ4oG3y{aTPVD(;_re~C(_ zBiV1YHB_Q4MNJ4C;qGmm6IdI2JchmQA)5S8t0x z+1LPMRiPbB^id%=X_o58HBzP;b;!>xBnduG@?`sh=^pOZ`Wo2Mk>6h$?D@g=fKl2rv7voOd!nAAj1mZ1!YG)z3J!chl?<`#3wqq41 zDq;9yN0;U*;^93uGD{yQb z9_Ay?K0rjVCkqD&fH8SUV-90FOxntb~V$>etzR1|}*L(vF&Qb@NY2_zVckMkX;In)pethGg z9=n@D(w*}|1bP(pl{fIxw}iz4NL0u(an{FzjmlugEdZl=(dNQKNW!*|BMXR_UM>=12ZWU%R!*WdK!S!>#}{3Sj^)H1y& zE8XQ^+{Vo4w)FSFCf(pyv-{M5SuJd?_P(!L>RpLx5yUw5?a<#zsyav)un^F62KAQk zfI*@HYN4^;&=wY4H<$!R_rnO6%}_lY47Ak{9(R(_=8{sO00da)nY0jxRals#ceBSn zENgus1l9rC4+mpsSZh|}(MVFo?0I`*?PrwSaZq<-p{KdGiplIGQkhh%j!7uWH^tAt zS%yP>T8nGe$FL80Y$2;7g;~>M{`M5&hjFaOI}C9!I&g`6X4GZ=4Ew&eNU4YJ&cdw- z$7u)Z?4tvL$#sHw0OZ8F09~=OT>r&_w7@$v@ip7_QDnL-OzKb(<4q=jtyjbAFIa6@ zTaW$uy0Q9Usxj4?&;jCEiEQ-p$qoe<$X4x_jy!)X_;yGdg><(*y_Lk<^IM34 zB65k}MJ@7_bM7=`B)`2*dEYUZbK~piIs%*zL*icW{?ukG;5AKC%5Qnb^>50Y`B*Xz zu7nmCj=Fd&A(~-6C3R9;tXg_^g#Ytn>nisoq!uIp0E}s=cEpQcGJCx8uR|Y-^1#z} zv!%&{BQ9FO939v}>cu6JL{sPq2@tXDgivzqgjCTz$h|fczJx!LK0xtQhoQzt-zpBK&1}h}T5N zy!f^Pv=%KfUc^W?j-vxWoYU$j;DlH<-gM&M;*K~ zBCYe)^Z!nqjysNXdh_MWr=Cqc7TG@N*`|tPvX0(FmKL%wu@a=ddi2* zE6pHc#XF&G^W{jbSPT9_Q2eu`VPBNJ7gC~kMQIko_vcQXDP(U#X9atOS!hQCGCb-D z0+dujYmgMxcVNiP7OmLg?ThmhWkTdDo{T&2rGsn?m+)OFQ&^K)<{3I*KMxgSu18>a zEWuAtToM0ufOlSxWTVcKKf=C~Pq{LlrX&?3F6O}4X;3K?exR)n!d#JO-IK?TL<_6D zxnvb8E?Kbo2FP8P{YJt1V2^<2#*H$B0Z53PfoAnHUA*dNt)-|K0wQ3tZOLOlpb?Zl znZ#v~z&EnR1i}d3A-yRxX%6r5GaXonEA;sqH}YZ1w?c|8VV0#7K#`Z0UxC*8EDQ50r%2A z6|d9P7gh*F>^>s$p~lk6o2#Z0qd6lK5>_V3izb-kH26MNwM5Q&ege}w$w6|7kw?+> zdk8p?#c^VycSOLcfS;NE2eQ{0<=1KF*YP7D=b!nq1(Ae_Ky=tMq;1jntdvLg$Nxa? zP>z>+(${C`vCU`tb>s)K-}Mh6pmY?)xhJTM%TbMyJ|H-U4B2E)J}X$lOysQa&3(gH zf0%${A)Se7-bV0!~pSPOAun$8l%M^ z;zb4Iz61hxSGYAhFaAnpL6zM0Y{2)gq54FS`Yh;UgevOzaySLVVK59IU`BD^P=WXs z)%^7x{X4IutePp89S_&6_=m~RgT;6*Pk+LOW=3m4r0k!I2qV3nGry>sTuY7_lchZS z6m%7X!(|~3t$nTFW{8l&mK3eGm6;0T636(96`!j&;*wNIMK~BP4f_0CB~W@LIpsvj zSzX8Tr46U^ECxP80!4Bez;;=tRr089O>3?5Qm|y6crLEQRT=oRbbckK`|-KD|ip%HfZ+ z%oL6-qi(YIBp&Mlh}TiFc=GfN*-#wXt|_eRTVGQc=sC&DaGq(kCJ**(wD27D|DouN z4}PMw#3SM$06{g2X`~_>QnUj9+J2NaS`&k+I0y}Pw9$*e7|0p_A9z{Bm-y;WkZlQ%4 zbZyEYb1k(e^Gf0a5O2;q#W}7L54#Rhd!VIMET7sx<(Kv%ZPK$1Uj zGQCs82GQ^;j<|aNp72SR4=a&5^HY2WY2p_>|K_3ci?Dq}w)BhP`i7?Ri>W*z1SYKr z5-y&}zO#NoWUYq;?fSjb((%E(UH*E_*E-zoT%0+7Q~w;Cxtm+3$=oUCCvZaVVhYz^{>bML-TFQ6!ELiFqxCK zO`JlCH9W|FtP>4uL-qq({G4}B(SaW>rE1JN-f$>DCNDKlTxzenAq8oGCAQW902`fO z0mWYemMyliF9Ja5`>BUdDp9iu62pn^E$M-a&K(6bVLkl$+s1-io@2h3>eY-MkwaaP zlcrjbJlrDddf6GD9G8m^&0ZJgPKMV}V2(#%>%*elFu|@7l?0no9W)HVrvnikoogPV zu*gMwIbk_dJ+t z096C+M=zDj2vyqf0ev?+;~-v6F1R+?M5P>JNGZ5 z-^E;}yv3yq-b7Q+i$a6^)s4L{5wSL*^L6{l=S=&__e?kE$4f8Z6Jl4)7gG?i2!;Zz zT!byasjJYC1tgzs1WfT3nA1hxObxLJfZ2yJ2eTCZ7q9iFhkiH*EfPd^O6HX(R23%Ae5(;y15q>W;pki!@*E66Nxc}UrqpWDyQ-QGNngd4e2_~2iq zy9%rY8!NgzSBnvl1WYcSj`hS6*jQk8-y!(rHOQ9Z1gcOD5bE<8*Dh@KnqYbYc>3FE zwVpH|#V{mmNzpeJtcB&I$LLeq9fF4e>3GoP*Vd)Q5$iUzIjT1HhQw#)SIq6AQAg)o zlCz{*r%~3GJ5;XFPZ7{3*{g3u66Z<3hOM@lS@x{xC%Jl!oN+r^D3GfAMy71HsXL%h z>8iUg)5UiG<0mj^S_jG}5-B}})7J<%wL36*sHV$W){3JAT^TU|j8&jWGZo6I zr*O6zx5zM!efikfkRAIw{am}wlkT=_47*=^W3jgk=7YGoSSy5gaf{s=--XrI<+$cL zj2~Yo{8jsm_K0eAf69Pz;;=*mk&YNbTu@h3wx)&?tQ9)$tES=Z+J8MN_1a5prQ66T zg}cnCStp%g%va@MjaO~JFz2iKuHn<#5p=m_NkB(>AAZ(m#9NbHP5Sk-z2elo-Sl5g z@opvVPhYIs2A3rXaej;>yg<^<+HOuI65sKd)a1ID%|@w9N6R0n^BoHsHxlJgM!mVR zy{|YmwmZqt=U}5GVh`9Y0y=yCZJe&( zh;OHZP_Tsk)E;pAbmH@4S7Xzo^Wt7;{&*s+9rODQYm?=uk1vS5ol%0t(Vg}}{ODxmk3C7|XtJx0Qm7iYi(rt(%D+d&0sNDBgG zdxkQ8(o+KJCgqL+qU_EdqS;dz&<~cAdPe{e?bMRSwKF;R;pr)0@Ckyb!17dq#6R}1 z=zCAB@5dEl;mJQb*huUfauUz-X43WU36;P5mdxu*6LRAD&4!qtc(;bcKMIp$@jOf0 z25Vr5-aA&scy~TY>>IiS$ivo8U>w-RigmN3E^O3KPCkMw5F)rV(P+g zi$cP_w#NGduj2~)ufKZ|3j^~KhXesdHinLx!fhvQ?#ec^mTPyq3 z$l7%IZ7wWecYmdn9-Zoc7+GAS@j}Qn!n4YxpO45!AL6a3Jo^t8%{KwbZKKnIcVPb7 zNGqV9;sio)PqSIIw2h9P`-P4xZQ=YA*IIFm&s<;$XPeyZ_8D^rbUKfhm4w4)lry;+ zEi5ZjdN=3z)S1^MvS0d;+m_EQ?6~0~N+q0XcT-Y#0G0pq1q$}%F^%2Pw_5Dq=ainX z$?P~BQvVf)g<~Lm!*WphTtDlYy0V8Jn03 zjj1R_&1-_f){-^_=w;Kb3yFJJxIk?D*(N=}WzkQ%V`&HIwsxN<+Pf-actYQu{v?w( zFz^Zj@nQ+O|F(T5bhNLsU>j(MTdkMmr(G%H$vu#Ni zgqRiczj9K;8mLhTB5Vk`B-!cuH#V<;%AG3A5e`X~z31lZt)5uQcXqzvI3DB2fx^oi6i>z# zQkHIRQ7L@@Qj-!{)4`6C0f%zy<3qAU2HA!&j4fneA}J)2u@uP?xk$LSVRAzsqp}sL zoV3`oe6&fJ8w!^~WHRV-RC==dCvR(e*gdPod0{y`<^+TdH=)| zWf5bajUUN!7yhgCDmCu1)<@9dMP|<&0&l%YtByu*0es$i^gmBTY`t2Fh zr!4=h8M1dD?4}uB8~#>%f5bhz@vo50A7ipp52$rIZPla{ywo7l`W=nTvLg31?e^Fm z9%(#o#ogH>8JXQnPZz0aa+R_FRwN%EETt8eYM?MZY9P$@sL&vD=;la>7V|#uZ4O{< z^XeaV)v?2Ie@K;A^s*&i<|_=T`dju0^I?aud#)yDkVD@+W-DGNM)!`;!`7?QiEK0u z2LcHCwdONp=fC!*3DWrKp}-#+D({Kv51i4G;|Wss+P@-%&id3>I;*>?faZsR;x z-KYB>?Wi8?E?JZ5U)RO(F#W>c6(cgWdCQm0esxb6Aw|&_eCzlQ4 zUW{m4lXlIqD=x)ZW(}$m*$l@{7hte&Dr@vv*62>s$#$<(blT7)u|yW2!`7T!Z3*oD8aIWz=!N4mQ z-^sL&3eRU(Nmpy07>y7<^6Fb{T&dUu6~90C)A~5xRlj?rni;6N8Jg)Qu$6i3u<~jm z*ekf*B|3g5pZS%(CMQMZ(zn}8VxdFKOaHNM*Ekn*8t*2J$7ZCU+6R$ln`naJ48Hy!QDUP6CIYv(=oP^9tH_X1_VZ`nS3hzp)ug zk>7cn+mHl&1<2fq`dwaadP-$89yQRZs%z1z;JLfueQ2&;JQc5{rfn{WaL)WusLoJrHh`EgX>)vw(w>T>~E1B)* zndzdS|k) z=4iRsbi8cZx|DTePx#K;lXRYMoY<>n*RVZP*#3UYec@pt3w}J)J-)A^#q((Xs{HL& z@EU`$wZTORUZKh+O|JfCo#1F*extye{Nvipono(XWXH{xH)Aa673-7qW#7LMzImNv z{9N*9;?%MHRHY-={3<5-bva7%i^!V2Q6l#SF7;3Bl1z5c?y@Z82v$@TNI2&Ih7W&M z!xpUeEfvB$Xm8mz*K8CMsQiX$-&fewAMex~S05ADnE6^&Ce7OP;|=aM1F2$#5*_mp z#jDjHZYuUPzT>%T6R2rWA5O0=bo%r%^mJn8$-BCD?pj79Kc#=FTbc6WMSQmh2_{e> zg15dFT&ouor-*`sz7%aBiM^OLV=hsi3!;S6-w^u#2MT`4<^;xl zqKx3Q667kCjz?nm`Unh*i!V@{Dj8o8p_u&+RU)|#sPfO>gv{y(2#lIS6CsFvt>oi| z)tY)aNHEkJdXX=C6O(P(H#q$F1}FHl7n~57cwpeQ5IM{%^CPhgBv?fp9(jfP2Odxh z^YQlaryf$LhJ{dl!VdZS&^A!iR65(cW;b-$SgDok_3Pl^CFJ6M`(96S9dr|fpIsC- zc3~V!L}L!WF#c3*%=eh8?XN{B4K5=fexsfO9iwvOR*z8LRt$aY6N!?enP^0 z7d2o@K)q#+1fpsdDBm#81A#uvEby2oGQr9O+OosVKGszLTF7uKFTn=R%83A5HVGC% zfFw;s{ zk49l(axA@MfWxUQlfmI^<)FPPOT@bki6pCI>e+3=aM%C?!@@N%jINIVS2tJuAZvxX zxc-6@*H7W^Zb$7zQ84PQ0I*TmgB1fAx;2+0rHED zfT<7yQ0wM~SE_;vdJ>61hAPG)Y2D}&T8Cl8q#vF|v|>at4I_Aa1W{9@9%TF>5@K@v zD{mNZ2;)Yh5C?3dmhQMwjEIZD2nD7X657f{LWhrH*sEAcR;yPrf*FqyGfWj^OzcI* z$CH3*?{;*ah@C$_joEbd${_4LhCNFIrWwlc0Sxb0VIY-G;9a`7;~=)r7{T}YklbGv zF;jfMD8knFBWyMUVtTB;Bw^rmHUu@mqka)&IE!JAbFsGVas@$bFE)c529SVu0fuJ| z$RXQ$3=1rRnCwr}{c9y0l0h^i52^sUUKZ>dg9%AaOeyBGrk7FK;4{k%Y zDnrP&tqIr-nJk}ttYrblF1-{#Jj!VXlMl#li%+Y?m16m$9<3BhWxDzQuN%84tKloR PFlPAY0appj7IgMMQM_1| diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index db5043d4e..4b7e1f3d3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Dec 21 16:11:33 EST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d51..8e25e6c19 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index f9553162f..9618d8d96 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome From 8ab10de4ad3cd39debcd8f9d620f4b88c1761ef3 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Sat, 10 Aug 2019 17:54:44 +0200 Subject: [PATCH 063/258] Fix plot title toggling (fixes #2456) --- .../intellectualsites/plotsquared/plot/commands/Toggle.java | 5 +---- .../plotsquared/plot/listener/PlotListener.java | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java index d9bd9bd99..e19d81762 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java @@ -3,7 +3,6 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; -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; @@ -69,9 +68,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; public void titles(Command command, PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { - PlotArea area = player.getApplicablePlotArea(); - boolean chat = area != null && area.PLOT_CHAT; - if (toggle(player, "disabletitles") != chat) { + if (toggle(player, "disabletitles")) { MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); } else { MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); 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 50b2f5398..c26c4231e 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 @@ -163,7 +163,7 @@ public class PlotListener { } CommentManager.sendTitle(player, plot); } - if (titles) { + if (titles && !player.getAttribute("disabletitles")) { if (!Captions.TITLE_ENTERED_PLOT.getTranslated().isEmpty() || !Captions.TITLE_ENTERED_PLOT_SUB.getTranslated().isEmpty()) { TaskManager.runTaskLaterAsync(() -> { From ca954ccc97455264af054a6ac49e3e01d5a590a1 Mon Sep 17 00:00:00 2001 From: jewome62 Date: Sun, 11 Aug 2019 21:15:02 +0200 Subject: [PATCH 064/258] Add toggle for time --- Bukkit/src/main/resources/plugin.yml | 1 + .../plotsquared/plot/commands/Toggle.java | 12 ++++++++++++ .../plotsquared/plot/config/Captions.java | 1 + .../plotsquared/plot/listener/PlotListener.java | 2 +- Nukkit/src/main/resources/plugin.yml | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 4c6f33b10..f60db3d67 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -126,6 +126,7 @@ permissions: plots.toggle: true plots.toggle.titles: true plots.toggle.chat: true + plots.toggle.time: true plots.set.biome: true plots.set.home: true plots.set.alias: true diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java index e19d81762..11715fcbf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java @@ -75,6 +75,18 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; } } + @CommandDeclaration(command = "time", permission = "plots.toggle.time", + description = "Toggle plot time settings") + public void time(Command command, PlotPlayer player, String[] args, + RunnableVal3 confirm, + RunnableVal2 whenDone) { + if (toggle(player, "disabletime")) { + MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); + } else { + MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); + } + } + public boolean toggle(PlotPlayer player, String key) { if (player.getAttribute(key)) { player.removeAttribute(key); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 5fd74a9ea..f9f33c20e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -52,6 +52,7 @@ public enum Captions { PERMISSION_WORLDEDIT_BYPASS("plots.worldedit.bypass", "static.permissions"), PERMISSION_PLOT_TOGGLE_TITLES("plots.toggle.titles", "static.permissions"), PERMISSION_PLOT_TOGGLE_CHAT("plots.toggle.chat", "static.permissions"), + PERMISSION_PLOT_TOGGLE_TIME("plots.toggle.time", "static.permissions"), PERMISSION_ADMIN_UPDATE_NOTIFICATION("plots.admin.update.notify", "static.permissions"), PERMISSION_ADMIN_EXIT_DENIED("plots.admin.exit.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"), 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 c26c4231e..6d738b758 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 @@ -122,7 +122,7 @@ public class PlotListener { } } Optional timeFlag = plot.getFlag(Flags.TIME); - if (timeFlag.isPresent()) { + if (timeFlag.isPresent() && !player.getAttribute("disabletime")) { try { long time = timeFlag.get(); player.setTime(time); diff --git a/Nukkit/src/main/resources/plugin.yml b/Nukkit/src/main/resources/plugin.yml index a25e26cf9..d17737c50 100644 --- a/Nukkit/src/main/resources/plugin.yml +++ b/Nukkit/src/main/resources/plugin.yml @@ -119,6 +119,7 @@ permissions: plots.toggle: true plots.toggle.titles: true plots.toggle.chat: true + plots.toggle.time: true plots.set.biome: true plots.set.home: true plots.set.alias: true From ad7bcd19d41c4b2caa26f767a5b36f060661f756 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 12 Aug 2019 13:40:22 -0400 Subject: [PATCH 065/258] Added a debug command to diagnose the issues in #2411 --- .../plotsquared/plot/commands/Debug.java | 9 +++++++++ .../plotsquared/plot/object/PlotPlayer.java | 3 +++ 2 files changed, 12 insertions(+) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index fdc44e5c7..c1970f969 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -7,11 +7,20 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import java.util.Map; + @CommandDeclaration(command = "debug", category = CommandCategory.DEBUG, description = "Show debug information", usage = "/plot debug [msg]", permission = "plots.admin") public class Debug extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { + if ((args.length > 0) && "player".equalsIgnoreCase(args[1])) { + for (Map.Entry meta : player.getMeta().entrySet()) { + MainUtil.sendMessage(player, + "Key: " + meta.getKey() + " Value: " + meta.getValue().toString() + " , "); + } + ; + } if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { StringBuilder msg = new StringBuilder(); for (Captions caption : Captions.values()) { 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 09bc364f1..8981b2923 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 @@ -118,6 +118,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { return meta; } + public ConcurrentHashMap getMeta() { + return meta; + } /** * Delete the metadata for a key. * - metadata is session only From f1c190028e51d695864f74d369e5ddf30ec345d7 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 12 Aug 2019 23:59:14 +0200 Subject: [PATCH 066/258] Fixes #2013 Tested with LuckPerms, result successful. --- Core/src/main/resources/addplots.js | 2 +- Core/src/main/resources/automerge.js | 28 +------------------------- Core/src/main/resources/fixborders.js | 29 ++------------------------- 3 files changed, 4 insertions(+), 55 deletions(-) diff --git a/Core/src/main/resources/addplots.js b/Core/src/main/resources/addplots.js index b45f8d4ff..f3696d7ff 100644 --- a/Core/src/main/resources/addplots.js +++ b/Core/src/main/resources/addplots.js @@ -1,6 +1,6 @@ /* This will increase a player's allowed plots by the provided value -/plot debugexec runasync addperm +/plot debugexec runasync addplots.js */ var uuid = UUIDHandler.getUUID('%s0', null); if (uuid === null) { diff --git a/Core/src/main/resources/automerge.js b/Core/src/main/resources/automerge.js index 220a24867..e2846f87e 100644 --- a/Core/src/main/resources/automerge.js +++ b/Core/src/main/resources/automerge.js @@ -1,32 +1,6 @@ /* -Need to script something quick with PlotSquared? -/plot debugexec runasync automerge.js - This is an example script that will auto merge all plots - -The following utility classes are usable: - - PlotSquared - - TaskManager - - TitleManager - - ConsolePlayer - - SchematicHandler - - ChunkManager - - BlockManager - - SetupUtils - - EventUtil - - UUIDHandler - - DBFunc - - HybridUtils - - IMP ( BukkitMain or SpongeMain) - - MainCommand - - MainUtil - - Settings - - StringMan - - MathMan - - C ( use C_ ) - - Permissions ( use Permissions_ ) - - For more information see: https://github.com/IntellectualSites/PlotSquared/wiki/Scripting +/plot debugexec runasync automerge.js */ var plots = PS.sortPlotsByTemp(PS.getPlots()); PS.class.static.log("Attempting to auto merge " + plots.size() + " plots"); diff --git a/Core/src/main/resources/fixborders.js b/Core/src/main/resources/fixborders.js index 779b54c61..1becaeb60 100644 --- a/Core/src/main/resources/fixborders.js +++ b/Core/src/main/resources/fixborders.js @@ -1,31 +1,6 @@ /* -Need to script something quick with PlotSquared? -/plot debugexec runasync fixborder.js - - -The following utility classes are usable: - - PS - - TaskManager - - TitleManager - - ConsolePlayer - - SchematicHandler - - ChunkManager - - BlockManager - - SetupUtils - - EventUtil - - UUIDHandler - - DBFunc - - HybridUtils - - IMP ( BukkitMain or SpongeMain) - - MainCommand - - MainUtil - - Settings - - StringMan - - MathMan - - C ( use C_ ) - - Permissions ( use Permissions_ ) - - For more information see: https://github.com/IntellectualSites/PlotSquared/wiki/Scripting +Fixes border around plots +/plot debugexec runasync fixborder.js */ var plots = PS.sortPlotsByTemp(PS.getPlots()); PS.class.static.log("Attempting to fix border for " + plots.size() + " plots"); From b1391bd6d796e02784aec1a6958d1c0c808afc1f Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 13 Aug 2019 03:13:03 +0200 Subject: [PATCH 067/258] Fix template export --- .../plotsquared/plot/generator/HybridPlotManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ac10f7aab..773b427c9 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 @@ -43,7 +43,7 @@ public class HybridPlotManager extends ClassicPlotManager { Files.readAllBytes(sideroad.toPath()))); } File intersection = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schem"); + MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "intersection.schem"); if (intersection.exists()) { files.add(new FileBytes(newDir + "intersection.schem", Files.readAllBytes(intersection.toPath()))); From bb97fb8e1969c9e679f59275cf627976624acb22 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 13 Aug 2019 04:08:17 +0200 Subject: [PATCH 068/258] Update Templates to sponge schematic format Skyblock has been removed as it was simply the default island if ASkyBlock --- Core/src/main/resources/bridge.template | Bin 5325 -> 2920 bytes Core/src/main/resources/skyblock.template | Bin 1127 -> 0 bytes Core/src/main/resources/town.template | Bin 1771 -> 2659 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Core/src/main/resources/skyblock.template diff --git a/Core/src/main/resources/bridge.template b/Core/src/main/resources/bridge.template index d5f9ccd933cdd4107dc56b07265ed7bc13946f00..0e21a3a17ab2203da1ce435ce0e432f4236b91be 100644 GIT binary patch delta 2629 zcmZ9OcTf}97RCc1f=cfs5WpY;N_i4Pr~wfW5|O1BDN2#Jbd(}!FjCxrR6(lrUZjLb z69`g8nn!*N9L@Pbo&H?v(gcVjE-)Jnx#zLp9*qhfN!Umdh~ojYIg+W9_Wfbl0~m zMRNE+<|Gk<*?hGdA3*_zm=gWM`5xA7#fLrS_M+W>7VC>oixm+ZQL*n%yr(g=6Kdig zJYB4_?aAINcJP;0zIRSMRRwrB zRg>#!e1<0V=2cs7Kz7fcd}W4NJC()oRUQONtBhOjxhc2mK=+nw z)q|kD25b4MBWm)bikUOy@+p^iPea1vw_(F^>}~sZymDVo3su|Ja`$62fzN1Bg#8hV z79aH!A@i&O)zg?NTZLz-kWwl^PpOF$CKF*zwKtXRo8POwJhX9mtrU)9tsg73 z4>*M2QoeU@15PM>a9lBWVrw{AKA53mx$%^@#Pg0VuB;&kYqHhV_GQ~vwH@frm?eMd zKj}p)HSqN}ZJ#8Y_cnRldzbgn4KHTncSj%UMp-locQF}Kru2IngoD#}Pu%KqR$6PY z2u4fmS)a_2@nqWx$4cHXcZ z)8p3(>LaAY!udHpQt`qAdHGk)h1KS|%=Sr6C0<@Gsc17&ZPK&`_7|U1)~~%eX@%d& z@cJV&FB@mov;R81>>U3`L_({BtRhva+ms7#{7iks*f8^x-6+oheL~6D7gG?ky#*iG z2$RjC;g^w-?PQse|FeJXuTqyYduG(Ce^XyedTIsicO$N87R z;MhcQ&ib7$<1&nO$Cr13ATOSqdXz~k3wSkGkSdypF^pik*m8?N^%Ecalm3?LT;z;f zum^8cy2!d>c1gVg;r-FFfv-Y}*i?Cq=@lMBIhn_e<%Vc=q{n3e%Q@WWQY|9x2I3WBLVf*^ z&kvjv?2GiS6VDfSLxUkDFX_)Yo*LlZtwM~F8%ZOwBUks9{SQrcHAnr$-zJr-j(qbE zl3xb*^Fvl@PQTE7ER4U`C?gaaj3Gst^QRw`&yQeu(;~4GhlJo(o|Kt_8Mj$g#Ce=X zX#6!9vyg}|rctf4LkEHaiJS&LW>TGYGVgBYcP;EJ5wrMO`jy9!gT#gJ{0{heh)p0_ zP(m3b(K!xiP+7g+^EzT8d3dZi!&TF2eI4X3l+y8WbG~(VJdTC)faF=BSf)|W_EomE zTtUR)?e*U34}!izqQmnw^bQ4gjuzz10`>Xon6aj=`#HXCky8VjEV?(oQ~SSze$Eb% zC+#0c0{}MQMlu9-VWMu5GeY{*!!fUos75D~cY(`%2Ls z^X#9soufqo8Wkagd?0!LJrAo~llp#8xs1^Jr*qXYP@Mg6sH67_OKILm3^_&0t<=&F zP1vOHtyd4lLQCbq75n_M?1x_+Z=6XH-WNaY{FDCzvOR&`s=10on3AHXuC&CYJsn+= zc3Xc;jknC5fJM&6YshYwYx?Q>gjb0cq?EwI&mv~KTxKyw?w{gVbCp)OemHlG*HduU zozJshEpaE)ecdQFkHEC#kWDYQ)H1}HT9y$T(zm^xWzpUGkV}B; z5?RNc5sSCmeJ!-Vgc|Q`z^X>|-Y-8loV-Vj#fg??=gH@cV?04>J1zW}C;S+(h5~V@ z!u2(WM=XOq)}#H|`Al@FZ$kAu;cRy{WGq%T^71IAH*bvwOc*Ci4t$V=sr)e>Q`Z8? zo3!vdqe5UEo*6cNEC^@w_t7bGyE4c+zV3fSv8%d=(m8Pn9TLf~;(gIp2v}fY4;$vy z!68;HS%c~0@6ru+9rk>UWcNy1)g#sWk*Ki2Mr=JtA1IHLd?Yc+F@S|3LV1BT6aAKh;K2%a;Kt5kZ*;hg`%6d&e2Q2Nmr+v!$j zKCt)Tf?8|g%)8z+o3s_PibvEjd%ieZD{?Ye?h^UhmP$dst-MLPzC&>40Hh2zaIH;S z*cz#u8P$vc*UkjVk7Sf!!?Vb}+)Z%x!u!ab`nY*6WHg+&3*-VWo&~93-;>@9F43k` z+A)D-T>A1XBa zr9>K9PQb6A#{Mg*{cf@HF}FE%uIQovkNhHj7c%$%a@^k~fi5PM6D;vh{P%9k|G+)Z a#K>@>xb@JWGe6&fKQ{LdgHSs6^Y&lrAk0+& literal 5325 zcmbVQWl$W-vR>TX9fAf35-hm8yDp0c7TvH|a0r^x{#o647<3DfU_z?ylXg;9+@1G|r zT~4VIxS{>ZbJ&{L*93RlX+DP(wRU;bM%NQ^Xl>aEy@mD0U(<5Myv(_|Qn{YbQ1b-C zth&a%3?BVIvsCqv-GQ8wCWTZsjd321hB-YvmROns32D?g1r*bICvVt=#gLw$$uc-^ z8W)578h*B65=Dy3eTTga6xcteEs^VAE7=OW6I(@8j~<<6f?Uw4NCo_$A&u&cJ#iEr zvM!*TKX+|?;(L4O<0JoA@b;uHqD)si!+!iZ9X(Xl_bCBM&{Qcqn;cnUin?Ky)~*m5 z@#ZKBnJw&5DWX}tafn^AZN6G(sL2pTrQYyW~2aXRBCMi&qL!
    Hdo-ZylD|?nmfcnL?+{6OE-_KSoWiA~*=g69Ry!`cF!R<{eV_r4KIJm$x<6TY!BrZle>rk+b{$gdvEb)vF&U4`n6;KYrJrDI9Rt@C9!xXX6gzB2i-W%s7^mu zCym&td^taii`5K5af0+^?@(3$)%WxIJy)Grv-(HZ-`gO8HLi)jFQ!->d%LqL3-^u|M~-a=W~ku;#q>_>)&B0f8cF$GRC2Vp1uqA77ccDQZ|0_9enmJHP6kD zz3Q5->#?WORJjF2I_Mj6V38j2IBAU`Y6rZU&YeV36NbghiE3X@>CV2@R}=PS!SaXe zYpRG{Rt5kxlu=N@bDEvP2mk>8FV*;4lnVYcltO;F^$&zv>v@O}K2qpwY3a$hx8pNw z#mDImjI53g4XnzajtPRW*xroA@u<02rKb}$N7hsecyPE_jZa%&ZOvz{-R@=X!TiKC z$B*7-jEl!;h|sTqO7RR4Ua=!`I?VlK8h$})JrO}PA?`KEfc#9{O8qC=?KvWQVTg6u zenGPr6OV@`caZwfGvSbh@wUf|yIsM+xWU6I!>Xh9TqQL^OIwL;@o{=X+8~^aOh#8C zu7^~==_4?-)z=INe{>tKBqIi2@COZ~%zg|UV==Ca zoqsusG^iBa^-(HeRpmrj;{DKLCkM_{ZTw=Z<%_QOFMGjL!UWpFgH8eaC(2Vvwud2V zdbaQvi&$RLp zWB1kOf)2?DaVa=MVR*62O(z)s@y!aig*jR6+A?WPlMX3FZEwO$(?l#=Buk3NF~6a+ zO`AGYER%qWJCg}t72I7@f=i{VtCwRMf}W~!2yQDT4A4Mw5>6oi3{LxHw8HYq5xbkE z+^OP=aXC?ff?G>8A8?3S-u3do0M`y7DmNl4|gKWGyF zun1L-6mH3BKSpXQv?78t7CawTT$&K8NH@p&J!-UTg~&Ze@=^;2G*pW;s! zZ>I}wuA3E%POhlV8s-k08D;K-wHRuPQJKi^7+2k{2hpALbIPAY$qabHZ_8 zYLSp=P}wK%cV?79YA+tC__A4&DE;wi3rsmOa{oC{eUbnB)cuLw(BT}!@_Q+MMXBUy z?SXxAzHTQOJ>pNLlc`A~Y1&4m-fi0G{NYvn;$$60+9*#37tD>DlpO(#6F6_y?UjVx z-P;9?ax7*|G3)%0bF^Z_4eX;2kzLp3Csui4w?YP8@7Q$SxKmffxx0ntU1%dE_9fXR z&Q8!Cot8J1dr!Djie^S4D3H_)yy*@Voj(!wmPw_ZOc&K&Rk2jPvZKkqAt=TX3h>QL z2%0lF>(okW?E`y~v%)FXpDz_vOI~Q%os9t4-P`#B$Yy+W>GKRE)Cw}>IW`79EN~Da zY_#ta_!Q*YU809m=2f=nU5*g0{+zMBobCF8*Lsc+T8tUV#U>xILl|aR*l19jPt798 zH4ar`;@Mb?HUH_Rna0pQJ`^n;{z~viC&k=WxucxU-1$;C#JA&Bn?aV6XsfS3Nahx- zT%T6j(D@}%%4mgmpl++=C4``;IaPeX(J= z6H}P@_2moGAH6-#GQKx&#$>vIk>6bgBYN5ll>A7|K_@cgVmu4QWyGe+d_-_E*;VSq zV7bUw|L&{ut)O#$j)~fT_`2TQNXXY{w8gyT9fJ75KCH94UVvbu7QN|M&um$hmC*SG z3m$AaoIh$I<9Sc|J^$QTKkQ_FpWR%A;iv3*MN@V!H&na`E!ypIW|p{Xi~jC-2XFK% zjogI8{wmMc9?p;`#j+aqj$l5+J4iFIj+bw;p?(5QiMyF&%-F$}_D~&d$}kH#v2)|Q z2t0`runir_PbQOuT-cTBhu~HKi{u`W)~P#h!_#n8O;`6~nigY)eu96=mr~O77hG4_ zZA!UL-uW!znDOU+86!wekvF8KEu#%|v;zAfGkjEB%@zxV{S%1lPGaN>%!=Q{OcNYQ zNxUUrc6Se3$WFv#Cw$;1E$dL0#(pp2!Xa@1<_pm1hq?QWAunq7&kIDk8>-R750?Wz zmGV&~S58mEP}+-(C`0DebA^Jjhg^n_O20pn2{ngFw5Bt_zvpw;!w~xZY}k_5(FF?P zHzF#^&{BroU=-n-q7#!IeeRxfY;EVo{EyK-Aih79N5r zyX^(hf35qzUp_+gVtWEGnG?!bAbbzBklGSapJTk0nQ7L!E05B{Na!j zNAziTW}u>!84W~V<(O*1sxGIg88WAm!eh$KL>#G}|0*USjj@*bmc|jEGb5T>g3l{0 zdNRwcWS6HI4d~R$_Jws@i}fp1F|<2W2*Uc<4n`IpWOKWlbx9KV6gR|*M&Q@2W^r$a zwca-O@*KGMoGK`NtHSE;snk-j)w$s=nXy?{m>5Jz)nSu6rJ3hAIQfB@<6AXlhSLpc zB#>jjhL}6d?L02tm3Q#{1M@28^sM-G%%Kq>^g@5MzB@h|`2@&lr3J6X&QDAuKYkRR zqjpK?TVY*-EeD+^a039j%ULsSZeuE(X=5q09jthPq_NRgN)2P#;1YyY80;XpU`{C_6qY;@tzpKPot{|Q zJXp0suMA(GG`+m{)qFybRyen{qE1I#@k?4NzU3;&Xcg0MajVH*3ch>ykiQbNOH=Q! z*Kym-yeFbq_iB8WZT5oig0AvwclDq~+W|Ut_wSw%gnOMCV-U9`UVi zhq-0^e~)s9GF9b#@BjeUFa7%*CH|G8uGWqa2Xj|zD5t9<Ft2xJ8M+a*y)tVVv z+}2Armtk<3mHlOHB8_tYu9t?D^X4b+NlD?rU<`2(Q<0$=BCLHEdaIEduE zc;&r$;g!HN(9T~F`a+h?FSa35xPJgg5i1%{%&KV_&4~&y?rQT5a^Ad%Lq)J@m6}NfQ>-1zzTZ@Oso-_qP zRLZiB6BAZBIFAP0POuMfN=1HfIm31KhNpEIkUgYf7r194}+$m{8v+d zu64f$|39SQ7fJ9BO#PJx_-`|RPS@Xs^A8!t{zqp1?=t$|=Kk#5-x&Bq-r)TmA~ckd TkbmDp{Ix=U1?DBe@6-PPqm#)9 diff --git a/Core/src/main/resources/skyblock.template b/Core/src/main/resources/skyblock.template deleted file mode 100644 index 1801175de6ef386cdbffe98679a3ca4f2fdee3ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1127 zcmWIWW@Zs#;Nak35SkY4#()GYf$ZYsjMUu3lFa1d7JkYy(3GdMD%wS#BgqN`u^QvcToS;S*Et9Q_^dy}*3Ml8VQie_o4w+|J&;@A|j>x~ZkVc3A0)P04RPel=B9 zOd@>J@AnHcn$+3?zPcW`Ii>H3B==v=UZt4(Y+qL%7Gzi~caF)E<3+Cil#jcPUw9}a z)xsF>{6f<)=#fVyPioP$?;^UXTHa}=ej4y=E;(^fNHFJab!x*rrsLiR7JvVeXONt% zSL~q7+Pmwta%R&#uA3HiwVztrvliJedi{d`qvGR3BGEPlOSreOxw-RvoF3WqsI@(2 z$-j*gTeVz5&3yKJQq2GGqxr^yoE=japIXJGQs{K*q`~J;-({BShFl0qJ-oKY_3HWQ z`>tf3%b9NHY8sN&86I9_c7K`P`t{pV=UmH}}9I7Kipa4?kcv$_{;pZDGdC|btEz#s;U&63pIf}F&X)MEXT+ydQ{ z#F9k4%G{jTfP;RA4S4px*Dku9xncoh(7OUxrgx#UcI37QhkNeIQursU9=m;7%%tyc zz9;Qx)I2#?!1l&E{~#M#NtfTeK{E0`ZbrGh-hHP?VCov9R+mIylLV%h`kGO#f<}oa zHy(U_`}gVN>dCSWsw)=1t(l_KYG}UFFz~HH$p#MfR*lUvo1@L*9o7a$vM-ykeI?f& zK6#IsZwwjaj#Zj zLpX0!4Ki4Wxz%2+srQ ICT0*10BLf5gML3)2ce3VC(5+D$%p-5<R7Sd&b4**0sG?Rk{r&Cg-d6M8L|WF9h)G_AnD=PQO*_q7 zV7*n@R(X!+T&+RekffmR(VT1gZ=v_*C_KyYq7m{66w|OZG`AVU<{_ zoj1PL9dOq@X&vrt(Ng5g>+$C?C9D8ni>TDr3(CPXsDJWORmRoXYROA)Rk*;yUWCwI z8D-6#Gq1u8Si6F4_1?oHllHkdKQoJ6QC)f9N+p*HBz^yt{$%FU-gr2RIDdAN7i$4Enmj` z5n1%boTKzIcmUapEN*-3PVTe2Pz`n#)?gip`{kBlySXxRQW#km0!m+VX?e&_ z22;~){4$S&3Aml0oZF+x9=?kOJ#d`7OmTPZ%_Jw0z&1&{AQ-3R$hSITx~-e0sz{@% zfY8?3`RHa9`J8Pz(nhmG+LaGe1}}yuCXp*%Jsn_DaW`XBp)<>HEU!jbRhwzd-ZUj) zf=%KrqEow?&a>6T*rQIUt*gAzXjEVM35g~Zo6x#YVKeCvg)fae2~0Iqd2aPKW+#sy z-#-i7Deq>TCMJjJbe|6yj)F zPm(QL7Gn%?sGr|N8p0O-pxfW@i@I+a!VfR4FX)}eOw??zTM!nt#xLco-ci2>H%j#* z#PqRKm7ip$Vi`6TJYkean+C|7-9_tGL+p_7hHoAdi*m+x)d~5CMQ7=W7~Zs};LtQA z!8jDwn9Q>$2)Qu2Y^@~K^F1+%=H9vAa~bmK9u@fYTQgDf#Q~0q!D;}tn99)lcgw8q zfL#9FCgI8oe*zijyY0q?s#s1M&k)nq463eNl%1bu1jR*28uxpKC@_tGrWskdJ;1+D zPFj$NkiW(I#jW`ywac)5KOOI}{5ShDHu1oq1{@-I^$b>k2R4ib(-ESos{Nl7U2??y z&E@s|AB2fRy4UAG8^wLXPgE`*Vu};`#WzDHNlO)8gy=l@xfi*UCa)d4F@f;#(R@hz z9r-o0t})4XZ(L6{u$LsCztnTx8Mc=*2JZhk*99b%|!W2{RydHLaL zO=7s0HU>CP$z!?mDXMBp{heInj@9miQJjxGa{xhpi-tIK&w$(f85Z{52 zXK&nwNseQ_wgG$OjSO_3=A0jc!L4DtAnj-+kLXsm32!gA87EViH;;w+G0+;r1P$I$ z+JJ%q0M?)O`vE1fYmr+a+yvlF;KO4PBJ@A^bee2|>D1$lm8MR=Giv7BT;%vFdJDUV zmcLakBjcceMJ`FWH(IC)>Jpl>>{3Esnhjfu_Mx^~$b)VBBhAcL>XVBM*pF++OrkFw z00GxTG9f?Ys3B+xrD2?J^b2TES*>mJg7WSSx0z!JB+CvM|=QJn0d~8EP zf)=N|(#ln3g}g^vUQ3h+Zbys@iT6VdRYaiIDZ>ccYGN0d_HTuwpJPoZ`M;SoQ4-!(Rfp zhbuZPPy|Xljq9$BZ-A6r)r=rIM!n{bdA{AQykW=U&A1Z28K0f`kg^+=_LbsLxc=0_ ztVEC>PUIj~Wd%l*o`X6bd^p<({42!Lf$pQ0Xf1PIm%@DZa{1NJCpHtC1o`{386Gq$ z+KKVv)*FEWs>_|F&ii+dm#x7fQw_-MLi>y|NkeMiX0X$Abi}=Be+J~MqNC8OQ9HPi zPCdtmm$QfbJ(vjVVQD?13xUieJh7Mfy)@3)h&9-EWGdoc&>t=h>MMIS=MFgwx^D?a zS1oQyamY1u>3dgVgY^x^tX42?%J%y@ZsBSi4Thpi9o1)7-M=MzHN__|#+n`-(T|u; zdBz$wqn!H_KrMz-5P=|Gz<*zrUpc5j9s`@n|8K^xE1>hsV*>yLfk`lhQ=a}`&95E# bf2*-$B3nX)c)^g%9Gz2eFbG=s0ifqk1(2P7r zSKaa;HOd3ZDqWnfLy9@6G#u-}gN@OiWw>00Myk zs5{Q4fK4zE&I8;%Q5Yo7%RRuw?3@kaye-rOalzR9oHf+m!q^3Yus>%FN0?ZgM<84R zygX3;K1dJEuX_@wKecrWD!|6^Ms z)j+o{qNVGIG?}^B#4026sI7$J+3IE5qJByk!f%j2^p-Mf=mKM-DGXwLby#{Yl}Vr( z75VTgY#NtejO`^5VL>rlJPzB)616e(ENjAx&@N{KBn+S5+a9@N^;Z&M96P{PIYvxg zYm9HfGhiVsz45C2QPC%19SWOx4YTJI|7qTUNGY_S7ZoQ=;f_UWd{x z-J;J@r#WzT64qnNp}11LTPOBOZ^lm*KK%I0Z`GwLMcoI2Wi%95H3J2O&OiI~V*R#Q z&A5$BEzB_yL4(if5#`>*es6AJHMfWE)3-Z({#wq_o)sQuO`4J(#(O^QkoHob(h^a< zw17@zu(*Qh#cnpK(TU2cN}s-OKzO=p#vM0vD2-qU5~+?@NXJE9|Lc@xNl5@41_U*G zO$_RY0st1mg8!>N6@~i5p)kJQNE|BQ2oB?W*aL|}YTm?nyC&FPh}HtvPlw_MPfec1 zup3>APj~Cd*T@}W)tHg)CQt+^j8*&r;Y5! z6KH|$uIa%TWx-#4Dc*Iw+Fk?zxc{Ghf&N%-cwuoU{{WOb&dUe8ksTu2Mdnr^_dtK= z5&Jw8TcZVj{JV}@T_N*>eBs#}P}jk9+5#m}2U|$~ zL-UC#EuTeYUXP0K1-&VlIZzbruoxXFFG3Y9vXoRzn)JgqKG5VRYqX&`AmT})>cM*M z{!xGZ0q<=X$F780<{nC3%&d+cBE!jATcrRxnlsz(KvYYavvb8mR0GMF$SvzO0D{at z!4qI1{o92Fhlz+P05*bqvt`zU`=9t4$^R$DzrAX+3f4WiflQ$;zVFCy&)EEwb-irh cl=u(*I^S0h93~;;3;+-l4kaO5WQq0FpAlUTS^xk5 From 41052b27a08d4f6781196f070bbaa575afa4e47f Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 13 Aug 2019 21:57:49 +0200 Subject: [PATCH 069/258] I have some random ideas sometimes - Adjusting some RequiredTypes fitting their partners/default behavior - A plot doesn't need to be claimed to get the center - Adapting another gamemode acronym - Fix copyFile to adapt the latest changes - Removing HastebinUtility, we have our own paste service --- .../plotsquared/plot/PlotSquared.java | 2 +- .../plotsquared/plot/commands/Leave.java | 2 +- .../plotsquared/plot/commands/Middle.java | 5 +- .../plotsquared/plot/commands/Relight.java | 2 +- .../plotsquared/plot/commands/Remove.java | 2 +- .../plotsquared/plot/commands/SetHome.java | 2 +- .../plotsquared/plot/flag/GameModeFlag.java | 1 + .../plot/util/HastebinUtility.java | 70 ------------------- 8 files changed, 7 insertions(+), 79 deletions(-) delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HastebinUtility.java 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 2f8fc8235..31c7710c2 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 @@ -251,12 +251,12 @@ import java.util.zip.ZipInputStream; copyFile("addplots.js", Settings.Paths.SCRIPTS); copyFile("addsigns.js", Settings.Paths.SCRIPTS); copyFile("automerge.js", Settings.Paths.SCRIPTS); + copyFile("fixborders.js", Settings.Paths.SCRIPTS); copyFile("furthest.js", Settings.Paths.SCRIPTS); copyFile("mycommand.js", Settings.Paths.SCRIPTS); copyFile("setbiomes.js", Settings.Paths.SCRIPTS); copyFile("start.js", Settings.Paths.SCRIPTS); copyFile("town.template", Settings.Paths.TEMPLATES); - copyFile("skyblock.template", Settings.Paths.TEMPLATES); copyFile("bridge.template", Settings.Paths.TEMPLATES); copyFile("de-DE.yml", Settings.Paths.TRANSLATIONS); copyFile("es-ES.yml", Settings.Paths.TRANSLATIONS); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index cbc227bd3..b51993326 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -16,7 +16,7 @@ import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "leave", description = "Removes self from being trusted or a member of the plot", permission = "plots.leave", category = CommandCategory.CLAIMING, - requiredType = RequiredType.NONE) public class Leave extends Command { + requiredType = RequiredType.PLAYER) public class Leave extends Command { public Leave() { super(MainCommand.getInstance(), true); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java index 8fbec1ecb..f3acaf5a0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; */ @CommandDeclaration(command = "middle", aliases = {"center", "centre"}, description = "Teleports you to the center of the plot", usage = "/plot middle", - category = CommandCategory.TELEPORT, requiredType = RequiredType.NONE) public class Middle + category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER) public class Middle extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] arguments) { @@ -20,9 +20,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; if (plot == null) { return sendMessage(player, Captions.NOT_IN_PLOT); } - if (!plot.hasOwner()) { - return sendMessage(player, Captions.PLOT_UNOWNED); - } player.teleport(plot.getCenter()); return true; } 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 321f91d24..5af706df3 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 @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight", - category = CommandCategory.DEBUG) public class Relight extends Command { + category = CommandCategory.DEBUG, requiredType = RequiredType.PLAYER) public class Relight extends Command { public Relight() { super(MainCommand.getInstance(), true); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java index 875eb6e4c..af1c0024d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java @@ -19,7 +19,7 @@ import java.util.UUID; @CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"}, description = "Remove a player from a plot", usage = "/plot remove ", - category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, + category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER, permission = "plots.remove") public class Remove extends SubCommand { public Remove() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java index af0968a92..7a208ebd5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @CommandDeclaration(command = "sethome", permission = "plots.set.home", description = "Set the plot home to your current position", usage = "/plot sethome [none]", - aliases = {"sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) + aliases = {"sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class SetHome extends SetCommand { @Override public boolean set(PlotPlayer player, Plot plot, String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index 3467171f2..80225c2aa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -27,6 +27,7 @@ public class GameModeFlag extends Flag { case "2": return PlotGameMode.ADVENTURE; case "spectator": + case "sp": case "3": return PlotGameMode.SPECTATOR; default: diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HastebinUtility.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HastebinUtility.java deleted file mode 100644 index 3b0563a3d..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HastebinUtility.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.util; - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class HastebinUtility { - - public static final String BIN_URL = "https://hastebin.com/documents", USER_AGENT = - "Mozilla/5.0"; - public static final Pattern PATTERN = Pattern.compile("\\{\"key\":\"([\\S\\s]*)\"\\}"); - - public static String upload(final String string) throws IOException { - final URL url = new URL(BIN_URL); - final HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - - connection.setRequestMethod("POST"); - connection.setRequestProperty("User-Agent", USER_AGENT); - connection.setDoOutput(true); - - try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) { - outputStream.write(string.getBytes()); - outputStream.flush(); - } - - StringBuilder response; - try (BufferedReader in = new BufferedReader( - new InputStreamReader(connection.getInputStream()))) { - response = new StringBuilder(); - - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - } - - Matcher matcher = PATTERN.matcher(response.toString()); - if (matcher.matches()) { - return "https://hastebin.com/" + matcher.group(1); - } else { - throw new RuntimeException("Couldn't read response!"); - } - } - - public static String upload(final File file) throws IOException { - List lines = new ArrayList<>(); - try (BufferedReader reader = new BufferedReader(new FileReader(file))) { - String line; - int i = 0; - while ((line = reader.readLine()) != null) { - lines.add(line); - } - } - final StringBuilder content = new StringBuilder(); - for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) { - content.append(lines.get(i)).append("\n"); - } - return upload(content.toString()); - } - -} From 96427777500a0fdb48680ad657bf1077062f2f5a Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 13 Aug 2019 17:33:32 -0400 Subject: [PATCH 070/258] If NMF can have midnight work, so can I --- .../plotsquared/bukkit/BukkitMain.java | 2 +- .../bukkit/listeners/PlayerEvents.java | 4 +- .../bukkit/util/BukkitChunkManager.java | 5 +- .../bukkit/util/BukkitLegacyMappings.java | 3 +- .../plotsquared/bukkit/util/BukkitUtil.java | 3 +- .../plotsquared/plot/commands/Auto.java | 3 ++ .../plot/generator/HybridPlotManager.java | 7 +-- .../plotsquared/plot/object/Plot.java | 49 ++++++++++++------- .../plotsquared/plot/object/PlotArea.java | 2 +- 9 files changed, 48 insertions(+), 30 deletions(-) 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 e32b26cb2..12a31de02 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 @@ -119,7 +119,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain new PlotSquared(this, "Bukkit"); - if (PlotSquared.get().IMP.getServerVersion()[1] < 13) { + if (PaperLib.getMinecraftVersion() < 13 && PaperLib.getMinecraftPatchVersion() < 2) { System.out.println( "You can't use this version of PlotSquared on a server less than Minecraft 1.13.2."); System.out 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 938cc8b9a..5334cafb8 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 @@ -932,10 +932,10 @@ import java.util.regex.Pattern; PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer()); Location location = plotPlayer.getLocation(); PlotArea area = location.getPlotArea(); - if (area == null || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) { + if (location.isPlotArea() || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) { return; } - Plot plot = area.getPlot(location); + Plot plot = location.getPlot(); if (plot == null) { return; } 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 c3b7521f2..a40fb252b 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 @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlock import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; +import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; @@ -276,7 +277,7 @@ public class BukkitChunkManager extends ChunkManager { } final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z - && PlotSquared.imp().getServerVersion()[1] == 13) { + && PaperLib.getMinecraftVersion() == 13) { AugmentedUtils .bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.x, chunk.z)); continue; @@ -391,7 +392,7 @@ public class BukkitChunkManager extends ChunkManager { return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force); } - @SuppressWarnings("deprecation") @Override + @Override public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) { 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..bc18271db 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 @@ -6,6 +6,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; +import io.papermc.lib.PaperLib; import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -829,7 +830,7 @@ public final class BukkitLegacyMappings extends LegacyMappings { LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName, @NonNull final String newName, @NonNull final String new14Name) { this(numericalId, dataValue, legacyName, - PlotSquared.get().IMP.getServerVersion()[1] == 13 ? newName : new14Name); + PaperLib.getMinecraftVersion() == 13 ? newName : new14Name); } LegacyBlock(final int numericalId, @NonNull final String legacyName, 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 283e68688..2c5d9c9d0 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 @@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.worldedit.bukkit.BukkitWorld; +import io.papermc.lib.PaperLib; import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -353,7 +354,7 @@ import java.util.Set; } else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) { facing = BlockFace.SOUTH; } - if (PlotSquared.get().IMP.getServerVersion()[1] == 13) { + if (PaperLib.getMinecraftVersion() == 13) { block.setType(Material.valueOf("WALL_SIGN"), false); } else { block.setType(Material.valueOf("OAK_WALL_SIGN"), false); 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 fa187877e..c68d8ba30 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 @@ -253,6 +253,9 @@ public class Auto extends SubCommand { for (int j = start.y; j <= end.y; j++) { Plot plot = plotarea.getPlotAbs(new PlotId(i, j)); boolean teleport = i == end.x && j == end.y; + if (plot == null) { + return false; + } plot.claim(player, teleport, null); } } 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 ac10f7aab..2634f4af1 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 @@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.Sets; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockTypes; + import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -34,13 +35,13 @@ public class HybridPlotManager extends ClassicPlotManager { String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.worldname + File.separator; try { - File sideroad = + File sideRoad = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem"); String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator; - if (sideroad.exists()) { + if (sideRoad.exists()) { files.add(new FileBytes(newDir + "sideroad.schem", - Files.readAllBytes(sideroad.toPath()))); + Files.readAllBytes(sideRoad.toPath()))); } File intersection = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schem"); 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 b1098e6f3..513a74ec0 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 @@ -21,6 +21,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 org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -46,13 +47,14 @@ import java.util.stream.Collectors; public class Plot { private static final int MAX_HEIGHT = 256; + /** * @deprecated raw access is deprecated */ @Deprecated private static HashSet connected_cache; private static HashSet regions_cache; - private final PlotId id; + @NotNull private final PlotId id; /** * plot owner @@ -62,10 +64,12 @@ public class Plot { * @deprecated */ @Deprecated public UUID owner; + /** * Has the plot changed since the last save cycle? */ public boolean countsTowardsMax = true; + /** * Represents whatever the database manager needs it to:
    * - A value of -1 usually indicates the plot will not be stored in the DB
    @@ -74,23 +78,28 @@ public class Plot { * @deprecated magical */ @Deprecated public int temp; + /** * Plot creation timestamp (not accurate if the plot was created before this was implemented)
    * - Milliseconds since the epoch
    */ private long timestamp; + /** * List of trusted (with plot permissions). */ private HashSet trusted; + /** * List of members users (with plot permissions). */ private HashSet members; + /** * List of denied players. */ private HashSet denied; + /** * External settings class. * - Please favor the methods over direct access to this class
    @@ -99,6 +108,7 @@ public class Plot { private PlotSettings settings; private PlotArea area; + /** * Session only plot metadata (session is until the server stops)
    *
    @@ -107,6 +117,7 @@ public class Plot { * @see FlagManager */ private ConcurrentHashMap meta; + /** * The cached origin plot. * - The origin plot is used for plot grouping and relational data @@ -117,12 +128,12 @@ public class Plot { * Constructor for a new plot. * (Only changes after plot.create() will be properly set in the database) * - * @param area the PlotArea where the plot is located - * @param id the plot id + * @param area the PlotArea where the plot is located + * @param id the plot id * @param owner the plot owner * @see Plot#getPlot(Location) for existing plots */ - public Plot(PlotArea area, PlotId id, UUID owner) { + public Plot(PlotArea area, @NotNull PlotId id, UUID owner) { this.area = area; this.id = id; this.owner = owner; @@ -133,10 +144,10 @@ public class Plot { * (Only changes after plot.create() will be properly set in the database) * * @param area the PlotArea where the plot is located - * @param id the plot id + * @param id the plot id * @see Plot#getPlot(Location) for existing plots */ - public Plot(PlotArea area, PlotId id) { + public Plot(PlotArea area, @NotNull PlotId id) { this.area = area; this.id = id; } @@ -146,13 +157,13 @@ public class Plot { * The database will ignore any queries regarding temporary plots. * Please note that some bulk plot management functions may still affect temporary plots (TODO: fix this) * - * @param area the PlotArea where the plot is located - * @param id the plot id + * @param area the PlotArea where the plot is located + * @param id the plot id * @param owner the owner of the plot - * @param temp Represents whatever the database manager needs it to + * @param temp Represents whatever the database manager needs it to * @see Plot#getPlot(Location) for existing plots */ - public Plot(PlotArea area, PlotId id, UUID owner, int temp) { + public Plot(PlotArea area, @NotNull PlotId id, UUID owner, int temp) { this.area = area; this.id = id; this.owner = owner; @@ -162,14 +173,14 @@ public class Plot { /** * Constructor for a saved plots (Used by the database manager when plots are fetched) * - * @param id the plot id - * @param owner the plot owner + * @param id the plot id + * @param owner the plot owner * @param trusted the plot trusted players - * @param denied the plot denied players - * @param merged array giving merged plots + * @param denied the plot denied players + * @param merged an array giving merged plots * @see Plot#getPlot(Location) for existing plots */ - public Plot(PlotId id, UUID owner, HashSet trusted, HashSet members, + public Plot(@NotNull PlotId id, UUID owner, HashSet trusted, HashSet members, HashSet denied, String alias, BlockLoc position, Collection flags, PlotArea area, boolean[] merged, long timestamp, int temp) { this.id = id; @@ -194,8 +205,8 @@ public class Plot { /** * Gets a plot from a string e.g. [area];[id] * - * @param defaultArea If no area is specified - * @param string plot id/area + id + * @param defaultArea if no area is specified + * @param string plot id/area + id * @return New or existing plot object */ public static Plot fromString(PlotArea defaultArea, String string) { @@ -452,7 +463,7 @@ public class Plot { * * @return the PlotId for this plot */ - public PlotId getId() { + @NotNull public PlotId getId() { return this.id; } @@ -1627,7 +1638,7 @@ public class Plot { /** * Moves the settings for a plot. * - * @param plot the plot to move + * @param plot the plot to move * @param whenDone * @return */ 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 3ed1e2c95..50ffaf7b3 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 @@ -635,7 +635,7 @@ public abstract class PlotArea { this.meta.put(key, value); } - @Nullable public T getMeta(@Nullable final String key, @Nullable final T def) { + @NotNull public T getMeta(@Nullable final String key, @NotNull final T def) { final Object v = getMeta(key); return v == null ? def : (T) v; } From 265f0c6615f128e3975ee1f7b6be2bc9c4dba4c6 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 13 Aug 2019 18:06:10 -0400 Subject: [PATCH 071/258] Potential fix for #1930 --- .../plotsquared/bukkit/util/BukkitUtil.java | 4 +- .../plotsquared/plot/commands/Unlink.java | 10 +++- .../plotsquared/plot/object/Direction.java | 6 +- .../plotsquared/plot/object/Plot.java | 60 ++++++++++++++++--- .../plotsquared/plot/object/PlotSettings.java | 18 +++++- 5 files changed, 80 insertions(+), 18 deletions(-) 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 2c5d9c9d0..947dd22fd 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 @@ -356,8 +356,8 @@ import java.util.Set; } if (PaperLib.getMinecraftVersion() == 13) { block.setType(Material.valueOf("WALL_SIGN"), false); - } else { - block.setType(Material.valueOf("OAK_WALL_SIGN"), false); + } else if (PaperLib.getMinecraftVersion() == 14) { + block.setType(Material.OAK_WALL_SIGN, false); } final Directional sign = (Directional) block.getBlockData(); sign.setFacing(facing); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java index 9ce6bd5fb..4805c75e7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java @@ -5,7 +5,11 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; 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.util.*; +import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; @CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"}, description = "Unlink a mega-plot", usage = "/plot unlink [createroads]", @@ -14,8 +18,8 @@ public class Unlink extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java index 0c7de4905..e39dfba0e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java @@ -1,9 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.object; public enum Direction { - NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4, - "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, "southwest"), NORTHWEST(7, - "northwest"), + ALL(-1, "all"), NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, + "west"), NORTHEAST(4, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, + "southwest"), NORTHWEST(7, "northwest"), ; 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 513a74ec0..a03ac6dd5 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 @@ -790,7 +790,7 @@ public class Plot { /** * Sets the plot owner (and update the database) * - * @param owner uuid to set as owner + * @param owner uuid to set as owner * @param initiator player initiating set owner * @return boolean */ @@ -1003,7 +1003,7 @@ public class Plot { } PlotManager manager = this.area.getPlotManager(); if (this.area.ALLOW_SIGNS) { - Location loc = manager.getSignLoc(this); + Location location = manager.getSignLoc(this); String id = this.id.x + ";" + this.id.y; String[] lines = new String[] {Captions.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), @@ -1013,7 +1013,9 @@ public class Plot { "%plr%", name), Captions.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll( "%plr%", name)}; - WorldUtil.IMP.setSign(this.getWorldName(), loc.getX(), loc.getY(), loc.getZ(), lines); + WorldUtil.IMP + .setSign(this.getWorldName(), location.getX(), location.getY(), location.getZ(), + lines); } } @@ -2054,6 +2056,44 @@ public class Plot { } } + /** + * Sets the raw merge data
    + * - Updates DB
    + * - Does not modify terrain
    + * ----------
    + * 0 = north
    + * 1 = east
    + * 2 = south
    + * 3 = west
    + * ----------
    + * + * @param direction + * @param value + */ + public void setMerged(Direction direction, boolean value) { + if (this.getSettings().setMerged(direction.getIndex(), value)) { + if (value) { + Plot other = this.getRelative(direction).getBasePlot(false); + if (!other.equals(this.getBasePlot(false))) { + Plot base = other.id.y < this.id.y + || other.id.y == this.id.y && other.id.x < this.id.x ? other : this.origin; + this.origin.origin = base; + other.origin = base; + this.origin = base; + connected_cache = null; + } + } else { + if (this.origin != null) { + this.origin.origin = null; + this.origin = null; + } + connected_cache = null; + } + DBFunc.setMerged(this, this.getSettings().getMerged()); + regions_cache = null; + } + } + /** * Gets the merged array. * @@ -2219,7 +2259,7 @@ public class Plot { * 3 = west
    * @param max The max number of merges to do * @param uuid The UUID it is allowed to merge with - * @param removeRoads Whether to remove roads + * @param removeRoads whether to remove roads * @return true if a merge takes place */ public boolean autoMerge(int dir, int max, UUID uuid, boolean removeRoads) { @@ -2852,7 +2892,7 @@ public class Plot { } /** - * Merges 2 plots Removes the road in-between
    - Assumes plots are directly next to each other
    - saves to DB + * Merges two plots.
    - Assumes plots are directly next to each other
    - saves to DB * * @param lesserPlot * @param removeRoads @@ -2868,10 +2908,11 @@ public class Plot { if (!lesserPlot.getMerged(Direction.SOUTH)) { lesserPlot.clearRatings(); greaterPlot.clearRatings(); - lesserPlot.setMerged(2, true); - greaterPlot.setMerged(0, true); + lesserPlot.setMerged(Direction.SOUTH, true); + greaterPlot.setMerged(Direction.NORTH, true); lesserPlot.mergeData(greaterPlot); if (removeRoads) { + lesserPlot.removeSign(); lesserPlot.removeRoadSouth(); Plot diagonal = greaterPlot.getRelative(Direction.EAST); if (diagonal.getMerged(Direction.NORTHWEST)) { @@ -2892,10 +2933,11 @@ public class Plot { if (!lesserPlot.getMerged(Direction.EAST)) { lesserPlot.clearRatings(); greaterPlot.clearRatings(); - lesserPlot.setMerged(1, true); - greaterPlot.setMerged(3, true); + lesserPlot.setMerged(Direction.EAST, true); + greaterPlot.setMerged(Direction.WEST, true); lesserPlot.mergeData(greaterPlot); if (removeRoads) { + lesserPlot.removeSign(); Plot diagonal = greaterPlot.getRelative(Direction.SOUTH); if (diagonal.getMerged(Direction.NORTHWEST)) { lesserPlot.removeRoadSouthEast(); 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 829e42dbd..ce51fea33 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 @@ -5,7 +5,12 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import com.google.common.collect.ImmutableList; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; /** * Generic settings class. @@ -80,6 +85,17 @@ public class PlotSettings { return false; } + public boolean setMerged(Direction direction, boolean merged) { + if (Direction.ALL == direction) { + throw new IllegalArgumentException("You cannot use Direction.ALL in this method!"); + } + if (this.merged[direction.getIndex()] != merged) { + this.merged[direction.getIndex()] = merged; + return true; + } + return false; + } + public BlockLoc getPosition() { if (this.position == null) { return new BlockLoc(0, 0, 0); From d7c72d5f7587b67e95f611a61c3a173904472c0f Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 13 Aug 2019 18:10:04 -0400 Subject: [PATCH 072/258] Variable renames --- .../plot/object/schematic/Schematic.java | 8 ++++---- .../plotsquared/plot/util/SchematicHandler.java | 14 +++++++------- .../plot/util/block/BasicLocalBlockQueue.java | 1 - .../plot/util/block/DelegateLocalBlockQueue.java | 1 - .../plot/util/block/LocalBlockQueue.java | 4 ---- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java index b67b16b58..e2c222df5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java @@ -30,8 +30,8 @@ public class Schematic { public boolean setBlock(BlockVector3 position, BaseBlock block) throws WorldEditException { if (clipboard.getRegion().contains(position)) { - BlockVector3 v = position.subtract(clipboard.getRegion().getMinimumPoint()); - clipboard.setBlock(v, block); + BlockVector3 vector3 = position.subtract(clipboard.getRegion().getMinimumPoint()); + clipboard.setBlock(vector3, block); return true; } else { return false; @@ -39,9 +39,9 @@ public class Schematic { } public void save(File file) throws IOException { - try (SpongeSchematicWriter ssw = new SpongeSchematicWriter( + try (SpongeSchematicWriter schematicWriter = new SpongeSchematicWriter( new NBTOutputStream(new FileOutputStream(file)))) { - ssw.write(clipboard); + schematicWriter.write(clipboard); } } } 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 6ce59fe6c..9742ffb98 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 @@ -327,9 +327,9 @@ public abstract class SchematicHandler { public Schematic getSchematic(@NotNull URL url) { try { - ReadableByteChannel rbc = Channels.newChannel(url.openStream()); - InputStream is = Channels.newInputStream(rbc); - return getSchematic(is); + ReadableByteChannel readableByteChannel = Channels.newChannel(url.openStream()); + InputStream inputStream = Channels.newInputStream(readableByteChannel); + return getSchematic(inputStream); } catch (IOException e) { e.printStackTrace(); } @@ -338,15 +338,15 @@ public abstract class SchematicHandler { public Schematic getSchematic(@NotNull InputStream is) { try { - SpongeSchematicReader ssr = + SpongeSchematicReader schematicReader = new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is))); - BlockArrayClipboard clip = (BlockArrayClipboard) ssr.read(); + BlockArrayClipboard clip = (BlockArrayClipboard) schematicReader.read(); return new Schematic(clip); } catch (IOException ignored) { try { - MCEditSchematicReader msr = + MCEditSchematicReader schematicReader = new MCEditSchematicReader(new NBTInputStream(new GZIPInputStream(is))); - BlockArrayClipboard clip = (BlockArrayClipboard) msr.read(); + BlockArrayClipboard clip = (BlockArrayClipboard) schematicReader.read(); return new Schematic(clip); } catch (IOException e) { e.printStackTrace(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 6993c3208..6b5d625d7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -23,7 +23,6 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { private int lastZ = Integer.MIN_VALUE; public BasicLocalBlockQueue(String world) { - super(world); this.world = world; this.modified = System.currentTimeMillis(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index 0c797c706..5c2a8fb48 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -8,7 +8,6 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { private final LocalBlockQueue parent; public DelegateLocalBlockQueue(LocalBlockQueue parent) { - super(parent == null ? null : parent.getWorld()); this.parent = parent; } 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 53196966e..852505d74 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 @@ -16,10 +16,6 @@ import java.util.Map; public abstract class LocalBlockQueue { - public LocalBlockQueue(String world) { - // Implement this elsewhere - } - public ScopedLocalBlockQueue getForChunk(int x, int z) { int bx = x << 4; int bz = z << 4; From 56e055c6712d7a079b1ad1b350c170de9c5fbe6b Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 13 Aug 2019 18:39:38 -0400 Subject: [PATCH 073/258] Second attempt at a sign fix. --- .../intellectualsites/plotsquared/plot/object/Plot.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 a03ac6dd5..1dc7d9f81 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 @@ -2899,6 +2899,7 @@ public class Plot { */ public void mergePlot(Plot lesserPlot, boolean removeRoads) { Plot greaterPlot = this; + lesserPlot.removeSign(); if (lesserPlot.getId().x == greaterPlot.getId().x) { if (lesserPlot.getId().y > greaterPlot.getId().y) { Plot tmp = lesserPlot; @@ -2912,7 +2913,7 @@ public class Plot { greaterPlot.setMerged(Direction.NORTH, true); lesserPlot.mergeData(greaterPlot); if (removeRoads) { - lesserPlot.removeSign(); + //lesserPlot.removeSign(); lesserPlot.removeRoadSouth(); Plot diagonal = greaterPlot.getRelative(Direction.EAST); if (diagonal.getMerged(Direction.NORTHWEST)) { @@ -2937,7 +2938,7 @@ public class Plot { greaterPlot.setMerged(Direction.WEST, true); lesserPlot.mergeData(greaterPlot); if (removeRoads) { - lesserPlot.removeSign(); + //lesserPlot.removeSign(); Plot diagonal = greaterPlot.getRelative(Direction.SOUTH); if (diagonal.getMerged(Direction.NORTHWEST)) { lesserPlot.removeRoadSouthEast(); From 3e6b0b83946cd9a8a0745f4b3529b0870f887daa Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 13 Aug 2019 22:01:23 -0400 Subject: [PATCH 074/258] Work on directions and merging --- .../bukkit/events/PlotMergeEvent.java | 7 +- .../plotsquared/plot/commands/Merge.java | 24 +++-- .../plotsquared/plot/object/Direction.java | 9 ++ .../plotsquared/plot/object/Plot.java | 95 +++++-------------- 4 files changed, 52 insertions(+), 83 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java index 493145f2a..55488011e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java @@ -6,8 +6,7 @@ import lombok.Setter; import org.bukkit.World; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Event called when several plots are merged @@ -29,8 +28,8 @@ public final class PlotMergeEvent extends PlotEvent implements Cancellable { * @param dir The direction of the merge * @param max Max merge size */ - public PlotMergeEvent(@Nonnull final World world, @Nonnull final Plot plot, - @Nonnull final int dir, @Nonnull final int max) { + public PlotMergeEvent(@NotNull final World world, @NotNull final Plot plot, + @NotNull final int dir, @NotNull final int max) { super(plot); this.world = world; this.dir = dir; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index fcf5650b2..bbd0979cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; 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.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; @@ -17,6 +18,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.UUID; +import static com.github.intellectualsites.plotsquared.plot.object.Direction.getFromIndex; + @CommandDeclaration(command = "merge", aliases = "m", description = "Merge the plot you are standing on, with another plot", permission = "plots.merge", usage = "/plot merge [removeroads]", @@ -82,20 +85,20 @@ public class Merge extends SubCommand { MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.merge." + (size + 1)); return false; } - int direction = -1; + Direction direction = Direction.ALL; if (args.length == 0) { switch (direction(player.getLocationFull().getYaw())) { case "NORTH": - direction = 0; + direction = Direction.NORTH; break; case "EAST": - direction = 1; + direction = Direction.EAST; break; case "SOUTH": - direction = 2; + direction = Direction.SOUTH; break; case "WEST": - direction = 3; + direction = Direction.WEST; break; } } else { @@ -110,7 +113,7 @@ public class Merge extends SubCommand { Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); return true; } - if (plot.autoMerge(-1, maxSize, uuid, terrain)) { + if (plot.autoMerge(Direction.ALL, maxSize, uuid, terrain)) { if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { EconHandler.manager.withdrawMoney(player, price); sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); @@ -124,12 +127,12 @@ public class Merge extends SubCommand { } for (int i = 0; i < values.length; i++) { if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) { - direction = i; + direction = getFromIndex(i); break; } } } - if (direction == -1) { + if (direction == Direction.ALL) { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); MainUtil.sendMessage(player, @@ -156,7 +159,8 @@ public class Merge extends SubCommand { return true; } Plot adjacent = plot.getRelative(direction); - if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4) + if (adjacent == null || !adjacent.hasOwner() || adjacent + .getMerged((direction.getIndex() + 2) % 4) || adjacent.isOwner(uuid)) { MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); return false; @@ -173,7 +177,7 @@ public class Merge extends SubCommand { continue; } isOnline = true; - final int dir = direction; + final Direction dir = direction; Runnable run = () -> { MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED); plot.autoMerge(dir, maxSize - size, owner, terrain); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java index e39dfba0e..3c3900dc1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java @@ -16,6 +16,15 @@ public enum Direction { this.name = name; } + public static Direction getFromIndex(int index) { + for (Direction value : values()) { + if (value.getIndex() == index) { + return value; + } + } + return NORTH; + } + public int getIndex() { return index; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index 1dc7d9f81..f130041c6 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 @@ -1545,7 +1545,7 @@ public class Plot { DBFunc.createPlotAndSettings(this, () -> { PlotArea plotworld = Plot.this.area; if (notify && plotworld.AUTO_MERGE) { - Plot.this.autoMerge(-1, Integer.MAX_VALUE, uuid, true); + Plot.this.autoMerge(Direction.ALL, Integer.MAX_VALUE, uuid, true); } }); return true; @@ -2022,56 +2022,12 @@ public class Plot { * Sets the raw merge data
    * - Updates DB
    * - Does not modify terrain
    - * ----------
    - * 0 = north
    - * 1 = east
    - * 2 = south
    - * 3 = west
    - * ----------
    - * - * @param direction - * @param value - */ - public void setMerged(int direction, boolean value) { - if (this.getSettings().setMerged(direction, value)) { - if (value) { - Plot other = this.getRelative(direction).getBasePlot(false); - if (!other.equals(this.getBasePlot(false))) { - Plot base = other.id.y < this.id.y - || other.id.y == this.id.y && other.id.x < this.id.x ? other : this.origin; - this.origin.origin = base; - other.origin = base; - this.origin = base; - connected_cache = null; - } - } else { - if (this.origin != null) { - this.origin.origin = null; - this.origin = null; - } - connected_cache = null; - } - DBFunc.setMerged(this, this.getSettings().getMerged()); - regions_cache = null; - } - } - - /** - * Sets the raw merge data
    - * - Updates DB
    - * - Does not modify terrain
    - * ----------
    - * 0 = north
    - * 1 = east
    - * 2 = south
    - * 3 = west
    - * ----------
    * * @param direction * @param value */ public void setMerged(Direction direction, boolean value) { - if (this.getSettings().setMerged(direction.getIndex(), value)) { + if (this.getSettings().setMerged(direction, value)) { if (value) { Plot other = this.getRelative(direction).getBasePlot(false); if (!other.equals(this.getBasePlot(false))) { @@ -2249,24 +2205,21 @@ public class Plot { } /** - * Auto merge a plot in a specific direction
    + * Auto merge a plot in a specific direction. * - * @param dir The direction to merge
    - * -1 = All directions
    - * 0 = north
    - * 1 = east
    - * 2 = south
    - * 3 = west
    - * @param max The max number of merges to do - * @param uuid The UUID it is allowed to merge with + * @param dir the direction to merge + * @param max the max number of merges to do + * @param uuid the UUID it is allowed to merge with * @param removeRoads whether to remove roads * @return true if a merge takes place */ - public boolean autoMerge(int dir, int max, UUID uuid, boolean removeRoads) { + public boolean autoMerge(Direction dir, int max, UUID uuid, boolean removeRoads) { + //Ignore merging if there is no owner for the plot if (this.owner == null) { return false; } - if (!EventUtil.manager.callMerge(this, dir, max)) { + //Call the merge event + if (!EventUtil.manager.callMerge(this, dir.getIndex(), max)) { return false; } Set connected = this.getConnectedPlots(); @@ -2282,7 +2235,7 @@ public class Plot { } visited.add(current); Set plots; - if ((dir == -1 || dir == 0) && !getMerged(Direction.NORTH)) { + if ((dir == Direction.ALL || dir == Direction.NORTH) && !getMerged(Direction.NORTH)) { Plot other = current.getRelative(Direction.NORTH); if (other != null && other.isOwner(uuid) && ( other.getBasePlot(false).equals(current.getBasePlot(false)) @@ -2301,7 +2254,8 @@ public class Plot { } } } - if (max >= 0 && (dir == -1 || dir == 1) && !current.getMerged(Direction.EAST)) { + if (max >= 0 && (dir == Direction.ALL || dir == Direction.EAST) && !current + .getMerged(Direction.EAST)) { Plot other = current.getRelative(Direction.EAST); if (other != null && other.isOwner(uuid) && ( other.getBasePlot(false).equals(current.getBasePlot(false)) @@ -2320,7 +2274,8 @@ public class Plot { } } } - if (max >= 0 && (dir == -1 || dir == 2) && !getMerged(Direction.SOUTH)) { + if (max >= 0 && (dir == Direction.ALL || dir == Direction.SOUTH) && !getMerged( + Direction.SOUTH)) { Plot other = current.getRelative(Direction.SOUTH); if (other != null && other.isOwner(uuid) && ( other.getBasePlot(false).equals(current.getBasePlot(false)) @@ -2339,7 +2294,8 @@ public class Plot { } } } - if (max >= 0 && (dir == -1 || dir == 3) && !getMerged(Direction.WEST)) { + if (max >= 0 && (dir == Direction.ALL || dir == Direction.WEST) && !getMerged( + Direction.WEST)) { Plot other = current.getRelative(Direction.WEST); if (other != null && other.isOwner(uuid) && ( other.getBasePlot(false).equals(current.getBasePlot(false)) @@ -2502,10 +2458,10 @@ public class Plot { // invalid merge PlotSquared.debug("Fixing invalid merge: " + this); if (tmp.isOwnerAbs(this.owner)) { - tmp.getSettings().setMerged(2, true); + tmp.getSettings().setMerged(Direction.SOUTH, true); DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); } else { - this.getSettings().setMerged(0, false); + this.getSettings().setMerged(Direction.NORTH, false); DBFunc.setMerged(this, this.getSettings().getMerged()); } } @@ -2518,10 +2474,10 @@ public class Plot { // invalid merge PlotSquared.debug("Fixing invalid merge: " + this); if (tmp.isOwnerAbs(this.owner)) { - tmp.getSettings().setMerged(3, true); + tmp.getSettings().setMerged(Direction.WEST, true); DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); } else { - this.getSettings().setMerged(1, false); + this.getSettings().setMerged(Direction.EAST, false); DBFunc.setMerged(this, this.getSettings().getMerged()); } } @@ -2534,10 +2490,10 @@ public class Plot { // invalid merge PlotSquared.debug("Fixing invalid merge: " + this); if (tmp.isOwnerAbs(this.owner)) { - tmp.getSettings().setMerged(0, true); + tmp.getSettings().setMerged(Direction.NORTH, true); DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); } else { - this.getSettings().setMerged(2, false); + this.getSettings().setMerged(Direction.SOUTH, false); DBFunc.setMerged(this, this.getSettings().getMerged()); } } @@ -2550,10 +2506,10 @@ public class Plot { // invalid merge PlotSquared.debug("Fixing invalid merge: " + this); if (tmp.isOwnerAbs(this.owner)) { - tmp.getSettings().setMerged(1, true); + tmp.getSettings().setMerged(Direction.EAST, true); DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); } else { - this.getSettings().setMerged(3, false); + this.getSettings().setMerged(Direction.WEST, false); DBFunc.setMerged(this, this.getSettings().getMerged()); } } @@ -2951,6 +2907,7 @@ public class Plot { } } } + } /** From fd9e716ec441f8b1a05871bcd462ee738293d51c Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 13 Aug 2019 22:10:48 -0400 Subject: [PATCH 075/258] Variable renaming --- .../bukkit/listeners/PlayerEvents.java | 131 +++++++++--------- .../bukkit/object/BukkitPlayer.java | 4 +- .../bukkit/util/BukkitChunkManager.java | 27 ++-- .../plotsquared/plot/commands/Alias.java | 4 +- .../plotsquared/plot/commands/Claim.java | 11 +- .../plotsquared/plot/commands/Comment.java | 6 +- .../plotsquared/plot/commands/Copy.java | 4 +- .../plot/commands/CreateRoadSchematic.java | 6 +- .../plot/commands/DebugClaimTest.java | 6 +- .../plotsquared/plot/commands/DebugExec.java | 6 +- .../plot/commands/DebugRoadRegen.java | 9 +- .../plotsquared/plot/commands/Delete.java | 21 ++- .../plotsquared/plot/commands/Deny.java | 4 +- .../plotsquared/plot/commands/Done.java | 4 +- .../plotsquared/plot/commands/FlagCmd.java | 4 +- .../plot/commands/MainCommand.java | 8 +- .../plotsquared/plot/commands/Merge.java | 8 +- .../plotsquared/plot/commands/Move.java | 4 +- .../plotsquared/plot/commands/Music.java | 10 +- .../plotsquared/plot/commands/SetCommand.java | 4 +- .../plotsquared/plot/commands/SetHome.java | 9 +- .../plotsquared/plot/commands/Swap.java | 4 +- .../plot/listener/PlotListener.java | 12 +- .../plot/object/ConsolePlayer.java | 13 +- .../plotsquared/plot/object/Plot.java | 52 +++---- .../plotsquared/plot/object/PlotCluster.java | 4 +- .../plotsquared/plot/object/PlotPlayer.java | 25 ++-- .../util/block/ScopedLocalBlockQueue.java | 14 +- 28 files changed, 215 insertions(+), 199 deletions(-) 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 5334cafb8..c7c2edf5d 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 @@ -85,10 +85,10 @@ import java.util.regex.Pattern; int distance = Bukkit.getViewDistance() * 16; for (Entry entry : UUIDHandler.getPlayers().entrySet()) { PlotPlayer player = entry.getValue(); - Location loc = player.getLocation(); - if (loc.getWorld().equals(world)) { - if (16 * Math.abs(loc.getX() - x) / 16 > distance - || 16 * Math.abs(loc.getZ() - z) / 16 > distance) { + Location location = player.getLocation(); + if (location.getWorld().equals(world)) { + if (16 * Math.abs(location.getX() - x) / 16 > distance + || 16 * Math.abs(location.getZ() - z) / 16 > distance) { continue; } ((BukkitPlayer) player).player.sendBlockChange(bloc, data); @@ -314,12 +314,12 @@ import java.util.regex.Pattern; case POWERED_RAIL: return; default:*/ - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = loc.getOwnedPlot(); + Plot plot = location.getOwnedPlot(); if (plot == null) { return; } @@ -369,12 +369,11 @@ import java.util.regex.Pattern; switch (event.getChangedType()) { case COMPARATOR: { Block block = event.getBlock(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); - if (area == null) { + Location location = BukkitUtil.getLocation(block.getLocation()); + if (location.isPlotArea()) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = location.getOwnedPlotAbs(); if (plot == null) { return; } @@ -391,12 +390,12 @@ import java.util.regex.Pattern; case TURTLE_HELMET: case TURTLE_SPAWN_EGG: { Block block = event.getBlock(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location); if (plot == null) { return; } @@ -413,30 +412,30 @@ import java.util.regex.Pattern; case STICKY_PISTON: org.bukkit.block.data.Directional piston = (org.bukkit.block.data.Directional) block.getBlockData(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location); if (plot == null) { return; } switch (piston.getFacing()) { case EAST: - loc.setX(loc.getX() + 1); + location.setX(location.getX() + 1); break; case SOUTH: - loc.setX(loc.getX() - 1); + location.setX(location.getX() - 1); break; case WEST: - loc.setZ(loc.getZ() + 1); + location.setZ(location.getZ() + 1); break; case NORTH: - loc.setZ(loc.getZ() - 1); + location.setZ(location.getZ() - 1); break; } - Plot newPlot = area.getOwnedPlotAbs(loc); + Plot newPlot = area.getOwnedPlotAbs(location); if (!plot.equals(newPlot)) { event.setCancelled(true); return; @@ -470,15 +469,15 @@ import java.util.regex.Pattern; @EventHandler public boolean onProjectileHit(ProjectileHitEvent event) { Projectile entity = event.getEntity(); - Location loc = BukkitUtil.getLocation(entity); - if (!PlotSquared.get().hasPlotArea(loc.getWorld())) { + Location location = BukkitUtil.getLocation(entity); + if (!PlotSquared.get().hasPlotArea(location.getWorld())) { return true; } - PlotArea area = loc.getPlotArea(); + PlotArea area = location.getPlotArea(); if (area == null) { return true; } - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); ProjectileSource shooter = entity.getShooter(); if (shooter instanceof Player) { PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter); @@ -523,22 +522,22 @@ import java.util.regex.Pattern; return; } Player player = event.getPlayer(); - PlotPlayer pp = BukkitUtil.getPlayer(player); - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); + Location location = plotPlayer.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return; } String[] parts = msg.split(" "); - Plot plot = pp.getCurrentPlot(); + Plot plot = plotPlayer.getCurrentPlot(); // Check WorldEdit switch (parts[0].toLowerCase()) { case "up": case "/up": case "worldedit:up": case "worldedit:/up": - if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions - .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { + if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { event.setCancelled(true); return; } @@ -548,7 +547,7 @@ import java.util.regex.Pattern; } Optional> flag = plot.getFlag(Flags.BLOCKED_CMDS); if (flag.isPresent() && !Permissions - .hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { List blocked_cmds = flag.get(); String part = parts[0]; if (parts[0].contains(":")) { @@ -592,13 +591,13 @@ import java.util.regex.Pattern; } if (pattern.matcher(msg).matches()) { String perm; - if (plot.isAdded(pp.getUUID())) { + if (plot.isAdded(plotPlayer.getUUID())) { perm = "plots.admin.command.blocked-cmds.shared"; } else { perm = "plots.admin.command.blocked-cmds.other"; } - if (!Permissions.hasPermission(pp, perm)) { - MainUtil.sendMessage(pp, Captions.COMMAND_BLOCKED); + if (!Permissions.hasPermission(plotPlayer, perm)) { + MainUtil.sendMessage(plotPlayer, Captions.COMMAND_BLOCKED); event.setCancelled(true); } return; @@ -619,10 +618,10 @@ import java.util.regex.Pattern; UUID uuid = pp.getUUID(); UUIDHandler.add(sw, uuid); - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = pp.getLocation(); + PlotArea area = location.getPlotArea(); if (area != null) { - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); if (plot != null) { plotEntry(pp, plot); } @@ -688,27 +687,27 @@ import java.util.regex.Pattern; org.bukkit.Location to = event.getTo(); if (to != null) { Player player = event.getPlayer(); - PlotPlayer pp = PlotPlayer.wrap(player); - Location loc = BukkitUtil.getLocation(to); - PlotArea area = loc.getPlotArea(); + PlotPlayer plotPlayer = PlotPlayer.wrap(player); + Location location = BukkitUtil.getLocation(to); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); if (plot != null) { - final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot); + final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); if (!result) { - MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_ENTRY_DENIED); event.setCancelled(true); if (lastLoc != null) { - pp.setMeta(PlotPlayer.META_LOCATION, lastLoc); + plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc); } if (lastPlot != null) { - pp.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); + plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); } } else { - plotEntry(pp, plot); + plotEntry(plotPlayer, plot); } } } @@ -809,14 +808,14 @@ import java.util.regex.Pattern; // Cancel teleport TaskManager.TELEPORT_QUEUE.remove(pp.getName()); // Set last location - Location loc = BukkitUtil.getLocation(to); - pp.setMeta(PlotPlayer.META_LOCATION, loc); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(to); + pp.setMeta(PlotPlayer.META_LOCATION, location); + PlotArea area = location.getPlotArea(); if (area == null) { pp.deleteMeta(PlotPlayer.META_LAST_PLOT); return; } - Plot now = area.getPlot(loc); + Plot now = area.getPlot(location); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); if (now == null) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp @@ -869,14 +868,14 @@ import java.util.regex.Pattern; // Cancel teleport TaskManager.TELEPORT_QUEUE.remove(pp.getName()); // Set last location - Location loc = BukkitUtil.getLocation(to); - pp.setMeta(PlotPlayer.META_LOCATION, loc); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(to); + pp.setMeta(PlotPlayer.META_LOCATION, location); + PlotArea area = location.getPlotArea(); if (area == null) { pp.deleteMeta(PlotPlayer.META_LAST_PLOT); return; } - Plot now = area.getPlot(loc); + Plot now = area.getPlot(location); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); if (now == null) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp @@ -1123,10 +1122,10 @@ import java.util.regex.Pattern; if (Settings.Enabled_Components.PERMISSION_CACHE) { pp.deleteMeta("perm"); } - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); - if (loc.isPlotArea()) { - plot = loc.getPlot(); + Location location = pp.getLocation(); + PlotArea area = location.getPlotArea(); + if (location.isPlotArea()) { + plot = location.getPlot(); if (plot != null) { plotEntry(pp, plot); } @@ -2269,17 +2268,17 @@ import java.util.regex.Pattern; Entity ignitingEntity = event.getIgnitingEntity(); Block block = event.getBlock(); BlockIgniteEvent.IgniteCause igniteCause = event.getCause(); - Location loc; + Location location1; if (block != null) { - loc = BukkitUtil.getLocation(block.getLocation()); + location1 = BukkitUtil.getLocation(block.getLocation()); } else if (ignitingEntity != null) { - loc = BukkitUtil.getLocation(ignitingEntity); + location1 = BukkitUtil.getLocation(ignitingEntity); } else if (player != null) { - loc = BukkitUtil.getLocation(player); + location1 = BukkitUtil.getLocation(player); } else { return; } - PlotArea area = loc.getPlotArea(); + PlotArea area = location1.getPlotArea(); if (area == null) { return; } @@ -2288,7 +2287,7 @@ import java.util.regex.Pattern; return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location1); if (player != null) { PlotPlayer pp = BukkitUtil.getPlayer(player); if (plot == null) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index d16038215..e9a000943 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -72,8 +72,8 @@ public class BukkitPlayer extends PlotPlayer { return this.player.getLastPlayed(); } - @Override public boolean canTeleport(@NotNull final Location loc) { - final org.bukkit.Location to = BukkitUtil.getLocation(loc); + @Override public boolean canTeleport(@NotNull final Location location) { + final org.bukkit.Location to = BukkitUtil.getLocation(location); final org.bukkit.Location from = player.getLocation(); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); callEvent(event); 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 a40fb252b..9049df000 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 @@ -352,8 +352,8 @@ public class BukkitChunkManager extends ChunkManager { int bz = min.getZ(); for (int x1 = 0; x1 < 16; x1++) { for (int z1 = 0; z1 < 16; z1++) { - PlotLoc loc = new PlotLoc(bx + x1, bz + z1); - BaseBlock[] ids = map.allBlocks.get(loc); + PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1); + BaseBlock[] ids = map.allBlocks.get(plotLoc); if (ids != null) { for (int y = 0; y < Math.min(128, ids.length); y++) { BaseBlock id = ids[y]; @@ -388,17 +388,18 @@ public class BukkitChunkManager extends ChunkManager { return true; } - @Override public boolean loadChunk(String world, ChunkLoc loc, boolean force) { - return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force); + @Override public boolean loadChunk(String world, ChunkLoc chunkLoc, boolean force) { + return BukkitUtil.getWorld(world).getChunkAt(chunkLoc.x, chunkLoc.z).load(force); } @Override - public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, + public void unloadChunk(final String world, final ChunkLoc chunkLoc, final boolean save, final boolean safe) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) { - TaskManager.runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save)); + TaskManager.runTask( + () -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save)); } else { - BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save); + BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save); } } @@ -615,9 +616,9 @@ public class BukkitChunkManager extends ChunkManager { void saveEntitiesOut(Chunk chunk, RegionWrapper region) { for (Entity entity : chunk.getEntities()) { - Location loc = BukkitUtil.getLocation(entity); - int x = loc.getX(); - int z = loc.getZ(); + Location location = BukkitUtil.getLocation(entity); + int x = location.getX(); + int z = location.getZ(); if (isIn(region, x, z)) { continue; } @@ -637,9 +638,9 @@ public class BukkitChunkManager extends ChunkManager { void saveEntitiesIn(Chunk chunk, RegionWrapper region, int offsetX, int offsetZ, boolean delete) { for (Entity entity : chunk.getEntities()) { - Location loc = BukkitUtil.getLocation(entity); - int x = loc.getX(); - int z = loc.getZ(); + Location location = BukkitUtil.getLocation(entity); + int x = location.getX(); + int z = location.getZ(); if (!isIn(region, x, z)) { continue; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 7f335cfa5..215fefc70 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -25,8 +25,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; return false; } - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } 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 b06e0b57b..94a82fdd8 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 @@ -20,13 +20,14 @@ public class Claim extends SubCommand { if (args.length >= 1) { schematic = args[0]; } - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return sendMessage(player, Captions.NOT_IN_PLOT); } - int currentPlots = - Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); + int currentPlots = Settings.Limit.GLOBAL ? + player.getPlotCount() : + player.getPlotCount(location.getWorld()); int grants = 0; if (currentPlots >= player.getAllowedPlots()) { if (player.hasPersistentMeta("grantedPlots")) { @@ -89,7 +90,7 @@ public class Claim extends SubCommand { @Override public void run(Object value) { plot.claim(player, true, finalSchematic, false); if (area.AUTO_MERGE) { - plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true); + plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(), true); } } }), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED)); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java index 048047bb6..171a5bfe5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java @@ -32,7 +32,7 @@ public class Comment extends SubCommand { StringMan.join(CommentManager.inboxes.keySet(), "|")); return false; } - Location loc = player.getLocation(); + Location location = player.getLocation(); PlotId id; try { id = PlotId.fromString(args[1]); @@ -44,7 +44,7 @@ public class Comment extends SubCommand { int index; if (plot == null) { index = 1; - plot = loc.getPlotAbs(); + plot = location.getPlotAbs(); } else { if (args.length < 4) { sendMessage(player, Captions.COMMENT_SYNTAX, @@ -59,7 +59,7 @@ public class Comment extends SubCommand { } String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " "); PlotComment comment = - new PlotComment(loc.getWorld(), id, message, player.getName(), inbox.toString(), + new PlotComment(location.getWorld(), id, message, player.getName(), inbox.toString(), System.currentTimeMillis()); boolean result = inbox.addComment(plot, comment); if (!result) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index 2a34fdbf5..de77513bc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; requiredType = RequiredType.NONE) public class Copy extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java index 26962781c..bd6088ea8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java @@ -16,12 +16,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return sendMessage(player, Captions.NOT_IN_PLOT); } - if (!(loc.getPlotArea() instanceof HybridPlotWorld)) { + if (!(location.getPlotArea() instanceof HybridPlotWorld)) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } HybridUtils.manager.setupRoadSchematic(plot); 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 41a5eda80..6dbcdfb57 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 @@ -55,13 +55,13 @@ public class DebugClaimTest extends SubCommand { MainUtil.sendMessage(player, " - &cDB Already contains: " + plot.getId()); continue; } - Location loc = manager.getSignLoc(plot); - ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); + Location location = manager.getSignLoc(plot); + ChunkLoc chunk = new ChunkLoc(location.getX() >> 4, location.getZ() >> 4); boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false); if (!result) { continue; } - String[] lines = WorldUtil.IMP.getSign(loc); + String[] lines = WorldUtil.IMP.getSign(location); if (lines != null) { String line = lines[2]; if (line != null && line.length() > 2) { 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 7e8e9cf34..841c6fc8c 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 @@ -369,17 +369,17 @@ import java.util.concurrent.CompletableFuture; Command cmd = MainCommand.getInstance().getCommand(args[3]); String[] params = Arrays.copyOfRange(args, 4, args.length); if ("true".equals(args[1])) { - Location loc = player.getMeta(PlotPlayer.META_LOCATION); + Location location = player.getMeta(PlotPlayer.META_LOCATION); Plot plot = player.getMeta(PlotPlayer.META_LAST_PLOT); for (Plot current : PlotSquared.get().getBasePlots()) { player.setMeta(PlotPlayer.META_LOCATION, current.getBottomAbs()); player.setMeta(PlotPlayer.META_LAST_PLOT, current); cmd.execute(player, params, null, null); } - if (loc == null) { + if (location == null) { player.deleteMeta(PlotPlayer.META_LOCATION); } else { - player.setMeta(PlotPlayer.META_LOCATION, loc); + player.setMeta(PlotPlayer.META_LOCATION, location); } if (plot == null) { player.deleteMeta(PlotPlayer.META_LAST_PLOT); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index d6029186f..9cc80adb4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -3,7 +3,6 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; -import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -43,8 +42,8 @@ public class DebugRoadRegen extends SubCommand { } public boolean regenPlot(PlotPlayer player) { - Location loc = player.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = player.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } @@ -82,8 +81,8 @@ public class DebugRoadRegen extends SubCommand { return false; } - Location loc = player.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = player.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java index 16f10b7b0..d3b8c2674 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java @@ -3,8 +3,16 @@ package com.github.intellectualsites.plotsquared.plot.commands; 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.util.*; +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.util.CmdConfirm; +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; @CommandDeclaration(command = "delete", permission = "plots.delete", @@ -16,8 +24,8 @@ import com.github.intellectualsites.plotsquared.plot.util.*; // The syntax also works with any command: /plot @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } @@ -30,8 +38,9 @@ import com.github.intellectualsites.plotsquared.plot.util.*; } final PlotArea plotArea = plot.getArea(); final java.util.Set plots = plot.getConnectedPlots(); - final int currentPlots = - Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); + final int currentPlots = Settings.Limit.GLOBAL ? + player.getPlotCount() : + player.getPlotCount(location.getWorld()); Runnable run = new Runnable() { @Override public void run() { if (plot.getRunning() > 0) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 7bb0ab34a..6650361a5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -97,8 +97,8 @@ import java.util.UUID; if (player.getGameMode() == PlotGameMode.SPECTATOR) { player.stopSpectating(); } - Location loc = player.getLocation(); - Location spawn = WorldUtil.IMP.getSpawn(loc.getWorld()); + Location location = player.getLocation(); + Location spawn = WorldUtil.IMP.getSpawn(location.getWorld()); MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED); if (plot.equals(spawn.getPlot())) { Location newSpawn = diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java index 8ef920565..055cfabd9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java @@ -19,8 +19,8 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; requiredType = RequiredType.NONE) public class Done extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if ((plot == null) || !plot.hasOwner()) { return !sendMessage(player, Captions.NOT_IN_PLOT); } 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 470d8d605..c9bba547a 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 @@ -91,8 +91,8 @@ import java.util.*; "/plot flag "); return false; } - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return false; 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 31e599976..d4a1592c8 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 @@ -193,7 +193,7 @@ public class MainCommand extends Command { // Clear perm caching // player.deleteMeta("perm"); // Optional command scope // - Location loc = null; + Location location = null; Plot plot = null; boolean tp = false; if (args.length >= 2) { @@ -205,7 +205,7 @@ public class MainCommand extends Command { Location newLoc = newPlot.getCenter(); if (player.canTeleport(newLoc)) { // Save meta - loc = player.getMeta(PlotPlayer.META_LOCATION); + location = player.getMeta(PlotPlayer.META_LOCATION); plot = player.getMeta(PlotPlayer.META_LAST_PLOT); tp = true; // Set loc @@ -262,10 +262,10 @@ public class MainCommand extends Command { } // Reset command scope // if (tp && !(player instanceof ConsolePlayer)) { - if (loc == null) { + if (location == null) { player.deleteMeta(PlotPlayer.META_LOCATION); } else { - player.setMeta(PlotPlayer.META_LOCATION, loc); + player.setMeta(PlotPlayer.META_LOCATION, location); } if (plot == null) { player.deleteMeta(PlotPlayer.META_LAST_PLOT); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index bbd0979cd..dc70cefe0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -52,8 +52,8 @@ public class Merge extends SubCommand { } @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocationFull(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocationFull(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } @@ -135,8 +135,8 @@ public class Merge extends SubCommand { if (direction == Direction.ALL) { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); - MainUtil.sendMessage(player, - Captions.DIRECTION.getTranslated().replaceAll("%dir%", direction(loc.getYaw()))); + MainUtil.sendMessage(player, Captions.DIRECTION.getTranslated() + .replaceAll("%dir%", direction(location.getYaw()))); return false; } final boolean terrain; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 0e6d78247..5840d51c0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -15,8 +15,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; requiredType = RequiredType.PLAYER) public class Move extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java index e773879ae..a763a3c51 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.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.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; -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.PlotInventory; +import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import java.util.Arrays; import java.util.Collection; @@ -20,8 +24,8 @@ import java.util.Locale; "music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait"); @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index bc64f0244..8b746c624 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -11,8 +11,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; public abstract class SetCommand extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java index af0968a92..fa828303f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java @@ -25,11 +25,10 @@ public class SetHome extends SetCommand { } case "": Plot base = plot.getBasePlot(false); - Location bot = base.getBottomAbs(); - Location loc = player.getLocationFull(); - BlockLoc rel = - new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(), - loc.getYaw(), loc.getPitch()); + Location bottom = base.getBottomAbs(); + Location location = player.getLocationFull(); + BlockLoc rel = new BlockLoc(location.getX() - bottom.getX(), location.getY(), + location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch()); base.setHome(rel); return MainUtil.sendMessage(player, Captions.POSITION_SET); default: diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java index 9f7f0b145..b3ec2ff05 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; public class Swap extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } 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 6d738b758..4911f9f47 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 @@ -138,18 +138,18 @@ public class PlotListener { final PlotBlock block = PlotBlock.get(id); final String rawId = block.getRawId().toString(); if (rawId.contains("disc") || PlotBlock.isEverything(block) || block.isAir()) { - Location loc = player.getLocation(); - Location lastLoc = player.getMeta("music"); - if (lastLoc != null) { - player.playMusic(lastLoc, PlotBlock.get("air")); + Location location = player.getLocation(); + Location lastLocation = player.getMeta("music"); + if (lastLocation != null) { + player.playMusic(lastLocation, PlotBlock.get("air")); if (PlotBlock.isEverything(block) || block.isAir()) { player.deleteMeta("music"); } } if (!(PlotBlock.isEverything(block) || block.isAir())) { try { - player.setMeta("music", loc); - player.playMusic(loc, block); + player.setMeta("music", location); + player.playMusic(location, block); } catch (Exception ignored) { } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 9f4677f4f..a8fbffad6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import java.util.UUID; @@ -15,15 +16,15 @@ public class ConsolePlayer extends PlotPlayer { private ConsolePlayer() { PlotArea area = PlotSquared.get().getFirstPlotArea(); - Location loc; + Location location; if (area != null) { RegionWrapper region = area.getRegion(); - loc = new Location(area.worldname, region.minX + region.maxX / 2, 0, + location = new Location(area.worldname, region.minX + region.maxX / 2, 0, region.minZ + region.maxZ / 2); } else { - loc = new Location("world", 0, 0, 0); + location = new Location("world", 0, 0, 0); } - setMeta("location", loc); + setMeta("location", location); } public static ConsolePlayer getConsole() { @@ -34,7 +35,7 @@ public class ConsolePlayer extends PlotPlayer { return instance; } - @Override public boolean canTeleport(@Nonnull Location loc) { + @Override public boolean canTeleport(@NotNull Location location) { return true; } @@ -50,7 +51,7 @@ public class ConsolePlayer extends PlotPlayer { return getLocation(); } - @Nonnull @Override public UUID getUUID() { + @NotNull @Override public UUID getUUID() { return DBFunc.EVERYONE; } 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 f130041c6..824a812a7 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 @@ -1212,18 +1212,18 @@ public class Plot { Location[] corners = getCorners(); Location top = corners[0]; Location bot = corners[1]; - Location loc = new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()), + Location location = + new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()), MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ())); if (!isLoaded()) { - return loc; + return location; } - int y = - isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), loc.getX(), loc.getZ()) : 62; + int y = WorldUtil.IMP.getHighestBlock(getWorldName(), location.getX(), location.getZ()); if (area.ALLOW_SIGNS) { y = Math.max(y, getManager().getSignLoc(this).getY()); } - loc.setY(1 + y); - return loc; + location.setY(1 + y); + return location; } public Location getSide() { @@ -1248,18 +1248,19 @@ public class Plot { if (home == null || home.x == 0 && home.z == 0) { return this.getDefaultHome(true); } else { - Location bot = this.getBottomAbs(); - Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, - bot.getZ() + home.z, home.yaw, home.pitch); + 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); if (!isLoaded()) { - return loc; + return location; } - if (!WorldUtil.IMP.getBlock(loc).isAir()) { - loc.setY(Math.max( - 1 + WorldUtil.IMP.getHighestBlock(this.getWorldName(), loc.getX(), loc.getZ()), - bot.getY())); + if (!WorldUtil.IMP.getBlock(location).isAir()) { + location.setY(Math.max(1 + WorldUtil.IMP + .getHighestBlock(this.getWorldName(), location.getX(), location.getZ()), + bottom.getY())); } - return loc; + return location; } } @@ -1426,9 +1427,9 @@ public class Plot { if (!this.area.ALLOW_SIGNS) { return; } - Location loc = manager.getSignLoc(this); + Location location = manager.getSignLoc(this); LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); - queue.setBlock(loc.getX(), loc.getY(), loc.getZ(), PlotBlock.get("air")); + queue.setBlock(location.getX(), location.getY(), location.getZ(), PlotBlock.get("air")); queue.flush(); } @@ -1568,8 +1569,8 @@ public class Plot { * @return the name of the biome */ public String getBiome() { - Location loc = this.getCenter(); - return WorldUtil.IMP.getBiome(loc.getWorld(), loc.getX(), loc.getZ()); + Location location = this.getCenter(); + return WorldUtil.IMP.getBiome(location.getWorld(), location.getX(), location.getZ()); } //TODO Better documentation needed. @@ -1589,9 +1590,9 @@ public class Plot { * Returns the bottom location for the plot. */ public Location getBottomAbs() { - Location loc = getManager().getPlotBottomLocAbs(this.id); - loc.setWorld(getWorldName()); - return loc; + Location location = getManager().getPlotBottomLocAbs(this.id); + location.setWorld(getWorldName()); + return location; } /** @@ -2131,11 +2132,12 @@ public class Plot { return null; } try { - final Location loc = this.getManager().getSignLoc(this); + final Location location = this.getManager().getSignLoc(this); String[] lines = TaskManager.IMP.sync(new RunnableVal() { @Override public void run(String[] value) { - ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false); - this.value = WorldUtil.IMP.getSign(loc); + ChunkManager.manager + .loadChunk(location.getWorld(), location.getChunkLoc(), false); + this.value = WorldUtil.IMP.getSign(location); } }); if (lines == null) { 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 0b9427839..feaf64ddb 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 @@ -132,8 +132,8 @@ public class PlotCluster { toReturn = center.getHome(); if (toReturn.getY() == 0) { PlotManager manager = this.area.getPlotManager(); - Location loc = manager.getSignLoc(center); - toReturn.setY(loc.getY()); + Location location = manager.getSignLoc(center); + toReturn.setY(location.getY()); } } else { toReturn = getClusterBottom().add(home.x, home.y, home.z); 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 8981b2923..4da8cae90 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 @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.google.common.base.Preconditions; import lombok.NonNull; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import java.nio.ByteBuffer; @@ -335,14 +336,14 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @return UUID */ - @Override @Nonnull public abstract UUID getUUID(); + @Override @NotNull public abstract UUID getUUID(); - public boolean canTeleport(@Nonnull final Location loc) { - Preconditions.checkNotNull(loc, "Specified location cannot be null"); + public boolean canTeleport(@NotNull final Location location) { + Preconditions.checkNotNull(location, "Specified location cannot be null"); final Location current = getLocationFull(); - teleport(loc); + teleport(location); boolean result = true; - if (!getLocation().equals(loc)) { + if (!getLocation().equals(location)) { result = false; } teleport(current); @@ -493,10 +494,10 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { ByteBuffer buffer = ByteBuffer.allocate(13); buffer.putShort((short) x); buffer.putShort((short) z); - Location loc = getLocation(); - buffer.putInt(loc.getX()); - buffer.put((byte) loc.getY()); - buffer.putInt(loc.getZ()); + Location location = getLocation(); + buffer.putInt(location.getX()); + buffer.put((byte) location.getY()); + buffer.putInt(location.getZ()); setPersistentMeta("quitLoc", buffer.array()); } else if (hasPersistentMeta("quitLoc")) { removePersistentMeta("quitLoc"); @@ -596,11 +597,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { return; } - final Location loc = new Location(plot.getWorldName(), x, y, z); + final Location location = new Location(plot.getWorldName(), x, y, z); if (plot.isLoaded()) { TaskManager.runTask(() -> { if (getMeta("teleportOnLogin", true)) { - teleport(loc); + teleport(location); sendMessage( Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX + "," + plotZ + ")"); @@ -612,7 +613,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { TaskManager.runTask(() -> { if (getMeta("teleportOnLogin", true)) { if (plot.isLoaded()) { - teleport(loc); + teleport(location); sendMessage(Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc-unloaded) (" + plotX + "," + plotZ + ")"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java index c9065f65e..7e41887ed 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java @@ -80,22 +80,22 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { int bx = minX; int bz = minZ; PlotArea area = PlotSquared.get().getPlotArea(getWorld(), null); - Location loc = new Location(getWorld(), bx, 0, bz); + Location location = new Location(getWorld(), bx, 0, bz); if (area != null) { PlotManager manager = area.getPlotManager(); for (int x = 0; x < 16; x++) { - loc.setX(bx + x); + location.setX(bx + x); for (int z = 0; z < 16; z++) { - loc.setZ(bz + z); - task.run(area.getPlotAbs(loc), x, z); + location.setZ(bz + z); + task.run(area.getPlotAbs(location), x, z); } } } else { for (int x = 0; x < 16; x++) { - loc.setX(bx + x); + location.setX(bx + x); for (int z = 0; z < 16; z++) { - loc.setZ(bz + z); - task.run(loc.getPlotAbs(), x, z); + location.setZ(bz + z); + task.run(location.getPlotAbs(), x, z); } } } From 403916748c663e81141b4ef3d5a64b93e96c25be Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 13 Aug 2019 22:10:48 -0400 Subject: [PATCH 076/258] Variable renaming --- .../bukkit/listeners/PlayerEvents.java | 131 +++++++++--------- .../bukkit/object/BukkitPlayer.java | 4 +- .../bukkit/util/BukkitChunkManager.java | 27 ++-- .../plotsquared/plot/commands/Alias.java | 4 +- .../plotsquared/plot/commands/Auto.java | 10 +- .../plotsquared/plot/commands/Claim.java | 11 +- .../plotsquared/plot/commands/Comment.java | 6 +- .../plotsquared/plot/commands/Copy.java | 4 +- .../plot/commands/CreateRoadSchematic.java | 6 +- .../plot/commands/DebugClaimTest.java | 6 +- .../plotsquared/plot/commands/DebugExec.java | 6 +- .../plot/commands/DebugRoadRegen.java | 9 +- .../plotsquared/plot/commands/Delete.java | 21 ++- .../plotsquared/plot/commands/Deny.java | 4 +- .../plotsquared/plot/commands/Done.java | 4 +- .../plotsquared/plot/commands/FlagCmd.java | 4 +- .../plot/commands/MainCommand.java | 8 +- .../plotsquared/plot/commands/Merge.java | 8 +- .../plotsquared/plot/commands/Move.java | 4 +- .../plotsquared/plot/commands/Music.java | 10 +- .../plotsquared/plot/commands/SetCommand.java | 4 +- .../plotsquared/plot/commands/SetHome.java | 9 +- .../plotsquared/plot/commands/Swap.java | 4 +- .../plot/listener/PlotListener.java | 12 +- .../plot/object/ConsolePlayer.java | 13 +- .../plotsquared/plot/object/Plot.java | 52 +++---- .../plotsquared/plot/object/PlotCluster.java | 4 +- .../plotsquared/plot/object/PlotPlayer.java | 25 ++-- .../util/block/ScopedLocalBlockQueue.java | 14 +- 29 files changed, 218 insertions(+), 206 deletions(-) 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 5334cafb8..c7c2edf5d 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 @@ -85,10 +85,10 @@ import java.util.regex.Pattern; int distance = Bukkit.getViewDistance() * 16; for (Entry entry : UUIDHandler.getPlayers().entrySet()) { PlotPlayer player = entry.getValue(); - Location loc = player.getLocation(); - if (loc.getWorld().equals(world)) { - if (16 * Math.abs(loc.getX() - x) / 16 > distance - || 16 * Math.abs(loc.getZ() - z) / 16 > distance) { + Location location = player.getLocation(); + if (location.getWorld().equals(world)) { + if (16 * Math.abs(location.getX() - x) / 16 > distance + || 16 * Math.abs(location.getZ() - z) / 16 > distance) { continue; } ((BukkitPlayer) player).player.sendBlockChange(bloc, data); @@ -314,12 +314,12 @@ import java.util.regex.Pattern; case POWERED_RAIL: return; default:*/ - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = loc.getOwnedPlot(); + Plot plot = location.getOwnedPlot(); if (plot == null) { return; } @@ -369,12 +369,11 @@ import java.util.regex.Pattern; switch (event.getChangedType()) { case COMPARATOR: { Block block = event.getBlock(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); - if (area == null) { + Location location = BukkitUtil.getLocation(block.getLocation()); + if (location.isPlotArea()) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = location.getOwnedPlotAbs(); if (plot == null) { return; } @@ -391,12 +390,12 @@ import java.util.regex.Pattern; case TURTLE_HELMET: case TURTLE_SPAWN_EGG: { Block block = event.getBlock(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location); if (plot == null) { return; } @@ -413,30 +412,30 @@ import java.util.regex.Pattern; case STICKY_PISTON: org.bukkit.block.data.Directional piston = (org.bukkit.block.data.Directional) block.getBlockData(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location); if (plot == null) { return; } switch (piston.getFacing()) { case EAST: - loc.setX(loc.getX() + 1); + location.setX(location.getX() + 1); break; case SOUTH: - loc.setX(loc.getX() - 1); + location.setX(location.getX() - 1); break; case WEST: - loc.setZ(loc.getZ() + 1); + location.setZ(location.getZ() + 1); break; case NORTH: - loc.setZ(loc.getZ() - 1); + location.setZ(location.getZ() - 1); break; } - Plot newPlot = area.getOwnedPlotAbs(loc); + Plot newPlot = area.getOwnedPlotAbs(location); if (!plot.equals(newPlot)) { event.setCancelled(true); return; @@ -470,15 +469,15 @@ import java.util.regex.Pattern; @EventHandler public boolean onProjectileHit(ProjectileHitEvent event) { Projectile entity = event.getEntity(); - Location loc = BukkitUtil.getLocation(entity); - if (!PlotSquared.get().hasPlotArea(loc.getWorld())) { + Location location = BukkitUtil.getLocation(entity); + if (!PlotSquared.get().hasPlotArea(location.getWorld())) { return true; } - PlotArea area = loc.getPlotArea(); + PlotArea area = location.getPlotArea(); if (area == null) { return true; } - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); ProjectileSource shooter = entity.getShooter(); if (shooter instanceof Player) { PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter); @@ -523,22 +522,22 @@ import java.util.regex.Pattern; return; } Player player = event.getPlayer(); - PlotPlayer pp = BukkitUtil.getPlayer(player); - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); + Location location = plotPlayer.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return; } String[] parts = msg.split(" "); - Plot plot = pp.getCurrentPlot(); + Plot plot = plotPlayer.getCurrentPlot(); // Check WorldEdit switch (parts[0].toLowerCase()) { case "up": case "/up": case "worldedit:up": case "worldedit:/up": - if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions - .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { + if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { event.setCancelled(true); return; } @@ -548,7 +547,7 @@ import java.util.regex.Pattern; } Optional> flag = plot.getFlag(Flags.BLOCKED_CMDS); if (flag.isPresent() && !Permissions - .hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { List blocked_cmds = flag.get(); String part = parts[0]; if (parts[0].contains(":")) { @@ -592,13 +591,13 @@ import java.util.regex.Pattern; } if (pattern.matcher(msg).matches()) { String perm; - if (plot.isAdded(pp.getUUID())) { + if (plot.isAdded(plotPlayer.getUUID())) { perm = "plots.admin.command.blocked-cmds.shared"; } else { perm = "plots.admin.command.blocked-cmds.other"; } - if (!Permissions.hasPermission(pp, perm)) { - MainUtil.sendMessage(pp, Captions.COMMAND_BLOCKED); + if (!Permissions.hasPermission(plotPlayer, perm)) { + MainUtil.sendMessage(plotPlayer, Captions.COMMAND_BLOCKED); event.setCancelled(true); } return; @@ -619,10 +618,10 @@ import java.util.regex.Pattern; UUID uuid = pp.getUUID(); UUIDHandler.add(sw, uuid); - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = pp.getLocation(); + PlotArea area = location.getPlotArea(); if (area != null) { - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); if (plot != null) { plotEntry(pp, plot); } @@ -688,27 +687,27 @@ import java.util.regex.Pattern; org.bukkit.Location to = event.getTo(); if (to != null) { Player player = event.getPlayer(); - PlotPlayer pp = PlotPlayer.wrap(player); - Location loc = BukkitUtil.getLocation(to); - PlotArea area = loc.getPlotArea(); + PlotPlayer plotPlayer = PlotPlayer.wrap(player); + Location location = BukkitUtil.getLocation(to); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); if (plot != null) { - final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot); + final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); if (!result) { - MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_ENTRY_DENIED); event.setCancelled(true); if (lastLoc != null) { - pp.setMeta(PlotPlayer.META_LOCATION, lastLoc); + plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc); } if (lastPlot != null) { - pp.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); + plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); } } else { - plotEntry(pp, plot); + plotEntry(plotPlayer, plot); } } } @@ -809,14 +808,14 @@ import java.util.regex.Pattern; // Cancel teleport TaskManager.TELEPORT_QUEUE.remove(pp.getName()); // Set last location - Location loc = BukkitUtil.getLocation(to); - pp.setMeta(PlotPlayer.META_LOCATION, loc); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(to); + pp.setMeta(PlotPlayer.META_LOCATION, location); + PlotArea area = location.getPlotArea(); if (area == null) { pp.deleteMeta(PlotPlayer.META_LAST_PLOT); return; } - Plot now = area.getPlot(loc); + Plot now = area.getPlot(location); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); if (now == null) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp @@ -869,14 +868,14 @@ import java.util.regex.Pattern; // Cancel teleport TaskManager.TELEPORT_QUEUE.remove(pp.getName()); // Set last location - Location loc = BukkitUtil.getLocation(to); - pp.setMeta(PlotPlayer.META_LOCATION, loc); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(to); + pp.setMeta(PlotPlayer.META_LOCATION, location); + PlotArea area = location.getPlotArea(); if (area == null) { pp.deleteMeta(PlotPlayer.META_LAST_PLOT); return; } - Plot now = area.getPlot(loc); + Plot now = area.getPlot(location); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); if (now == null) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp @@ -1123,10 +1122,10 @@ import java.util.regex.Pattern; if (Settings.Enabled_Components.PERMISSION_CACHE) { pp.deleteMeta("perm"); } - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); - if (loc.isPlotArea()) { - plot = loc.getPlot(); + Location location = pp.getLocation(); + PlotArea area = location.getPlotArea(); + if (location.isPlotArea()) { + plot = location.getPlot(); if (plot != null) { plotEntry(pp, plot); } @@ -2269,17 +2268,17 @@ import java.util.regex.Pattern; Entity ignitingEntity = event.getIgnitingEntity(); Block block = event.getBlock(); BlockIgniteEvent.IgniteCause igniteCause = event.getCause(); - Location loc; + Location location1; if (block != null) { - loc = BukkitUtil.getLocation(block.getLocation()); + location1 = BukkitUtil.getLocation(block.getLocation()); } else if (ignitingEntity != null) { - loc = BukkitUtil.getLocation(ignitingEntity); + location1 = BukkitUtil.getLocation(ignitingEntity); } else if (player != null) { - loc = BukkitUtil.getLocation(player); + location1 = BukkitUtil.getLocation(player); } else { return; } - PlotArea area = loc.getPlotArea(); + PlotArea area = location1.getPlotArea(); if (area == null) { return; } @@ -2288,7 +2287,7 @@ import java.util.regex.Pattern; return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location1); if (player != null) { PlotPlayer pp = BukkitUtil.getPlayer(player); if (plot == null) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index d16038215..e9a000943 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -72,8 +72,8 @@ public class BukkitPlayer extends PlotPlayer { return this.player.getLastPlayed(); } - @Override public boolean canTeleport(@NotNull final Location loc) { - final org.bukkit.Location to = BukkitUtil.getLocation(loc); + @Override public boolean canTeleport(@NotNull final Location location) { + final org.bukkit.Location to = BukkitUtil.getLocation(location); final org.bukkit.Location from = player.getLocation(); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); callEvent(event); 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 a40fb252b..9049df000 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 @@ -352,8 +352,8 @@ public class BukkitChunkManager extends ChunkManager { int bz = min.getZ(); for (int x1 = 0; x1 < 16; x1++) { for (int z1 = 0; z1 < 16; z1++) { - PlotLoc loc = new PlotLoc(bx + x1, bz + z1); - BaseBlock[] ids = map.allBlocks.get(loc); + PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1); + BaseBlock[] ids = map.allBlocks.get(plotLoc); if (ids != null) { for (int y = 0; y < Math.min(128, ids.length); y++) { BaseBlock id = ids[y]; @@ -388,17 +388,18 @@ public class BukkitChunkManager extends ChunkManager { return true; } - @Override public boolean loadChunk(String world, ChunkLoc loc, boolean force) { - return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force); + @Override public boolean loadChunk(String world, ChunkLoc chunkLoc, boolean force) { + return BukkitUtil.getWorld(world).getChunkAt(chunkLoc.x, chunkLoc.z).load(force); } @Override - public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, + public void unloadChunk(final String world, final ChunkLoc chunkLoc, final boolean save, final boolean safe) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) { - TaskManager.runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save)); + TaskManager.runTask( + () -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save)); } else { - BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save); + BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save); } } @@ -615,9 +616,9 @@ public class BukkitChunkManager extends ChunkManager { void saveEntitiesOut(Chunk chunk, RegionWrapper region) { for (Entity entity : chunk.getEntities()) { - Location loc = BukkitUtil.getLocation(entity); - int x = loc.getX(); - int z = loc.getZ(); + Location location = BukkitUtil.getLocation(entity); + int x = location.getX(); + int z = location.getZ(); if (isIn(region, x, z)) { continue; } @@ -637,9 +638,9 @@ public class BukkitChunkManager extends ChunkManager { void saveEntitiesIn(Chunk chunk, RegionWrapper region, int offsetX, int offsetZ, boolean delete) { for (Entity entity : chunk.getEntities()) { - Location loc = BukkitUtil.getLocation(entity); - int x = loc.getX(); - int z = loc.getZ(); + Location location = BukkitUtil.getLocation(entity); + int x = location.getX(); + int z = location.getZ(); if (!isIn(region, x, z)) { continue; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 7f335cfa5..215fefc70 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -25,8 +25,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; return false; } - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } 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 c68d8ba30..ff5c02bd0 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,12 +5,7 @@ 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.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.object.*; import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -123,7 +118,8 @@ public class Auto extends SubCommand { } else if (checkAllowedPlots(player, area, allowedPlots, 1, 1)) { plot.claim(player, true, schematic, false); if (area.AUTO_MERGE) { - plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true); + plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(), + true); } } else { DBFunc.delete(plot); 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 b06e0b57b..94a82fdd8 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 @@ -20,13 +20,14 @@ public class Claim extends SubCommand { if (args.length >= 1) { schematic = args[0]; } - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return sendMessage(player, Captions.NOT_IN_PLOT); } - int currentPlots = - Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); + int currentPlots = Settings.Limit.GLOBAL ? + player.getPlotCount() : + player.getPlotCount(location.getWorld()); int grants = 0; if (currentPlots >= player.getAllowedPlots()) { if (player.hasPersistentMeta("grantedPlots")) { @@ -89,7 +90,7 @@ public class Claim extends SubCommand { @Override public void run(Object value) { plot.claim(player, true, finalSchematic, false); if (area.AUTO_MERGE) { - plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true); + plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(), true); } } }), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED)); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java index 048047bb6..171a5bfe5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java @@ -32,7 +32,7 @@ public class Comment extends SubCommand { StringMan.join(CommentManager.inboxes.keySet(), "|")); return false; } - Location loc = player.getLocation(); + Location location = player.getLocation(); PlotId id; try { id = PlotId.fromString(args[1]); @@ -44,7 +44,7 @@ public class Comment extends SubCommand { int index; if (plot == null) { index = 1; - plot = loc.getPlotAbs(); + plot = location.getPlotAbs(); } else { if (args.length < 4) { sendMessage(player, Captions.COMMENT_SYNTAX, @@ -59,7 +59,7 @@ public class Comment extends SubCommand { } String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " "); PlotComment comment = - new PlotComment(loc.getWorld(), id, message, player.getName(), inbox.toString(), + new PlotComment(location.getWorld(), id, message, player.getName(), inbox.toString(), System.currentTimeMillis()); boolean result = inbox.addComment(plot, comment); if (!result) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index 2a34fdbf5..de77513bc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; requiredType = RequiredType.NONE) public class Copy extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java index 26962781c..bd6088ea8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java @@ -16,12 +16,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return sendMessage(player, Captions.NOT_IN_PLOT); } - if (!(loc.getPlotArea() instanceof HybridPlotWorld)) { + if (!(location.getPlotArea() instanceof HybridPlotWorld)) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } HybridUtils.manager.setupRoadSchematic(plot); 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 41a5eda80..6dbcdfb57 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 @@ -55,13 +55,13 @@ public class DebugClaimTest extends SubCommand { MainUtil.sendMessage(player, " - &cDB Already contains: " + plot.getId()); continue; } - Location loc = manager.getSignLoc(plot); - ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); + Location location = manager.getSignLoc(plot); + ChunkLoc chunk = new ChunkLoc(location.getX() >> 4, location.getZ() >> 4); boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false); if (!result) { continue; } - String[] lines = WorldUtil.IMP.getSign(loc); + String[] lines = WorldUtil.IMP.getSign(location); if (lines != null) { String line = lines[2]; if (line != null && line.length() > 2) { 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 7e8e9cf34..841c6fc8c 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 @@ -369,17 +369,17 @@ import java.util.concurrent.CompletableFuture; Command cmd = MainCommand.getInstance().getCommand(args[3]); String[] params = Arrays.copyOfRange(args, 4, args.length); if ("true".equals(args[1])) { - Location loc = player.getMeta(PlotPlayer.META_LOCATION); + Location location = player.getMeta(PlotPlayer.META_LOCATION); Plot plot = player.getMeta(PlotPlayer.META_LAST_PLOT); for (Plot current : PlotSquared.get().getBasePlots()) { player.setMeta(PlotPlayer.META_LOCATION, current.getBottomAbs()); player.setMeta(PlotPlayer.META_LAST_PLOT, current); cmd.execute(player, params, null, null); } - if (loc == null) { + if (location == null) { player.deleteMeta(PlotPlayer.META_LOCATION); } else { - player.setMeta(PlotPlayer.META_LOCATION, loc); + player.setMeta(PlotPlayer.META_LOCATION, location); } if (plot == null) { player.deleteMeta(PlotPlayer.META_LAST_PLOT); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index d6029186f..9cc80adb4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -3,7 +3,6 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; -import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -43,8 +42,8 @@ public class DebugRoadRegen extends SubCommand { } public boolean regenPlot(PlotPlayer player) { - Location loc = player.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = player.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } @@ -82,8 +81,8 @@ public class DebugRoadRegen extends SubCommand { return false; } - Location loc = player.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = player.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java index 16f10b7b0..d3b8c2674 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java @@ -3,8 +3,16 @@ package com.github.intellectualsites.plotsquared.plot.commands; 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.util.*; +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.util.CmdConfirm; +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; @CommandDeclaration(command = "delete", permission = "plots.delete", @@ -16,8 +24,8 @@ import com.github.intellectualsites.plotsquared.plot.util.*; // The syntax also works with any command: /plot @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } @@ -30,8 +38,9 @@ import com.github.intellectualsites.plotsquared.plot.util.*; } final PlotArea plotArea = plot.getArea(); final java.util.Set plots = plot.getConnectedPlots(); - final int currentPlots = - Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); + final int currentPlots = Settings.Limit.GLOBAL ? + player.getPlotCount() : + player.getPlotCount(location.getWorld()); Runnable run = new Runnable() { @Override public void run() { if (plot.getRunning() > 0) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 7bb0ab34a..6650361a5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -97,8 +97,8 @@ import java.util.UUID; if (player.getGameMode() == PlotGameMode.SPECTATOR) { player.stopSpectating(); } - Location loc = player.getLocation(); - Location spawn = WorldUtil.IMP.getSpawn(loc.getWorld()); + Location location = player.getLocation(); + Location spawn = WorldUtil.IMP.getSpawn(location.getWorld()); MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED); if (plot.equals(spawn.getPlot())) { Location newSpawn = diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java index 8ef920565..055cfabd9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java @@ -19,8 +19,8 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; requiredType = RequiredType.NONE) public class Done extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if ((plot == null) || !plot.hasOwner()) { return !sendMessage(player, Captions.NOT_IN_PLOT); } 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 470d8d605..c9bba547a 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 @@ -91,8 +91,8 @@ import java.util.*; "/plot flag "); return false; } - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return false; 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 31e599976..d4a1592c8 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 @@ -193,7 +193,7 @@ public class MainCommand extends Command { // Clear perm caching // player.deleteMeta("perm"); // Optional command scope // - Location loc = null; + Location location = null; Plot plot = null; boolean tp = false; if (args.length >= 2) { @@ -205,7 +205,7 @@ public class MainCommand extends Command { Location newLoc = newPlot.getCenter(); if (player.canTeleport(newLoc)) { // Save meta - loc = player.getMeta(PlotPlayer.META_LOCATION); + location = player.getMeta(PlotPlayer.META_LOCATION); plot = player.getMeta(PlotPlayer.META_LAST_PLOT); tp = true; // Set loc @@ -262,10 +262,10 @@ public class MainCommand extends Command { } // Reset command scope // if (tp && !(player instanceof ConsolePlayer)) { - if (loc == null) { + if (location == null) { player.deleteMeta(PlotPlayer.META_LOCATION); } else { - player.setMeta(PlotPlayer.META_LOCATION, loc); + player.setMeta(PlotPlayer.META_LOCATION, location); } if (plot == null) { player.deleteMeta(PlotPlayer.META_LAST_PLOT); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index bbd0979cd..dc70cefe0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -52,8 +52,8 @@ public class Merge extends SubCommand { } @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocationFull(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocationFull(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } @@ -135,8 +135,8 @@ public class Merge extends SubCommand { if (direction == Direction.ALL) { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); - MainUtil.sendMessage(player, - Captions.DIRECTION.getTranslated().replaceAll("%dir%", direction(loc.getYaw()))); + MainUtil.sendMessage(player, Captions.DIRECTION.getTranslated() + .replaceAll("%dir%", direction(location.getYaw()))); return false; } final boolean terrain; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 0e6d78247..5840d51c0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -15,8 +15,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; requiredType = RequiredType.PLAYER) public class Move extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java index e773879ae..a763a3c51 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.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.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; -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.PlotInventory; +import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import java.util.Arrays; import java.util.Collection; @@ -20,8 +24,8 @@ import java.util.Locale; "music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait"); @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index bc64f0244..8b746c624 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -11,8 +11,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; public abstract class SetCommand extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java index af0968a92..fa828303f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java @@ -25,11 +25,10 @@ public class SetHome extends SetCommand { } case "": Plot base = plot.getBasePlot(false); - Location bot = base.getBottomAbs(); - Location loc = player.getLocationFull(); - BlockLoc rel = - new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(), - loc.getYaw(), loc.getPitch()); + Location bottom = base.getBottomAbs(); + Location location = player.getLocationFull(); + BlockLoc rel = new BlockLoc(location.getX() - bottom.getX(), location.getY(), + location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch()); base.setHome(rel); return MainUtil.sendMessage(player, Captions.POSITION_SET); default: diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java index 9f7f0b145..b3ec2ff05 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; public class Swap extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } 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 6d738b758..4911f9f47 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 @@ -138,18 +138,18 @@ public class PlotListener { final PlotBlock block = PlotBlock.get(id); final String rawId = block.getRawId().toString(); if (rawId.contains("disc") || PlotBlock.isEverything(block) || block.isAir()) { - Location loc = player.getLocation(); - Location lastLoc = player.getMeta("music"); - if (lastLoc != null) { - player.playMusic(lastLoc, PlotBlock.get("air")); + Location location = player.getLocation(); + Location lastLocation = player.getMeta("music"); + if (lastLocation != null) { + player.playMusic(lastLocation, PlotBlock.get("air")); if (PlotBlock.isEverything(block) || block.isAir()) { player.deleteMeta("music"); } } if (!(PlotBlock.isEverything(block) || block.isAir())) { try { - player.setMeta("music", loc); - player.playMusic(loc, block); + player.setMeta("music", location); + player.playMusic(location, block); } catch (Exception ignored) { } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 9f4677f4f..a8fbffad6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import java.util.UUID; @@ -15,15 +16,15 @@ public class ConsolePlayer extends PlotPlayer { private ConsolePlayer() { PlotArea area = PlotSquared.get().getFirstPlotArea(); - Location loc; + Location location; if (area != null) { RegionWrapper region = area.getRegion(); - loc = new Location(area.worldname, region.minX + region.maxX / 2, 0, + location = new Location(area.worldname, region.minX + region.maxX / 2, 0, region.minZ + region.maxZ / 2); } else { - loc = new Location("world", 0, 0, 0); + location = new Location("world", 0, 0, 0); } - setMeta("location", loc); + setMeta("location", location); } public static ConsolePlayer getConsole() { @@ -34,7 +35,7 @@ public class ConsolePlayer extends PlotPlayer { return instance; } - @Override public boolean canTeleport(@Nonnull Location loc) { + @Override public boolean canTeleport(@NotNull Location location) { return true; } @@ -50,7 +51,7 @@ public class ConsolePlayer extends PlotPlayer { return getLocation(); } - @Nonnull @Override public UUID getUUID() { + @NotNull @Override public UUID getUUID() { return DBFunc.EVERYONE; } 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 f130041c6..824a812a7 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 @@ -1212,18 +1212,18 @@ public class Plot { Location[] corners = getCorners(); Location top = corners[0]; Location bot = corners[1]; - Location loc = new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()), + Location location = + new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()), MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ())); if (!isLoaded()) { - return loc; + return location; } - int y = - isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), loc.getX(), loc.getZ()) : 62; + int y = WorldUtil.IMP.getHighestBlock(getWorldName(), location.getX(), location.getZ()); if (area.ALLOW_SIGNS) { y = Math.max(y, getManager().getSignLoc(this).getY()); } - loc.setY(1 + y); - return loc; + location.setY(1 + y); + return location; } public Location getSide() { @@ -1248,18 +1248,19 @@ public class Plot { if (home == null || home.x == 0 && home.z == 0) { return this.getDefaultHome(true); } else { - Location bot = this.getBottomAbs(); - Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, - bot.getZ() + home.z, home.yaw, home.pitch); + 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); if (!isLoaded()) { - return loc; + return location; } - if (!WorldUtil.IMP.getBlock(loc).isAir()) { - loc.setY(Math.max( - 1 + WorldUtil.IMP.getHighestBlock(this.getWorldName(), loc.getX(), loc.getZ()), - bot.getY())); + if (!WorldUtil.IMP.getBlock(location).isAir()) { + location.setY(Math.max(1 + WorldUtil.IMP + .getHighestBlock(this.getWorldName(), location.getX(), location.getZ()), + bottom.getY())); } - return loc; + return location; } } @@ -1426,9 +1427,9 @@ public class Plot { if (!this.area.ALLOW_SIGNS) { return; } - Location loc = manager.getSignLoc(this); + Location location = manager.getSignLoc(this); LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); - queue.setBlock(loc.getX(), loc.getY(), loc.getZ(), PlotBlock.get("air")); + queue.setBlock(location.getX(), location.getY(), location.getZ(), PlotBlock.get("air")); queue.flush(); } @@ -1568,8 +1569,8 @@ public class Plot { * @return the name of the biome */ public String getBiome() { - Location loc = this.getCenter(); - return WorldUtil.IMP.getBiome(loc.getWorld(), loc.getX(), loc.getZ()); + Location location = this.getCenter(); + return WorldUtil.IMP.getBiome(location.getWorld(), location.getX(), location.getZ()); } //TODO Better documentation needed. @@ -1589,9 +1590,9 @@ public class Plot { * Returns the bottom location for the plot. */ public Location getBottomAbs() { - Location loc = getManager().getPlotBottomLocAbs(this.id); - loc.setWorld(getWorldName()); - return loc; + Location location = getManager().getPlotBottomLocAbs(this.id); + location.setWorld(getWorldName()); + return location; } /** @@ -2131,11 +2132,12 @@ public class Plot { return null; } try { - final Location loc = this.getManager().getSignLoc(this); + final Location location = this.getManager().getSignLoc(this); String[] lines = TaskManager.IMP.sync(new RunnableVal() { @Override public void run(String[] value) { - ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false); - this.value = WorldUtil.IMP.getSign(loc); + ChunkManager.manager + .loadChunk(location.getWorld(), location.getChunkLoc(), false); + this.value = WorldUtil.IMP.getSign(location); } }); if (lines == null) { 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 0b9427839..feaf64ddb 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 @@ -132,8 +132,8 @@ public class PlotCluster { toReturn = center.getHome(); if (toReturn.getY() == 0) { PlotManager manager = this.area.getPlotManager(); - Location loc = manager.getSignLoc(center); - toReturn.setY(loc.getY()); + Location location = manager.getSignLoc(center); + toReturn.setY(location.getY()); } } else { toReturn = getClusterBottom().add(home.x, home.y, home.z); 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 8981b2923..4da8cae90 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 @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.google.common.base.Preconditions; import lombok.NonNull; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import java.nio.ByteBuffer; @@ -335,14 +336,14 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @return UUID */ - @Override @Nonnull public abstract UUID getUUID(); + @Override @NotNull public abstract UUID getUUID(); - public boolean canTeleport(@Nonnull final Location loc) { - Preconditions.checkNotNull(loc, "Specified location cannot be null"); + public boolean canTeleport(@NotNull final Location location) { + Preconditions.checkNotNull(location, "Specified location cannot be null"); final Location current = getLocationFull(); - teleport(loc); + teleport(location); boolean result = true; - if (!getLocation().equals(loc)) { + if (!getLocation().equals(location)) { result = false; } teleport(current); @@ -493,10 +494,10 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { ByteBuffer buffer = ByteBuffer.allocate(13); buffer.putShort((short) x); buffer.putShort((short) z); - Location loc = getLocation(); - buffer.putInt(loc.getX()); - buffer.put((byte) loc.getY()); - buffer.putInt(loc.getZ()); + Location location = getLocation(); + buffer.putInt(location.getX()); + buffer.put((byte) location.getY()); + buffer.putInt(location.getZ()); setPersistentMeta("quitLoc", buffer.array()); } else if (hasPersistentMeta("quitLoc")) { removePersistentMeta("quitLoc"); @@ -596,11 +597,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { return; } - final Location loc = new Location(plot.getWorldName(), x, y, z); + final Location location = new Location(plot.getWorldName(), x, y, z); if (plot.isLoaded()) { TaskManager.runTask(() -> { if (getMeta("teleportOnLogin", true)) { - teleport(loc); + teleport(location); sendMessage( Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX + "," + plotZ + ")"); @@ -612,7 +613,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { TaskManager.runTask(() -> { if (getMeta("teleportOnLogin", true)) { if (plot.isLoaded()) { - teleport(loc); + teleport(location); sendMessage(Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc-unloaded) (" + plotX + "," + plotZ + ")"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java index c9065f65e..7e41887ed 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java @@ -80,22 +80,22 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { int bx = minX; int bz = minZ; PlotArea area = PlotSquared.get().getPlotArea(getWorld(), null); - Location loc = new Location(getWorld(), bx, 0, bz); + Location location = new Location(getWorld(), bx, 0, bz); if (area != null) { PlotManager manager = area.getPlotManager(); for (int x = 0; x < 16; x++) { - loc.setX(bx + x); + location.setX(bx + x); for (int z = 0; z < 16; z++) { - loc.setZ(bz + z); - task.run(area.getPlotAbs(loc), x, z); + location.setZ(bz + z); + task.run(area.getPlotAbs(location), x, z); } } } else { for (int x = 0; x < 16; x++) { - loc.setX(bx + x); + location.setX(bx + x); for (int z = 0; z < 16; z++) { - loc.setZ(bz + z); - task.run(loc.getPlotAbs(), x, z); + location.setZ(bz + z); + task.run(location.getPlotAbs(), x, z); } } } From a910b542a0edb14d15d31696a587ffe8541ad771 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 13 Aug 2019 23:43:11 -0400 Subject: [PATCH 077/258] Replace annotations with JetBrains annotations --- .../plotsquared/bukkit/BukkitMain.java | 2 +- .../bukkit/events/PlotAutoMergeEvent.java | 4 +- .../bukkit/events/PlotUnlinkEvent.java | 4 +- .../bukkit/object/BukkitPlayer.java | 4 +- .../bukkit/util/BukkitEventUtil.java | 192 ++++++++---------- .../plotsquared/bukkit/util/BukkitUtil.java | 2 +- .../plotsquared/plot/PlotSquared.java | 2 +- .../plotsquared/plot/commands/Auto.java | 2 +- .../plotsquared/plot/commands/Setup.java | 2 +- .../plotsquared/plot/database/AbstractDB.java | 3 +- .../plotsquared/plot/database/SQLManager.java | 2 +- .../plot/generator/ClassicPlotWorld.java | 2 +- .../plot/object/ConsolePlayer.java | 9 +- .../plotsquared/plot/object/Plot.java | 10 +- .../plotsquared/plot/object/PlotArea.java | 72 +++---- .../plotsquared/plot/object/PlotId.java | 6 +- .../plotsquared/plot/object/PlotPlayer.java | 8 +- .../plot/object/worlds/SinglePlot.java | 2 +- .../plot/object/worlds/SinglePlotArea.java | 20 +- .../plotsquared/plot/util/EventUtil.java | 2 +- .../plotsquared/plot/util/MainUtil.java | 4 +- .../plotsquared/plot/util/UUIDHandler.java | 2 +- .../plot/util/UUIDHandlerImplementation.java | 2 +- .../plot/database/AbstractDBTest.java | 2 +- 24 files changed, 173 insertions(+), 187 deletions(-) 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 12a31de02..64d156130 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 @@ -55,7 +55,7 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.lang.reflect.Method; import java.util.ArrayList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java index 88c9773c9..d30aa5770 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java @@ -30,8 +30,8 @@ public final class PlotAutoMergeEvent extends PlotEvent implements Cancellable { * @param plot Plot that was merged * @param plots A list of plots involved in the event */ - public PlotAutoMergeEvent(@Nonnull final World world, @Nonnull final Plot plot, - @Nonnull final List plots) { + public PlotAutoMergeEvent(@NotNull final World world, @NotNull final Plot plot, + @NotNull final List plots) { super(plot); this.world = world; this.plots = plots; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java index 675f10d8f..77566c70c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java @@ -31,8 +31,8 @@ public final class PlotUnlinkEvent extends Event implements Cancellable { * @param world World in which the event occurred * @param plots Plots that are involved in the event */ - public PlotUnlinkEvent(@Nonnull final World world, @Nonnull final PlotArea area, - @Nonnull final List plots) { + public PlotUnlinkEvent(@NotNull final World world, @NotNull final PlotArea area, + @NotNull final List plots) { this.plots = plots; this.world = world; this.area = area; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index e9a000943..7eae614f7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -184,7 +184,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void teleport(@Nonnull final Location location) { + @Override public void teleport(@NotNull final Location location) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { return; } @@ -229,7 +229,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Nonnull @Override public PlotGameMode getGameMode() { + @NotNull @Override public PlotGameMode getGameMode() { switch (this.player.getGameMode()) { case ADVENTURE: return PlotGameMode.ADVENTURE; 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 744d9084f..c2e39715e 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,22 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -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.events.*; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -30,9 +14,9 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.List; import java.util.UUID; @@ -41,91 +25,93 @@ import java.util.UUID; */ public final class BukkitEventUtil extends EventUtil { - @Nullable public Player getPlayer(final PlotPlayer player) { - if (player instanceof BukkitPlayer) { - return ((BukkitPlayer) player).player; + @Nullable public Player getPlayer(final PlotPlayer player) { + if (player instanceof BukkitPlayer) { + return ((BukkitPlayer) player).player; + } + return null; } - return null; - } - private boolean callEvent(@Nonnull final Event event) { - Bukkit.getServer().getPluginManager().callEvent(event); - return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled(); - } - - @Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) { - return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto)); - } - - @Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) { - return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot)); - } - - @Override public boolean callComponentSet(Plot plot, String component) { - return callEvent(new PlotComponentSetEvent(plot, component)); - } - - @Override public boolean callClear(Plot plot) { - return callEvent(new PlotClearEvent(plot)); - } - - @Override public boolean callDelete(Plot plot) { - return callEvent(new PlotDeleteEvent(plot)); - } - - @Override public boolean callFlagAdd(Flag flag, Plot plot) { - return callEvent(new PlotFlagAddEvent(flag, plot)); - } - - @Override public boolean callFlagRemove(Flag flag, Plot plot, Object value) { - return callEvent(new PlotFlagRemoveEvent(flag, plot)); - } - - @Override public boolean callMerge(Plot plot, int dir, int max) { - return callEvent(new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max)); - } - - @Override public boolean callAutoMerge(Plot plot, List plots) { - return callEvent(new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots)); - } - - @Override public boolean callUnlink(PlotArea area, List plots) { - return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots)); - } - - @Override public void callEntry(PlotPlayer player, Plot plot) { - callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot)); - } - - @Override public void callLeave(PlotPlayer player, Plot plot) { - callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot)); - } - - @Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added)); - } - - @Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added)); - } - - @Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added)); - } - - @Override - public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, - boolean hasOldOwner) { - return callEvent( - new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner)); - } - - @Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) { - PlotRateEvent event = new PlotRateEvent(player, rating, plot); - Bukkit.getServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return null; + private boolean callEvent(@NotNull final Event event) { + Bukkit.getServer().getPluginManager().callEvent(event); + return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled(); + } + + @Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) { + return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto)); + } + + @Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) { + return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot)); + } + + @Override public boolean callComponentSet(Plot plot, String component) { + return callEvent(new PlotComponentSetEvent(plot, component)); + } + + @Override public boolean callClear(Plot plot) { + return callEvent(new PlotClearEvent(plot)); + } + + @Override public boolean callDelete(Plot plot) { + return callEvent(new PlotDeleteEvent(plot)); + } + + @Override public boolean callFlagAdd(Flag flag, Plot plot) { + return callEvent(new PlotFlagAddEvent(flag, plot)); + } + + @Override public boolean callFlagRemove(Flag flag, Plot plot, Object value) { + return callEvent(new PlotFlagRemoveEvent(flag, plot)); + } + + @Override public boolean callMerge(Plot plot, int dir, int max) { + return callEvent( + new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max)); + } + + @Override public boolean callAutoMerge(Plot plot, List plots) { + return callEvent( + new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots)); + } + + @Override public boolean callUnlink(PlotArea area, List plots) { + return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots)); + } + + @Override public void callEntry(PlotPlayer player, Plot plot) { + callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot)); + } + + @Override public void callLeave(PlotPlayer player, Plot plot) { + callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot)); + } + + @Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added)); + } + + @Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added)); + } + + @Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added)); + } + + @Override + public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, + boolean hasOldOwner) { + return callEvent( + new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner)); + } + + @Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) { + PlotRateEvent event = new PlotRateEvent(player, rating, plot); + Bukkit.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return null; + } + return event.getRating(); } - return event.getRating(); - } } 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 947dd22fd..9996b99fc 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 @@ -29,7 +29,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; 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 2f8fc8235..414e2a0b3 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 @@ -34,7 +34,7 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.io.*; import java.net.MalformedURLException; import java.net.URISyntaxException; 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 ff5c02bd0..93eef7813 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 @@ -12,7 +12,7 @@ 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 javax.annotation.Nullable; +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/Setup.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java index 2b7e5ab7f..19e94c6f5 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 @@ -17,7 +17,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import lombok.*; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.Map.Entry; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java index d812413ea..dc9564371 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java @@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import java.util.*; @@ -301,7 +302,7 @@ public interface AbstractDB { * * @param plot The Plot to get comments from */ - void getComments(@Nonnull Plot plot, String inbox, RunnableVal> whenDone); + void getComments(@NotNull Plot plot, String inbox, RunnableVal> whenDone); void createPlotAndSettings(Plot plot, Runnable whenDone); 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 49fbc0bc9..16991bf75 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 @@ -2170,7 +2170,7 @@ import java.util.concurrent.atomic.AtomicInteger; }); } - @Override public void getComments(@Nonnull Plot plot, final String inbox, + @Override public void getComments(@NotNull Plot plot, final String inbox, final RunnableVal> whenDone) { addPlotTask(plot, new UniqueStatement("getComments_" + plot) { @Override public void set(PreparedStatement statement) throws SQLException { 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 6bf38d22c..143879680 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 @@ -46,7 +46,7 @@ import java.util.Locale; * command - this may be useful if a config value can be changed at a later date, and has no impact on the actual * world generation

    */ - @Nonnull @Override public ConfigurationNode[] getSettingNodes() { + @NotNull @Override public ConfigurationNode[] getSettingNodes() { return new ConfigurationNode[] { new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height", Configuration.INTEGER), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index a8fbffad6..253681c89 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.UUID; public class ConsolePlayer extends PlotPlayer { @@ -101,14 +100,14 @@ public class ConsolePlayer extends PlotPlayer { return RequiredType.CONSOLE; } - @Override public void setWeather(@Nonnull PlotWeather weather) { + @Override public void setWeather(@NotNull PlotWeather weather) { } - @Nonnull @Override public PlotGameMode getGameMode() { + @NotNull @Override public PlotGameMode getGameMode() { return PlotGameMode.NOT_SET; } - @Override public void setGameMode(@Nonnull PlotGameMode gameMode) { + @Override public void setGameMode(@NotNull PlotGameMode gameMode) { } @Override public void setTime(long time) { @@ -121,7 +120,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setFlight(boolean fly) { } - @Override public void playMusic(@Nonnull Location location, @Nonnull PlotBlock id) { + @Override public void playMusic(@NotNull Location location, @NotNull PlotBlock id) { } @Override public void kick(String message) { 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 824a812a7..77b60b456 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 @@ -24,7 +24,7 @@ import com.sk89q.jnbt.CompoundTag; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.awt.geom.Area; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; @@ -337,7 +337,7 @@ public class Plot { * @param uuid the player uuid * @return if the provided uuid is the owner of the plot */ - public boolean isOwner(@Nonnull UUID uuid) { + public boolean isOwner(@NotNull UUID uuid) { if (uuid.equals(this.getOwner())) { return true; } @@ -993,7 +993,7 @@ public class Plot { * * @param name name */ - public void setSign(@Nonnull String name) { + public void setSign(@NotNull String name) { if (!isLoaded()) { return; } @@ -1524,7 +1524,7 @@ public class Plot { * @param notify notify * @return true if plot was created successfully */ - public boolean create(@Nonnull UUID uuid, final boolean notify) { + public boolean create(@NotNull UUID uuid, final boolean notify) { this.owner = uuid; Plot existing = this.area.getOwnedPlotAbs(this.id); if (existing != null) { @@ -2569,7 +2569,7 @@ public class Plot { * * @return */ - @Nonnull public HashSet getRegions() { + @NotNull public HashSet getRegions() { if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) { return regions_cache; } 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 50ffaf7b3..9c7d88dd2 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,7 +24,7 @@ import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; @@ -76,7 +76,7 @@ public abstract class PlotArea { private ConcurrentHashMap meta; private QuadMap clusters; - public PlotArea(@Nonnull final String worldName, @Nullable final String id, + public PlotArea(@NotNull final String worldName, @Nullable final String id, @NotNull IndependentPlotGenerator generator, @Nullable final PlotId min, @Nullable final PlotId max) { this.worldname = worldName; @@ -394,7 +394,7 @@ public abstract class PlotArea { } } - @Nonnull @Override public String toString() { + @NotNull @Override public String toString() { if (this.id == null) { return this.worldname; } else { @@ -422,7 +422,7 @@ public abstract class PlotArea { * @param location the location * @return the {@code Plot} or null if none exists */ - @Nullable public Plot getPlotAbs(@Nonnull final Location location) { + @Nullable public Plot getPlotAbs(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -437,7 +437,7 @@ public abstract class PlotArea { * @param location the location * @return base Plot */ - @Nullable public Plot getPlot(@Nonnull final Location location) { + @Nullable public Plot getPlot(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -452,7 +452,7 @@ public abstract class PlotArea { * @param location the location * @return the base plot or null */ - @Nullable public Plot getOwnedPlot(@Nonnull final Location location) { + @Nullable public Plot getOwnedPlot(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -468,7 +468,7 @@ public abstract class PlotArea { * @param location the location * @return Plot or null */ - @Nullable public Plot getOwnedPlotAbs(@Nonnull final Location location) { + @Nullable public Plot getOwnedPlotAbs(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -483,11 +483,11 @@ public abstract class PlotArea { * @param id the {@code PlotId} * @return the plot or null */ - @Nullable public Plot getOwnedPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getOwnedPlotAbs(@NotNull final PlotId id) { return this.plots.get(id); } - @Nullable public Plot getOwnedPlot(@Nonnull final PlotId id) { + @Nullable public Plot getOwnedPlot(@NotNull final PlotId id) { Plot plot = this.plots.get(id); return plot == null ? null : plot.getBasePlot(false); } @@ -496,17 +496,17 @@ public abstract class PlotArea { return this.TYPE != 2 || getRegionAbs().isIn(x, z); } - public boolean contains(@Nonnull final PlotId id) { + public boolean contains(@NotNull final PlotId id) { return this.min == null || (id.x >= this.min.x && id.x <= this.max.x && id.y >= this.min.y && id.y <= this.max.y); } - public boolean contains(@Nonnull final Location location) { + public boolean contains(@NotNull final Location location) { return StringMan.isEqual(location.getWorld(), this.worldname) && (getRegionAbs() == null || this.region.isIn(location.getX(), location.getZ())); } - @Nonnull Set getPlotsAbs(final UUID uuid) { + @NotNull Set getPlotsAbs(final UUID uuid) { if (uuid == null) { return Collections.emptySet(); } @@ -519,7 +519,7 @@ public abstract class PlotArea { return myPlots; } - @Nonnull public Set getPlots(@Nonnull final UUID uuid) { + @NotNull public Set getPlots(@NotNull final UUID uuid) { return getPlots().stream().filter(plot -> plot.isBasePlot() && plot.isOwner(uuid)) .collect(ImmutableSet.toImmutableSet()); } @@ -533,7 +533,7 @@ public abstract class PlotArea { return this.plots.values(); } - public int getPlotCount(@Nonnull final UUID uuid) { + public int getPlotCount(@NotNull final UUID uuid) { if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { return (int) getPlotsAbs(uuid).stream().filter(plot -> !plot.hasFlag(Flags.DONE)) .count(); @@ -546,11 +546,11 @@ public abstract class PlotArea { * * @deprecated Use {@link #getPlots(UUID)} */ - @Deprecated public Set getPlots(@Nonnull final PlotPlayer player) { + @Deprecated public Set getPlots(@NotNull final PlotPlayer player) { return getPlots(player.getUUID()); } - public boolean hasPlot(@Nonnull final UUID uuid) { + public boolean hasPlot(@NotNull final UUID uuid) { return this.plots.entrySet().stream().anyMatch(entry -> entry.getValue().isOwner(uuid)); } @@ -559,7 +559,7 @@ public abstract class PlotArea { return player != null ? getPlotCount(player.getUUID()) : 0; } - @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y @@ -571,7 +571,7 @@ public abstract class PlotArea { return plot; } - @Nullable public Plot getPlot(@Nonnull final PlotId id) { + @Nullable public Plot getPlot(@NotNull final PlotId id) { final Plot plot = getOwnedPlotAbs(id); if (plot == null) { if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y @@ -592,7 +592,7 @@ public abstract class PlotArea { return this.plots.size(); } - @Nullable public PlotCluster getCluster(@Nonnull final Location location) { + @Nullable public PlotCluster getCluster(@NotNull final Location location) { final Plot plot = getPlot(location); if (plot == null) { return null; @@ -600,8 +600,8 @@ public abstract class PlotArea { return this.clusters != null ? this.clusters.get(plot.getId().x, plot.getId().y) : null; } - @Nullable public PlotCluster getFirstIntersectingCluster(@Nonnull final PlotId pos1, - @Nonnull final PlotId pos2) { + @Nullable public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1, + @NotNull final PlotId pos2) { if (this.clusters == null) { return null; } @@ -613,7 +613,7 @@ public abstract class PlotArea { return null; } - @Nullable PlotCluster getCluster(@Nonnull final PlotId id) { + @Nullable PlotCluster getCluster(@NotNull final PlotId id) { return this.clusters != null ? this.clusters.get(id.x, id.y) : null; } @@ -628,7 +628,7 @@ public abstract class PlotArea { * * @see FlagManager */ - public void setMeta(@Nonnull final String key, @Nullable final Object value) { + public void setMeta(@NotNull final String key, @Nullable final Object value) { if (this.meta == null) { this.meta = new ConcurrentHashMap<>(); } @@ -645,14 +645,14 @@ public abstract class PlotArea { *
    * For persistent metadata use the flag system */ - @Nullable public Object getMeta(@Nonnull final String key) { + @Nullable public Object getMeta(@NotNull final String key) { if (this.meta != null) { return this.meta.get(key); } return null; } - @SuppressWarnings("unused") @Nonnull public Set getBasePlots() { + @SuppressWarnings("unused") @NotNull public Set getBasePlots() { final HashSet myPlots = new HashSet<>(getPlots()); myPlots.removeIf(plot -> !plot.isBasePlot()); return myPlots; @@ -685,15 +685,15 @@ public abstract class PlotArea { * @deprecated Use {@link #getPlotsMap()} */ //todo eventually remove - @Deprecated @Nonnull public Map getPlotsRaw() { + @Deprecated @NotNull public Map getPlotsRaw() { return ImmutableMap.copyOf(plots); } - @Nonnull public Set> getPlotEntries() { + @NotNull public Set> getPlotEntries() { return this.plots.entrySet(); } - public boolean addPlot(@Nonnull final Plot plot) { + public boolean addPlot(@NotNull final Plot plot) { for (PlotPlayer pp : plot.getPlayersInPlot()) { pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); } @@ -731,7 +731,7 @@ public abstract class PlotArea { return null; } - public boolean addPlotIfAbsent(@Nonnull final Plot plot) { + public boolean addPlotIfAbsent(@NotNull final Plot plot) { if (this.plots.putIfAbsent(plot.getId(), plot) == null) { for (PlotPlayer pp : plot.getPlayersInPlot()) { pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); @@ -741,7 +741,7 @@ public abstract class PlotArea { return false; } - public boolean addPlotAbs(@Nonnull final Plot plot) { + public boolean addPlotAbs(@NotNull final Plot plot) { return this.plots.put(plot.getId(), plot) == null; } @@ -786,14 +786,14 @@ public abstract class PlotArea { * * @param key Meta data key */ - public void deleteMeta(@Nonnull final String key) { + public void deleteMeta(@NotNull final String key) { if (this.meta != null) { this.meta.remove(key); } } - public boolean canClaim(@Nullable final PlotPlayer player, @Nonnull final PlotId pos1, - @Nonnull final PlotId pos2) { + public boolean canClaim(@Nullable final PlotPlayer player, @NotNull final PlotId pos1, + @NotNull final PlotId pos2) { if (pos1.x == pos2.x && pos1.y == pos2.y) { if (getOwnedPlot(pos1) != null) { return false; @@ -819,11 +819,11 @@ public abstract class PlotArea { return true; } - public boolean removePlot(@Nonnull final PlotId id) { + public boolean removePlot(@NotNull final PlotId id) { return this.plots.remove(id) != null; } - public boolean mergePlots(@Nonnull final List plotIds, final boolean removeRoads) { + public boolean mergePlots(@NotNull final List plotIds, final boolean removeRoads) { if (plotIds.size() < 2) { return false; } @@ -901,7 +901,7 @@ public abstract class PlotArea { * @param pos2 second corner of selection * @return the plots in the selection which are owned */ - public Set getPlotSelectionOwned(@Nonnull final PlotId pos1, @Nonnull final PlotId pos2) { + public Set getPlotSelectionOwned(@NotNull final PlotId pos1, @NotNull final PlotId pos2) { final int size = (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); final Set result = new HashSet<>(); if (size < 16 || size < getPlotCount()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 10b9e4c71..6506a1d50 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class PlotId { /** @@ -32,14 +32,14 @@ public class PlotId { * @return the PlotId representation of the arguement * @throws IllegalArgumentException if the string does not contain a valid PlotId */ - @Nonnull public static PlotId fromString(@Nonnull String string) { + @NotNull public static PlotId fromString(@NotNull String string) { PlotId plot = fromStringOrNull(string); if (plot == null) throw new IllegalArgumentException("Cannot create PlotID. String invalid."); return plot; } - @Nullable public static PlotId fromStringOrNull(@Nonnull String string) { + @Nullable public static PlotId fromStringOrNull(@NotNull String string) { String[] parts = string.split("[;|,]"); if (parts.length < 2) { return null; 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 4da8cae90..04390adbe 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 @@ -422,21 +422,21 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @param weather the weather visible to the player */ - public abstract void setWeather(@Nonnull PlotWeather weather); + public abstract void setWeather(@NotNull PlotWeather weather); /** * Get this player's gamemode. * * @return the gamemode of the player. */ - @Nonnull public abstract PlotGameMode getGameMode(); + @NotNull public abstract PlotGameMode getGameMode(); /** * Set this player's gameMode. * * @param gameMode the gamemode to set */ - public abstract void setGameMode(@Nonnull PlotGameMode gameMode); + public abstract void setGameMode(@NotNull PlotGameMode gameMode); /** * Set this player's local time (ticks). @@ -465,7 +465,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @param location where to play the music * @param id the record item id */ - public abstract void playMusic(@Nonnull Location location, @Nonnull PlotBlock id); + public abstract void playMusic(@NotNull Location location, @NotNull PlotBlock id); /** * Check if this player is banned. 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 36d23c8f6..c216b4589 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 @@ -60,7 +60,7 @@ public class SinglePlot extends Plot { return super.isLoaded(); } - @Nonnull @Override public HashSet getRegions() { + @NotNull @Override public HashSet getRegions() { return regions; } 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 41801c087..28a2e02dc 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 @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -113,38 +113,38 @@ public class SinglePlotArea extends GridPlotWorld { new ConfigurationNode("void", this.VOID, "Void world", Configuration.BOOLEAN)}; } - @Nullable @Override public Plot getOwnedPlot(@Nonnull final Location location) { + @Nullable @Override public Plot getOwnedPlot(@NotNull final Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); Plot plot = pid == null ? null : this.plots.get(pid); return plot == null ? null : plot.getBasePlot(false); } - @Nullable @Override public Plot getOwnedPlotAbs(@Nonnull Location location) { + @Nullable @Override public Plot getOwnedPlotAbs(@NotNull Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : plots.get(pid); } - @Nullable @Override public Plot getPlot(@Nonnull final Location location) { + @Nullable @Override public Plot getPlot(@NotNull final Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : getPlot(pid); } - @Nullable @Override public Plot getPlotAbs(@Nonnull final Location location) { + @Nullable @Override public Plot getPlotAbs(@NotNull final Location location) { final PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : getPlotAbs(pid); } - public boolean addPlot(@Nonnull Plot plot) { + public boolean addPlot(@NotNull Plot plot) { plot = adapt(plot); return super.addPlot(plot); } - @Override public boolean addPlotAbs(@Nonnull Plot plot) { + @Override public boolean addPlotAbs(@NotNull Plot plot) { plot = adapt(plot); return super.addPlotAbs(plot); } - @Override public boolean addPlotIfAbsent(@Nonnull Plot plot) { + @Override public boolean addPlotIfAbsent(@NotNull Plot plot) { plot = adapt(plot); return super.addPlotIfAbsent(plot); } @@ -160,7 +160,7 @@ public class SinglePlotArea extends GridPlotWorld { return p; } - @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { return new SinglePlot(this, id); @@ -168,7 +168,7 @@ public class SinglePlotArea extends GridPlotWorld { return plot; } - @Nullable public Plot getPlot(@Nonnull PlotId id) { + @Nullable public Plot getPlot(@NotNull PlotId id) { // TODO Plot plot = getOwnedPlotAbs(id); if (plot == null) { 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 0a5b77515..b2b88d342 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 @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; -import javax.annotation.Nullable; +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/MainUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java index e45d70caf..10e81c8db 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 @@ -329,7 +329,7 @@ public class MainUtil { * @param owner * @return The player's name, None, Everyone or Unknown */ - @Nonnull public static String getName(UUID owner) { + @NotNull public static String getName(UUID owner) { if (owner == null) { return Captions.NONE.getTranslated(); } @@ -358,7 +358,7 @@ public class MainUtil { * @return * @see Plot#getCorners() */ - @Nonnull public static Location[] getCorners(String world, Collection regions) { + @NotNull public static Location[] getCorners(String world, Collection regions) { Location min = null; Location max = null; for (RegionWrapper region : regions) { 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 315687463..60a0d778b 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 @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.google.common.collect.BiMap; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; +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 55ff35c95..17ab6b5ce 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 @@ -15,7 +15,7 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.HashSet; import java.util.Map; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java index 1ef5c92ec..944aa6cab 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java @@ -149,7 +149,7 @@ public class AbstractDBTest implements AbstractDB { @Override public void setComment(Plot plot, PlotComment comment) { } - @Override public void getComments(@Nonnull Plot plot, String inbox, + @Override public void getComments(@NotNull Plot plot, String inbox, RunnableVal> whenDone) { } From b4c33aaa187fc851f4e8bbea19fcd181a50eb83e Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 14 Aug 2019 14:36:20 -0400 Subject: [PATCH 078/258] Midnight work Also fixes #2463 --- .../bukkit/listeners/PlayerEvents.java | 4 ++-- .../bukkit/object/BukkitPlayer.java | 3 +-- .../plotsquared/bukkit/util/BukkitUtil.java | 5 +++-- .../plotsquared/plot/commands/Set.java | 2 -- .../plotsquared/plot/database/SQLManager.java | 2 +- .../plot/generator/AugmentedUtils.java | 3 --- .../plot/generator/HybridPlotWorld.java | 2 +- .../plot/generator/HybridUtils.java | 2 +- .../plotsquared/plot/object/ConsolePlayer.java | 2 +- .../plotsquared/plot/object/PlotArea.java | 18 +++++++----------- .../plotsquared/plot/object/PlotId.java | 2 +- .../plotsquared/plot/object/PlotPlayer.java | 3 +-- .../plot/object/worlds/SinglePlot.java | 2 +- .../plot/object/worlds/SinglePlotArea.java | 10 +++++----- .../plotsquared/plot/util/MainUtil.java | 10 +++++----- 15 files changed, 30 insertions(+), 40 deletions(-) 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 c7c2edf5d..3ecc572db 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 @@ -931,10 +931,10 @@ import java.util.regex.Pattern; PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer()); Location location = plotPlayer.getLocation(); PlotArea area = location.getPlotArea(); - if (location.isPlotArea() || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) { + if (area == null || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) { return; } - Plot plot = location.getPlot(); + Plot plot = area.getPlot(location); if (plot == null) { return; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 7eae614f7..61862f899 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -25,7 +25,6 @@ import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.RegisteredListener; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Set; import java.util.UUID; @@ -56,7 +55,7 @@ public class BukkitPlayer extends PlotPlayer { super.populatePersistentMetaMap(); } - @Override public Location getLocation() { + @NotNull @Override public Location getLocation() { final Location location = super.getLocation(); return location == null ? BukkitUtil.getLocation(this.player) : location; } 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 9996b99fc..0ba9c5700 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 @@ -28,8 +28,9 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; - +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -243,7 +244,7 @@ import java.util.Set; location.getBlockZ()); } - public static Location getLocationFull(@NonNull final Entity entity) { + @NotNull public static Location getLocationFull(@NonNull final Entity entity) { final org.bukkit.Location location = entity.getLocation(); return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 982e03ae1..082e80582 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; 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.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -45,7 +44,6 @@ import java.util.stream.IntStream; } @Override public boolean set(PlotPlayer player, final Plot plot, String value) { - PlotArea plotArea = player.getLocation().getPlotArea(); PlotManager manager = player.getLocation().getPlotManager(); String[] components = manager.getPlotComponents(plot.getId()); boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(player.getUUID()); 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 16991bf75..b3b20379f 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 @@ -12,8 +12,8 @@ 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.google.common.base.Charsets; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.sql.*; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index fe0a614a2..2a85581ad 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -47,9 +47,6 @@ public class AugmentedUtils { continue; } IndependentPlotGenerator generator = area.getGenerator(); - if (generator == null) { - continue; - } // Mask if (queue == null) { queue = GlobalBlockQueue.IMP.getNewQueue(world, false); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index 101b6fcb3..2f8c7c823 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -44,7 +44,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { super(worldName, id, generator, min, max); } - @Override + @NotNull @Override protected PlotManager createManager() { return new HybridPlotManager(this); } 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 135149279..46f02d6fb 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 @@ -140,7 +140,7 @@ public abstract class HybridUtils { } HybridUtils.UPDATE = true; Set regions = new HashSet<>(); - regions.add(ChunkManager.manager.getChunkChunk(plot.getCenter())); + regions.add(ChunkManager.getChunkChunk(plot.getCenter())); return scheduleRoadUpdate(plot.getArea(), regions, extend); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 253681c89..490a6e211 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -42,7 +42,7 @@ public class ConsolePlayer extends PlotPlayer { public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { } - @Override public Location getLocation() { + @NotNull @Override public Location getLocation() { return this.getMeta("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 9c7d88dd2..ff6668ea4 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 @@ -22,9 +22,8 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; - -import javax.annotation.Nonnull; import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; @@ -37,12 +36,12 @@ public abstract class PlotArea { public final String worldname; public final String id; - public final PlotManager manager; + @NotNull public final PlotManager manager; public final int worldhash; protected final ConcurrentHashMap plots = new ConcurrentHashMap<>(); private final PlotId min; private final PlotId max; - private final IndependentPlotGenerator generator; + @NotNull private final IndependentPlotGenerator generator; private final BlockBucket[][] blockBucketChunk; public int MAX_PLOT_MEMBERS = 128; public boolean AUTO_MERGE = false; @@ -102,7 +101,7 @@ public abstract class PlotArea { } } - protected abstract PlotManager createManager(); + @NotNull protected abstract PlotManager createManager(); public LocalBlockQueue getQueue(final boolean autoQueue) { return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue); @@ -117,10 +116,7 @@ public abstract class PlotArea { if (blockBucketChunk != null) { return blockBucketChunk; } - if (generator != null) { - return generator.generateBlockBucketChunk(this); - } - return null; + return generator.generateBlockBucketChunk(this); } /** @@ -178,7 +174,7 @@ public abstract class PlotArea { * * @return the {@link IndependentPlotGenerator} */ - public IndependentPlotGenerator getGenerator() { + @NotNull public IndependentPlotGenerator getGenerator() { return this.generator; } @@ -617,7 +613,7 @@ public abstract class PlotArea { return this.clusters != null ? this.clusters.get(id.x, id.y) : null; } - public PlotManager getPlotManager() { + @NotNull public PlotManager getPlotManager() { return this.manager; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 6506a1d50..21e7dc777 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.object; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class PlotId { 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 04390adbe..f8e21255b 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 @@ -16,7 +16,6 @@ import com.google.common.base.Preconditions; import lombok.NonNull; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.HashSet; @@ -307,7 +306,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @return The location */ - public Location getLocation() { + @NotNull public Location getLocation() { Location location = getMeta("location"); if (location != null) { return location; 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 c216b4589..8c80e46a7 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 @@ -4,8 +4,8 @@ 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.google.common.collect.Sets; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.HashSet; import java.util.UUID; 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 28a2e02dc..8f8ac96b1 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 @@ -9,9 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -26,7 +26,7 @@ public class SinglePlotArea extends GridPlotWorld { this.DEFAULT_HOME = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE); } - @Override + @NotNull @Override protected PlotManager createManager() { return new SinglePlotManager(this); } @@ -76,8 +76,8 @@ public class SinglePlotArea extends GridPlotWorld { new File(dataDest, file.getName()).toPath()); } } - } catch (IOException ignore) { - ignore.printStackTrace(); + } catch (IOException exception) { + exception.printStackTrace(); } } } 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 10e81c8db..1f42d6772 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 @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.stream.AbstractDelegateOutputStream; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.io.*; import java.net.HttpURLConnection; import java.net.MalformedURLException; @@ -560,11 +560,11 @@ public class MainUtil { * Send a message to the player. * * @param player Player to receive message - * @param msg Message to send + * @param message Message to send * @return true Can be used in things such as commands (return PlayerFunctions.sendMessage(...)) */ - public static boolean sendMessage(PlotPlayer player, String msg) { - return sendMessage(player, msg, true); + public static boolean sendMessage(PlotPlayer player, String message) { + return sendMessage(player, message, true); } /** @@ -585,7 +585,7 @@ public class MainUtil { * @param prefix If the message should be prefixed with the configured prefix * @return */ - public static boolean sendMessage(CommandCaller player, String msg, boolean prefix) { + public static boolean sendMessage(CommandCaller player, @NotNull String msg, boolean prefix) { if (!msg.isEmpty()) { if (player == null) { String message = (prefix ? Captions.PREFIX.getTranslated() : "") + msg; From 3473f5dc851a06baab01049e832a7f6312ba20eb Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 14 Aug 2019 20:47:01 -0400 Subject: [PATCH 079/258] Fixed compatibility with FAWE and compile issue. --- .../bukkit/events/PlotAutoMergeEvent.java | 2 +- .../plotsquared/bukkit/events/PlotUnlinkEvent.java | 2 +- .../plotsquared/plot/database/SQLManager.java | 4 ++-- .../plot/util/block/BasicLocalBlockQueue.java | 1 + .../plot/util/block/DelegateLocalBlockQueue.java | 1 + .../plot/util/block/LocalBlockQueue.java | 8 ++++++++ .../plotsquared/plot/database/AbstractDBTest.java | 14 +++++++++++--- 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java index d30aa5770..059b296cf 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java @@ -7,8 +7,8 @@ import lombok.Setter; import org.bukkit.World; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java index 77566c70c..5db7d04d4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java @@ -8,8 +8,8 @@ import org.bukkit.World; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; 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 b3b20379f..2f041cc57 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 @@ -2942,7 +2942,7 @@ import java.util.concurrent.atomic.AtomicInteger; boolean[] pm = plot.getMerged(); boolean[] dm = dataPlot.getMerged(); if (pm[0] != dm[0] || pm[1] != dm[1]) { - PlotSquared.debug("&8 - &7Correcting merge for: " + plot); + PlotSquared.debug(" - Correcting merge for: " + plot); setMerged(dataPlot, plot.getMerged()); } HashMap, Object> pf = plot.getFlags(); @@ -2951,7 +2951,7 @@ import java.util.concurrent.atomic.AtomicInteger; if (pf.size() != df.size() || !StringMan .isEqual(StringMan.joinOrdered(pf.values(), ","), StringMan.joinOrdered(df.values(), ","))) { - PlotSquared.debug("&8 - &7Correcting flags for: " + plot); + PlotSquared.debug(" - Correcting flags for: " + plot); setFlags(plot, pf); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 6b5d625d7..6993c3208 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -23,6 +23,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { private int lastZ = Integer.MIN_VALUE; public BasicLocalBlockQueue(String world) { + super(world); this.world = world; this.modified = System.currentTimeMillis(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index 5c2a8fb48..a89597fcf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -8,6 +8,7 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { private final LocalBlockQueue parent; public DelegateLocalBlockQueue(LocalBlockQueue parent) { + super(parent.getWorld()); this.parent = parent; } 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 852505d74..fd921c18c 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 @@ -16,6 +16,14 @@ import java.util.Map; public abstract class LocalBlockQueue { + /** + * Needed for compatibility with FAWE. + * + * @param world unused + */ + @Deprecated public LocalBlockQueue(String world) { + } + public ScopedLocalBlockQueue getForChunk(int x, int z) { int bx = x << 4; int bz = z << 4; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java index 944aa6cab..a2cc07d1b 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java @@ -1,11 +1,19 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -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.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; public class AbstractDBTest implements AbstractDB { From fbaef135537241efcd6be3452306e0037da96c7b Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 15 Aug 2019 15:39:37 +0200 Subject: [PATCH 080/258] Unify player string <> args are used in a lot of commands, PlayerName is used in only 3 commands and I don'T want to remove methods if not really necessary, so let's just change it here. --- .../github/intellectualsites/plotsquared/commands/Argument.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java index dd5221a3a..7ae1985ce 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java @@ -33,7 +33,7 @@ public abstract class Argument { } }; public static final Argument PlayerName = - new Argument("PlayerName", "Dinnerbone") { + new Argument("PlayerName", "") { @Override public String parse(String in) { return in.length() <= 16 ? in : null; } From b3e53e34b6a6dd4693b49d16d39b3108ad65bba6 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 15 Aug 2019 16:20:30 +0200 Subject: [PATCH 081/258] Simplify help string --- .../plotsquared/plot/commands/WE_Anywhere.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java index bd18e3886..3a4e1d71c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java @@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @CommandDeclaration(command = "weanywhere", permission = "plots.worldedit.bypass", - description = "Force bypass of WorldEdit", aliases = {"wea"}, usage = "/plot weanywhere", + description = "Force bypass of WorldEdit restrictions", aliases = {"wea"}, usage = "/plot weanywhere", requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION) @Deprecated public class WE_Anywhere extends SubCommand { From 8653b9b0a2773ca3b44bdd81d25d3325a0368bdd Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 15 Aug 2019 16:37:57 +0200 Subject: [PATCH 082/258] Update unfitting messages --- .../github/intellectualsites/plotsquared/plot/commands/Add.java | 2 +- .../intellectualsites/plotsquared/plot/commands/Deny.java | 2 +- .../intellectualsites/plotsquared/plot/commands/Trust.java | 2 +- .../intellectualsites/plotsquared/plot/config/Captions.java | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java index f6dba37a4..d92dd4ea3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java @@ -49,7 +49,7 @@ import java.util.concurrent.CompletableFuture; continue; } if (plot.isOwner(uuid)) { - MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); iterator.remove(); continue; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 7bb0ab34a..6d5dc99c7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -56,7 +56,7 @@ import java.util.UUID; continue; } if (plot.isOwner(uuid)) { - MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, Captions.CANT_REMOVE_OWNER, MainUtil.getName(uuid)); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java index 630e636d6..4531d2737 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java @@ -52,7 +52,7 @@ import java.util.concurrent.CompletableFuture; continue; } if (currentPlot.isOwner(uuid)) { - MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); iterator.remove(); continue; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 5fd74a9ea..a20898f5a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -647,6 +647,7 @@ public enum Captions { DENIED_NEED_ARGUMENT("$2Arguments are missing. $1/plot denied add $2or $1/plot denied remove ", "Deny"), WAS_NOT_DENIED("$2That player was not denied on this plot", "Deny"), YOU_GOT_DENIED("$4You are denied from the plot you were previously on, and got teleported to spawn", "Deny"), + CANT_REMOVE_OWNER("$2You can't remove the plot owner", "Deny"), // YOU_GOT_KICKED("$4You got kicked!", "Kick"), // From 31c81fc9fe8850839facad8adef63c3b7ccdd952 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 15 Aug 2019 17:35:40 +0200 Subject: [PATCH 083/258] Update command aliases format --- .../intellectualsites/plotsquared/plot/commands/Help.java | 2 +- .../intellectualsites/plotsquared/plot/commands/Kick.java | 2 +- .../intellectualsites/plotsquared/plot/commands/Load.java | 2 +- .../intellectualsites/plotsquared/plot/commands/Move.java | 2 +- .../intellectualsites/plotsquared/plot/commands/Visit.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index 47d9ea89b..7949df513 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -14,7 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.helpmenu.HelpMenu; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "help", description = "Get this help menu", aliases = {"he", "?"}, +@CommandDeclaration(command = "help", description = "Get this help menu", aliases = "?", category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use") public class Help extends Command { public Help(Command parent) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java index 2ffb6aa6a..eb36f8e67 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java @@ -17,7 +17,7 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -@CommandDeclaration(command = "kick", aliases = {"k"}, description = "Kick a player from your plot", +@CommandDeclaration(command = "kick", aliases = "k", description = "Kick a player from your plot", permission = "plots.kick", usage = "/plot kick ", category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER) public class Kick extends SubCommand { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java index d18332798..4b0305969 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java @@ -19,7 +19,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; -@CommandDeclaration(command = "load", aliases = {"restore"}, category = CommandCategory.SCHEMATIC, +@CommandDeclaration(command = "load", aliases = "restore", category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load", usage = "/plot load") public class Load extends SubCommand { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 0e6d78247..fb8464aea 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; @CommandDeclaration(usage = "/plot move ", command = "move", description = "Move a plot", - aliases = {"debugmove"}, permission = "plots.move", category = CommandCategory.CLAIMING, + permission = "plots.move", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER) public class Move extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java index c9e7ed8e8..ea5647b66 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 @@ -16,7 +16,7 @@ import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "visit", permission = "plots.visit", description = "Visit someones plot", usage = "/plot visit [|||] [#]", - aliases = {"v", "tp", "teleport", "goto", "home", "h"}, requiredType = RequiredType.PLAYER, + aliases = {"v", "tp", "teleport", "goto", "home", "h", "warp"}, requiredType = RequiredType.PLAYER, category = CommandCategory.TELEPORT) public class Visit extends Command { public Visit() { From 49b7c71fbb3fb638c04e5cad3b7ddffb8c16186f Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 16 Aug 2019 01:22:24 +0200 Subject: [PATCH 084/258] Adding some more translation strings --- .../plot/commands/CreateRoadSchematic.java | 3 +-- .../plotsquared/plot/commands/Download.java | 2 +- .../plot/commands/SchematicCmd.java | 25 ++++++++----------- .../plotsquared/plot/commands/Unlink.java | 2 +- .../plotsquared/plot/config/Captions.java | 15 +++++++++-- .../plot/listener/ProcessedWEExtent.java | 4 +-- 6 files changed, 29 insertions(+), 22 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java index 26962781c..2c901aa35 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java @@ -25,8 +25,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } HybridUtils.manager.setupRoadSchematic(plot); - MainUtil.sendMessage(player, - "$1Saved new road schematic. To test the road, fly to a few other plots and use /plot debugroadregen"); + MainUtil.sendMessage(player, Captions.SCHEMATIC_ROAD_CREATED); return true; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java index 14521b2c6..776cff0f8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java @@ -76,7 +76,7 @@ import java.net.URL; Captions.NO_PERMISSION.send(player, Captions.PERMISSION_DOWNLOAD_WORLD); return false; } - MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512"); + MainUtil.sendMessage(player, Captions.MCA_FILE_SIZE); plot.addRunning(); WorldUtil.IMP.saveWorld(world); WorldUtil.IMP.upload(plot, null, null, new RunnableVal() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index 24ccbe016..f654fa776 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -62,7 +62,7 @@ public class SchematicCmd extends SubCommand { return false; } if (this.running) { - MainUtil.sendMessage(player, "&cTask is already running."); + MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS); return false; } final String location = args[1]; @@ -148,8 +148,7 @@ public class SchematicCmd extends SubCommand { return false; } if (args.length != 2) { - MainUtil.sendMessage(player, - "&cNeed world argument. Use &7/plot sch exportall "); + MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD_ARGS); return false; } PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]); @@ -160,19 +159,17 @@ public class SchematicCmd extends SubCommand { Collection plots = area.getPlots(); if (plots.isEmpty()) { MainUtil - .sendMessage(player, "&cInvalid world. Use &7/plot sch exportall "); + .sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD); return false; } boolean result = SchematicHandler.manager.exportAll(plots, null, null, - () -> MainUtil.sendMessage(player, "&aFinished mass export")); + () -> MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_FINISHED)); if (!result) { - MainUtil.sendMessage(player, "&cTask is already running."); + MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS); return false; } else { - MainUtil.sendMessage(player, - "&3Plot&8->&3Schematic&8: &7Mass export has started. This may take a while."); - MainUtil.sendMessage(player, - "&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); + MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED); + MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_COUNT, plots.size()); } break; } @@ -184,7 +181,7 @@ public class SchematicCmd extends SubCommand { return false; } if (this.running) { - MainUtil.sendMessage(player, "&cTask is already running."); + MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS); return false; } Location location = player.getLocation(); @@ -203,14 +200,14 @@ public class SchematicCmd extends SubCommand { } ArrayList plots = Lists.newArrayList(plot); boolean result = SchematicHandler.manager.exportAll(plots, null, null, () -> { - MainUtil.sendMessage(player, "&aFinished export"); + MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_SINGLE_FINISHED); SchematicCmd.this.running = false; }); if (!result) { - MainUtil.sendMessage(player, "&cTask is already running."); + MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS); return false; } else { - MainUtil.sendMessage(player, "&7Starting export..."); + MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED); } break; case "list": { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java index 9ce6bd5fb..7e84ef3aa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java @@ -41,7 +41,7 @@ public class Unlink extends SubCommand { } Runnable runnable = () -> { if (!plot.unlinkPlot(createRoad, createRoad)) { - MainUtil.sendMessage(player, "&cUnlink has been cancelled"); + MainUtil.sendMessage(player, Captions.UNMERGE_CANCELLED); return; } MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index a20898f5a..dca4f5b23 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -400,6 +400,15 @@ public enum Captions { "Schematics"), SCHEMATIC_PASTE_SUCCESS("$4The schematic pasted successfully", "Schematics"), SCHEMATIC_LIST("$4Saved Schematics: $1%s", "Schematics"), + SCHEMATIC_ROAD_CREATED("$1Saved new road schematic. To test the schematic, fly to a few other plots and run /plot debugroadregen", "Schematics"), + MCA_FILE_SIZE("$1Note: The `.mca` files are 512x512", "Schematics"), + SCHEMATIC_EXPORTALL_STARTED("$1Starting export...", "Schematics"), + SCHEMATIC_EXPORTALL_WORLD_ARGS("$1Need world argument. Use $3/plot sch exportall ", "Schematics"), + SCHEMATIC_EXPORTALL_WORLD("$1Invalid world. Use &3/plot sch exportall ", "Schematic"), + SCHEMATIC_EXPORTALL_MASS_STARTED("$1Schematic mass export has been started. This may take a while", "Schematics"), + SCHEMATIC_EXPORTALL_COUNT("$1Found $3%s $1plots...", "Schematics"), + SCHEMATIC_EXPORTALL_FINISHED("$1Finished mass export", "Schematics"), + SCHEMATIC_EXPORTALL_SINGLE_FINISHED("$1Finished export", "Schematics"), // // TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"), @@ -470,8 +479,9 @@ public enum Captions { NO_AVAILABLE_AUTOMERGE( "$2You do not own any adjacent plots in the specified direction or are not allowed to merge to the required size.", - "Merge"), UNLINK_REQUIRED("$2An unlink is required to do this.", "Merge"), - + "Merge"), + UNLINK_REQUIRED("$2An unlink is required to do this.", "Merge"), + UNMERGE_CANCELLED("$1Unlink has been cancelled", "Merge"), UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"), UNLINK_SUCCESS( "$2Successfully unlinked plots.", "Merge"), // @@ -505,6 +515,7 @@ public enum Captions { WAIT_FOR_TIMER( "$2A set block timer is bound to either the current plot or you. Please wait for it to finish", "Errors"), + TASK_IN_PROCESS("$1Task is already running.", "Error"), // DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java index 21014db70..7d2d824b4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java @@ -107,7 +107,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { if (this.BScount > Settings.Chunk_Processor.MAX_TILES) { this.BSblocked = true; PlotSquared.debug( - Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getX() + "," + Captions.PREFIX + "&cDetected unsafe WorldEdit: " + location.getX() + "," + location.getZ()); } if (WEManager @@ -162,7 +162,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) { this.Eblocked = true; PlotSquared.debug( - Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + Captions.PREFIX + "&cDetected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); } if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), From b22919a278374922ad2d3fc02712efac033bcff6 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 16 Aug 2019 01:47:22 +0200 Subject: [PATCH 085/258] Variable renames and fixes --- .../plotsquared/plot/PlotSquared.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 31c7710c2..174d88367 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 @@ -1601,7 +1601,7 @@ import java.util.zip.ZipInputStream; this.version = PlotVersion.tryParse(versionString, commitString, dateString); Settings.DATE = new Date(100 + version.year, version.month, version.day).toGMTString(); - Settings.BUILD = "https://ci.athion.net/job/PlotSquared/" + version.build; + Settings.BUILD = "https://ci.athion.net/job/PlotSquared-Breaking/" + version.build; Settings.COMMIT = "https://github.com/IntellectualSites/PlotSquared/commit/" + Integer .toHexString(version.hash); @@ -1777,15 +1777,15 @@ import java.util.zip.ZipInputStream; */ private void setupStyle() { if (this.version != null) { - this.style.set("version", this.version.toString()); + this.style.set("Version", this.version.toString()); } - Map o = new HashMap<>(4); - o.put("color.1", "6"); - o.put("color.2", "7"); - o.put("color.3", "8"); - o.put("color.4", "3"); + Map object = new HashMap<>(4); + object.put("color.1", "6"); + object.put("color.2", "7"); + object.put("color.3", "8"); + object.put("color.4", "3"); if (!this.style.contains("color")) { - for (Entry node : o.entrySet()) { + for (Entry node : object.entrySet()) { this.style.set(node.getKey(), node.getValue()); } } From 011baba140386bbaa4e47516c90c574626f48b2e Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 16 Aug 2019 02:05:51 +0200 Subject: [PATCH 086/258] Update PlotSquared.java --- .../github/intellectualsites/plotsquared/plot/PlotSquared.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 174d88367..f92c6a6fb 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 @@ -1601,7 +1601,7 @@ import java.util.zip.ZipInputStream; this.version = PlotVersion.tryParse(versionString, commitString, dateString); Settings.DATE = new Date(100 + version.year, version.month, version.day).toGMTString(); - Settings.BUILD = "https://ci.athion.net/job/PlotSquared-Breaking/" + version.build; + Settings.BUILD = "https://ci.athion.net/job/PlotSquared-Releases/" + version.build; Settings.COMMIT = "https://github.com/IntellectualSites/PlotSquared/commit/" + Integer .toHexString(version.hash); From be20b2404b3a1d8cf23eb9259109b4c44c2fdddb Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 17 Aug 2019 01:48:43 +0200 Subject: [PATCH 087/258] OCD - Typo Fixes - Small amendments (Spelling) - Reformatting --- .../plotsquared/plot/commands/Biome.java | 2 +- .../plotsquared/plot/commands/Merge.java | 2 +- .../plotsquared/plot/commands/Set.java | 2 +- .../plotsquared/plot/commands/Trust.java | 2 +- .../plotsquared/plot/config/Captions.java | 501 +++++++----------- 5 files changed, 206 insertions(+), 303 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java index 487c5d7c0..8b9ecb790 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java @@ -17,7 +17,7 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; int biome = WorldUtil.IMP.getBiomeFromString(value); if (biome == -1) { String biomes = StringMan - .join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.getTranslated()); + .join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATOR.getTranslated()); Captions.NEED_BIOME.send(player); MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index fcf5650b2..179761f94 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -18,7 +18,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.UUID; @CommandDeclaration(command = "merge", aliases = "m", - description = "Merge the plot you are standing on, with another plot", + description = "Merge the plot you are standing on with another plot", permission = "plots.merge", usage = "/plot merge [removeroads]", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, confirmation = true) public class Merge extends SubCommand { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 982e03ae1..1f2d1c2a0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -128,7 +128,7 @@ import java.util.stream.IntStream; } MainUtil .sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan - .join(newValues, Captions.BLOCK_LIST_SEPARATER.formatted())); + .join(newValues, Captions.BLOCK_LIST_SEPARATOR.formatted())); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java index 4531d2737..c0cd3309e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java @@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.PLAYER, usage = "/plot trust ", - description = "Allow a user to build in a plot while you are offline", + description = "Allow a user to build in a plot and use WorldEdit while you are offline", category = CommandCategory.SETTINGS) public class Trust extends Command { public Trust() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index dca4f5b23..27f3fdeac 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -57,8 +57,8 @@ public enum Captions { PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"), PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"), - PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), PERMISSION_MERGE_KEEP_ROAD( - "plots.merge.keeproad", "static.permissions"), + PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), + PERMISSION_MERGE_KEEP_ROAD("plots.merge.keeproad", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"), PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"), PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"), @@ -68,8 +68,8 @@ public enum Captions { PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"), PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"), PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"), - PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT( - "plots.admin.build.heightlimit", "static.permissions"), + PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), + PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT("plots.admin.build.heightlimit", "static.permissions"), PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"), PERMISSION_ADMIN_COMMAND_RATE("plots.admin.command.rate", "static.permissions"), PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"), @@ -122,8 +122,8 @@ public enum Captions { PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"), PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"), PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"), - PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), PERMISSION_LIST_FOR_SALE( - "plots.list.forsale", "static.permissions"), + PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), + PERMISSION_LIST_FOR_SALE("plots.list.forsale", "static.permissions"), PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"), PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"), PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"), @@ -138,8 +138,8 @@ public enum Captions { PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"), PERMISSION_LIST_AREA("plots.list.area", "static.permissions"), PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"), - PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), PERMISSION_ADMIN_COMMAND_SET_OWNER( - "plots.admin.command.setowner", "static.permissions"), + PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), + PERMISSION_ADMIN_COMMAND_SET_OWNER("plots.admin.command.setowner", "static.permissions"), PERMISSION_COMMENT("plots.comment", "static.permissions"), PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"), PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"), @@ -164,20 +164,19 @@ public enum Captions { CONSOLE_JAVA_OUTDATED( "&cYour version of java is outdated. It is highly recommended that you update to Java 8 as it increases performance " + "and security. %s0 will require Java 8 in a future update.", - "static.console"), CONSOLE_PLEASE_ENABLE_METRICS( + "static.console"), + CONSOLE_PLEASE_ENABLE_METRICS( "&dPlease enable metrics for %s0. Using metrics improves plugin stability, performance, and features. " + "Bug fixes and new features are influenced on metrics.", "static.console"), // // EXPIRED_CONFIRM("$2Confirmation has expired, please run the command again!", "Confirm"), FAILED_CONFIRM("$2You have no pending actions to confirm!", "Confirm"), - REQUIRES_CONFIRM( - "$2Are you sure you wish to execute: $1%s$2?&-$2This cannot be undone! If you are sure: $1/plot confirm", - "Confirm"), + REQUIRES_CONFIRM("$2Are you sure you wish to execute: $1%s$2?&-$2This cannot be undone! If you are sure: $1/plot confirm", "Confirm"), // // - MOVE_SUCCESS("$4Successfully moved plot.", "Move"), COPY_SUCCESS("$4Successfully copied plot.", - "Move"), + MOVE_SUCCESS("$4Successfully moved plot.", "Move"), + COPY_SUCCESS("$4Successfully copied plot.", "Move"), REQUIRES_UNOWNED("$2The location specified is already occupied.", "Move"), // // @@ -186,8 +185,7 @@ public enum Captions { // // GENERATING_LINK("$1Processing plot...", "Web"), - GENERATING_LINK_FAILED( - "$2Failed to generate download link!", "Web"), + GENERATING_LINK_FAILED("$2Failed to generate download link!", "Web"), SAVE_FAILED("$2Failed to save", "Web"), LOAD_NULL("$2Please use $4/plot load $2to get a list of schematics", "Web"), LOAD_FAILED("$2Failed to load schematic", "Web"), @@ -200,212 +198,163 @@ public enum Captions { // CLUSTER_AVAILABLE_ARGS( "$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, " - + "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_LIST_HEADING( - "$2There are $1%s$2 clusters in this world", "Cluster"), CLUSTER_LIST_ELEMENT("$2 - $1%s&-", - "Cluster"), CLUSTER_INTERSECTION( - "$2The proposed area overlaps with: %s0", "Cluster"), CLUSTER_OUTSIDE( - "$2The proposed area is outside the plot area: %s0", "Cluster"), CLUSTER_ADDED( - "$4Successfully created the cluster.", "Cluster"), CLUSTER_DELETED( - "$4Successfully deleted the cluster.", "Cluster"), CLUSTER_RESIZED( - "$4Successfully resized the cluster.", "Cluster"), CLUSTER_ADDED_USER( - "$4Successfully added user to the cluster.", "Cluster"), CANNOT_KICK_PLAYER( - "$2You cannot kick that player", "Cluster"), CLUSTER_INVITED( - "$1You have been invited to the following cluster: $2%s", "Cluster"), CLUSTER_REMOVED( - "$1You have been removed from cluster: $2%s", "Cluster"), CLUSTER_KICKED_USER( - "$4Successfully kicked the user", "Cluster"), INVALID_CLUSTER( - "$1Invalid cluster name: $2%s", "Cluster"), CLUSTER_NOT_ADDED( - "$2That player was not added to the plot cluster", "Cluster"), CLUSTER_CANNOT_LEAVE( - "$1You must delete or transfer ownership before leaving", - "Cluster"), CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster", - "Cluster"), CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", - "Cluster"), CLUSTER_REGENERATED("$4Successfully started cluster regeneration", - "Cluster"), CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"), - CLUSTER_INFO( - "$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%", - "Cluster"), + + "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), + CLUSTER_LIST_HEADING("$2There are $1%s$2 clusters in this world", "Cluster"), + CLUSTER_LIST_ELEMENT("$2 - $1%s&-", "Cluster"), + CLUSTER_INTERSECTION("$2The proposed area overlaps with: %s0", "Cluster"), + CLUSTER_OUTSIDE("$2The proposed area is outside the plot area: %s0", "Cluster"), + CLUSTER_ADDED("$4Successfully created the cluster.", "Cluster"), + CLUSTER_DELETED("$4Successfully deleted the cluster.", "Cluster"), + CLUSTER_RESIZED("$4Successfully resized the cluster.", "Cluster"), + CLUSTER_ADDED_USER("$4Successfully added user to the cluster.", "Cluster"), + CANNOT_KICK_PLAYER("$2You cannot kick that player", "Cluster"), + CLUSTER_INVITED("$1You have been invited to the following cluster: $2%s", "Cluster"), + CLUSTER_REMOVED("$1You have been removed from cluster: $2%s", "Cluster"), + CLUSTER_KICKED_USER("$4Successfully kicked the user", "Cluster"), + INVALID_CLUSTER("$1Invalid cluster name: $2%s", "Cluster"), + CLUSTER_NOT_ADDED("$2That player was not added to the plot cluster", "Cluster"), + CLUSTER_CANNOT_LEAVE("$1You must delete or transfer ownership before leaving", "Cluster"), + CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster", "Cluster"), + CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", "Cluster"), + CLUSTER_REGENERATED("$4Successfully started cluster regeneration", "Cluster"), + CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"), + CLUSTER_INFO("$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%", "Cluster"), // // BORDER("$2You are outside the current map border", "Border"), // - // - UNCLAIM_SUCCESS("$4You successfully unclaimed the plot.", "Unclaim"), UNCLAIM_FAILED( - "$2Could not unclaim the plot", "Unclaim"), + // + UNCLAIM_SUCCESS("$4You successfully unclaimed the plot.", "Unclaim"), + UNCLAIM_FAILED("$2Could not unclaim the plot", "Unclaim"), // // - WORLDEDIT_DELAYED("$2Please wait while we process your WorldEdit action...", - "WorldEdit Masks"), WORLDEDIT_RUN("$2Apologies for the delay. Now executing: %s", - "WorldEdit Masks"), - REQUIRE_SELECTION_IN_MASK( - "$2%s of your selection is not within your plot mask. You can only make edits within your plot.", - "WorldEdit Masks"), WORLDEDIT_VOLUME( - "$2You cannot select a volume of %current%. The maximum volume you can modify is %max%.", - "WorldEdit Masks"), - - WORLDEDIT_ITERATIONS( - "$2You cannot iterate %current% times. The maximum number of iterations allowed is %max%.", - "WorldEdit Masks"), WORLDEDIT_UNSAFE("$2Access to that command has been blocked", - "WorldEdit Masks"), - - WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea", - "WorldEdit Masks"), WORLDEDIT_BYPASSED("$2Currently bypassing WorldEdit restriction.", - "WorldEdit Masks"), - - WORLDEDIT_UNMASKED("$1Your WorldEdit is now unrestricted.", - "WorldEdit Masks"), WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted.", - "WorldEdit Masks"), - - GAMEMODE_WAS_BYPASSED("$1You bypassed the GameMode ($2{gamemode}$1) $1set for $2{plot}", - "GameMode"), HEIGHT_LIMIT("$1This plot area has a height limit of $2{limit}", - "Height Limit"), + WORLDEDIT_DELAYED("$2Please wait while we process your WorldEdit action...", "WorldEdit Masks"), + WORLDEDIT_RUN("$2Apologies for the delay. Now executing: %s", "WorldEdit Masks"), + REQUIRE_SELECTION_IN_MASK("$2%s of your selection is not within your plot mask. You can only make edits within your plot.", "WorldEdit Masks"), + WORLDEDIT_VOLUME("$2You cannot select a volume of %current%. The maximum volume you can modify is %max%.", "WorldEdit Masks"), + WORLDEDIT_ITERATIONS("$2You cannot iterate %current% times. The maximum number of iterations allowed is %max%.", "WorldEdit Masks"), + WORLDEDIT_UNSAFE("$2Access to that command has been blocked","WorldEdit Masks"), + WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea", "WorldEdit Masks"), + WORLDEDIT_BYPASSED("$2Currently bypassing WorldEdit restriction.", "WorldEdit Masks"), + WORLDEDIT_UNMASKED("$1Your WorldEdit is now unrestricted.", "WorldEdit Masks"), + WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted.", "WorldEdit Masks"), + // + // + GAMEMODE_WAS_BYPASSED("$1You bypassed the gamemode ($2{gamemode}$1) $1set for $2{plot}", "GameMode"), + // + // + HEIGHT_LIMIT("$1This plot area has a height limit of $2{limit}", "Height Limit"), // // NOTIFY_ENTER("$2%player $2entered your plot ($1%plot$2)", "Records"), NOTIFY_LEAVE("$2%player $2left your plot ($1%plot$2)", "Records"), // // - SWAP_OVERLAP("$2The proposed areas are not allowed to overlap", "Swap"), SWAP_DIMENSIONS( - "$2The proposed areas must have comparable dimensions", "Swap"), - - SWAP_SYNTAX("$2/plot swap ", "Swap"), SWAP_SUCCESS("$4Successfully swapped plots", "Swap"), - + SWAP_OVERLAP("$2The proposed areas are not allowed to overlap", "Swap"), + SWAP_DIMENSIONS("$2The proposed areas must have comparable dimensions", "Swap"), + SWAP_SYNTAX("$2/plot swap ", "Swap"), + SWAP_SUCCESS("$4Successfully swapped plots", "Swap"), STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"), // - // - INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"), NOT_VALID_INBOX_INDEX( - "$2No comment at index %s", "Comment"), - - INBOX_ITEM("$2 - $4%s", "Comment"), COMMENT_SYNTAX("$2Use /plot comment [X;Z] <%s> ", - "Comment"), - - INVALID_INBOX("$2That is not a valid inbox.&-$1Accepted values: %s", "Comment"), NO_PERM_INBOX( - "$2You do not have permission for that inbox", "Comment"), - - NO_PERM_INBOX_MODIFY("$2You do not have permission to modify that inbox", - "Comment"), NO_PLOT_INBOX("$2You must stand in or supply a plot argument", "Comment"), - - COMMENT_REMOVED("$4Successfully deleted comment/s:n$2 - '$3%s$2'", "Comment"), COMMENT_ADDED( - "$4A comment has been left", "Comment"), - - COMMENT_HEADER("$2&m---------&r $1Comments $2&m---------&r", "Comment"), INBOX_EMPTY( - "$2No comments", "Comment"), + // + INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"), + NOT_VALID_INBOX_INDEX("$2No comment at index %s", "Comment"), + INBOX_ITEM("$2 - $4%s", "Comment"), + COMMENT_SYNTAX("$2Use /plot comment [X;Z] <%s> ", "Comment"), + INVALID_INBOX("$2That is not a valid inbox.&-$1Accepted values: %s", "Comment"), + NO_PERM_INBOX("$2You do not have permission for that inbox", "Comment"), + NO_PERM_INBOX_MODIFY("$2You do not have permission to modify that inbox","Comment"), + NO_PLOT_INBOX("$2You must stand in or supply a plot argument", "Comment"), + COMMENT_REMOVED("$4Successfully deleted comment/s:n$2 - '$3%s$2'", "Comment"), + COMMENT_ADDED("$4A comment has been left", "Comment"), + COMMENT_HEADER("$2&m---------&r $1Comments $2&m---------&r", "Comment"), + INBOX_EMPTY("$2No comments", "Comment"), // // - NOT_CONSOLE("$2For safety reasons, this command can only be executed by console.", - "Console"), IS_CONSOLE("$2This command can only be executed by a player.", "Console"), + NOT_CONSOLE("$2For safety reasons, this command can only be executed by console.", "Console"), + IS_CONSOLE("$2This command can only be executed by a player.", "Console"), // // - INVENTORY_USAGE("&cUsage: &6{usage}", "Inventory"), INVENTORY_DESC("&cDescription: &6{desc}", - "Inventory"), - + INVENTORY_USAGE("&cUsage: &6{usage}", "Inventory"), INVENTORY_DESC("&cDescription: &6{desc}", "Inventory"), INVENTORY_CATEGORY("&cCategory: &6{category}", "Inventory"), // // - CLIPBOARD_SET( - "$2The current plot is now copied to your clipboard, use $1/plot paste$2 to paste it", - "Clipboard"), PASTED( - "$4The plot selection was successfully pasted. It has been cleared from your clipboard.", - "Clipboard"), + CLIPBOARD_SET("$2The current plot is now copied to your clipboard, use $1/plot paste$2 to paste it", "Clipboard"), + PASTED("$4The plot selection was successfully pasted. It has been cleared from your clipboard.", "Clipboard"), - PASTE_FAILED("$2Failed to paste the selection. Reason: $2%s", "Clipboard"), NO_CLIPBOARD( - "$2You don't have a selection in your clipboard", "Clipboard"), - - CLIPBOARD_INFO( - "$2Current Selection - Plot ID: $1%id$2, Width: $1%width$2, Total Blocks: $1%total$2", - "Clipboard"), + PASTE_FAILED("$2Failed to paste the selection. Reason: $2%s", "Clipboard"), + NO_CLIPBOARD("$2You don't have a selection in your clipboard", "Clipboard"), + CLIPBOARD_INFO("$2Current Selection - Plot ID: $1%id$2, Width: $1%width$2, Total Blocks: $1%total$2", "Clipboard"), // // - TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"), TOGGLE_DISABLED("$2Disabled setting: %s", - "Toggle"), - + TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"), TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"), + // + // COMMAND_BLOCKED("$2That command is not allowed in this plot", "Blocked Command"), // // - - DONE_ALREADY_DONE("$2This plot is already marked as done", "Done"), DONE_NOT_DONE( - "$2This plot is not marked as done.", "Done"), - - DONE_INSUFFICIENT_COMPLEXITY( - "$2This plot is too simple. Please add more detail before using this command.", - "Done"), DONE_SUCCESS("$1Successfully marked this plot as done.", "Done"), - + DONE_ALREADY_DONE("$2This plot is already marked as done", "Done"), + DONE_NOT_DONE("$2This plot is not marked as done.", "Done"), + DONE_INSUFFICIENT_COMPLEXITY("$2This plot is too simple. Please add more detail before using this command.", "Done"), + DONE_SUCCESS("$1Successfully marked this plot as done.", "Done"), DONE_REMOVED("$1You may now continue building in this plot.", "Done"), // // - RATINGS_PURGED("$2Purged ratings for this plot", "Ratings"), RATING_NOT_VALID( - "$2You need to specify a number between 1 and 10", "Ratings"), - - RATING_ALREADY_EXISTS("$2You have already rated plot $2%s", "Ratings"), RATING_APPLIED( - "$4You successfully rated plot $2%s", "Ratings"), - - RATING_DISLIKED("$4You successfully disliked plot $2%s", "Ratings"), RATING_LIKED( - "$4You successfully liked plot $2%s", "Ratings"), - - RATING_NOT_YOUR_OWN("$2You cannot rate your own plot", "Ratings"), RATING_NOT_DONE( - "$2You can only rate finished plots.", "Ratings"), - + RATINGS_PURGED("$2Purged ratings for this plot", "Ratings"), + RATING_NOT_VALID("$2You need to specify a number between 1 and 10", "Ratings"), + RATING_ALREADY_EXISTS("$2You have already rated plot $2%s", "Ratings"), + RATING_APPLIED("$4You successfully rated plot $2%s", "Ratings"), + RATING_DISLIKED("$4You successfully disliked plot $2%s", "Ratings"), + RATING_LIKED("$4You successfully liked plot $2%s", "Ratings"), + RATING_NOT_YOUR_OWN("$2You cannot rate your own plot", "Ratings"), + RATING_NOT_DONE("$2You can only rate finished plots.", "Ratings"), RATING_NOT_OWNED("$2You cannot rate a plot that is not claimed by anyone", "Ratings"), // // - RATE_THIS("$2Rate this plot!", "Tutorial"), COMMENT_THIS( - "$2Leave some feedback on this plot: %s", "Tutorial"), + RATE_THIS("$2Rate this plot!", "Tutorial"), + COMMENT_THIS("$2Leave some feedback on this plot: %s", "Tutorial"), // // - ECON_DISABLED("$2Economy is not enabled", "Economy"), CANNOT_AFFORD_PLOT( - "$2You cannot afford to buy this plot. It costs $1%s", "Economy"), - - NOT_FOR_SALE("$2This plot is not for sale", "Economy"), CANNOT_BUY_OWN( - "$2You cannot buy your own plot", "Economy"), - - PLOT_SOLD("$4Your plot; $1%s0$4, has been sold to $1%s1$4 for $1$%s2", - "Economy"), CANNOT_AFFORD_MERGE("$2You cannot afford to merge the plots. It costs $1%s", - "Economy"), - - ADDED_BALANCE("$1%s $2has been added to your balance", "Economy"), REMOVED_BALANCE( - "$1%s $2has been taken from your balance", "Economy"), - + ECON_DISABLED("$2Economy is not enabled", "Economy"), + CANNOT_AFFORD_PLOT("$2You cannot afford to buy this plot. It costs $1%s", "Economy"), + NOT_FOR_SALE("$2This plot is not for sale", "Economy"), + CANNOT_BUY_OWN("$2You cannot buy your own plot", "Economy"), + PLOT_SOLD("$4Your plot; $1%s0$4, has been sold to $1%s1$4 for $1$%s2", "Economy"), + CANNOT_AFFORD_MERGE("$2You cannot afford to merge the plots. It costs $1%s", "Economy"), + ADDED_BALANCE("$1%s $2has been added to your balance", "Economy"), + REMOVED_BALANCE("$1%s $2has been taken from your balance", "Economy"), REMOVED_GRANTED_PLOT("$2You used %s plot grant(s), you've got $1%s $2left", "Economy"), // // - SETUP_INIT("$1Usage: $2/plot setup ", "Setup"), SETUP_STEP( - "$3[$1Step %s0$3] $1%s1 $2- $1Expecting: $2%s2 $1Default: $2%s3", "Setup"), - - SETUP_INVALID_ARG( - "$2%s0 is not a valid argument for step %s1. To cancel setup use: $1/plot setup cancel", - "Setup"), SETUP_VALID_ARG("$2Value $1%s0 $2set to %s1", "Setup"), - + SETUP_INIT("$1Usage: $2/plot setup ", "Setup"), + SETUP_STEP("$3[$1Step %s0$3] $1%s1 $2- $1Expecting: $2%s2 $1Default: $2%s3", "Setup"), + SETUP_INVALID_ARG("$2%s0 is not a valid argument for step %s1. To cancel setup use: $1/plot setup cancel", "Setup"), + SETUP_VALID_ARG("$2Value $1%s0 $2set to %s1", "Setup"), SETUP_FINISHED( "$4You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or " - + "your chosen world management plugin.", "Setup"), SETUP_WORLD_TAKEN( - "$2%s is already a world", "Setup"), - + + "your chosen world management plugin.", "Setup"), + SETUP_WORLD_TAKEN("$2%s is already a world", "Setup"), SETUP_MISSING_WORLD( "$2You need to specify a world name ($1/plot setup &l$1 $2)&-$1Additional commands:&-$2 - $1/plot setup &-$2 -" + " $1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), SETUP_MISSING_GENERATOR( "$2You need to specify a generator ($1/plot setup &l&r$2)&-$1Additional commands:&-$2 - $1/plot setup &-$2 - " + "$1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), - SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"), // - // - - SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", - "Schematics"), SCHEMATIC_MISSING_ARG( - "$2You need to specify an argument. Possible values: $1test $2 , $1save$2 , $1paste $2, $1exportall$2, $1list", - "Schematics"), - - SCHEMATIC_INVALID("$2That is not a valid schematic. Reason: $2%s", - "Schematics"), SCHEMATIC_VALID("$2That is a valid schematic", "Schematics"), - - SCHEMATIC_PASTE_FAILED("$2Failed to paste the schematic", - "Schematics"), SCHEMATIC_PASTE_SUCCESS("$4The schematic pasted successfully", "Schematics"), - + // + SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"), + SCHEMATIC_MISSING_ARG("$2You need to specify an argument. Possible values: $1test $2 , $1save$2 , $1paste $2, $1exportall$2, $1list", "Schematics"), + SCHEMATIC_INVALID("$2That is not a valid schematic. Reason: $2%s", "Schematics"), + SCHEMATIC_VALID("$2That is a valid schematic", "Schematics"), + SCHEMATIC_PASTE_FAILED("$2Failed to paste the schematic", "Schematics"), + SCHEMATIC_PASTE_SUCCESS("$4The schematic pasted successfully", "Schematics"), SCHEMATIC_LIST("$4Saved Schematics: $1%s", "Schematics"), SCHEMATIC_ROAD_CREATED("$1Saved new road schematic. To test the schematic, fly to a few other plots and run /plot debugroadregen", "Schematics"), MCA_FILE_SIZE("$1Note: The `.mca` files are 512x512", "Schematics"), SCHEMATIC_EXPORTALL_STARTED("$1Starting export...", "Schematics"), - SCHEMATIC_EXPORTALL_WORLD_ARGS("$1Need world argument. Use $3/plot sch exportall ", "Schematics"), - SCHEMATIC_EXPORTALL_WORLD("$1Invalid world. Use &3/plot sch exportall ", "Schematic"), - SCHEMATIC_EXPORTALL_MASS_STARTED("$1Schematic mass export has been started. This may take a while", "Schematics"), + SCHEMATIC_EXPORTALL_WORLD_ARGS("$1Need world argument. Use $3/plot schem exportall ", "Schematics"), + SCHEMATIC_EXPORTALL_WORLD("$1Invalid world. Use &3/plot sch exportall ", "Schematics"), + SCHEMATIC_EXPORTALL_MASS_STARTED("$1Schematic mass export has been started. This may take a while", "Schematicss"), SCHEMATIC_EXPORTALL_COUNT("$1Found $3%s $1plots...", "Schematics"), SCHEMATIC_EXPORTALL_FINISHED("$1Finished mass export", "Schematics"), SCHEMATIC_EXPORTALL_SINGLE_FINISHED("$1Finished export", "Schematics"), @@ -425,75 +374,58 @@ public enum Captions { RELOADED_CONFIGS("$1Translations and world settings have been reloaded", "Reload"), RELOAD_FAILED("$2Failed to reload file configurations", "Reload"), // - // + // DESC_SET("$2Plot description set", "Desc"), DESC_UNSET("$2Plot description unset", "Desc"), MISSING_DESC("$2You need to specify a description", "Desc"), // // - - ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), ALIAS_REMOVED("$2Plot alias removed", - "Alias"), - - MISSING_ALIAS("$2You need to specify an alias", "Alias"), ALIAS_TOO_LONG( - "$2The alias must be < 50 characters in length", "Alias"), - + ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), + ALIAS_REMOVED("$2Plot alias removed", "Alias"), + MISSING_ALIAS("$2You need to specify an alias", "Alias"), + ALIAS_TOO_LONG("$2The alias must be < 50 characters in length", "Alias"), ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"), // // - - MISSING_POSITION("$2You need to specify a position. Possible values: $1none", - "Position"), POSITION_SET("$1Home position set to your current location", "Position"), - - POSITION_UNSET("$1Home position reset to the default location", "Position"), HOME_ARGUMENT( - "$2Use /plot set home [none]", "Position"), - + MISSING_POSITION("$2You need to specify a position. Possible values: $1none", "Position"), + POSITION_SET("$1Home position set to your current location", "Position"), + POSITION_UNSET("$1Home position reset to the default location", "Position"), + HOME_ARGUMENT("$2Use /plot set home [none]", "Position"), INVALID_POSITION("$2That is not a valid position value", "Position"), // // - ENTITY_CAP("$2You are not allowed to spawn more mobs", "cap"), + ENTITY_CAP("$2You are not allowed to spawn more mobs", "Cap"), // // - NO_SCHEMATIC_PERMISSION("$2You don't have the permission required to use schematic $1%s", - "Permission"), + NO_SCHEMATIC_PERMISSION("$2You don't have the permission required to use schematic $1%s", "Permission"), NO_PERMISSION("$2You are lacking the permission node: $1%s", "Permission"), NO_PERMISSION_EVENT("$2You are lacking the permission node: $1%s", "Permission"), NO_PLOT_PERMS("$2You must be the plot owner to perform this action", "Permission"), CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots.", "Permission"), CANT_CLAIM_MORE_CLUSTERS("$2You can't claim more clusters.", "Permission"), - - CANT_TRANSFER_MORE_PLOTS("$2You can't send more plots to that user", - "Permission"), CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once", - "Permission"), - + CANT_TRANSFER_MORE_PLOTS("$2You can't send more plots to that user", "Permission"), + CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once", "Permission"), // // - MERGE_NOT_VALID("$2This merge request is no longer valid.", "Merge"), MERGE_ACCEPTED( - "$2The merge request has been accepted", "Merge"), - - SUCCESS_MERGE("$2Plots have been merged!", "Merge"), MERGE_REQUESTED( - "$2Successfully sent a merge request", "Merge"), - - MERGE_REQUEST_CONFIRM("Merge request from %s", "Permission"), NO_PERM_MERGE( - "$2You are not the owner of the plot: $1%plot%", "Merge"), - - NO_AVAILABLE_AUTOMERGE( - "$2You do not own any adjacent plots in the specified direction or are not allowed to merge to the required size.", - "Merge"), + MERGE_NOT_VALID("$2This merge request is no longer valid.", "Merge"), + MERGE_ACCEPTED("$2The merge request has been accepted", "Merge"), + SUCCESS_MERGE("$2Plots have been merged!", "Merge"), + MERGE_REQUESTED("$2Successfully sent a merge request", "Merge"), + MERGE_REQUEST_CONFIRM("Merge request from %s", "Permission"), + NO_PERM_MERGE("$2You are not the owner of the plot: $1%plot%", "Merge"), + NO_AVAILABLE_AUTOMERGE("$2You do not own any adjacent plots in the specified direction or are not allowed to merge to the required size.", "Merge"), UNLINK_REQUIRED("$2An unlink is required to do this.", "Merge"), UNMERGE_CANCELLED("$1Unlink has been cancelled", "Merge"), - UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"), UNLINK_SUCCESS( - "$2Successfully unlinked plots.", "Merge"), + UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"), + UNLINK_SUCCESS("$2Successfully unlinked plots.", "Merge"), // // - NOT_VALID_SUBCOMMAND("$2That is not a valid subcommand", "CommandConfig"), DID_YOU_MEAN( - "$2Did you mean: $1%s", "CommandConfig"), - - NAME_LITTLE("$2%s0 name is too short, $1%s1$2<$1%s3", "CommandConfig"), NO_COMMANDS( - "$2I'm sorry, but you're not permitted to use any subcommands.", "CommandConfig"), - - SUBCOMMAND_SET_OPTIONS_HEADER("$2Possible Values: ", "CommandConfig"), COMMAND_SYNTAX( - "$1Usage: $2%s", "CommandConfig"), + NOT_VALID_SUBCOMMAND("$2That is not a valid subcommand", "CommandConfig"), + DID_YOU_MEAN("$2Did you mean: $1%s", "CommandConfig"), + NAME_LITTLE("$2%s0 name is too short, $1%s1$2<$1%s3", "CommandConfig"), + NO_COMMANDS("$2I'm sorry, but you're not permitted to use any subcommands.", "CommandConfig"), + SUBCOMMAND_SET_OPTIONS_HEADER("$2Possible Values: ", "CommandConfig"), + COMMAND_SYNTAX("$1Usage: $2%s", "CommandConfig"), // // INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"), @@ -505,75 +437,61 @@ public enum Captions { NO_FREE_PLOTS("$2There are no free plots available", "Errors"), NOT_IN_PLOT("$2You're not in a plot", "Errors"), NOT_LOADED("$2The plot could not be loaded", "Errors"), - NOT_IN_CLUSTER( - "$2You must be within a plot cluster to perform that action", "Errors"), + NOT_IN_CLUSTER("$2You must be within a plot cluster to perform that action", "Errors"), NOT_IN_PLOT_WORLD("$2You're not in a plot area", "Errors"), PLOTWORLD_INCOMPATIBLE("$2The two worlds must be compatible", "Errors"), NOT_VALID_WORLD("$2That is not a valid world (case sensitive)", "Errors"), NOT_VALID_PLOT_WORLD("$2That is not a valid plot area (case sensitive)", "Errors"), NO_PLOTS("$2You don't have any plots", "Errors"), - WAIT_FOR_TIMER( - "$2A set block timer is bound to either the current plot or you. Please wait for it to finish", - "Errors"), + WAIT_FOR_TIMER("$2A set block timer is bound to either the current plot or you. Please wait for it to finish", "Errors"), TASK_IN_PROCESS("$1Task is already running.", "Error"), // + // DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"), - + // + // PURGE_SUCCESS("$4Successfully purged %s plots", "Purge"), - + // // TRIM_IN_PROGRESS("A world trim task is already in progress!", "Trim"), NOT_VALID_HYBRID_PLOT_WORLD("The hybrid plot manager is required to perform this action", "Trim"), // // - - BLOCK_LIST_SEPARATER("$1,$2 ", "Block List"), + BLOCK_LIST_SEPARATOR("$1,$2 ", "Block List"), // // - - NEED_BIOME("$2You need to specify a valid biome.", "Biome"), BIOME_SET_TO( - "$2Plot biome set to $2", "Biome"), + NEED_BIOME("$2You need to specify a valid biome.", "Biome"), + BIOME_SET_TO("$2Plot biome set to $2", "Biome"), // // - - TELEPORTED_TO_PLOT("$1You have been teleported", "Teleport"), TELEPORTED_TO_ROAD( - "$2You got teleported to the road", "Teleport"), - - TELEPORT_IN_SECONDS("$1Teleporting in %s seconds. Do not move...", "Teleport"), TELEPORT_FAILED( - "$2Teleportation cancelled due to movement or damage", "Teleport"), + TELEPORTED_TO_PLOT("$1You have been teleported", "Teleport"), + TELEPORTED_TO_ROAD("$2You got teleported to the road", "Teleport"), + TELEPORT_IN_SECONDS("$1Teleporting in %s seconds. Do not move...", "Teleport"), + TELEPORT_FAILED("$2Teleportation cancelled due to movement or damage", "Teleport"), // // - SET_BLOCK_ACTION_FINISHED("$1The last setblock action is now finished.", "Set Block"), // - // - - DEBUGALLOWUNSAFE_ON("$2Unsafe actions allowed", "unsafe"), DEBUGALLOWUNSAFE_OFF( - "$2Unsafe actions disabled", "unsafe"), + // + DEBUGALLOWUNSAFE_ON("$2Unsafe actions allowed", "unsafe"), + DEBUGALLOWUNSAFE_OFF("$2Unsafe actions disabled", "unsafe"), // // - - DEBUG_HEADER("$1Debug Information&-", "Debug"), DEBUG_SECTION("$2>> $1&l%val%", "Debug"), - + DEBUG_HEADER("$1Debug Information&-", "Debug"), + DEBUG_SECTION("$2>> $1&l%val%", "Debug"), DEBUG_LINE("$2>> $1%var%$2:$1 %val%&-", "Debug"), // // - - NOT_VALID_DATA("$2That's not a valid data id.", "Invalid"), NOT_VALID_BLOCK( - "$2That's not a valid block: %s", "Invalid"), - - NOT_ALLOWED_BLOCK("$2That block is not allowed: %s", "Invalid"), NOT_VALID_NUMBER( - "$2That's not a valid number within the range: %s", "Invalid"), - - NOT_VALID_PLOT_ID("$2That's not a valid plot id.", "Invalid"), PLOT_ID_FORM( - "$2The plot id must be in the form: $1X;Y $2e.g. $1-5;7", "Invalid"), - - NOT_YOUR_PLOT("$2That is not your plot.", "Invalid"), NO_SUCH_PLOT("$2There is no such plot", - "Invalid"), - - PLAYER_HAS_NOT_BEEN_ON("$2That player hasn't been in the plotworld", "Invalid"), FOUND_NO_PLOTS( - "$2Found no plots with your search query", "Invalid"), - + NOT_VALID_DATA("$2That's not a valid data id.", "Invalid"), + NOT_VALID_BLOCK("$2That's not a valid block: %s", "Invalid"), + NOT_ALLOWED_BLOCK("$2That block is not allowed: %s", "Invalid"), + NOT_VALID_NUMBER("$2That's not a valid number within the range: %s", "Invalid"), + NOT_VALID_PLOT_ID("$2That's not a valid plot id.", "Invalid"), + PLOT_ID_FORM("$2The plot id must be in the form: $1X;Y $2e.g. $1-5;7", "Invalid"), + NOT_YOUR_PLOT("$2That is not your plot.", "Invalid"), + NO_SUCH_PLOT("$2There is no such plot", "Invalid"), + PLAYER_HAS_NOT_BEEN_ON("$2That player hasn't been in the plotworld", "Invalid"), + FOUND_NO_PLOTS("$2Found no plots with your search query", "Invalid"), FOUND_NO_PLOTS_FOR_PLAYER("$2No plots found for player: %s", "Invalid"), // // @@ -588,43 +506,33 @@ public enum Captions { // // NONE("None", "Info"), NOW("Now", "Info"), - NEVER("Never", "Info"), UNKNOWN("Unknown", "Info"), - SERVER("Server", "Info"), - EVERYONE("Everyone", "Info"), - PLOT_UNOWNED( - "$2The current plot must have an owner to perform this action", "Info"), - - PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), PLOT_INFO_HEADER( - "$3&m---------&r $1INFO $3&m---------", false, "Info"), - + PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"), + PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), + PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"), PLOT_INFO_HIDDEN("$2You cannot view the information about this plot", "Info"), - PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner: $2%owner%$1&-" + "$1Biome: $2%biome%$1&-" + "$1Can Build: $2%build%$1&-" + "$1Rating: $2%rating%&-" + "$1Seen: $2%seen%&-" + "$1Trusted: $2%trusted%$1&-" + "$1Members: $2%members%$1&-" + "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"), - PLOT_INFO_FOOTER( - "$3&m---------&r $1INFO $3&m---------", false, "Info"), - + PLOT_INFO_FOOTER("$3&m---------&r $1INFO $3&m---------", false, "Info"), PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), PLOT_INFO_MEMBERS("$1Members:$2 %members%", "Info"), - - PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"), PLOT_INFO_FLAGS("$1Flags:$2 %flags%", "Info"), - - PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"), PLOT_INFO_RATING("$1Rating:$2 %rating%", "Info"), - + PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"), + PLOT_INFO_FLAGS("$1Flags:$2 %flags%", "Info"), + PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"), + PLOT_INFO_RATING("$1Rating:$2 %rating%", "Info"), PLOT_INFO_LIKES("$1Like Ratio:$2 %likes%%", "Info"), - - PLOT_INFO_OWNER("$1Owner:$2 %owner%", "Info"), PLOT_INFO_ID("$1ID:$2 %id%", "Info"), - - PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"), PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"), - - PLOT_INFO_SEEN("$1Seen:$2 %seen%", "Info"), PLOT_USER_LIST(" $1%user%$2,", "Info"), - - PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"), INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"), + PLOT_INFO_OWNER("$1Owner:$2 %owner%", "Info"), + PLOT_INFO_ID("$1ID:$2 %id%", "Info"), + PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"), + PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"), + PLOT_INFO_SEEN("$1Seen:$2 %seen%", "Info"), + PLOT_USER_LIST(" $1%user%$2,", "Info"), + PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"), + INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"), // // GENERATING_COMPONENT("$1Started generating component from your settings", "Working"), @@ -660,7 +568,9 @@ public enum Captions { YOU_GOT_DENIED("$4You are denied from the plot you were previously on, and got teleported to spawn", "Deny"), CANT_REMOVE_OWNER("$2You can't remove the plot owner", "Deny"), // + // YOU_GOT_KICKED("$4You got kicked!", "Kick"), + // // FLAG_KEY("$2Key: %s", "Flag"), FLAG_TYPE("$2Type: %s", "Flag"), @@ -684,15 +594,13 @@ public enum Captions { // REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"), ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"), - ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"), - MEMBER_REMOVED("$1You successfully removed a user from the plot", "Member"), MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"), PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"), // - // + // SET_OWNER("$4You successfully set the plot owner", "Owner"), SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"), NOW_OWNER("$4You are now owner of plot %s", "Owner"), @@ -712,10 +620,8 @@ public enum Captions { HELP_DISPLAY_ALL_COMMANDS("Display all commands", "Help"), DIRECTION("$1Current direction: %dir%", "Help"), // - - BUCKET_ENTRIES_IGNORED( - "$2Total bucket values add up to 1 or more. Blocks without a spcified chance will be ignored", - "Generator_Bucket"), + // + BUCKET_ENTRIES_IGNORED("$2Total bucket values add up to 1 or more. Blocks without a specified chance will be ignored", "Generator_Bucket"), /** * Command Categories @@ -730,7 +636,6 @@ public enum Captions { COMMAND_CATEGORY_DEBUG("Debug", "Category"), COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), - // GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), GRANTED_PLOT("$1You granted %s0 plot to $2%s1", "Grants"), @@ -740,18 +645,16 @@ public enum Captions { /** * Legacy Configuration Conversion */ - LEGACY_CONFIG_FOUND("A legacy configuration file was detected. Conversion will be attempted.", - "LegacyConfig"), LEGACY_CONFIG_BACKUP( - "A copy of worlds.yml $1have been saved in the file worlds.yml.old$1.", - "LegacyConfig"), LEGACY_CONFIG_REPLACED("> %s has been replaced with %s", - "LegacyConfig"), LEGACY_CONFIG_DONE( + LEGACY_CONFIG_FOUND("A legacy configuration file was detected. Conversion will be attempted.", "LegacyConfig"), + LEGACY_CONFIG_BACKUP("A copy of worlds.yml $1have been saved in the file worlds.yml.old$1.", "LegacyConfig"), + LEGACY_CONFIG_REPLACED("> %s has been replaced with %s", "LegacyConfig"), + LEGACY_CONFIG_DONE( "The conversion has finished. PlotSquared will now be disabled and the new configuration file will" + " be used at next startup. Please review the new worlds.yml file. " + "Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. " + "You need to re-generate the schematics.", - "LegacyConfig"), LEGACY_CONFIG_CONVERSION_FAILED( - "Failed to convert the legacy configuration file. See stack trace for information.", "LegacyConfig"), + LEGACY_CONFIG_CONVERSION_FAILED("Failed to convert the legacy configuration file. See stack trace for information.", "LegacyConfig"), CUSTOM_STRING("-", "-"); //@formatter:on From 1cf85ff2c68fff501ddd3406f4d853479254f517 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 17 Aug 2019 02:19:29 +0200 Subject: [PATCH 088/258] Removed unused translation strings And added a new alias --- .../plotsquared/plot/commands/Delete.java | 2 +- .../plotsquared/plot/config/Captions.java | 62 +++---------------- 2 files changed, 8 insertions(+), 56 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java index 16f10b7b0..3593de74f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java @@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.*; @CommandDeclaration(command = "delete", permission = "plots.delete", description = "Delete the plot you stand on", usage = "/plot delete", - aliases = {"dispose", "del"}, category = CommandCategory.CLAIMING, + aliases = {"dispose", "del", "unclaim"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, confirmation = true) public class Delete extends SubCommand { // Note: To delete a specific plot use /plot delete diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 27f3fdeac..5caac5718 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -223,21 +223,9 @@ public enum Captions { // BORDER("$2You are outside the current map border", "Border"), // - // - UNCLAIM_SUCCESS("$4You successfully unclaimed the plot.", "Unclaim"), - UNCLAIM_FAILED("$2Could not unclaim the plot", "Unclaim"), - // // - WORLDEDIT_DELAYED("$2Please wait while we process your WorldEdit action...", "WorldEdit Masks"), - WORLDEDIT_RUN("$2Apologies for the delay. Now executing: %s", "WorldEdit Masks"), - REQUIRE_SELECTION_IN_MASK("$2%s of your selection is not within your plot mask. You can only make edits within your plot.", "WorldEdit Masks"), - WORLDEDIT_VOLUME("$2You cannot select a volume of %current%. The maximum volume you can modify is %max%.", "WorldEdit Masks"), - WORLDEDIT_ITERATIONS("$2You cannot iterate %current% times. The maximum number of iterations allowed is %max%.", "WorldEdit Masks"), - WORLDEDIT_UNSAFE("$2Access to that command has been blocked","WorldEdit Masks"), WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea", "WorldEdit Masks"), WORLDEDIT_BYPASSED("$2Currently bypassing WorldEdit restriction.", "WorldEdit Masks"), - WORLDEDIT_UNMASKED("$1Your WorldEdit is now unrestricted.", "WorldEdit Masks"), - WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted.", "WorldEdit Masks"), // // GAMEMODE_WAS_BYPASSED("$1You bypassed the gamemode ($2{gamemode}$1) $1set for $2{plot}", "GameMode"), @@ -254,7 +242,6 @@ public enum Captions { SWAP_DIMENSIONS("$2The proposed areas must have comparable dimensions", "Swap"), SWAP_SYNTAX("$2/plot swap ", "Swap"), SWAP_SUCCESS("$4Successfully swapped plots", "Swap"), - STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"), // // INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"), @@ -274,20 +261,12 @@ public enum Captions { NOT_CONSOLE("$2For safety reasons, this command can only be executed by console.", "Console"), IS_CONSOLE("$2This command can only be executed by a player.", "Console"), // - // - INVENTORY_USAGE("&cUsage: &6{usage}", "Inventory"), INVENTORY_DESC("&cDescription: &6{desc}", "Inventory"), - INVENTORY_CATEGORY("&cCategory: &6{category}", "Inventory"), - // // - CLIPBOARD_SET("$2The current plot is now copied to your clipboard, use $1/plot paste$2 to paste it", "Clipboard"), - PASTED("$4The plot selection was successfully pasted. It has been cleared from your clipboard.", "Clipboard"), - PASTE_FAILED("$2Failed to paste the selection. Reason: $2%s", "Clipboard"), - NO_CLIPBOARD("$2You don't have a selection in your clipboard", "Clipboard"), - CLIPBOARD_INFO("$2Current Selection - Plot ID: $1%id$2, Width: $1%width$2, Total Blocks: $1%total$2", "Clipboard"), // // - TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"), TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"), + TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"), + TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"), // // COMMAND_BLOCKED("$2That command is not allowed in this plot", "Blocked Command"), @@ -366,7 +345,6 @@ public enum Captions { PREFIX_FAREWELL("$1%id%$2> ", "Titles"), // // - TASK_START("Starting task...", "Core"), PREFIX("$3[$1P2$3] $2", "Core"), ENABLED("$1%s0 is now enabled", "Core"), // @@ -377,24 +355,17 @@ public enum Captions { // DESC_SET("$2Plot description set", "Desc"), DESC_UNSET("$2Plot description unset", "Desc"), - MISSING_DESC("$2You need to specify a description", "Desc"), // // ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), ALIAS_REMOVED("$2Plot alias removed", "Alias"), - MISSING_ALIAS("$2You need to specify an alias", "Alias"), ALIAS_TOO_LONG("$2The alias must be < 50 characters in length", "Alias"), ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"), // // - MISSING_POSITION("$2You need to specify a position. Possible values: $1none", "Position"), POSITION_SET("$1Home position set to your current location", "Position"), POSITION_UNSET("$1Home position reset to the default location", "Position"), HOME_ARGUMENT("$2Use /plot set home [none]", "Position"), - INVALID_POSITION("$2That is not a valid position value", "Position"), - // - // - ENTITY_CAP("$2You are not allowed to spawn more mobs", "Cap"), // // NO_SCHEMATIC_PERMISSION("$2You don't have the permission required to use schematic $1%s", "Permission"), @@ -414,7 +385,6 @@ public enum Captions { MERGE_REQUEST_CONFIRM("Merge request from %s", "Permission"), NO_PERM_MERGE("$2You are not the owner of the plot: $1%plot%", "Merge"), NO_AVAILABLE_AUTOMERGE("$2You do not own any adjacent plots in the specified direction or are not allowed to merge to the required size.", "Merge"), - UNLINK_REQUIRED("$2An unlink is required to do this.", "Merge"), UNMERGE_CANCELLED("$1Unlink has been cancelled", "Merge"), UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"), UNLINK_SUCCESS("$2Successfully unlinked plots.", "Merge"), @@ -422,13 +392,10 @@ public enum Captions { // NOT_VALID_SUBCOMMAND("$2That is not a valid subcommand", "CommandConfig"), DID_YOU_MEAN("$2Did you mean: $1%s", "CommandConfig"), - NAME_LITTLE("$2%s0 name is too short, $1%s1$2<$1%s3", "CommandConfig"), - NO_COMMANDS("$2I'm sorry, but you're not permitted to use any subcommands.", "CommandConfig"), SUBCOMMAND_SET_OPTIONS_HEADER("$2Possible Values: ", "CommandConfig"), COMMAND_SYNTAX("$1Usage: $2%s", "CommandConfig"), // // - INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"), INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"), INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"), INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"), @@ -454,7 +421,6 @@ public enum Captions { // // TRIM_IN_PROGRESS("A world trim task is already in progress!", "Trim"), - NOT_VALID_HYBRID_PLOT_WORLD("The hybrid plot manager is required to perform this action", "Trim"), // // BLOCK_LIST_SEPARATOR("$1,$2 ", "Block List"), @@ -482,31 +448,23 @@ public enum Captions { DEBUG_LINE("$2>> $1%var%$2:$1 %val%&-", "Debug"), // // - NOT_VALID_DATA("$2That's not a valid data id.", "Invalid"), NOT_VALID_BLOCK("$2That's not a valid block: %s", "Invalid"), NOT_ALLOWED_BLOCK("$2That block is not allowed: %s", "Invalid"), NOT_VALID_NUMBER("$2That's not a valid number within the range: %s", "Invalid"), NOT_VALID_PLOT_ID("$2That's not a valid plot id.", "Invalid"), - PLOT_ID_FORM("$2The plot id must be in the form: $1X;Y $2e.g. $1-5;7", "Invalid"), - NOT_YOUR_PLOT("$2That is not your plot.", "Invalid"), - NO_SUCH_PLOT("$2There is no such plot", "Invalid"), - PLAYER_HAS_NOT_BEEN_ON("$2That player hasn't been in the plotworld", "Invalid"), FOUND_NO_PLOTS("$2Found no plots with your search query", "Invalid"), - FOUND_NO_PLOTS_FOR_PLAYER("$2No plots found for player: %s", "Invalid"), // // - NEED_PLOT_NUMBER("$2You've got to specify a plot number or alias", "Need"), NEED_BLOCK("$2You've got to specify a block", "Need"), - NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"), - NEED_PLOT_WORLD("$2You've got to specify a plot area.", "Need"), - NEED_USER("$2You need to specify a username", "Need"), // // PLOT_NEAR("$1Players: %s0", "Near"), // // - NONE("None", "Info"), NOW("Now", "Info"), - NEVER("Never", "Info"), UNKNOWN("Unknown", "Info"), + NONE("None", "Info"), + NOW("Now", "Info"), + NEVER("Never", "Info"), + UNKNOWN("Unknown", "Info"), SERVER("Server", "Info"), EVERYONE("Everyone", "Info"), PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"), @@ -532,11 +490,10 @@ public enum Captions { PLOT_INFO_SEEN("$1Seen:$2 %seen%", "Info"), PLOT_USER_LIST(" $1%user%$2,", "Info"), PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"), - INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"), + INFO_SYNTAX_CONSOLE("$2/plot info X;Z", "Info"), // // GENERATING_COMPONENT("$1Started generating component from your settings", "Working"), - CLEARING_PLOT("$2Clearing plot async.", "Working"), CLEARING_DONE("$4Clear completed! Took %sms.", "Working"), DELETING_DONE("$4Delete completed! Took %sms.", "Working"), PLOT_NOT_CLAIMED("$2Plot not claimed", "Working"), @@ -561,7 +518,6 @@ public enum Captions { PLOT_CHAT_OFF("$4Plot chat disabled.", "Chat"), // // - DENIED_REMOVED("$4You successfully undenied the player from this plot", "Deny"), DENIED_ADDED("$4You successfully denied the player from this plot", "Deny"), DENIED_NEED_ARGUMENT("$2Arguments are missing. $1/plot denied add $2or $1/plot denied remove ", "Deny"), WAS_NOT_DENIED("$2That player was not denied on this plot", "Deny"), @@ -578,7 +534,6 @@ public enum Captions { NOT_VALID_FLAG("$2That is not a valid flag", "Flag"), NOT_VALID_FLAG_SUGGESTED("$2That is not a valid flag. Did you mean: $1%s", "Flag"), NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"), - FLAG_NOT_IN_PLOT("$2The plot does not have that flag", "Flag"), FLAG_NOT_REMOVED("$2The flag could not be removed", "Flag"), FLAG_NOT_ADDED("$2The flag could not be added", "Flag"), FLAG_REMOVED("$4Successfully removed flag", "Flag"), @@ -587,8 +542,6 @@ public enum Captions { // // TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), - TRUSTED_REMOVED("$4You successfully removed a trusted user from the plot", "Trusted"), - WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), PLOT_REMOVED_USER("$1Plot %s of which you were added to has been deleted due to owner inactivity", "Trusted"), // // @@ -596,7 +549,6 @@ public enum Captions { ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"), ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"), - MEMBER_REMOVED("$1You successfully removed a user from the plot", "Member"), MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"), PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"), // From c6a420626631b7f85634ba1235bd77cbbf833dcb Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 17 Aug 2019 17:06:17 +0200 Subject: [PATCH 089/258] Fix Typo --- .../plotsquared/plot/generator/HybridUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 135149279..84c487bdb 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 @@ -183,7 +183,7 @@ public abstract class HybridUtils { ChunkLoc loc = iterator.next(); iterator.remove(); PlotSquared.debug("&3Updating .mcr: " + loc.x + ", " + loc.z - + " (aprrox 1024 chunks)"); + + " (approx 1024 chunks)"); PlotSquared.debug(" - Remaining: " + regions.size()); chunks.addAll(getChunks(loc)); System.gc(); From 920796d8ec6a87957de6e08a3042fe2f7966120a Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sat, 17 Aug 2019 16:28:53 -0400 Subject: [PATCH 090/258] Fixed #2468 --- .../plotsquared/plot/util/block/DelegateLocalBlockQueue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index a89597fcf..0c797c706 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -8,7 +8,7 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { private final LocalBlockQueue parent; public DelegateLocalBlockQueue(LocalBlockQueue parent) { - super(parent.getWorld()); + super(parent == null ? null : parent.getWorld()); this.parent = parent; } From 008237b2a45871a48917f9b839817034ac3ff95c Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sat, 17 Aug 2019 18:40:39 -0400 Subject: [PATCH 091/258] Fixed #2469 --- .../plotsquared/bukkit/BukkitMain.java | 19 ++++++++++--------- .../plotsquared/bukkit/util/SendChunk.java | 4 +--- 2 files changed, 11 insertions(+), 12 deletions(-) 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 64d156130..0bba5cc09 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 @@ -54,8 +54,8 @@ import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; + import java.io.File; import java.lang.reflect.Method; import java.util.ArrayList; @@ -598,14 +598,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } @Override public QueueProvider initBlockQueue() { - try { - new SendChunk(); - MainUtil.canSendChunk = true; - } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) { - PlotSquared.debug( - SendChunk.class + " does not support " + StringMan.getString(getServerVersion())); - MainUtil.canSendChunk = false; - } + //TODO Figure out why this code is still here yet isn't being called anywhere. + // try { + // new SendChunk(); + // MainUtil.canSendChunk = true; + // } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) { + // PlotSquared.debug( + // SendChunk.class + " does not support " + StringMan.getString(getServerVersion())); + // MainUtil.canSendChunk = false; + // } return QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class); } 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 6ed7317b6..cb525199c 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 @@ -42,7 +42,6 @@ public class SendChunk { * Constructor. */ public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { - RefConstructor tempMapChunk; RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer"); this.methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle"); RefClass classCraftChunk = getRefClass("{cb}.CraftChunk"); @@ -50,8 +49,7 @@ public class SendChunk { RefClass classChunk = getRefClass("{nms}.Chunk"); this.methodInitLighting = classChunk.getMethod("initLighting"); RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk"); - tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class); - this.mapChunk = tempMapChunk; + this.mapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class); RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer"); this.connection = classEntityPlayer.getField("playerConnection"); RefClass classPacket = getRefClass("{nms}.Packet"); From e5da93f359ddcad40d0a5217825007c50f53ce49 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sat, 17 Aug 2019 18:42:31 -0400 Subject: [PATCH 092/258] Added a null check for the very unlikely chance that the command isn't found. --- .../intellectualsites/plotsquared/bukkit/BukkitMain.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 0bba5cc09..15e1ef219 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 @@ -289,9 +289,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public void registerCommands() { final BukkitCommand bukkitCommand = new BukkitCommand(); final PluginCommand plotCommand = getCommand("plots"); - plotCommand.setExecutor(bukkitCommand); - plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot")); - plotCommand.setTabCompleter(bukkitCommand); + if (plotCommand != null) { + plotCommand.setExecutor(bukkitCommand); + plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot")); + plotCommand.setTabCompleter(bukkitCommand); + } } @Override public File getDirectory() { From cc9c1f63d858b5efc2b76b95a47f477ae8d5bbbc Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sat, 17 Aug 2019 18:45:07 -0400 Subject: [PATCH 093/258] When an exception is actually being used it shouldn't be named ignored --- .../plotsquared/bukkit/listeners/SingleWorldListener.java | 4 ++-- .../intellectualsites/plotsquared/plot/PlotVersion.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java index fc13147dd..a53527fc9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java @@ -30,8 +30,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod(); try { this.mustSave = classChunk.getField("mustSave").getRealField(); - } catch (Throwable ignore) { - ignore.printStackTrace(); + } catch (NoSuchFieldException e) { + e.printStackTrace(); } Bukkit.getPluginManager().registerEvents(this, plugin); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java index 1d65c36e0..27e1a6afb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java @@ -24,8 +24,8 @@ public class PlotVersion { public static PlotVersion tryParse(String version, String commit, String date) { try { return new PlotVersion(version, commit, date); - } catch (Exception ignore) { - ignore.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); return new PlotVersion(0, 0, 0, 0, 0); } } From 76dc60194db8e3b0d845d659bc84c14a8291a061 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sat, 17 Aug 2019 19:17:01 -0400 Subject: [PATCH 094/258] Added an invalid world name check. --- .../plotsquared/plot/commands/Setup.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 19e94c6f5..7b21352e2 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 @@ -16,8 +16,8 @@ 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 org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.Map.Entry; @@ -288,6 +288,11 @@ import java.util.Map.Entry; MainUtil.sendMessage(player, "&cYou need to choose a world name!"); return false; } + if (!d(args[0])) { + MainUtil.sendMessage(player, + "Non [a-z0-9_.-] character in the world name: " + args[0]); + return false; + } if (WorldUtil.IMP.isWorld(args[0])) { if (PlotSquared.get().hasPlotArea(args[0])) { MainUtil.sendMessage(player, "&cThat world name is already taken!"); @@ -317,6 +322,11 @@ import java.util.Map.Entry; return false; } + private static boolean d(String s) { + return s.chars().allMatch((i) -> { + return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; + }); + } private static final class StepPickGenerator extends SetupStep { @Getter private String generator; From 59a1d619d3fdf825b207987f936fbbd3adaeea6c Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 18 Aug 2019 14:29:37 +0200 Subject: [PATCH 095/258] Add sponsors --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 85ceaea93..5ff94de6d 100644 --- a/README.md +++ b/README.md @@ -65,3 +65,9 @@ Suggestions are welcome! We have a separate issue tracker for suggestions, that * [PlotSquaredMG](https://www.spigotmc.org/resources/plotsquaredmg.8025/) * [BasicPlots](https://www.spigotmc.org/resources/basicplots.6901/) * [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/) + +# Sponsors +

    +

    +

    +

    From a63f8650e5c347884f490cfa70f3f00cf639a9d3 Mon Sep 17 00:00:00 2001 From: Matt <4009945+MattBDev@users.noreply.github.com> Date: Sun, 18 Aug 2019 13:25:11 -0400 Subject: [PATCH 096/258] Create CONTRIBUTING.md --- CONTRIBUTING.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..52188c269 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,20 @@ +# Contributing +If you feel like you can improve the plugin any way, then you are +more than welcome to contribute to PlotSquared. It would be highly +appreciated if you made sure to test your code before committing it, +as it will save us a lot of time and effort. + +### Code Style + +If you are planning to commit any changes to the project, +it would be highly appreciated if you were to follow the +project code style conventions. To make this easier we have +provided settings that can be imported into your IDE. + +**Eclipse:** +`Window > Preferences > Java > Code Style > Formatter` +Press `Import` and select `...path/to/project/code_style.xml` + +**IntelliJ:** +`File > Settings > Editor > Code Style`. Next to "Scheme" there is a cog wheel, press that and then +`Import Scheme > IntelliJ IDEA Code Style XML` and then select `..path/to/project/code_style.xml` From ec84b91f846bb92700f1003e4fb6c4abf3613362 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 19 Aug 2019 14:51:14 -0400 Subject: [PATCH 097/258] added a stupid check because of a spigot issue. --- .../plot/commands/DebugRoadRegen.java | 8 ++------ .../plotsquared/plot/commands/Unlink.java | 1 - .../plotsquared/plot/object/Plot.java | 16 +++++++++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index 9cc80adb4..a268f8903 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -22,21 +22,17 @@ public class DebugRoadRegen extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { if (args.length < 1) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - DebugRoadRegen.USAGE); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); return false; } String kind = args[0].toLowerCase(); switch (kind) { case "plot": return regenPlot(player); - case "region": return regenRegion(player, Arrays.copyOfRange(args, 1, args.length)); - default: - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - DebugRoadRegen.USAGE); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); return false; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java index 4805c75e7..0ac65184a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java @@ -17,7 +17,6 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; public class Unlink extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location location = player.getLocation(); final Plot plot = location.getPlotAbs(); if (plot == null) { 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 77b60b456..27a04e402 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 @@ -22,9 +22,8 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.sk89q.jnbt.CompoundTag; import org.jetbrains.annotations.NotNull; - -import javax.annotation.Nonnull; import org.jetbrains.annotations.Nullable; + import java.awt.geom.Area; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; @@ -875,8 +874,15 @@ public class Plot { } Plot current = queue.poll(); if (Plot.this.area.TERRAIN != 0) { - ChunkManager.manager - .regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, this); + try { + ChunkManager.manager + .regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, + this); + } catch (UnsupportedOperationException exception) { + MainUtil.sendMessage(null, + "Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience"); + return; + } return; } manager.clearPlot(current, this); @@ -930,8 +936,8 @@ public class Plot { /** * Unlink the plot and all connected plots. * - * @param createSign whether to recreate signs * @param createRoad whether to recreate road + * @param createSign whether to recreate signs * @return success/!cancelled */ public boolean unlinkPlot(boolean createRoad, boolean createSign) { From 0ca69d4f03be11932aee38d1ef64c64ce6807576 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 19 Aug 2019 20:39:03 +0100 Subject: [PATCH 098/258] Don't use PaperLib I guess --- .../intellectualsites/plotsquared/bukkit/BukkitMain.java | 2 +- .../plotsquared/bukkit/util/BukkitChunkManager.java | 3 +-- .../plotsquared/bukkit/util/BukkitLegacyMappings.java | 3 +-- .../intellectualsites/plotsquared/bukkit/util/BukkitUtil.java | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) 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 15e1ef219..6e0587fdb 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 @@ -119,7 +119,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain new PlotSquared(this, "Bukkit"); - if (PaperLib.getMinecraftVersion() < 13 && PaperLib.getMinecraftPatchVersion() < 2) { + if (PlotSquared.get().IMP.getServerVersion()[1] < 13) { System.out.println( "You can't use this version of PlotSquared on a server less than Minecraft 1.13.2."); System.out 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 9049df000..a9c6b2518 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 @@ -14,7 +14,6 @@ import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlock import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; -import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; @@ -277,7 +276,7 @@ public class BukkitChunkManager extends ChunkManager { } final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z - && PaperLib.getMinecraftVersion() == 13) { + && PlotSquared.imp().getServerVersion()[1] == 13) { AugmentedUtils .bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.x, chunk.z)); continue; 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 bc18271db..0331e948a 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 @@ -6,7 +6,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; -import io.papermc.lib.PaperLib; import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -830,7 +829,7 @@ public final class BukkitLegacyMappings extends LegacyMappings { LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName, @NonNull final String newName, @NonNull final String new14Name) { this(numericalId, dataValue, legacyName, - PaperLib.getMinecraftVersion() == 13 ? newName : new14Name); + PlotSquared.get().IMP.getServerVersion()[1] == 13 ? newName : new14Name); } LegacyBlock(final int numericalId, @NonNull final String legacyName, 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 0ba9c5700..6d7069c98 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 @@ -11,7 +11,6 @@ import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.worldedit.bukkit.BukkitWorld; -import io.papermc.lib.PaperLib; import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -355,7 +354,7 @@ import java.util.Set; } else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) { facing = BlockFace.SOUTH; } - if (PaperLib.getMinecraftVersion() == 13) { + if (PlotSquared.get().IMP.getServerVersion()[1] == 13) { block.setType(Material.valueOf("WALL_SIGN"), false); } else if (PaperLib.getMinecraftVersion() == 14) { block.setType(Material.OAK_WALL_SIGN, false); From dc0126b53c2c996b15598dd8e2119f52798040b9 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 19 Aug 2019 20:47:36 +0100 Subject: [PATCH 099/258] Revert PaperLib from later commits too --- .../intellectualsites/plotsquared/bukkit/util/BukkitUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 6d7069c98..a2d0b0c9b 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 @@ -356,8 +356,8 @@ import java.util.Set; } if (PlotSquared.get().IMP.getServerVersion()[1] == 13) { block.setType(Material.valueOf("WALL_SIGN"), false); - } else if (PaperLib.getMinecraftVersion() == 14) { - block.setType(Material.OAK_WALL_SIGN, false); + } else { + block.setType(Material.valueOf("OAK_WALL_SIGN"), false); } final Directional sign = (Directional) block.getBlockData(); sign.setFacing(facing); From 589a69ac6d190935acb9cf3549c9fa4279a1e305 Mon Sep 17 00:00:00 2001 From: Matt <4009945+MattBDev@users.noreply.github.com> Date: Tue, 20 Aug 2019 15:36:13 -0400 Subject: [PATCH 100/258] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 91ba21cb9..8192d7fa6 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -3,15 +3,13 @@ __*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and wil -**[REQUIRED] PlotSquared Version Number:** +**Debug paste link:** + **[REQUIRED] Spigot/Paper Version Number:** **[REQUIRED] Minecraft Version Number:** -**Links to worlds.yml file and settings.yml file:** - - **[REQUIRED] Description of the problem:** **Any relevant console output or screenshots:** From 434d219f4170b7ec35466ef21531ece133853704 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 23 Aug 2019 17:18:25 +0100 Subject: [PATCH 101/258] Add plots.admin.area.sudo for permission to commands of the form "/plot " as well as plots.admin --- .../plotsquared/plot/commands/MainCommand.java | 2 +- .../intellectualsites/plotsquared/plot/config/Captions.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 d4a1592c8..31095cd75 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 @@ -200,7 +200,7 @@ public class MainCommand extends Command { PlotArea area = player.getApplicablePlotArea(); Plot newPlot = Plot.fromString(area, args[0]); if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea() - .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN)) + .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_SUDO_AREA)) && !newPlot.isDenied(player.getUUID())) { Location newLoc = newPlot.getCenter(); if (player.canTeleport(newLoc)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index f9f33c20e..8b172758d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -46,6 +46,7 @@ public enum Captions { // PERMISSION_STAR("*", "static.permissions"), PERMISSION_ADMIN("plots.admin", "static.permissions"), + PERMISSION_ADMIN_SUDO_AREA("plots.admin.area.sudo", "static.permissions"), PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned", "static.permissions"), PERMISSION_PROJECTILE_OTHER("plots.projectile.other", "static.permissions"), PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS("plots.admin.interact.blockedcommands", "static.permissions"), From fa8b18f3d5c2099f95cdd584bcf3926118484484 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 23 Aug 2019 15:57:57 -0400 Subject: [PATCH 102/258] Add new switch conditions to entity spawning --- .../bukkit/listeners/PlayerEvents.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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 3ecc572db..291d4ecca 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 @@ -2162,8 +2162,16 @@ import java.util.regex.Pattern; } break; case REINFORCEMENTS: + case VILLAGE_DEFENSE: + case VILLAGE_INVASION: case NATURAL: case CHUNK_GEN: + case SILVERFISH_BLOCK: + case ENDER_PEARL: + case DROWNED: + case CURED: + case DEFAULT: + case LIGHTNING: if (!area.MOB_SPAWNING) { event.setCancelled(true); return; @@ -2268,16 +2276,7 @@ import java.util.regex.Pattern; Entity ignitingEntity = event.getIgnitingEntity(); Block block = event.getBlock(); BlockIgniteEvent.IgniteCause igniteCause = event.getCause(); - Location location1; - if (block != null) { - location1 = BukkitUtil.getLocation(block.getLocation()); - } else if (ignitingEntity != null) { - location1 = BukkitUtil.getLocation(ignitingEntity); - } else if (player != null) { - location1 = BukkitUtil.getLocation(player); - } else { - return; - } + Location location1 = BukkitUtil.getLocation(block.getLocation()); PlotArea area = location1.getPlotArea(); if (area == null) { return; From a0d666ae14ee89e918f1403bf1ac14f2679b8bb7 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 23 Aug 2019 15:57:57 -0400 Subject: [PATCH 103/258] Add new switch conditions to entity listeners --- .../bukkit/listeners/PlayerEvents.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 3ecc572db..f56ce0763 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 @@ -118,6 +118,7 @@ import java.util.regex.Pattern; case SPECTRAL_ARROW: case SPLASH_POTION: case THROWN_EXP_BOTTLE: + case TRIDENT: // projectile case FALLING_BLOCK: case PRIMED_TNT: @@ -180,6 +181,7 @@ import java.util.regex.Pattern; case VILLAGER: case WOLF: case ZOMBIE_HORSE: + case WANDERING_TRADER: // animal return EntityUtil .checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP); @@ -2162,8 +2164,16 @@ import java.util.regex.Pattern; } break; case REINFORCEMENTS: + case VILLAGE_DEFENSE: + case VILLAGE_INVASION: case NATURAL: case CHUNK_GEN: + case SILVERFISH_BLOCK: + case ENDER_PEARL: + case DROWNED: + case CURED: + case DEFAULT: + case LIGHTNING: if (!area.MOB_SPAWNING) { event.setCancelled(true); return; @@ -2268,16 +2278,7 @@ import java.util.regex.Pattern; Entity ignitingEntity = event.getIgnitingEntity(); Block block = event.getBlock(); BlockIgniteEvent.IgniteCause igniteCause = event.getCause(); - Location location1; - if (block != null) { - location1 = BukkitUtil.getLocation(block.getLocation()); - } else if (ignitingEntity != null) { - location1 = BukkitUtil.getLocation(ignitingEntity); - } else if (player != null) { - location1 = BukkitUtil.getLocation(player); - } else { - return; - } + Location location1 = BukkitUtil.getLocation(block.getLocation()); PlotArea area = location1.getPlotArea(); if (area == null) { return; From 08cd39749b47f6ff3843803d98ea11c3a4250e10 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 27 Aug 2019 14:44:56 +0200 Subject: [PATCH 104/258] Create PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..1ccb63862 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,17 @@ +## Overview + + +**Fixes #{issue number}** + +## Description + +## Checklist + +- [] I included all information required in the sections above +- [] I tested my changes and approved their functionality +- [] I ensured my changes do not break other parts of the code +- [] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/PlotSquared/blob/breaking/CONTRIBUTING.md) \ No newline at end of file From 5e8909883dbbe237d39d210c7e82e06cfa6d997d Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 1 Sep 2019 16:54:43 -0400 Subject: [PATCH 105/258] Modified internal configuration classes, Updated Mojang UUID fetcher, other various method and documentation tweaks --- .../bukkit/uuid/SQLUUIDHandler.java | 8 +- .../configuration/ConfigurationOptions.java | 23 +----- .../MemoryConfigurationOptions.java | 4 - .../file/FileConfigurationOptions.java | 5 -- .../file/YamlConfigurationOptions.java | 29 +------ .../plotsquared/plot/commands/FlagCmd.java | 7 +- .../plotsquared/plot/commands/Inbox.java | 10 ++- .../plotsquared/plot/database/AbstractDB.java | 23 ++++-- .../plotsquared/plot/database/DBFunc.java | 16 +++- .../plot/generator/ClassicPlotManager.java | 75 +++++++------------ .../plotsquared/plot/object/Plot.java | 27 +++---- .../util/block/DelegateLocalBlockQueue.java | 5 +- .../plot/util/block/GlobalBlockQueue.java | 22 ++++-- .../plot/util/block/LocalBlockQueue.java | 4 +- 14 files changed, 110 insertions(+), 148 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 86cd9ae0d..4c74be5b6 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -31,13 +31,13 @@ import java.util.ArrayDeque; import java.util.Collections; import java.util.HashMap; import java.util.UUID; +import java.util.concurrent.TimeUnit; public class SQLUUIDHandler extends UUIDHandlerImplementation { final int MAX_REQUESTS = 500; private final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/"; - private final int INTERVAL = 12000; private final JSONParser jsonParser = new JSONParser(); private final SQLite sqlite; @@ -133,7 +133,10 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { "Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)"); } try { - Thread.sleep(INTERVAL * 50); + //Mojang allows requests every 10 minutes according to https://wiki.vg/Mojang_API + //15 Minutes is chosen here since system timers are not always precise + //and it should provide enough time where Mojang won't block requests. + TimeUnit.MINUTES.sleep(15); } catch (InterruptedException e) { e.printStackTrace(); break; @@ -142,7 +145,6 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { if (whenDone != null) { whenDone.run(); } - return; }); }); } catch (SQLException e) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java index 5d13920e4..81c96196d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java @@ -6,7 +6,6 @@ package com.github.intellectualsites.plotsquared.configuration; */ class ConfigurationOptions { private final Configuration configuration; - private char pathSeparator = '.'; private boolean copyDefaults = false; protected ConfigurationOptions(Configuration configuration) { @@ -26,28 +25,12 @@ class ConfigurationOptions { * Gets the char that will be used to separate {@link * ConfigurationSection}s. * - *

    This value does not affect how the {@link Configuration} is stored, - * only in how you access the data. The default value is '.'. + *

    This value is always '.'. * * @return Path separator */ - public char pathSeparator() { - return pathSeparator; - } - - /** - * Sets the char that will be used to separate {@link - * ConfigurationSection}s. - * - *

    This value does not affect how the {@link Configuration} is stored, - * only in how you access the data. The default value is '.'. - * - * @param value Path separator - * @return This object, for chaining - */ - public ConfigurationOptions pathSeparator(char value) { - pathSeparator = value; - return this; + char pathSeparator() { + return '.'; } /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java index 971ea1e70..22f9d751b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java @@ -18,8 +18,4 @@ public class MemoryConfigurationOptions extends ConfigurationOptions { return this; } - @Override public MemoryConfigurationOptions pathSeparator(char value) { - super.pathSeparator(value); - return this; - } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java index a216d0566..6eb99bb6e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java @@ -25,11 +25,6 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions { return this; } - @Override public FileConfigurationOptions pathSeparator(char value) { - super.pathSeparator(value); - return this; - } - /** * Gets the header that will be applied to the top of the saved output. * diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java index a17bc3538..a7e71cdaf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java @@ -5,7 +5,6 @@ package com.github.intellectualsites.plotsquared.configuration.file; * YamlConfiguration}. */ public class YamlConfigurationOptions extends FileConfigurationOptions { - private int indent = 2; YamlConfigurationOptions(YamlConfiguration configuration) { super(configuration); @@ -20,11 +19,6 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { return this; } - @Override public YamlConfigurationOptions pathSeparator(char value) { - super.pathSeparator(value); - return this; - } - @Override public YamlConfigurationOptions header(String value) { super.header(value); return this; @@ -42,27 +36,8 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { * * @return How much to indent by */ - public int indent() { - return indent; + int indent() { + return 2; } - /** - * Sets how much spaces should be used to indent each line. - * - *

    The minimum value this may be is 2, and the maximum is 9. - * - * @param value New indent - * @return This object, for chaining - */ - public YamlConfigurationOptions indent(int value) { - if (value < 2) { - throw new IllegalArgumentException("Indent must be at least 2 characters"); - } - if (value > 9) { - throw new IllegalArgumentException("Indent cannot be greater than 9 characters"); - } - - indent = value; - return this; - } } 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 c9bba547a..e26cffaed 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 @@ -24,10 +24,9 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.*; -@CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setf", "setflag"}, - usage = "/plot flag ", description = "Set plot flags", - category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, - permission = "plots.flag") public class FlagCmd extends SubCommand { +@CommandDeclaration(command = "setflag", aliases = {"f", "flag", + "setflag"}, usage = "/plot flag ", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag") +public class FlagCmd extends SubCommand { private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) { key = key.toLowerCase(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 8d427bbcd..899139b98 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -149,8 +149,14 @@ import java.util.List; } PlotComment comment = value.get(index - 1); inbox.removeComment(plot, comment); - plot.removeComment(comment); - MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, comment.comment); + boolean success = plot.removeComment(comment); + //noinspection StatementWithEmptyBody + if (success) { + MainUtil + .sendMessage(player, Captions.COMMENT_REMOVED, comment.comment); + } else { + //TODO Comment removal failure message + } } })) { sendMessage(player, Captions.NOT_IN_PLOT); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java index dc9564371..5beef2aab 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java @@ -1,12 +1,19 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -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.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; public interface AbstractDB { @@ -224,7 +231,7 @@ public interface AbstractDB { /** * @param cluster PlotCluster Object - * @param uuid Player that should be removed + * @param uuid Player that should be removed */ void setHelper(PlotCluster cluster, UUID uuid); @@ -276,7 +283,7 @@ public interface AbstractDB { /** * Removes the specified comment from the given plot. * - * @param plot the plot + * @param plot the plot * @param comment the comment to remove */ void removeComment(Plot plot, PlotComment comment); @@ -284,7 +291,7 @@ public interface AbstractDB { /** * Clears the specified inbox on the given plot. * - * @param plot the plot + * @param plot the plot * @param inbox the inbox to clear */ void clearInbox(Plot plot, String inbox); @@ -292,13 +299,13 @@ public interface AbstractDB { /** * Adds the specified comment to the given plot. * - * @param plot the plot + * @param plot the plot * @param comment the comment to add */ void setComment(Plot plot, PlotComment comment); /** - * Gets Plot Comments. + * Gets Plot comments. * * @param plot The Plot to get comments from */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java index abb4dad24..47a03cf60 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java @@ -1,13 +1,21 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -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.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; /** * Database Functions @@ -74,6 +82,8 @@ public class DBFunc { DBFunc.dbManager.validateAllPlots(plots); } + + //TODO Consider Removal /** * Check if a {@link ResultSet} contains a column. * @@ -81,7 +91,7 @@ public class DBFunc { * @param name * @return */ - public static boolean hasColumn(ResultSet resultSet, String name) { + @Deprecated public static boolean hasColumn(ResultSet resultSet, String name) { try { ResultSetMetaData meta = resultSet.getMetaData(); int count = meta.getColumnCount(); 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 118733f36..1827bbb64 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 @@ -24,29 +24,21 @@ public class ClassicPlotManager extends SquarePlotManager { BlockBucket blocks) { switch (component) { case "floor": - setFloor(plotId, blocks); - return true; + return setFloor(plotId, blocks); case "wall": - setWallFilling(plotId, blocks); - return true; + return setWallFilling(plotId, blocks); case "all": - setAll(plotId, blocks); - return true; + return setAll(plotId, blocks); case "air": - setAir(plotId, blocks); - return true; + return setAir(plotId, blocks); case "main": - setMain(plotId, blocks); - return true; + return setMain(plotId, blocks); case "middle": - setMiddle(plotId, blocks); - return true; + return setMiddle(plotId, blocks); case "outline": - setOutline(plotId, blocks); - return true; + return setOutline(plotId, blocks); case "border": - setWall(plotId, blocks); - return true; + return setWall(plotId, blocks); } return false; } @@ -54,8 +46,7 @@ public class ClassicPlotManager extends SquarePlotManager { @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING); setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); - GlobalBlockQueue.IMP.addTask(whenDone); - return true; + return GlobalBlockQueue.IMP.addTask(whenDone); } public boolean setFloor(PlotId plotId, BlockBucket blocks) { @@ -70,8 +61,7 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid(pos1, pos2, blocks); } } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setAll(PlotId plotId, BlockBucket blocks) { @@ -86,8 +76,7 @@ public class ClassicPlotManager extends SquarePlotManager { Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setAir(PlotId plotId, BlockBucket blocks) { @@ -103,8 +92,7 @@ public class ClassicPlotManager extends SquarePlotManager { Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setMain(PlotId plotId, BlockBucket blocks) { @@ -119,8 +107,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, region.maxX, classicPlotWorld.PLOT_HEIGHT - 1, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setMiddle(PlotId plotId, BlockBucket blocks) { @@ -134,8 +121,7 @@ public class ClassicPlotManager extends SquarePlotManager { int x = MathMan.average(corners[0].getX(), corners[1].getX()); int z = MathMan.average(corners[0].getZ(), corners[1].getZ()); queue.setBlock(x, classicPlotWorld.PLOT_HEIGHT, z, blocks.getBlock()); - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setOutline(PlotId plotId, BlockBucket blocks) { @@ -187,8 +173,7 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid(pos1, pos2, blocks); } } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setWallFilling(PlotId plotId, BlockBucket blocks) { @@ -235,8 +220,7 @@ public class ClassicPlotManager extends SquarePlotManager { } } } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setWall(PlotId plotId, BlockBucket blocks) { @@ -276,8 +260,7 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setBlock(x, y, z, blocks.getBlock()); } } - queue.enqueue(); - return true; + return queue.enqueue(); } /** @@ -308,8 +291,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean createRoadSouth(Plot plot) { @@ -337,8 +319,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean createRoadSouthEast(Plot plot) { @@ -356,8 +337,7 @@ public class ClassicPlotManager extends SquarePlotManager { PlotBlock.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean removeRoadEast(Plot plot) { @@ -377,8 +357,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), classicPlotWorld.TOP_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean removeRoadSouth(Plot plot) { @@ -398,8 +377,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean removeRoadSouthEast(Plot plot) { @@ -416,14 +394,14 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } /** * Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED). */ @Override public boolean finishPlotMerge(List plotIds) { + //TODO This method shouldn't always return true final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; plotIds.forEach(id -> setWall(id, block)); if (Settings.General.MERGE_REPLACE_WALL) { @@ -434,12 +412,14 @@ public class ClassicPlotManager extends SquarePlotManager { } @Override public boolean finishPlotUnlink(List plotIds) { + //TODO This method shouldn't always return true final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; plotIds.forEach(id -> setWall(id, block)); return true; } @Override public boolean regenerateAllPlotWalls() { + //TODO This method shouldn't always return true for (Plot plot : classicPlotWorld.getPlots()) { if (plot.hasOwner()) { setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK); @@ -460,8 +440,7 @@ public class ClassicPlotManager extends SquarePlotManager { @Override public boolean claimPlot(Plot plot) { final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - setWall(plot.getId(), claim); - return true; + return setWall(plot.getId(), claim); } @Override public String[] getPlotComponents(PlotId plotId) { 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 27a04e402..30c5034a8 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 @@ -2418,20 +2418,16 @@ public class Plot { * @param direction * @return */ - public Plot getRelative(int direction) { + @Deprecated public Plot getRelative(int direction) { return this.area.getPlotAbs(this.id.getRelative(direction)); } /** - * Gets the plot in a relative direction
    - * 0 = north
    - * 1 = east
    - * 2 = south
    - * 3 = west
    + * Gets the plot in a relative direction * Note: May be null if the partial plot area does not include the relative location * * @param direction - * @return + * @return the plot relative to this one */ public Plot getRelative(Direction direction) { return this.area.getPlotAbs(this.id.getRelative(direction)); @@ -2441,7 +2437,7 @@ public class Plot { * Gets a set of plots connected (and including) this plot
    * - This result is cached globally * - * @return + * @return a Set of Plots connected to this Plot */ public Set getConnectedPlots() { if (this.settings == null) { @@ -2802,6 +2798,11 @@ public class Plot { return false; } + /** + * Checks if the owner of this Plot is online. + * + * @return true if the owner of the Plot is online + */ public boolean isOnline() { if (this.owner == null) { return false; @@ -3098,23 +3099,23 @@ public class Plot { return getFlags().containsKey(flag); } - @SuppressWarnings("deprecation") public boolean removeComment(PlotComment comment) { + public boolean removeComment(PlotComment comment) { return getSettings().removeComment(comment); } - @SuppressWarnings("deprecation") public void removeComments(List comments) { + public void removeComments(List comments) { getSettings().removeComments(comments); } - @SuppressWarnings("deprecation") public List getComments(String inbox) { + public List getComments(String inbox) { return getSettings().getComments(inbox); } - @SuppressWarnings("deprecation") public void addComment(PlotComment comment) { + public void addComment(PlotComment comment) { getSettings().addComment(comment); } - @SuppressWarnings("deprecation") public void setComments(List list) { + public void setComments(List list) { getSettings().setComments(list); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index 0c797c706..c5c17b4a4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -102,9 +102,10 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { } } - @Override public void enqueue() { + @Override public boolean enqueue() { if (parent != null) { - parent.enqueue(); + return parent.enqueue(); } + return false; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java index 6d75b6bfb..3373f8e57 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java @@ -45,10 +45,10 @@ public class GlobalBlockQueue { public GlobalBlockQueue(QueueProvider provider, int threads) { this.provider = provider; - activeQueues = new ConcurrentLinkedDeque<>(); - inactiveQueues = new ConcurrentLinkedDeque<>(); - runnables = new ConcurrentLinkedDeque<>(); - running = new AtomicBoolean(); + this.activeQueues = new ConcurrentLinkedDeque<>(); + this.inactiveQueues = new ConcurrentLinkedDeque<>(); + this.runnables = new ConcurrentLinkedDeque<>(); + this.running = new AtomicBoolean(); this.PARALLEL_THREADS = threads; } @@ -151,12 +151,20 @@ public class GlobalBlockQueue { return false; } - public void enqueue(LocalBlockQueue queue) { - inactiveQueues.remove(queue); + /** + * TODO Documentation needed. + * + * @param queue todo + * @return true if added to queue, false otherwise + */ + public boolean enqueue(LocalBlockQueue queue) { + boolean success = false; + success = inactiveQueues.remove(queue); if (queue.size() > 0 && !activeQueues.contains(queue)) { queue.optimize(); - activeQueues.add(queue); + success = activeQueues.add(queue); } + return success; } public void dequeue(LocalBlockQueue queue) { 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 fd921c18c..04a9e2f0c 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 @@ -96,8 +96,8 @@ public abstract class LocalBlockQueue { } } - public void enqueue() { - GlobalBlockQueue.IMP.enqueue(this); + public boolean enqueue() { + return GlobalBlockQueue.IMP.enqueue(this); } public void setCuboid(Location pos1, Location pos2, PlotBlock block) { From a7012814ab92c265b19e325cdb21e597146787c4 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 1 Sep 2019 19:40:16 -0400 Subject: [PATCH 106/258] Deprecated a poorly named method --- .../intellectualsites/plotsquared/plot/config/Captions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 8b172758d..9106cbbf3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -883,7 +883,7 @@ public enum Captions { } } - public String f(final Object... args) { + @Deprecated public String f(final Object... args) { return format(getTranslated(), args); } From 40e3b7fa06bc5853ef23d35baaf43cd87c856fc1 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 3 Sep 2019 23:56:08 +0200 Subject: [PATCH 107/258] Revert "Add new switch conditions to entity listeners" This reverts commit a0d666ae14ee89e918f1403bf1ac14f2679b8bb7. It seems to break armor stand placing in some cases. --- .../bukkit/listeners/PlayerEvents.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) 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 f56ce0763..3ecc572db 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 @@ -118,7 +118,6 @@ import java.util.regex.Pattern; case SPECTRAL_ARROW: case SPLASH_POTION: case THROWN_EXP_BOTTLE: - case TRIDENT: // projectile case FALLING_BLOCK: case PRIMED_TNT: @@ -181,7 +180,6 @@ import java.util.regex.Pattern; case VILLAGER: case WOLF: case ZOMBIE_HORSE: - case WANDERING_TRADER: // animal return EntityUtil .checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP); @@ -2164,16 +2162,8 @@ import java.util.regex.Pattern; } break; case REINFORCEMENTS: - case VILLAGE_DEFENSE: - case VILLAGE_INVASION: case NATURAL: case CHUNK_GEN: - case SILVERFISH_BLOCK: - case ENDER_PEARL: - case DROWNED: - case CURED: - case DEFAULT: - case LIGHTNING: if (!area.MOB_SPAWNING) { event.setCancelled(true); return; @@ -2278,7 +2268,16 @@ import java.util.regex.Pattern; Entity ignitingEntity = event.getIgnitingEntity(); Block block = event.getBlock(); BlockIgniteEvent.IgniteCause igniteCause = event.getCause(); - Location location1 = BukkitUtil.getLocation(block.getLocation()); + Location location1; + if (block != null) { + location1 = BukkitUtil.getLocation(block.getLocation()); + } else if (ignitingEntity != null) { + location1 = BukkitUtil.getLocation(ignitingEntity); + } else if (player != null) { + location1 = BukkitUtil.getLocation(player); + } else { + return; + } PlotArea area = location1.getPlotArea(); if (area == null) { return; From e1db27010c60d8dc4dd45ba5bc5b232c9c73612a Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 4 Sep 2019 03:01:25 +0200 Subject: [PATCH 108/258] Updating command usage formats --- .../intellectualsites/plotsquared/plot/commands/Alias.java | 4 ++-- .../plotsquared/plot/commands/Condense.java | 3 ++- .../plotsquared/plot/commands/Continue.java | 2 +- .../plotsquared/plot/commands/Database.java | 4 ++-- .../plotsquared/plot/commands/FlagCmd.java | 5 ++--- .../intellectualsites/plotsquared/plot/commands/Inbox.java | 6 ++---- .../intellectualsites/plotsquared/plot/commands/Owner.java | 2 +- .../plotsquared/plot/commands/SchematicCmd.java | 2 +- .../plotsquared/plot/commands/Template.java | 3 +-- .../intellectualsites/plotsquared/plot/commands/Toggle.java | 4 +++- 10 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 7f335cfa5..e4a719dcf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -21,7 +21,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; @Override public boolean onCommand(PlotPlayer player, String[] args) { if (args.length == 0) { - Captions.COMMAND_SYNTAX.send(player, "/plot alias "); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } @@ -64,7 +64,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; } break; default: - Captions.COMMAND_SYNTAX.send(player, "/plot alias "); + Captions.COMMAND_SYNTAX.send(player, getUsage()); result = false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index 184e2289d..a9341f373 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -20,6 +20,7 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @CommandDeclaration(command = "condense", permission = "plots.admin", + usage = "/plot condense [radius]", description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand { @@ -27,7 +28,7 @@ import java.util.concurrent.atomic.AtomicBoolean; @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length != 2 && args.length != 3) { - MainUtil.sendMessage(player, "/plot condense [radius]"); + MainUtil.sendMessage(player, getUsage()); return false; } PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java index 4aec2d6d0..961742c1b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java @@ -12,7 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; @CommandDeclaration(command = "continue", description = "Continue a plot that was previously marked as done", permission = "plots.continue", category = CommandCategory.SETTINGS, - requiredType = RequiredType.NONE) public class Continue extends SubCommand { + requiredType = RequiredType.PLAYER) public class Continue extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { Plot plot = player.getCurrentPlot(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index d908f2105..abbddc9ca 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -48,7 +48,7 @@ import java.util.Map.Entry; @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length < 1) { - MainUtil.sendMessage(player, "/plot database [area] "); + MainUtil.sendMessage(player, getUsage()); return false; } List plots; @@ -60,7 +60,7 @@ import java.util.Map.Entry; plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots()); } if (args.length < 1) { - MainUtil.sendMessage(player, "/plot database [world] "); + MainUtil.sendMessage(player, getUsage()); MainUtil.sendMessage(player, "[arg] indicates an optional argument"); return false; } 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 470d8d605..b55895494 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 @@ -87,8 +87,7 @@ import java.util.*; * plot flag list */ if (args.length == 0) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot flag "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return false; } Location loc = player.getLocation(); @@ -311,7 +310,7 @@ import java.util.*; return true; } MainUtil - .sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag "); + .sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return false; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 8d427bbcd..c0c898205 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -71,8 +71,7 @@ import java.util.List; return false; } if (args.length == 0) { - sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot inbox [inbox] [delete |clear|page]"); + sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); for (final CommentInbox inbox : CommentManager.inboxes.values()) { if (inbox.canRead(plot, player)) { if (!inbox.getComments(plot, new RunnableVal>() { @@ -172,8 +171,7 @@ import java.util.List; try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { - sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot inbox [inbox] [delete |clear|page]"); + sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return false; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 55dbdbda4..98e32dcd6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -17,7 +17,7 @@ import java.util.UUID; @CommandDeclaration(command = "setowner", permission = "plots.set.owner", description = "Set the plot owner", usage = "/plot setowner ", aliases = {"owner", "so", "seto"}, category = CommandCategory.CLAIMING, - requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand { + requiredType = RequiredType.PLAYER, confirmation = true) public class Owner extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, String value) { Set plots = plot.getConnectedPlots(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index f654fa776..deef2081c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -25,7 +25,7 @@ import java.util.UUID; @CommandDeclaration(command = "schematic", permission = "plots.schematic", description = "Schematic command", aliases = {"sch", "schem"}, - category = CommandCategory.SCHEMATIC, usage = "/plot schematic ") + category = CommandCategory.SCHEMATIC, usage = "/plot schematic ") public class SchematicCmd extends SubCommand { private boolean running = false; 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 eb96f78cc..563956c46 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 @@ -113,8 +113,7 @@ import java.util.zip.ZipOutputStream; return true; } } - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot template [template]"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return true; } final String world = args[1]; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java index e19d81762..efe54f3d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java @@ -9,14 +9,16 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @CommandDeclaration(command = "toggle", aliases = {"attribute"}, permission = "plots.use", + usage = "/plot toggle ", description = "Toggle per user settings", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS) public class Toggle extends Command { + public Toggle() { super(MainCommand.getInstance(), true); } @CommandDeclaration(command = "chatspy", aliases = {"spy"}, - permission = "plots.admin.command.chat", description = "Toggle admin chat spying") + permission = "plots.admin.command.chat", description = "Toggle plot chat spy") public void chatspy(Command command, PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { From 4d0bd8a3a35956e3bd5824d456bd703d0344945c Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 4 Sep 2019 03:04:51 +0200 Subject: [PATCH 109/258] Upgrade build files --- Bukkit/build.gradle | 2 +- Core/build.gradle | 10 +++++----- build.gradle | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 5fe453bd7..237c0740e 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -22,7 +22,7 @@ dependencies { implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile("io.papermc:paperlib:1.0.2") - implementation ("net.kyori:text-adapter-bukkit:3.0.3") + implementation("net.kyori:text-adapter-bukkit:3.0.3") compile("net.milkbowl.vault:VaultAPI:1.7") { exclude(module: "bukkit") } diff --git a/Core/build.gradle b/Core/build.gradle index 3cbf8f555..53f305992 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -5,7 +5,7 @@ def textVersion = "3.0.2" dependencies { implementation("org.yaml:snakeyaml:1.23") - implementation ("com.google.code.gson:gson:2.8.0") { + implementation("com.google.code.gson:gson:2.8.0") { because("Minecraft uses GSON 2.8.0") force = true } @@ -14,10 +14,10 @@ dependencies { testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") - implementation ("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") - implementation ("com.squareup.okhttp3:okhttp:3.14.0") - implementation ("com.squareup.okio:okio:2.2.2") - implementation ("org.jetbrains.kotlin:kotlin-stdlib:1.3.30") + implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") + implementation("com.squareup.okhttp3:okhttp:3.14.0") + implementation("com.squareup.okio:okio:2.2.2") + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.30") } sourceCompatibility = 1.8 diff --git a/build.gradle b/build.gradle index 64a344f80..f2afef586 100644 --- a/build.gradle +++ b/build.gradle @@ -32,11 +32,11 @@ ext { git = Grgit.open(dir: new File(rootDir.toString() + "/.git")) date = git.head().getDate().format("yy.MM.dd") revision = "-${git.head().abbreviatedId}" - parents = git.head().parentIds; + parents = git.head().parentIds if (project.hasProperty("buildnumber")) { buildNumber = "$buildnumber" } else { - index = -2042; // Offset to match CI + index = -2042 // Offset to match CI for (; parents != null && !parents.isEmpty(); index++) { parents = git.getResolve().toCommit(parents.get(0)).getParentIds() } @@ -67,10 +67,10 @@ subprojects { exclude(module: "mockito-core") exclude(module: "dummypermscompat") } - implementation ("net.kyori:text-api:3.0.2") - implementation ("net.kyori:text-serializer-gson:3.0.2") - implementation ("net.kyori:text-serializer-legacy:3.0.2") - implementation ("net.kyori:text-serializer-plain:3.0.2") + implementation("net.kyori:text-api:3.0.2") + implementation("net.kyori:text-serializer-gson:3.0.2") + implementation("net.kyori:text-serializer-legacy:3.0.2") + implementation("net.kyori:text-serializer-plain:3.0.2") implementation("com.google.guava:guava:21.0") { because("Minecraft uses Guava 21 as of 1.13") } From b3136b4ebec8261024e796f561e27bdf242c7fa8 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 6 Sep 2019 20:40:28 -0400 Subject: [PATCH 110/258] Version number fixes, fixed documentation, new caption added, and tweaks to API functionality. --- .../plotsquared/bukkit/BukkitMain.java | 5 ++- .../bukkit/listeners/PlayerEvents.java | 2 +- .../plotsquared/commands/Command.java | 2 +- .../plotsquared/plot/IPlotMain.java | 36 ++++++----------- .../plotsquared/plot/PlotSquared.java | 4 +- .../plotsquared/plot/PlotVersion.java | 7 ++++ .../plotsquared/plot/commands/Inbox.java | 16 ++++---- .../plotsquared/plot/commands/PluginCmd.java | 4 +- .../plotsquared/plot/config/Captions.java | 13 +++---- .../plot/generator/ClassicPlotManager.java | 39 +++++++++++++------ .../plot/generator/HybridPlotManager.java | 7 ++-- .../plotsquared/plot/object/PlotManager.java | 9 ++++- .../plot/util/block/BasicLocalBlockQueue.java | 3 +- 13 files changed, 80 insertions(+), 67 deletions(-) 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 6e0587fdb..9596a25e9 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 @@ -132,8 +132,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain // Check for updates if (PlotSquared.get().getUpdateUtility() != null) { final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); - updateUtility - .checkForUpdate(this.getPluginVersionString(), ((updateDescription, throwable) -> { + updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(), + ((updateDescription, throwable) -> { Bukkit.getScheduler().runTask(BukkitMain.this, () -> { getLogger().info("-------- PlotSquared Update Check --------"); if (throwable != null) { @@ -803,4 +803,5 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public LegacyMappings getLegacyMappings() { return this.legacyMappings; } + } 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 f56ce0763..9f3f0e0d4 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 @@ -642,7 +642,7 @@ import java.util.regex.Pattern; && PlotSquared.get().getUpdateUtility() != null) { final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class); - updateUtility.checkForUpdate(bukkitMain.getPluginVersionString(), + updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(), ((updateDescription, throwable) -> { if (throwable != null) { bukkitMain.getLogger().severe(String 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 945d2d374..faaf3c7af 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 @@ -263,7 +263,7 @@ public abstract class Command { /** * @param player Caller - * @param args Arguments + * @param args Arguments * @param confirm Instance, Success, Failure * @return CompletableFuture true if the command executed fully, false in * any other case 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 e1eb152b5..8fff0921d 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 @@ -63,12 +63,12 @@ public interface IPlotMain extends ILogger { */ String getPluginVersionString(); - String getPluginName(); + default String getPluginName() { + return "PlotSquared"; + } /** * Gets the version of Minecraft that is running. - * - * @return */ int[] getServerVersion(); @@ -101,7 +101,7 @@ public interface IPlotMain extends ILogger { /** * The task manager will run and manage Minecraft tasks. * - * @return + * @return the PlotSquared task manager */ TaskManager getTaskManager(); @@ -138,49 +138,39 @@ public interface IPlotMain extends ILogger { /** * Gets the economy provider. * - * @return + * @return the PlotSquared economy manager */ EconHandler getEconomyHandler(); /** * Gets the {@link QueueProvider} class. - * - * @return */ QueueProvider initBlockQueue(); /** * Gets the {@link WorldUtil} class. - * - * @return */ WorldUtil initWorldUtil(); /** * Gets the EventUtil class. - * - * @return */ EventUtil initEventUtil(); /** * Gets the chunk manager. * - * @return + * @return the PlotSquared chunk manager */ ChunkManager initChunkManager(); /** * Gets the {@link SetupUtils} class. - * - * @return */ SetupUtils initSetupUtils(); /** * Gets {@link HybridUtils} class. - * - * @return */ HybridUtils initHybridUtils(); @@ -199,32 +189,28 @@ public interface IPlotMain extends ILogger { /** * Gets the {@link UUIDHandlerImplementation} which will cache and * provide UUIDs. - * - * @return */ UUIDHandlerImplementation initUUIDHandler(); /** * Gets the {@link InventoryUtil} class (used for implementation specific * inventory guis). - * - * @return */ InventoryUtil initInventoryUtil(); /** * Unregisters a {@link PlotPlayer} from cache e.g. if they have logged off. * - * @param player + * @param player the player to remove */ void unregister(PlotPlayer player); /** * Gets the generator wrapper for a world (world) and generator (name). * - * @param world - * @param name - * @return + * @param world the world to get the generator from + * @param name the name of the generator + * @return the generator being used for the provided world */ GeneratorWrapper getGenerator(String world, String name); @@ -232,7 +218,7 @@ public interface IPlotMain extends ILogger { /** * Register the chunk processor which will clean out chunks that have too - * many blockstates or entities. + * many block states or entities. */ void registerChunkProcessor(); 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 414e2a0b3..8c6274b53 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 @@ -33,8 +33,8 @@ import com.sk89q.worldedit.WorldEdit; import lombok.Getter; import lombok.NonNull; import lombok.Setter; - import org.jetbrains.annotations.Nullable; + import java.io.*; import java.net.MalformedURLException; import java.net.URISyntaxException; @@ -1623,7 +1623,7 @@ import java.util.zip.ZipInputStream; final Properties properties = new Properties(); properties.load(bufferedReader); final boolean enabled = - Boolean.valueOf(properties.getOrDefault("enabled", true).toString()); + Boolean.parseBoolean(properties.getOrDefault("enabled", true).toString()); if (enabled) { this.updateUtility = new UpdateUtility(properties.getProperty("path"), properties.getProperty("job"), properties.getProperty("artifact")); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java index 27e1a6afb..4646a787a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java @@ -30,6 +30,13 @@ public class PlotVersion { } } + public String versionString() { + if (hash == 0 && build == 0) { + return "NoVer-SNAPSHOT"; + } else { + return "4." + build; + } + } @Override public String toString() { if (hash == 0 && build == 0) { return "PlotSquared-NoVer-SNAPSHOT"; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 899139b98..e7e2515c7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -14,9 +14,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.List; @CommandDeclaration(command = "inbox", description = "Review the comments for a plot", - usage = "/plot inbox [inbox] [delete |clear|page]", permission = "plots.inbox", - category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) public class Inbox - extends SubCommand { + usage = "/plot inbox [inbox] [delete |clear|page]", permission = "plots.inbox", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) +public class Inbox extends SubCommand { public void displayComments(PlotPlayer player, List oldComments, int page) { if (oldComments == null || oldComments.isEmpty()) { @@ -150,12 +149,13 @@ import java.util.List; PlotComment comment = value.get(index - 1); inbox.removeComment(plot, comment); boolean success = plot.removeComment(comment); - //noinspection StatementWithEmptyBody if (success) { - MainUtil - .sendMessage(player, Captions.COMMENT_REMOVED, comment.comment); + MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, + comment.comment); } else { - //TODO Comment removal failure message + MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_FAILURE, + comment.comment); + } } })) { @@ -172,7 +172,7 @@ import java.util.List; if (!comments.isEmpty()) { plot.removeComments(comments); } - MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, "*"); + MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, "*"); return true; default: try { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index d284ce708..8e31051fb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -22,8 +22,8 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21"); MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki"); - MainUtil.sendMessage(player, - "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); + // MainUtil.sendMessage(player, + // "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); } }); return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 9106cbbf3..b53aa42a2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -280,13 +280,12 @@ public enum Captions { "Comment"), INVALID_INBOX("$2That is not a valid inbox.&-$1Accepted values: %s", "Comment"), NO_PERM_INBOX( - "$2You do not have permission for that inbox", "Comment"), - - NO_PERM_INBOX_MODIFY("$2You do not have permission to modify that inbox", - "Comment"), NO_PLOT_INBOX("$2You must stand in or supply a plot argument", "Comment"), - - COMMENT_REMOVED("$4Successfully deleted comment/s:n$2 - '$3%s$2'", "Comment"), COMMENT_ADDED( - "$4A comment has been left", "Comment"), + "$2You do not have permission for that inbox", "Comment"), NO_PERM_INBOX_MODIFY( + "$2You do not have permission to modify that inbox", "Comment"), NO_PLOT_INBOX( + "$2You must stand in or supply a plot argument", "Comment"), COMMENT_REMOVED_SUCCESS( + "$4Successfully deleted comment/s:n$2 - '$3%s$2'", "Comment"), COMMENT_REMOVED_FAILURE( + "$4Failed to delete comment!", "Comment"), COMMENT_ADDED("$4A comment has been left", + "Comment"), COMMENT_HEADER("$2&m---------&r $1Comments $2&m---------&r", "Comment"), INBOX_EMPTY( "$2No comments", "Comment"), 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 1827bbb64..320953963 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 @@ -399,35 +399,48 @@ public class ClassicPlotManager extends SquarePlotManager { /** * Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED). + * + * @return false if part of the merge failed, otherwise true if successful. */ @Override public boolean finishPlotMerge(List plotIds) { - //TODO This method shouldn't always return true final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; - plotIds.forEach(id -> setWall(id, block)); + boolean success = true; + for (PlotId plotId : plotIds) { + success &= setWall(plotId, block); + } if (Settings.General.MERGE_REPLACE_WALL) { final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING; - plotIds.forEach(id -> setWallFilling(id, wallBlock)); + for (PlotId id : plotIds) { + success &= setWallFilling(id, wallBlock); + } } - return true; + return success; } @Override public boolean finishPlotUnlink(List plotIds) { - //TODO This method shouldn't always return true final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; - plotIds.forEach(id -> setWall(id, block)); - return true; + boolean success = true; + for (PlotId id : plotIds) { + success &= setWall(id, block); + } + return success; } + /** + * Sets all the blocks along all the plot walls to their correct state (claimed or unclaimed). + * + * @return true if the wall blocks were successfully set + */ @Override public boolean regenerateAllPlotWalls() { - //TODO This method shouldn't always return true + boolean success = true; for (Plot plot : classicPlotWorld.getPlots()) { if (plot.hasOwner()) { - setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK); + success &= setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK); } else { - setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); + success &= setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); } } - return true; + return success; } @Override public boolean startPlotMerge(List plotIds) { @@ -448,7 +461,9 @@ public class ClassicPlotManager extends SquarePlotManager { } /** - * Remove sign for a plot. + * Retrieves the location of where a sign should be for a plot. + * @param plot The plot + * @return The location where a sign should be */ @Override public Location getSignLoc(Plot plot) { plot = plot.getBasePlot(false); 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 c3aaa3857..0a3fc4de6 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 @@ -147,8 +147,7 @@ public class HybridPlotManager extends ClassicPlotManager { if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { createSchemAbs(queue, pos1, pos2); } - queue.enqueue(); - return true; + return queue.enqueue(); } /** @@ -222,7 +221,9 @@ public class HybridPlotManager extends ClassicPlotManager { } /** - * Remove sign for a plot. + * Retrieves the location of where a sign should be for a plot. + * @param plot The plot + * @return The location where a sign should be */ @Override public Location getSignLoc(Plot plot) { return hybridPlotWorld.getSignLocation(plot); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 74f0eddb7..0b39b2b7d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -39,6 +39,12 @@ public abstract class PlotManager { public abstract boolean unClaimPlot(Plot plot, Runnable whenDone); + /** + * Retrieves the location of where a sign should be for a plot. + * + * @param plot The plot + * @return The location where a sign should be + */ public abstract Location getSignLoc(Plot plot); /* @@ -47,8 +53,7 @@ public abstract class PlotManager { */ public abstract String[] getPlotComponents(PlotId plotId); - public abstract boolean setComponent(PlotId plotId, String component, - BlockBucket blocks); + public abstract boolean setComponent(PlotId plotId, String component, BlockBucket blocks); /* * PLOT MERGING (return false if your generator does not support plot diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 6993c3208..7f44d2931 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -102,8 +102,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { lastWrappedChunk.setBlock(x & 15, y, z & 15, id); LocalChunk previous = this.blockChunks.put(pair, lastWrappedChunk); if (previous == null) { - chunks.add(lastWrappedChunk); - return true; + return chunks.add(lastWrappedChunk); } this.blockChunks.put(pair, previous); lastWrappedChunk = previous; From 462c113ce89851f4c3af0134c39cbabf46b75879 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 6 Sep 2019 21:20:54 -0400 Subject: [PATCH 111/258] Fixed accidental code reversion --- .../plotsquared/plot/commands/Inbox.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index c0c898205..180bec623 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -148,8 +148,15 @@ import java.util.List; } PlotComment comment = value.get(index - 1); inbox.removeComment(plot, comment); - plot.removeComment(comment); - MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, comment.comment); + boolean success = plot.removeComment(comment); + if (success) { + MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, + comment.comment); + } else { + MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_FAILURE, + comment.comment); + + } } })) { sendMessage(player, Captions.NOT_IN_PLOT); @@ -165,13 +172,14 @@ import java.util.List; if (!comments.isEmpty()) { plot.removeComments(comments); } - MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, "*"); + MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, "*"); return true; default: try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { - sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); + sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot inbox [inbox] [delete |clear|page]"); return false; } } From 3bec76e27af3b25dbbdcd07b3f9af02dc1100959 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 7 Sep 2019 12:46:40 +0200 Subject: [PATCH 112/258] Create CONTRIBUTING.md --- CONTRIBUTING.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..5a97f91a9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Contributing +If you feel like you can improve the plugin any way, then you are more than welcome to contribute to PlotSquared. It would be highly appreciated if you made sure to test your code before committing it, as it will save us a lot of time and effort. + +### Code Style +If you are planning to commit any changes to the project, it would be highly appreciated if you were to follow the project code style conventions. To make this easier we have provided settings that can be imported into your IDE. + +Eclipse: `Window > Preferences > Java > Code Style > Formatter` Press `Import` and select `...path/to/project/code_style.xml` + +IntelliJ: `File > Settings > Editor > Code Style`. Next to "Scheme" there is a cog wheel, press that and then `Import Scheme > IntelliJ IDEA Code Style XML` and then select `..path/to/project/code_style.xml` From ec0281768d3e0bc37d0bc3bd9dc933e8bbfa442d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 7 Sep 2019 12:50:12 +0200 Subject: [PATCH 113/258] Update README.md --- README.md | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/README.md b/README.md index 5ff94de6d..09c241a1b 100644 --- a/README.md +++ b/README.md @@ -29,28 +29,9 @@ is to provide a lag-free and smooth experience. # Building Gradle is the **recommended** way to build the project. Use `./gradlew build` in the main project directory to build the project. Gradle is required if you intend to build or develop the Sponge module. -If you prefer to use maven, a `pom.xml` file is provided for working with the Bukkit part of the plugin. # Contributing -If you feel like you can improve the plugin any way, then you are -more than welcome to contribute to PlotSquared. It would be highly -appreciated if you made sure to test your code before committing it, -as it will save us a lot of time and effort. - -### Code Style - -If you are planning to commit any changes to the project, -it would be highly appreciated if you were to follow the -project code style conventions. To make this easier we have -provided settings that can be imported into your IDE. - -**Eclipse:** -`Window > Preferences > Java > Code Style > Formatter` -Press `Import` and select `...path/to/project/code_style.xml` - -**IntelliJ:** -`File > Settings > Editor > Code Style`. Next to "Scheme" there is a cog wheel, press that and then -`Import Scheme > IntelliJ IDEA Code Style XML` and then select `..path/to/project/code_style.xml` +See [here](https://github.com/IntellectualSites/PlotSquared/blob/breaking/CONTRIBUTING.md) ## Suggestions Suggestions are welcome! We have a separate issue tracker for suggestions, that can be found in [this](https://github.com/IntellectualSites/PlotSquaredSuggestions) repository. From 20b0fa31d013b765188be9e87e08e856a40cfc6f Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 7 Sep 2019 22:46:13 +0200 Subject: [PATCH 114/258] Update gradle and deprecated methods --- Bukkit/build.gradle | 4 ++-- Core/build.gradle | 5 +++-- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 237c0740e..de4ca4e9b 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -58,8 +58,8 @@ shadowJar { relocate('net.kyori.text', 'com.github.intellectualsites.plotsquared.formatting.text') relocate("io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib") // relocate('org.mcstats', 'com.plotsquared.stats') - archiveName = "${parent.name}-${project.name}-${parent.version}.jar" - destinationDir = file "../target" + archiveFileName = "${parent.name}-${project.name}-${parent.version}.jar" + destinationDirectory = file "../target" } shadowJar.doLast { diff --git a/Core/build.gradle b/Core/build.gradle index 53f305992..90a33b8d2 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -35,8 +35,9 @@ processResources { } } -jar.setArchiveName("PlotSquared-API-${project.parent.version}.jar") -jar.destinationDir = file("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/" + project.parent.version) +//noinspection GroovyAssignabilityCheck +jar.archiveFileName = "PlotSquared-API-${project.parent.version}.jar" +jar.destinationDirectory = file("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/" + project.parent.version) task createPom { doLast { pom { diff --git a/build.gradle b/build.gradle index f2afef586..3d83a509b 100644 --- a/build.gradle +++ b/build.gradle @@ -104,8 +104,8 @@ subprojects { } relocate("io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib") // relocate('org.mcstats', 'com.plotsquared.stats') - archiveName = "${parent.name}-${project.name}-${parent.version}.jar" - destinationDir = file "../target" + archiveFileName = "${parent.name}-${project.name}-${parent.version}.jar" + destinationDirectory = file "../target" } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4b7e1f3d3..7c4388a92 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From fe730574c9d36001189682c99b49ae267e06a0a6 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 8 Sep 2019 01:06:27 +0200 Subject: [PATCH 115/258] Fixes #2490 --- Bukkit/src/main/resources/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 4c6f33b10..95f22dae1 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: ${name} main: com.github.intellectualsites.plotsquared.bukkit.BukkitMain api-version: 1.13 -version: ${version} +version: "${version}" load: STARTUP description: > Easy, yet powerful Plot World generation and management. From 04f789d404491199725adfbcd8f5149c654ff86d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 8 Sep 2019 20:02:45 +0200 Subject: [PATCH 116/258] Fix merging --- .github/ISSUE_TEMPLATE.md | 6 +- .../plotsquared/bukkit/BukkitMain.java | 32 +-- .../bukkit/events/PlotAutoMergeEvent.java | 6 +- .../bukkit/events/PlotMergeEvent.java | 7 +- .../bukkit/events/PlotUnlinkEvent.java | 6 +- .../bukkit/listeners/PlayerEvents.java | 133 +++++----- .../bukkit/listeners/SingleWorldListener.java | 4 +- .../bukkit/object/BukkitPlayer.java | 11 +- .../bukkit/util/BukkitChunkManager.java | 29 +-- .../bukkit/util/BukkitEventUtil.java | 192 +++++++-------- .../plotsquared/bukkit/util/BukkitUtil.java | 5 +- .../plotsquared/bukkit/util/SendChunk.java | 4 +- .../bukkit/uuid/SQLUUIDHandler.java | 8 +- Bukkit/src/main/resources/plugin.yml | 3 +- .../plotsquared/commands/Command.java | 2 +- .../configuration/ConfigurationOptions.java | 23 +- .../MemoryConfigurationOptions.java | 4 - .../file/FileConfigurationOptions.java | 5 - .../file/YamlConfigurationOptions.java | 29 +-- .../plotsquared/plot/IPlotMain.java | 36 +-- .../plotsquared/plot/PlotSquared.java | 4 +- .../plotsquared/plot/PlotVersion.java | 11 +- .../plotsquared/plot/commands/Alias.java | 4 +- .../plotsquared/plot/commands/Auto.java | 15 +- .../plotsquared/plot/commands/Claim.java | 11 +- .../plotsquared/plot/commands/Comment.java | 6 +- .../plotsquared/plot/commands/Copy.java | 4 +- .../plot/commands/CreateRoadSchematic.java | 6 +- .../plot/commands/DebugClaimTest.java | 6 +- .../plotsquared/plot/commands/DebugExec.java | 6 +- .../plot/commands/DebugRoadRegen.java | 17 +- .../plotsquared/plot/commands/Delete.java | 21 +- .../plotsquared/plot/commands/Deny.java | 4 +- .../plotsquared/plot/commands/Done.java | 4 +- .../plotsquared/plot/commands/FlagCmd.java | 11 +- .../plotsquared/plot/commands/Inbox.java | 8 +- .../plot/commands/MainCommand.java | 10 +- .../plotsquared/plot/commands/Merge.java | 32 +-- .../plotsquared/plot/commands/Move.java | 6 +- .../plotsquared/plot/commands/Music.java | 10 +- .../plotsquared/plot/commands/Owner.java | 2 +- .../plotsquared/plot/commands/PluginCmd.java | 4 +- .../plotsquared/plot/commands/Remove.java | 2 +- .../plot/commands/SchematicCmd.java | 5 +- .../plotsquared/plot/commands/Set.java | 2 - .../plotsquared/plot/commands/SetCommand.java | 4 +- .../plotsquared/plot/commands/SetHome.java | 9 +- .../plotsquared/plot/commands/Setup.java | 12 +- .../plotsquared/plot/commands/Swap.java | 4 +- .../plotsquared/plot/commands/Toggle.java | 15 +- .../plotsquared/plot/commands/Unlink.java | 11 +- .../plot/commands/WE_Anywhere.java | 3 +- .../plotsquared/plot/config/Captions.java | 81 +++--- .../plotsquared/plot/database/AbstractDB.java | 26 +- .../plotsquared/plot/database/DBFunc.java | 16 +- .../plotsquared/plot/database/SQLManager.java | 8 +- .../plot/generator/AugmentedUtils.java | 3 - .../plot/generator/ClassicPlotManager.java | 108 ++++---- .../plot/generator/ClassicPlotWorld.java | 2 +- .../plot/generator/HybridPlotManager.java | 14 +- .../plot/generator/HybridPlotWorld.java | 2 +- .../plot/generator/HybridUtils.java | 2 +- .../plot/listener/PlotListener.java | 14 +- .../plot/object/ConsolePlayer.java | 24 +- .../plotsquared/plot/object/Direction.java | 15 +- .../plotsquared/plot/object/Plot.java | 232 ++++++++++-------- .../plotsquared/plot/object/PlotArea.java | 90 ++++--- .../plotsquared/plot/object/PlotCluster.java | 4 +- .../plotsquared/plot/object/PlotId.java | 8 +- .../plotsquared/plot/object/PlotManager.java | 9 +- .../plotsquared/plot/object/PlotPlayer.java | 36 +-- .../plotsquared/plot/object/PlotSettings.java | 18 +- .../plot/object/schematic/Schematic.java | 8 +- .../plot/object/worlds/SinglePlot.java | 4 +- .../plot/object/worlds/SinglePlotArea.java | 28 +-- .../plotsquared/plot/util/EventUtil.java | 2 +- .../plotsquared/plot/util/MainUtil.java | 14 +- .../plot/util/SchematicHandler.java | 14 +- .../plotsquared/plot/util/UUIDHandler.java | 2 +- .../plot/util/UUIDHandlerImplementation.java | 2 +- .../plot/util/block/BasicLocalBlockQueue.java | 3 +- .../util/block/DelegateLocalBlockQueue.java | 5 +- .../plot/util/block/GlobalBlockQueue.java | 22 +- .../plot/util/block/LocalBlockQueue.java | 12 +- .../util/block/ScopedLocalBlockQueue.java | 14 +- .../plot/database/AbstractDBTest.java | 16 +- Nukkit/src/main/resources/plugin.yml | 1 + gradlew | 2 +- gradlew.bat | 2 +- 89 files changed, 854 insertions(+), 823 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 91ba21cb9..8192d7fa6 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -3,15 +3,13 @@ __*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and wil -**[REQUIRED] PlotSquared Version Number:** +**Debug paste link:** + **[REQUIRED] Spigot/Paper Version Number:** **[REQUIRED] Minecraft Version Number:** -**Links to worlds.yml file and settings.yml file:** - - **[REQUIRED] Description of the problem:** **Any relevant console output or screenshots:** 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 e32b26cb2..9596a25e9 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 @@ -54,8 +54,8 @@ import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.io.File; import java.lang.reflect.Method; import java.util.ArrayList; @@ -132,8 +132,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain // Check for updates if (PlotSquared.get().getUpdateUtility() != null) { final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); - updateUtility - .checkForUpdate(this.getPluginVersionString(), ((updateDescription, throwable) -> { + updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(), + ((updateDescription, throwable) -> { Bukkit.getScheduler().runTask(BukkitMain.this, () -> { getLogger().info("-------- PlotSquared Update Check --------"); if (throwable != null) { @@ -289,9 +289,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public void registerCommands() { final BukkitCommand bukkitCommand = new BukkitCommand(); final PluginCommand plotCommand = getCommand("plots"); - plotCommand.setExecutor(bukkitCommand); - plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot")); - plotCommand.setTabCompleter(bukkitCommand); + if (plotCommand != null) { + plotCommand.setExecutor(bukkitCommand); + plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot")); + plotCommand.setTabCompleter(bukkitCommand); + } } @Override public File getDirectory() { @@ -598,14 +600,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } @Override public QueueProvider initBlockQueue() { - try { - new SendChunk(); - MainUtil.canSendChunk = true; - } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) { - PlotSquared.debug( - SendChunk.class + " does not support " + StringMan.getString(getServerVersion())); - MainUtil.canSendChunk = false; - } + //TODO Figure out why this code is still here yet isn't being called anywhere. + // try { + // new SendChunk(); + // MainUtil.canSendChunk = true; + // } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) { + // PlotSquared.debug( + // SendChunk.class + " does not support " + StringMan.getString(getServerVersion())); + // MainUtil.canSendChunk = false; + // } return QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class); } @@ -800,4 +803,5 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public LegacyMappings getLegacyMappings() { return this.legacyMappings; } + } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java index 88c9773c9..059b296cf 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java @@ -7,8 +7,8 @@ import lombok.Setter; import org.bukkit.World; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -30,8 +30,8 @@ public final class PlotAutoMergeEvent extends PlotEvent implements Cancellable { * @param plot Plot that was merged * @param plots A list of plots involved in the event */ - public PlotAutoMergeEvent(@Nonnull final World world, @Nonnull final Plot plot, - @Nonnull final List plots) { + public PlotAutoMergeEvent(@NotNull final World world, @NotNull final Plot plot, + @NotNull final List plots) { super(plot); this.world = world; this.plots = plots; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java index 493145f2a..55488011e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java @@ -6,8 +6,7 @@ import lombok.Setter; import org.bukkit.World; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Event called when several plots are merged @@ -29,8 +28,8 @@ public final class PlotMergeEvent extends PlotEvent implements Cancellable { * @param dir The direction of the merge * @param max Max merge size */ - public PlotMergeEvent(@Nonnull final World world, @Nonnull final Plot plot, - @Nonnull final int dir, @Nonnull final int max) { + public PlotMergeEvent(@NotNull final World world, @NotNull final Plot plot, + @NotNull final int dir, @NotNull final int max) { super(plot); this.world = world; this.dir = dir; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java index 675f10d8f..5db7d04d4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java @@ -8,8 +8,8 @@ import org.bukkit.World; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -31,8 +31,8 @@ public final class PlotUnlinkEvent extends Event implements Cancellable { * @param world World in which the event occurred * @param plots Plots that are involved in the event */ - public PlotUnlinkEvent(@Nonnull final World world, @Nonnull final PlotArea area, - @Nonnull final List plots) { + public PlotUnlinkEvent(@NotNull final World world, @NotNull final PlotArea area, + @NotNull final List plots) { this.plots = plots; this.world = world; this.area = area; 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 938cc8b9a..21c604dcc 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 @@ -85,10 +85,10 @@ import java.util.regex.Pattern; int distance = Bukkit.getViewDistance() * 16; for (Entry entry : UUIDHandler.getPlayers().entrySet()) { PlotPlayer player = entry.getValue(); - Location loc = player.getLocation(); - if (loc.getWorld().equals(world)) { - if (16 * Math.abs(loc.getX() - x) / 16 > distance - || 16 * Math.abs(loc.getZ() - z) / 16 > distance) { + Location location = player.getLocation(); + if (location.getWorld().equals(world)) { + if (16 * Math.abs(location.getX() - x) / 16 > distance + || 16 * Math.abs(location.getZ() - z) / 16 > distance) { continue; } ((BukkitPlayer) player).player.sendBlockChange(bloc, data); @@ -314,12 +314,12 @@ import java.util.regex.Pattern; case POWERED_RAIL: return; default:*/ - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = loc.getOwnedPlot(); + Plot plot = location.getOwnedPlot(); if (plot == null) { return; } @@ -369,12 +369,11 @@ import java.util.regex.Pattern; switch (event.getChangedType()) { case COMPARATOR: { Block block = event.getBlock(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); - if (area == null) { + Location location = BukkitUtil.getLocation(block.getLocation()); + if (location.isPlotArea()) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = location.getOwnedPlotAbs(); if (plot == null) { return; } @@ -391,12 +390,12 @@ import java.util.regex.Pattern; case TURTLE_HELMET: case TURTLE_SPAWN_EGG: { Block block = event.getBlock(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location); if (plot == null) { return; } @@ -413,30 +412,30 @@ import java.util.regex.Pattern; case STICKY_PISTON: org.bukkit.block.data.Directional piston = (org.bukkit.block.data.Directional) block.getBlockData(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location); if (plot == null) { return; } switch (piston.getFacing()) { case EAST: - loc.setX(loc.getX() + 1); + location.setX(location.getX() + 1); break; case SOUTH: - loc.setX(loc.getX() - 1); + location.setX(location.getX() - 1); break; case WEST: - loc.setZ(loc.getZ() + 1); + location.setZ(location.getZ() + 1); break; case NORTH: - loc.setZ(loc.getZ() - 1); + location.setZ(location.getZ() - 1); break; } - Plot newPlot = area.getOwnedPlotAbs(loc); + Plot newPlot = area.getOwnedPlotAbs(location); if (!plot.equals(newPlot)) { event.setCancelled(true); return; @@ -470,15 +469,15 @@ import java.util.regex.Pattern; @EventHandler public boolean onProjectileHit(ProjectileHitEvent event) { Projectile entity = event.getEntity(); - Location loc = BukkitUtil.getLocation(entity); - if (!PlotSquared.get().hasPlotArea(loc.getWorld())) { + Location location = BukkitUtil.getLocation(entity); + if (!PlotSquared.get().hasPlotArea(location.getWorld())) { return true; } - PlotArea area = loc.getPlotArea(); + PlotArea area = location.getPlotArea(); if (area == null) { return true; } - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); ProjectileSource shooter = entity.getShooter(); if (shooter instanceof Player) { PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter); @@ -523,22 +522,22 @@ import java.util.regex.Pattern; return; } Player player = event.getPlayer(); - PlotPlayer pp = BukkitUtil.getPlayer(player); - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); + Location location = plotPlayer.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return; } String[] parts = msg.split(" "); - Plot plot = pp.getCurrentPlot(); + Plot plot = plotPlayer.getCurrentPlot(); // Check WorldEdit switch (parts[0].toLowerCase()) { case "up": case "/up": case "worldedit:up": case "worldedit:/up": - if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions - .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { + if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { event.setCancelled(true); return; } @@ -548,7 +547,7 @@ import java.util.regex.Pattern; } Optional> flag = plot.getFlag(Flags.BLOCKED_CMDS); if (flag.isPresent() && !Permissions - .hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { List blocked_cmds = flag.get(); String part = parts[0]; if (parts[0].contains(":")) { @@ -592,13 +591,13 @@ import java.util.regex.Pattern; } if (pattern.matcher(msg).matches()) { String perm; - if (plot.isAdded(pp.getUUID())) { + if (plot.isAdded(plotPlayer.getUUID())) { perm = "plots.admin.command.blocked-cmds.shared"; } else { perm = "plots.admin.command.blocked-cmds.other"; } - if (!Permissions.hasPermission(pp, perm)) { - MainUtil.sendMessage(pp, Captions.COMMAND_BLOCKED); + if (!Permissions.hasPermission(plotPlayer, perm)) { + MainUtil.sendMessage(plotPlayer, Captions.COMMAND_BLOCKED); event.setCancelled(true); } return; @@ -619,10 +618,10 @@ import java.util.regex.Pattern; UUID uuid = pp.getUUID(); UUIDHandler.add(sw, uuid); - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = pp.getLocation(); + PlotArea area = location.getPlotArea(); if (area != null) { - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); if (plot != null) { plotEntry(pp, plot); } @@ -641,7 +640,7 @@ import java.util.regex.Pattern; && PlotSquared.get().getUpdateUtility() != null) { final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class); - updateUtility.checkForUpdate(bukkitMain.getPluginVersionString(), + updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(), ((updateDescription, throwable) -> { if (throwable != null) { bukkitMain.getLogger().severe(String @@ -688,27 +687,27 @@ import java.util.regex.Pattern; org.bukkit.Location to = event.getTo(); if (to != null) { Player player = event.getPlayer(); - PlotPlayer pp = PlotPlayer.wrap(player); - Location loc = BukkitUtil.getLocation(to); - PlotArea area = loc.getPlotArea(); + PlotPlayer plotPlayer = PlotPlayer.wrap(player); + Location location = BukkitUtil.getLocation(to); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getPlot(loc); + Plot plot = area.getPlot(location); if (plot != null) { - final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot); + final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); if (!result) { - MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_ENTRY_DENIED); event.setCancelled(true); if (lastLoc != null) { - pp.setMeta(PlotPlayer.META_LOCATION, lastLoc); + plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc); } if (lastPlot != null) { - pp.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); + plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); } } else { - plotEntry(pp, plot); + plotEntry(plotPlayer, plot); } } } @@ -809,14 +808,14 @@ import java.util.regex.Pattern; // Cancel teleport TaskManager.TELEPORT_QUEUE.remove(pp.getName()); // Set last location - Location loc = BukkitUtil.getLocation(to); - pp.setMeta(PlotPlayer.META_LOCATION, loc); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(to); + pp.setMeta(PlotPlayer.META_LOCATION, location); + PlotArea area = location.getPlotArea(); if (area == null) { pp.deleteMeta(PlotPlayer.META_LAST_PLOT); return; } - Plot now = area.getPlot(loc); + Plot now = area.getPlot(location); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); if (now == null) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp @@ -869,14 +868,14 @@ import java.util.regex.Pattern; // Cancel teleport TaskManager.TELEPORT_QUEUE.remove(pp.getName()); // Set last location - Location loc = BukkitUtil.getLocation(to); - pp.setMeta(PlotPlayer.META_LOCATION, loc); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(to); + pp.setMeta(PlotPlayer.META_LOCATION, location); + PlotArea area = location.getPlotArea(); if (area == null) { pp.deleteMeta(PlotPlayer.META_LAST_PLOT); return; } - Plot now = area.getPlot(loc); + Plot now = area.getPlot(location); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); if (now == null) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp @@ -1123,10 +1122,10 @@ import java.util.regex.Pattern; if (Settings.Enabled_Components.PERMISSION_CACHE) { pp.deleteMeta("perm"); } - Location loc = pp.getLocation(); - PlotArea area = loc.getPlotArea(); - if (loc.isPlotArea()) { - plot = loc.getPlot(); + Location location = pp.getLocation(); + PlotArea area = location.getPlotArea(); + if (location.isPlotArea()) { + plot = location.getPlot(); if (plot != null) { plotEntry(pp, plot); } @@ -2269,17 +2268,17 @@ import java.util.regex.Pattern; Entity ignitingEntity = event.getIgnitingEntity(); Block block = event.getBlock(); BlockIgniteEvent.IgniteCause igniteCause = event.getCause(); - Location loc; + Location location1; if (block != null) { - loc = BukkitUtil.getLocation(block.getLocation()); + location1 = BukkitUtil.getLocation(block.getLocation()); } else if (ignitingEntity != null) { - loc = BukkitUtil.getLocation(ignitingEntity); + location1 = BukkitUtil.getLocation(ignitingEntity); } else if (player != null) { - loc = BukkitUtil.getLocation(player); + location1 = BukkitUtil.getLocation(player); } else { return; } - PlotArea area = loc.getPlotArea(); + PlotArea area = location1.getPlotArea(); if (area == null) { return; } @@ -2288,7 +2287,7 @@ import java.util.regex.Pattern; return; } - Plot plot = area.getOwnedPlotAbs(loc); + Plot plot = area.getOwnedPlotAbs(location1); if (player != null) { PlotPlayer pp = BukkitUtil.getPlayer(player); if (plot == null) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java index fc13147dd..a53527fc9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java @@ -30,8 +30,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod(); try { this.mustSave = classChunk.getField("mustSave").getRealField(); - } catch (Throwable ignore) { - ignore.printStackTrace(); + } catch (NoSuchFieldException e) { + e.printStackTrace(); } Bukkit.getPluginManager().registerEvents(this, plugin); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index d16038215..61862f899 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -25,7 +25,6 @@ import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.RegisteredListener; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Set; import java.util.UUID; @@ -56,7 +55,7 @@ public class BukkitPlayer extends PlotPlayer { super.populatePersistentMetaMap(); } - @Override public Location getLocation() { + @NotNull @Override public Location getLocation() { final Location location = super.getLocation(); return location == null ? BukkitUtil.getLocation(this.player) : location; } @@ -72,8 +71,8 @@ public class BukkitPlayer extends PlotPlayer { return this.player.getLastPlayed(); } - @Override public boolean canTeleport(@NotNull final Location loc) { - final org.bukkit.Location to = BukkitUtil.getLocation(loc); + @Override public boolean canTeleport(@NotNull final Location location) { + final org.bukkit.Location to = BukkitUtil.getLocation(location); final org.bukkit.Location from = player.getLocation(); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); callEvent(event); @@ -184,7 +183,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void teleport(@Nonnull final Location location) { + @Override public void teleport(@NotNull final Location location) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { return; } @@ -229,7 +228,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Nonnull @Override public PlotGameMode getGameMode() { + @NotNull @Override public PlotGameMode getGameMode() { switch (this.player.getGameMode()) { case ADVENTURE: return PlotGameMode.ADVENTURE; 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 c3b7521f2..a9c6b2518 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 @@ -351,8 +351,8 @@ public class BukkitChunkManager extends ChunkManager { int bz = min.getZ(); for (int x1 = 0; x1 < 16; x1++) { for (int z1 = 0; z1 < 16; z1++) { - PlotLoc loc = new PlotLoc(bx + x1, bz + z1); - BaseBlock[] ids = map.allBlocks.get(loc); + PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1); + BaseBlock[] ids = map.allBlocks.get(plotLoc); if (ids != null) { for (int y = 0; y < Math.min(128, ids.length); y++) { BaseBlock id = ids[y]; @@ -387,17 +387,18 @@ public class BukkitChunkManager extends ChunkManager { return true; } - @Override public boolean loadChunk(String world, ChunkLoc loc, boolean force) { - return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force); + @Override public boolean loadChunk(String world, ChunkLoc chunkLoc, boolean force) { + return BukkitUtil.getWorld(world).getChunkAt(chunkLoc.x, chunkLoc.z).load(force); } - @SuppressWarnings("deprecation") @Override - public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, + @Override + public void unloadChunk(final String world, final ChunkLoc chunkLoc, final boolean save, final boolean safe) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) { - TaskManager.runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save)); + TaskManager.runTask( + () -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save)); } else { - BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save); + BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save); } } @@ -614,9 +615,9 @@ public class BukkitChunkManager extends ChunkManager { void saveEntitiesOut(Chunk chunk, RegionWrapper region) { for (Entity entity : chunk.getEntities()) { - Location loc = BukkitUtil.getLocation(entity); - int x = loc.getX(); - int z = loc.getZ(); + Location location = BukkitUtil.getLocation(entity); + int x = location.getX(); + int z = location.getZ(); if (isIn(region, x, z)) { continue; } @@ -636,9 +637,9 @@ public class BukkitChunkManager extends ChunkManager { void saveEntitiesIn(Chunk chunk, RegionWrapper region, int offsetX, int offsetZ, boolean delete) { for (Entity entity : chunk.getEntities()) { - Location loc = BukkitUtil.getLocation(entity); - int x = loc.getX(); - int z = loc.getZ(); + Location location = BukkitUtil.getLocation(entity); + int x = location.getX(); + int z = location.getZ(); if (!isIn(region, x, z)) { continue; } 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 744d9084f..c2e39715e 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,22 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -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.events.*; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -30,9 +14,9 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.List; import java.util.UUID; @@ -41,91 +25,93 @@ import java.util.UUID; */ public final class BukkitEventUtil extends EventUtil { - @Nullable public Player getPlayer(final PlotPlayer player) { - if (player instanceof BukkitPlayer) { - return ((BukkitPlayer) player).player; + @Nullable public Player getPlayer(final PlotPlayer player) { + if (player instanceof BukkitPlayer) { + return ((BukkitPlayer) player).player; + } + return null; } - return null; - } - private boolean callEvent(@Nonnull final Event event) { - Bukkit.getServer().getPluginManager().callEvent(event); - return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled(); - } - - @Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) { - return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto)); - } - - @Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) { - return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot)); - } - - @Override public boolean callComponentSet(Plot plot, String component) { - return callEvent(new PlotComponentSetEvent(plot, component)); - } - - @Override public boolean callClear(Plot plot) { - return callEvent(new PlotClearEvent(plot)); - } - - @Override public boolean callDelete(Plot plot) { - return callEvent(new PlotDeleteEvent(plot)); - } - - @Override public boolean callFlagAdd(Flag flag, Plot plot) { - return callEvent(new PlotFlagAddEvent(flag, plot)); - } - - @Override public boolean callFlagRemove(Flag flag, Plot plot, Object value) { - return callEvent(new PlotFlagRemoveEvent(flag, plot)); - } - - @Override public boolean callMerge(Plot plot, int dir, int max) { - return callEvent(new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max)); - } - - @Override public boolean callAutoMerge(Plot plot, List plots) { - return callEvent(new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots)); - } - - @Override public boolean callUnlink(PlotArea area, List plots) { - return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots)); - } - - @Override public void callEntry(PlotPlayer player, Plot plot) { - callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot)); - } - - @Override public void callLeave(PlotPlayer player, Plot plot) { - callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot)); - } - - @Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added)); - } - - @Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added)); - } - - @Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added)); - } - - @Override - public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, - boolean hasOldOwner) { - return callEvent( - new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner)); - } - - @Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) { - PlotRateEvent event = new PlotRateEvent(player, rating, plot); - Bukkit.getServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return null; + private boolean callEvent(@NotNull final Event event) { + Bukkit.getServer().getPluginManager().callEvent(event); + return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled(); + } + + @Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) { + return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto)); + } + + @Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) { + return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot)); + } + + @Override public boolean callComponentSet(Plot plot, String component) { + return callEvent(new PlotComponentSetEvent(plot, component)); + } + + @Override public boolean callClear(Plot plot) { + return callEvent(new PlotClearEvent(plot)); + } + + @Override public boolean callDelete(Plot plot) { + return callEvent(new PlotDeleteEvent(plot)); + } + + @Override public boolean callFlagAdd(Flag flag, Plot plot) { + return callEvent(new PlotFlagAddEvent(flag, plot)); + } + + @Override public boolean callFlagRemove(Flag flag, Plot plot, Object value) { + return callEvent(new PlotFlagRemoveEvent(flag, plot)); + } + + @Override public boolean callMerge(Plot plot, int dir, int max) { + return callEvent( + new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max)); + } + + @Override public boolean callAutoMerge(Plot plot, List plots) { + return callEvent( + new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots)); + } + + @Override public boolean callUnlink(PlotArea area, List plots) { + return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots)); + } + + @Override public void callEntry(PlotPlayer player, Plot plot) { + callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot)); + } + + @Override public void callLeave(PlotPlayer player, Plot plot) { + callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot)); + } + + @Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added)); + } + + @Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added)); + } + + @Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added)); + } + + @Override + public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, + boolean hasOldOwner) { + return callEvent( + new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner)); + } + + @Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) { + PlotRateEvent event = new PlotRateEvent(player, rating, plot); + Bukkit.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return null; + } + return event.getRating(); } - return event.getRating(); - } } 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 283e68688..a2d0b0c9b 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 @@ -27,8 +27,9 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -242,7 +243,7 @@ import java.util.Set; location.getBlockZ()); } - public static Location getLocationFull(@NonNull final Entity entity) { + @NotNull public static Location getLocationFull(@NonNull final Entity entity) { final org.bukkit.Location location = entity.getLocation(); return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(), 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 6ed7317b6..cb525199c 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 @@ -42,7 +42,6 @@ public class SendChunk { * Constructor. */ public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { - RefConstructor tempMapChunk; RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer"); this.methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle"); RefClass classCraftChunk = getRefClass("{cb}.CraftChunk"); @@ -50,8 +49,7 @@ public class SendChunk { RefClass classChunk = getRefClass("{nms}.Chunk"); this.methodInitLighting = classChunk.getMethod("initLighting"); RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk"); - tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class); - this.mapChunk = tempMapChunk; + this.mapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class); RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer"); this.connection = classEntityPlayer.getField("playerConnection"); RefClass classPacket = getRefClass("{nms}.Packet"); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 86cd9ae0d..4c74be5b6 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -31,13 +31,13 @@ import java.util.ArrayDeque; import java.util.Collections; import java.util.HashMap; import java.util.UUID; +import java.util.concurrent.TimeUnit; public class SQLUUIDHandler extends UUIDHandlerImplementation { final int MAX_REQUESTS = 500; private final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/"; - private final int INTERVAL = 12000; private final JSONParser jsonParser = new JSONParser(); private final SQLite sqlite; @@ -133,7 +133,10 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { "Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)"); } try { - Thread.sleep(INTERVAL * 50); + //Mojang allows requests every 10 minutes according to https://wiki.vg/Mojang_API + //15 Minutes is chosen here since system timers are not always precise + //and it should provide enough time where Mojang won't block requests. + TimeUnit.MINUTES.sleep(15); } catch (InterruptedException e) { e.printStackTrace(); break; @@ -142,7 +145,6 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { if (whenDone != null) { whenDone.run(); } - return; }); }); } catch (SQLException e) { diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 95f22dae1..0dbd861e0 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: ${name} main: com.github.intellectualsites.plotsquared.bukkit.BukkitMain -api-version: 1.13 +api-version: "1.13" version: "${version}" load: STARTUP description: > @@ -126,6 +126,7 @@ permissions: plots.toggle: true plots.toggle.titles: true plots.toggle.chat: true + plots.toggle.time: true plots.set.biome: true plots.set.home: true plots.set.alias: true 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 945d2d374..faaf3c7af 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 @@ -263,7 +263,7 @@ public abstract class Command { /** * @param player Caller - * @param args Arguments + * @param args Arguments * @param confirm Instance, Success, Failure * @return CompletableFuture true if the command executed fully, false in * any other case diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java index 5d13920e4..81c96196d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java @@ -6,7 +6,6 @@ package com.github.intellectualsites.plotsquared.configuration; */ class ConfigurationOptions { private final Configuration configuration; - private char pathSeparator = '.'; private boolean copyDefaults = false; protected ConfigurationOptions(Configuration configuration) { @@ -26,28 +25,12 @@ class ConfigurationOptions { * Gets the char that will be used to separate {@link * ConfigurationSection}s. * - *

    This value does not affect how the {@link Configuration} is stored, - * only in how you access the data. The default value is '.'. + *

    This value is always '.'. * * @return Path separator */ - public char pathSeparator() { - return pathSeparator; - } - - /** - * Sets the char that will be used to separate {@link - * ConfigurationSection}s. - * - *

    This value does not affect how the {@link Configuration} is stored, - * only in how you access the data. The default value is '.'. - * - * @param value Path separator - * @return This object, for chaining - */ - public ConfigurationOptions pathSeparator(char value) { - pathSeparator = value; - return this; + char pathSeparator() { + return '.'; } /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java index 971ea1e70..22f9d751b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java @@ -18,8 +18,4 @@ public class MemoryConfigurationOptions extends ConfigurationOptions { return this; } - @Override public MemoryConfigurationOptions pathSeparator(char value) { - super.pathSeparator(value); - return this; - } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java index a216d0566..6eb99bb6e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java @@ -25,11 +25,6 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions { return this; } - @Override public FileConfigurationOptions pathSeparator(char value) { - super.pathSeparator(value); - return this; - } - /** * Gets the header that will be applied to the top of the saved output. * diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java index a17bc3538..a7e71cdaf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java @@ -5,7 +5,6 @@ package com.github.intellectualsites.plotsquared.configuration.file; * YamlConfiguration}. */ public class YamlConfigurationOptions extends FileConfigurationOptions { - private int indent = 2; YamlConfigurationOptions(YamlConfiguration configuration) { super(configuration); @@ -20,11 +19,6 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { return this; } - @Override public YamlConfigurationOptions pathSeparator(char value) { - super.pathSeparator(value); - return this; - } - @Override public YamlConfigurationOptions header(String value) { super.header(value); return this; @@ -42,27 +36,8 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { * * @return How much to indent by */ - public int indent() { - return indent; + int indent() { + return 2; } - /** - * Sets how much spaces should be used to indent each line. - * - *

    The minimum value this may be is 2, and the maximum is 9. - * - * @param value New indent - * @return This object, for chaining - */ - public YamlConfigurationOptions indent(int value) { - if (value < 2) { - throw new IllegalArgumentException("Indent must be at least 2 characters"); - } - if (value > 9) { - throw new IllegalArgumentException("Indent cannot be greater than 9 characters"); - } - - indent = value; - return this; - } } 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 e1eb152b5..8fff0921d 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 @@ -63,12 +63,12 @@ public interface IPlotMain extends ILogger { */ String getPluginVersionString(); - String getPluginName(); + default String getPluginName() { + return "PlotSquared"; + } /** * Gets the version of Minecraft that is running. - * - * @return */ int[] getServerVersion(); @@ -101,7 +101,7 @@ public interface IPlotMain extends ILogger { /** * The task manager will run and manage Minecraft tasks. * - * @return + * @return the PlotSquared task manager */ TaskManager getTaskManager(); @@ -138,49 +138,39 @@ public interface IPlotMain extends ILogger { /** * Gets the economy provider. * - * @return + * @return the PlotSquared economy manager */ EconHandler getEconomyHandler(); /** * Gets the {@link QueueProvider} class. - * - * @return */ QueueProvider initBlockQueue(); /** * Gets the {@link WorldUtil} class. - * - * @return */ WorldUtil initWorldUtil(); /** * Gets the EventUtil class. - * - * @return */ EventUtil initEventUtil(); /** * Gets the chunk manager. * - * @return + * @return the PlotSquared chunk manager */ ChunkManager initChunkManager(); /** * Gets the {@link SetupUtils} class. - * - * @return */ SetupUtils initSetupUtils(); /** * Gets {@link HybridUtils} class. - * - * @return */ HybridUtils initHybridUtils(); @@ -199,32 +189,28 @@ public interface IPlotMain extends ILogger { /** * Gets the {@link UUIDHandlerImplementation} which will cache and * provide UUIDs. - * - * @return */ UUIDHandlerImplementation initUUIDHandler(); /** * Gets the {@link InventoryUtil} class (used for implementation specific * inventory guis). - * - * @return */ InventoryUtil initInventoryUtil(); /** * Unregisters a {@link PlotPlayer} from cache e.g. if they have logged off. * - * @param player + * @param player the player to remove */ void unregister(PlotPlayer player); /** * Gets the generator wrapper for a world (world) and generator (name). * - * @param world - * @param name - * @return + * @param world the world to get the generator from + * @param name the name of the generator + * @return the generator being used for the provided world */ GeneratorWrapper getGenerator(String world, String name); @@ -232,7 +218,7 @@ public interface IPlotMain extends ILogger { /** * Register the chunk processor which will clean out chunks that have too - * many blockstates or entities. + * many block states or entities. */ void registerChunkProcessor(); 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 f92c6a6fb..45c284a3f 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 @@ -33,8 +33,8 @@ import com.sk89q.worldedit.WorldEdit; import lombok.Getter; import lombok.NonNull; import lombok.Setter; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.io.*; import java.net.MalformedURLException; import java.net.URISyntaxException; @@ -1623,7 +1623,7 @@ import java.util.zip.ZipInputStream; final Properties properties = new Properties(); properties.load(bufferedReader); final boolean enabled = - Boolean.valueOf(properties.getOrDefault("enabled", true).toString()); + Boolean.parseBoolean(properties.getOrDefault("enabled", true).toString()); if (enabled) { this.updateUtility = new UpdateUtility(properties.getProperty("path"), properties.getProperty("job"), properties.getProperty("artifact")); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java index 1d65c36e0..4646a787a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java @@ -24,12 +24,19 @@ public class PlotVersion { public static PlotVersion tryParse(String version, String commit, String date) { try { return new PlotVersion(version, commit, date); - } catch (Exception ignore) { - ignore.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); return new PlotVersion(0, 0, 0, 0, 0); } } + public String versionString() { + if (hash == 0 && build == 0) { + return "NoVer-SNAPSHOT"; + } else { + return "4." + build; + } + } @Override public String toString() { if (hash == 0 && build == 0) { return "PlotSquared-NoVer-SNAPSHOT"; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index e4a719dcf..401446243 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -25,8 +25,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; return false; } - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } 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 fa187877e..93eef7813 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,19 +5,14 @@ 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.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.object.*; 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 javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.Set; @CommandDeclaration(command = "auto", permission = "plots.auto", @@ -123,7 +118,8 @@ public class Auto extends SubCommand { } else if (checkAllowedPlots(player, area, allowedPlots, 1, 1)) { plot.claim(player, true, schematic, false); if (area.AUTO_MERGE) { - plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true); + plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(), + true); } } else { DBFunc.delete(plot); @@ -253,6 +249,9 @@ public class Auto extends SubCommand { for (int j = start.y; j <= end.y; j++) { Plot plot = plotarea.getPlotAbs(new PlotId(i, j)); boolean teleport = i == end.x && j == end.y; + if (plot == null) { + return false; + } plot.claim(player, teleport, null); } } 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 b06e0b57b..94a82fdd8 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 @@ -20,13 +20,14 @@ public class Claim extends SubCommand { if (args.length >= 1) { schematic = args[0]; } - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return sendMessage(player, Captions.NOT_IN_PLOT); } - int currentPlots = - Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); + int currentPlots = Settings.Limit.GLOBAL ? + player.getPlotCount() : + player.getPlotCount(location.getWorld()); int grants = 0; if (currentPlots >= player.getAllowedPlots()) { if (player.hasPersistentMeta("grantedPlots")) { @@ -89,7 +90,7 @@ public class Claim extends SubCommand { @Override public void run(Object value) { plot.claim(player, true, finalSchematic, false); if (area.AUTO_MERGE) { - plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true); + plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(), true); } } }), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED)); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java index 048047bb6..171a5bfe5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java @@ -32,7 +32,7 @@ public class Comment extends SubCommand { StringMan.join(CommentManager.inboxes.keySet(), "|")); return false; } - Location loc = player.getLocation(); + Location location = player.getLocation(); PlotId id; try { id = PlotId.fromString(args[1]); @@ -44,7 +44,7 @@ public class Comment extends SubCommand { int index; if (plot == null) { index = 1; - plot = loc.getPlotAbs(); + plot = location.getPlotAbs(); } else { if (args.length < 4) { sendMessage(player, Captions.COMMENT_SYNTAX, @@ -59,7 +59,7 @@ public class Comment extends SubCommand { } String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " "); PlotComment comment = - new PlotComment(loc.getWorld(), id, message, player.getName(), inbox.toString(), + new PlotComment(location.getWorld(), id, message, player.getName(), inbox.toString(), System.currentTimeMillis()); boolean result = inbox.addComment(plot, comment); if (!result) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index 2a34fdbf5..de77513bc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; requiredType = RequiredType.NONE) public class Copy extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java index 2c901aa35..14fa6347e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java @@ -16,12 +16,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return sendMessage(player, Captions.NOT_IN_PLOT); } - if (!(loc.getPlotArea() instanceof HybridPlotWorld)) { + if (!(location.getPlotArea() instanceof HybridPlotWorld)) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } HybridUtils.manager.setupRoadSchematic(plot); 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 41a5eda80..6dbcdfb57 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 @@ -55,13 +55,13 @@ public class DebugClaimTest extends SubCommand { MainUtil.sendMessage(player, " - &cDB Already contains: " + plot.getId()); continue; } - Location loc = manager.getSignLoc(plot); - ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); + Location location = manager.getSignLoc(plot); + ChunkLoc chunk = new ChunkLoc(location.getX() >> 4, location.getZ() >> 4); boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false); if (!result) { continue; } - String[] lines = WorldUtil.IMP.getSign(loc); + String[] lines = WorldUtil.IMP.getSign(location); if (lines != null) { String line = lines[2]; if (line != null && line.length() > 2) { 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 7e8e9cf34..841c6fc8c 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 @@ -369,17 +369,17 @@ import java.util.concurrent.CompletableFuture; Command cmd = MainCommand.getInstance().getCommand(args[3]); String[] params = Arrays.copyOfRange(args, 4, args.length); if ("true".equals(args[1])) { - Location loc = player.getMeta(PlotPlayer.META_LOCATION); + Location location = player.getMeta(PlotPlayer.META_LOCATION); Plot plot = player.getMeta(PlotPlayer.META_LAST_PLOT); for (Plot current : PlotSquared.get().getBasePlots()) { player.setMeta(PlotPlayer.META_LOCATION, current.getBottomAbs()); player.setMeta(PlotPlayer.META_LAST_PLOT, current); cmd.execute(player, params, null, null); } - if (loc == null) { + if (location == null) { player.deleteMeta(PlotPlayer.META_LOCATION); } else { - player.setMeta(PlotPlayer.META_LOCATION, loc); + player.setMeta(PlotPlayer.META_LOCATION, location); } if (plot == null) { player.deleteMeta(PlotPlayer.META_LAST_PLOT); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index d6029186f..a268f8903 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -3,7 +3,6 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; -import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -23,28 +22,24 @@ public class DebugRoadRegen extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { if (args.length < 1) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - DebugRoadRegen.USAGE); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); return false; } String kind = args[0].toLowerCase(); switch (kind) { case "plot": return regenPlot(player); - case "region": return regenRegion(player, Arrays.copyOfRange(args, 1, args.length)); - default: - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - DebugRoadRegen.USAGE); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); return false; } } public boolean regenPlot(PlotPlayer player) { - Location loc = player.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = player.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } @@ -82,8 +77,8 @@ public class DebugRoadRegen extends SubCommand { return false; } - Location loc = player.getLocation(); - PlotArea area = loc.getPlotArea(); + Location location = player.getLocation(); + PlotArea area = location.getPlotArea(); if (area == null) { return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java index 3593de74f..72c6da126 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java @@ -3,8 +3,16 @@ package com.github.intellectualsites.plotsquared.plot.commands; 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.util.*; +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.util.CmdConfirm; +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; @CommandDeclaration(command = "delete", permission = "plots.delete", @@ -16,8 +24,8 @@ import com.github.intellectualsites.plotsquared.plot.util.*; // The syntax also works with any command: /plot @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } @@ -30,8 +38,9 @@ import com.github.intellectualsites.plotsquared.plot.util.*; } final PlotArea plotArea = plot.getArea(); final java.util.Set plots = plot.getConnectedPlots(); - final int currentPlots = - Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); + final int currentPlots = Settings.Limit.GLOBAL ? + player.getPlotCount() : + player.getPlotCount(location.getWorld()); Runnable run = new Runnable() { @Override public void run() { if (plot.getRunning() > 0) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 6d5dc99c7..5ddfde305 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -97,8 +97,8 @@ import java.util.UUID; if (player.getGameMode() == PlotGameMode.SPECTATOR) { player.stopSpectating(); } - Location loc = player.getLocation(); - Location spawn = WorldUtil.IMP.getSpawn(loc.getWorld()); + Location location = player.getLocation(); + Location spawn = WorldUtil.IMP.getSpawn(location.getWorld()); MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED); if (plot.equals(spawn.getPlot())) { Location newSpawn = diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java index 8ef920565..055cfabd9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java @@ -19,8 +19,8 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; requiredType = RequiredType.NONE) public class Done extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if ((plot == null) || !plot.hasOwner()) { return !sendMessage(player, Captions.NOT_IN_PLOT); } 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 b55895494..84446aa00 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 @@ -24,10 +24,9 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.*; -@CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setf", "setflag"}, - usage = "/plot flag ", description = "Set plot flags", - category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, - permission = "plots.flag") public class FlagCmd extends SubCommand { +@CommandDeclaration(command = "setflag", aliases = {"f", "flag", + "setflag"}, usage = "/plot flag ", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag") +public class FlagCmd extends SubCommand { private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) { key = key.toLowerCase(); @@ -90,8 +89,8 @@ import java.util.*; MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return false; } - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 180bec623..030ef0f44 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -14,9 +14,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.List; @CommandDeclaration(command = "inbox", description = "Review the comments for a plot", - usage = "/plot inbox [inbox] [delete |clear|page]", permission = "plots.inbox", - category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) public class Inbox - extends SubCommand { + usage = "/plot inbox [inbox] [delete |clear|page]", permission = "plots.inbox", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) +public class Inbox extends SubCommand { public void displayComments(PlotPlayer player, List oldComments, int page) { if (oldComments == null || oldComments.isEmpty()) { @@ -178,8 +177,7 @@ import java.util.List; try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { - sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot inbox [inbox] [delete |clear|page]"); + sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return false; } } 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 31e599976..31095cd75 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 @@ -193,19 +193,19 @@ public class MainCommand extends Command { // Clear perm caching // player.deleteMeta("perm"); // Optional command scope // - Location loc = null; + Location location = null; Plot plot = null; boolean tp = false; if (args.length >= 2) { PlotArea area = player.getApplicablePlotArea(); Plot newPlot = Plot.fromString(area, args[0]); if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea() - .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN)) + .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_SUDO_AREA)) && !newPlot.isDenied(player.getUUID())) { Location newLoc = newPlot.getCenter(); if (player.canTeleport(newLoc)) { // Save meta - loc = player.getMeta(PlotPlayer.META_LOCATION); + location = player.getMeta(PlotPlayer.META_LOCATION); plot = player.getMeta(PlotPlayer.META_LAST_PLOT); tp = true; // Set loc @@ -262,10 +262,10 @@ public class MainCommand extends Command { } // Reset command scope // if (tp && !(player instanceof ConsolePlayer)) { - if (loc == null) { + if (location == null) { player.deleteMeta(PlotPlayer.META_LOCATION); } else { - player.setMeta(PlotPlayer.META_LOCATION, loc); + player.setMeta(PlotPlayer.META_LOCATION, location); } if (plot == null) { player.deleteMeta(PlotPlayer.META_LAST_PLOT); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index 179761f94..43204b266 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; 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.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; @@ -17,6 +18,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.UUID; +import static com.github.intellectualsites.plotsquared.plot.object.Direction.getFromIndex; + @CommandDeclaration(command = "merge", aliases = "m", description = "Merge the plot you are standing on with another plot", permission = "plots.merge", usage = "/plot merge [removeroads]", @@ -49,8 +52,8 @@ public class Merge extends SubCommand { } @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocationFull(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocationFull(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } @@ -82,20 +85,20 @@ public class Merge extends SubCommand { MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.merge." + (size + 1)); return false; } - int direction = -1; + Direction direction = Direction.ALL; if (args.length == 0) { switch (direction(player.getLocationFull().getYaw())) { case "NORTH": - direction = 0; + direction = Direction.NORTH; break; case "EAST": - direction = 1; + direction = Direction.EAST; break; case "SOUTH": - direction = 2; + direction = Direction.SOUTH; break; case "WEST": - direction = 3; + direction = Direction.WEST; break; } } else { @@ -110,7 +113,7 @@ public class Merge extends SubCommand { Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); return true; } - if (plot.autoMerge(-1, maxSize, uuid, terrain)) { + if (plot.autoMerge(Direction.ALL, maxSize, uuid, terrain)) { if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { EconHandler.manager.withdrawMoney(player, price); sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); @@ -124,16 +127,16 @@ public class Merge extends SubCommand { } for (int i = 0; i < values.length; i++) { if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) { - direction = i; + direction = getFromIndex(i); break; } } } - if (direction == -1) { + if (direction == Direction.ALL) { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); - MainUtil.sendMessage(player, - Captions.DIRECTION.getTranslated().replaceAll("%dir%", direction(loc.getYaw()))); + MainUtil.sendMessage(player, Captions.DIRECTION.getTranslated() + .replaceAll("%dir%", direction(location.getYaw()))); return false; } final boolean terrain; @@ -156,7 +159,8 @@ public class Merge extends SubCommand { return true; } Plot adjacent = plot.getRelative(direction); - if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4) + if (adjacent == null || !adjacent.hasOwner() || adjacent + .getMerged((direction.getIndex() + 2) % 4) || adjacent.isOwner(uuid)) { MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); return false; @@ -173,7 +177,7 @@ public class Merge extends SubCommand { continue; } isOnline = true; - final int dir = direction; + final Direction dir = direction; Runnable run = () -> { MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED); plot.autoMerge(dir, maxSize - size, owner, terrain); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index fb8464aea..02c7494cb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -11,12 +11,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; @CommandDeclaration(usage = "/plot move ", command = "move", description = "Move a plot", - permission = "plots.move", category = CommandCategory.CLAIMING, + permission = "plots.move", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER) public class Move extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java index e773879ae..a763a3c51 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.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.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; -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.PlotInventory; +import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import java.util.Arrays; import java.util.Collection; @@ -20,8 +24,8 @@ import java.util.Locale; "music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait"); @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 98e32dcd6..55dbdbda4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -17,7 +17,7 @@ import java.util.UUID; @CommandDeclaration(command = "setowner", permission = "plots.set.owner", description = "Set the plot owner", usage = "/plot setowner ", aliases = {"owner", "so", "seto"}, category = CommandCategory.CLAIMING, - requiredType = RequiredType.PLAYER, confirmation = true) public class Owner extends SetCommand { + requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, String value) { Set plots = plot.getConnectedPlots(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index d284ce708..8e31051fb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -22,8 +22,8 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21"); MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki"); - MainUtil.sendMessage(player, - "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); + // MainUtil.sendMessage(player, + // "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); } }); return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java index af1c0024d..875eb6e4c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java @@ -19,7 +19,7 @@ import java.util.UUID; @CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"}, description = "Remove a player from a plot", usage = "/plot remove ", - category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER, + category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.remove") public class Remove extends SubCommand { public Remove() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index deef2081c..e645b8781 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -158,8 +158,7 @@ public class SchematicCmd extends SubCommand { } Collection plots = area.getPlots(); if (plots.isEmpty()) { - MainUtil - .sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD); + MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD); return false; } boolean result = SchematicHandler.manager.exportAll(plots, null, null, @@ -169,7 +168,7 @@ public class SchematicCmd extends SubCommand { return false; } else { MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED); - MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_COUNT, plots.size()); + MainUtil.sendMessage(player, "&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); } break; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 1f2d1c2a0..d3c65c8db 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; 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.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -45,7 +44,6 @@ import java.util.stream.IntStream; } @Override public boolean set(PlotPlayer player, final Plot plot, String value) { - PlotArea plotArea = player.getLocation().getPlotArea(); PlotManager manager = player.getLocation().getPlotManager(); String[] components = manager.getPlotComponents(plot.getId()); boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(player.getUUID()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index bc64f0244..8b746c624 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -11,8 +11,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; public abstract class SetCommand extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java index 7a208ebd5..4b742ad94 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java @@ -25,11 +25,10 @@ public class SetHome extends SetCommand { } case "": Plot base = plot.getBasePlot(false); - Location bot = base.getBottomAbs(); - Location loc = player.getLocationFull(); - BlockLoc rel = - new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(), - loc.getYaw(), loc.getPitch()); + Location bottom = base.getBottomAbs(); + Location location = player.getLocationFull(); + BlockLoc rel = new BlockLoc(location.getX() - bottom.getX(), location.getY(), + location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch()); base.setHome(rel); return MainUtil.sendMessage(player, Captions.POSITION_SET); default: 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 2b7e5ab7f..7b21352e2 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 @@ -16,8 +16,8 @@ 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 org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.*; import java.util.Map.Entry; @@ -288,6 +288,11 @@ import java.util.Map.Entry; MainUtil.sendMessage(player, "&cYou need to choose a world name!"); return false; } + if (!d(args[0])) { + MainUtil.sendMessage(player, + "Non [a-z0-9_.-] character in the world name: " + args[0]); + return false; + } if (WorldUtil.IMP.isWorld(args[0])) { if (PlotSquared.get().hasPlotArea(args[0])) { MainUtil.sendMessage(player, "&cThat world name is already taken!"); @@ -317,6 +322,11 @@ import java.util.Map.Entry; return false; } + private static boolean d(String s) { + return s.chars().allMatch((i) -> { + return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; + }); + } private static final class StepPickGenerator extends SetupStep { @Getter private String generator; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java index 9f7f0b145..b3ec2ff05 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; public class Swap extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = player.getLocation(); - Plot plot1 = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot1 = location.getPlotAbs(); if (plot1 == null) { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java index efe54f3d8..87411f1c6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java @@ -9,10 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @CommandDeclaration(command = "toggle", aliases = {"attribute"}, permission = "plots.use", - usage = "/plot toggle ", + usage = "/plot toggle ", description = "Toggle per user settings", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS) public class Toggle extends Command { - public Toggle() { super(MainCommand.getInstance(), true); } @@ -77,6 +76,18 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; } } + @CommandDeclaration(command = "time", permission = "plots.toggle.time", + description = "Toggle plot time settings") + public void time(Command command, PlotPlayer player, String[] args, + RunnableVal3 confirm, + RunnableVal2 whenDone) { + if (toggle(player, "disabletime")) { + MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); + } else { + MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); + } + } + public boolean toggle(PlotPlayer player, String key) { if (player.getAttribute(key)) { player.removeAttribute(key); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java index 7e84ef3aa..66682ccda 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java @@ -5,7 +5,11 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; 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.util.*; +import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; @CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"}, description = "Unlink a mega-plot", usage = "/plot unlink [createroads]", @@ -13,9 +17,8 @@ import com.github.intellectualsites.plotsquared.plot.util.*; public class Unlink extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - - Location loc = player.getLocation(); - final Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + final Plot plot = location.getPlotAbs(); if (plot == null) { return !sendMessage(player, Captions.NOT_IN_PLOT); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java index 3a4e1d71c..36744cc44 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java @@ -5,7 +5,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @CommandDeclaration(command = "weanywhere", permission = "plots.worldedit.bypass", description = "Force bypass of WorldEdit restrictions", aliases = {"wea"}, usage = "/plot weanywhere", - requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION) @Deprecated + requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION) +@Deprecated public class WE_Anywhere extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] arguments) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 52d56f364..9928f643a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -59,8 +59,8 @@ public enum Captions { PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"), PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"), - PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), - PERMISSION_MERGE_KEEP_ROAD("plots.merge.keeproad", "static.permissions"), + PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), PERMISSION_MERGE_KEEP_ROAD( + "plots.merge.keeproad", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"), PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"), PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"), @@ -70,8 +70,8 @@ public enum Captions { PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"), PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"), PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"), - PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), - PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT("plots.admin.build.heightlimit", "static.permissions"), + PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT( + "plots.admin.build.heightlimit", "static.permissions"), PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"), PERMISSION_ADMIN_COMMAND_RATE("plots.admin.command.rate", "static.permissions"), PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"), @@ -124,8 +124,8 @@ public enum Captions { PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"), PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"), PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"), - PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), - PERMISSION_LIST_FOR_SALE("plots.list.forsale", "static.permissions"), + PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), PERMISSION_LIST_FOR_SALE( + "plots.list.forsale", "static.permissions"), PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"), PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"), PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"), @@ -140,8 +140,8 @@ public enum Captions { PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"), PERMISSION_LIST_AREA("plots.list.area", "static.permissions"), PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"), - PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), - PERMISSION_ADMIN_COMMAND_SET_OWNER("plots.admin.command.setowner", "static.permissions"), + PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), PERMISSION_ADMIN_COMMAND_SET_OWNER( + "plots.admin.command.setowner", "static.permissions"), PERMISSION_COMMENT("plots.comment", "static.permissions"), PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"), PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"), @@ -224,15 +224,9 @@ public enum Captions { // // BORDER("$2You are outside the current map border", "Border"), - // - // WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea", "WorldEdit Masks"), WORLDEDIT_BYPASSED("$2Currently bypassing WorldEdit restriction.", "WorldEdit Masks"), - // - // - GAMEMODE_WAS_BYPASSED("$1You bypassed the gamemode ($2{gamemode}$1) $1set for $2{plot}", "GameMode"), - // - // + GAMEMODE_WAS_BYPASSED("$1You bypassed the GameMode ($2{gamemode}$1) $1set for $2{plot}", "GameMode"), HEIGHT_LIMIT("$1This plot area has a height limit of $2{limit}", "Height Limit"), // // @@ -244,9 +238,8 @@ public enum Captions { SWAP_DIMENSIONS("$2The proposed areas must have comparable dimensions", "Swap"), SWAP_SYNTAX("$2/plot swap ", "Swap"), SWAP_SUCCESS("$4Successfully swapped plots", "Swap"), - STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"), // - // + // INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"), NOT_VALID_INBOX_INDEX("$2No comment at index %s", "Comment"), INBOX_ITEM("$2 - $4%s", "Comment"), @@ -271,8 +264,6 @@ public enum Captions { // TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"), TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"), - // - // COMMAND_BLOCKED("$2That command is not allowed in this plot", "Blocked Command"), // // @@ -303,7 +294,7 @@ public enum Captions { NOT_FOR_SALE("$2This plot is not for sale", "Economy"), CANNOT_BUY_OWN("$2You cannot buy your own plot", "Economy"), PLOT_SOLD("$4Your plot; $1%s0$4, has been sold to $1%s1$4 for $1$%s2", "Economy"), - CANNOT_AFFORD_MERGE("$2You cannot afford to merge the plots. It costs $1%s", "Economy"), + CANNOT_AFFORD_MERGE("$2You cannot afford to merge the plots. It costs $1%s","Economy"), ADDED_BALANCE("$1%s $2has been added to your balance", "Economy"), REMOVED_BALANCE("$1%s $2has been taken from your balance", "Economy"), REMOVED_GRANTED_PLOT("$2You used %s plot grant(s), you've got $1%s $2left", "Economy"), @@ -317,17 +308,21 @@ public enum Captions { "$4You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or " + "your chosen world management plugin.", "Setup"), SETUP_WORLD_TAKEN("$2%s is already a world", "Setup"), + SETUP_MISSING_WORLD( "$2You need to specify a world name ($1/plot setup &l$1 $2)&-$1Additional commands:&-$2 - $1/plot setup &-$2 -" + " $1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), SETUP_MISSING_GENERATOR( "$2You need to specify a generator ($1/plot setup &l&r$2)&-$1Additional commands:&-$2 - $1/plot setup &-$2 - " + "$1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), + SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"), // - // - SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"), + // + SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", + "Schematics"), SCHEMATIC_MISSING_ARG("$2You need to specify an argument. Possible values: $1test $2 , $1save$2 , $1paste $2, $1exportall$2, $1list", "Schematics"), + SCHEMATIC_INVALID("$2That is not a valid schematic. Reason: $2%s", "Schematics"), SCHEMATIC_VALID("$2That is a valid schematic", "Schematics"), SCHEMATIC_PASTE_FAILED("$2Failed to paste the schematic", "Schematics"), @@ -336,12 +331,13 @@ public enum Captions { SCHEMATIC_ROAD_CREATED("$1Saved new road schematic. To test the schematic, fly to a few other plots and run /plot debugroadregen", "Schematics"), MCA_FILE_SIZE("$1Note: The `.mca` files are 512x512", "Schematics"), SCHEMATIC_EXPORTALL_STARTED("$1Starting export...", "Schematics"), - SCHEMATIC_EXPORTALL_WORLD_ARGS("$1Need world argument. Use $3/plot schem exportall ", "Schematics"), - SCHEMATIC_EXPORTALL_WORLD("$1Invalid world. Use &3/plot sch exportall ", "Schematics"), - SCHEMATIC_EXPORTALL_MASS_STARTED("$1Schematic mass export has been started. This may take a while", "Schematicss"), + SCHEMATIC_EXPORTALL_WORLD_ARGS("$1Need world argument. Use $3/plot sch exportall ", "Schematics"), + SCHEMATIC_EXPORTALL_WORLD("$1Invalid world. Use &3/plot sch exportall ", "Schematic"), + SCHEMATIC_EXPORTALL_MASS_STARTED("$1Schematic mass export has been started. This may take a while", "Schematics"), SCHEMATIC_EXPORTALL_COUNT("$1Found $3%s $1plots...", "Schematics"), SCHEMATIC_EXPORTALL_FINISHED("$1Finished mass export", "Schematics"), SCHEMATIC_EXPORTALL_SINGLE_FINISHED("$1Finished export", "Schematics"), + TASK_IN_PROCESS("$1Task is already running.", "Error"), // // TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"), @@ -357,13 +353,14 @@ public enum Captions { RELOADED_CONFIGS("$1Translations and world settings have been reloaded", "Reload"), RELOAD_FAILED("$2Failed to reload file configurations", "Reload"), // - // + // DESC_SET("$2Plot description set", "Desc"), DESC_UNSET("$2Plot description unset", "Desc"), // // ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), ALIAS_REMOVED("$2Plot alias removed", "Alias"), + ALIAS_TOO_LONG("$2The alias must be < 50 characters in length", "Alias"), ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"), // @@ -379,6 +376,7 @@ public enum Captions { NO_PLOT_PERMS("$2You must be the plot owner to perform this action", "Permission"), CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots.", "Permission"), CANT_CLAIM_MORE_CLUSTERS("$2You can't claim more clusters.", "Permission"), + CANT_TRANSFER_MORE_PLOTS("$2You can't send more plots to that user", "Permission"), CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once", "Permission"), // @@ -390,8 +388,8 @@ public enum Captions { MERGE_REQUEST_CONFIRM("Merge request from %s", "Permission"), NO_PERM_MERGE("$2You are not the owner of the plot: $1%plot%", "Merge"), NO_AVAILABLE_AUTOMERGE("$2You do not own any adjacent plots in the specified direction or are not allowed to merge to the required size.", "Merge"), - UNMERGE_CANCELLED("$1Unlink has been cancelled", "Merge"), UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"), + UNMERGE_CANCELLED("$1Unlink has been cancelled", "Merge"), UNLINK_SUCCESS("$2Successfully unlinked plots.", "Merge"), // // @@ -416,14 +414,9 @@ public enum Captions { NOT_VALID_PLOT_WORLD("$2That is not a valid plot area (case sensitive)", "Errors"), NO_PLOTS("$2You don't have any plots", "Errors"), WAIT_FOR_TIMER("$2A set block timer is bound to either the current plot or you. Please wait for it to finish", "Errors"), - TASK_IN_PROCESS("$1Task is already running.", "Error"), // - // DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"), - // - // PURGE_SUCCESS("$4Successfully purged %s plots", "Purge"), - // // TRIM_IN_PROGRESS("A world trim task is already in progress!", "Trim"), // @@ -443,7 +436,7 @@ public enum Captions { // SET_BLOCK_ACTION_FINISHED("$1The last setblock action is now finished.", "Set Block"), // - // + // DEBUGALLOWUNSAFE_ON("$2Unsafe actions allowed", "unsafe"), DEBUGALLOWUNSAFE_OFF("$2Unsafe actions disabled", "unsafe"), // @@ -529,9 +522,7 @@ public enum Captions { YOU_GOT_DENIED("$4You are denied from the plot you were previously on, and got teleported to spawn", "Deny"), CANT_REMOVE_OWNER("$2You can't remove the plot owner", "Deny"), // - // YOU_GOT_KICKED("$4You got kicked!", "Kick"), - // // FLAG_KEY("$2Key: %s", "Flag"), FLAG_TYPE("$2Type: %s", "Flag"), @@ -547,6 +538,7 @@ public enum Captions { // // TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), + WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), PLOT_REMOVED_USER("$1Plot %s of which you were added to has been deleted due to owner inactivity", "Trusted"), // // @@ -554,10 +546,9 @@ public enum Captions { ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"), ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"), - MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"), PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"), // - // + // SET_OWNER("$4You successfully set the plot owner", "Owner"), SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"), NOW_OWNER("$4You are now owner of plot %s", "Owner"), @@ -577,8 +568,7 @@ public enum Captions { HELP_DISPLAY_ALL_COMMANDS("Display all commands", "Help"), DIRECTION("$1Current direction: %dir%", "Help"), // - // - BUCKET_ENTRIES_IGNORED("$2Total bucket values add up to 1 or more. Blocks without a specified chance will be ignored", "Generator_Bucket"), + BUCKET_ENTRIES_IGNORED("$2Total bucket values add up to 1 or more. Blocks without a specified chance will be ignored","Generator_Bucket"), /** * Command Categories @@ -593,6 +583,7 @@ public enum Captions { COMMAND_CATEGORY_DEBUG("Debug", "Category"), COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), + // GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), GRANTED_PLOT("$1You granted %s0 plot to $2%s1", "Grants"), @@ -602,16 +593,18 @@ public enum Captions { /** * Legacy Configuration Conversion */ - LEGACY_CONFIG_FOUND("A legacy configuration file was detected. Conversion will be attempted.", "LegacyConfig"), - LEGACY_CONFIG_BACKUP("A copy of worlds.yml $1have been saved in the file worlds.yml.old$1.", "LegacyConfig"), - LEGACY_CONFIG_REPLACED("> %s has been replaced with %s", "LegacyConfig"), - LEGACY_CONFIG_DONE( + LEGACY_CONFIG_FOUND("A legacy configuration file was detected. Conversion will be attempted.", + "LegacyConfig"), LEGACY_CONFIG_BACKUP( + "A copy of worlds.yml $1have been saved in the file worlds.yml.old$1.", + "LegacyConfig"), LEGACY_CONFIG_REPLACED("> %s has been replaced with %s", + "LegacyConfig"), LEGACY_CONFIG_DONE( "The conversion has finished. PlotSquared will now be disabled and the new configuration file will" + " be used at next startup. Please review the new worlds.yml file. " + "Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. " + "You need to re-generate the schematics.", + "LegacyConfig"), LEGACY_CONFIG_CONVERSION_FAILED( + "Failed to convert the legacy configuration file. See stack trace for information.", "LegacyConfig"), - LEGACY_CONFIG_CONVERSION_FAILED("Failed to convert the legacy configuration file. See stack trace for information.", "LegacyConfig"), CUSTOM_STRING("-", "-"); //@formatter:on diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java index d812413ea..5beef2aab 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java @@ -1,11 +1,19 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -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.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; public interface AbstractDB { @@ -223,7 +231,7 @@ public interface AbstractDB { /** * @param cluster PlotCluster Object - * @param uuid Player that should be removed + * @param uuid Player that should be removed */ void setHelper(PlotCluster cluster, UUID uuid); @@ -275,7 +283,7 @@ public interface AbstractDB { /** * Removes the specified comment from the given plot. * - * @param plot the plot + * @param plot the plot * @param comment the comment to remove */ void removeComment(Plot plot, PlotComment comment); @@ -283,7 +291,7 @@ public interface AbstractDB { /** * Clears the specified inbox on the given plot. * - * @param plot the plot + * @param plot the plot * @param inbox the inbox to clear */ void clearInbox(Plot plot, String inbox); @@ -291,17 +299,17 @@ public interface AbstractDB { /** * Adds the specified comment to the given plot. * - * @param plot the plot + * @param plot the plot * @param comment the comment to add */ void setComment(Plot plot, PlotComment comment); /** - * Gets Plot Comments. + * Gets Plot comments. * * @param plot The Plot to get comments from */ - void getComments(@Nonnull Plot plot, String inbox, RunnableVal> whenDone); + void getComments(@NotNull Plot plot, String inbox, RunnableVal> whenDone); void createPlotAndSettings(Plot plot, Runnable whenDone); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java index abb4dad24..47a03cf60 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java @@ -1,13 +1,21 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -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.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; /** * Database Functions @@ -74,6 +82,8 @@ public class DBFunc { DBFunc.dbManager.validateAllPlots(plots); } + + //TODO Consider Removal /** * Check if a {@link ResultSet} contains a column. * @@ -81,7 +91,7 @@ public class DBFunc { * @param name * @return */ - public static boolean hasColumn(ResultSet resultSet, String name) { + @Deprecated public static boolean hasColumn(ResultSet resultSet, String name) { try { ResultSetMetaData meta = resultSet.getMetaData(); int count = meta.getColumnCount(); 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 49fbc0bc9..2f041cc57 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 @@ -12,8 +12,8 @@ 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.google.common.base.Charsets; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.sql.*; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -2170,7 +2170,7 @@ import java.util.concurrent.atomic.AtomicInteger; }); } - @Override public void getComments(@Nonnull Plot plot, final String inbox, + @Override public void getComments(@NotNull Plot plot, final String inbox, final RunnableVal> whenDone) { addPlotTask(plot, new UniqueStatement("getComments_" + plot) { @Override public void set(PreparedStatement statement) throws SQLException { @@ -2942,7 +2942,7 @@ import java.util.concurrent.atomic.AtomicInteger; boolean[] pm = plot.getMerged(); boolean[] dm = dataPlot.getMerged(); if (pm[0] != dm[0] || pm[1] != dm[1]) { - PlotSquared.debug("&8 - &7Correcting merge for: " + plot); + PlotSquared.debug(" - Correcting merge for: " + plot); setMerged(dataPlot, plot.getMerged()); } HashMap, Object> pf = plot.getFlags(); @@ -2951,7 +2951,7 @@ import java.util.concurrent.atomic.AtomicInteger; if (pf.size() != df.size() || !StringMan .isEqual(StringMan.joinOrdered(pf.values(), ","), StringMan.joinOrdered(df.values(), ","))) { - PlotSquared.debug("&8 - &7Correcting flags for: " + plot); + PlotSquared.debug(" - Correcting flags for: " + plot); setFlags(plot, pf); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index fe0a614a2..2a85581ad 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -47,9 +47,6 @@ public class AugmentedUtils { continue; } IndependentPlotGenerator generator = area.getGenerator(); - if (generator == null) { - continue; - } // Mask if (queue == null) { queue = GlobalBlockQueue.IMP.getNewQueue(world, false); 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 118733f36..320953963 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 @@ -24,29 +24,21 @@ public class ClassicPlotManager extends SquarePlotManager { BlockBucket blocks) { switch (component) { case "floor": - setFloor(plotId, blocks); - return true; + return setFloor(plotId, blocks); case "wall": - setWallFilling(plotId, blocks); - return true; + return setWallFilling(plotId, blocks); case "all": - setAll(plotId, blocks); - return true; + return setAll(plotId, blocks); case "air": - setAir(plotId, blocks); - return true; + return setAir(plotId, blocks); case "main": - setMain(plotId, blocks); - return true; + return setMain(plotId, blocks); case "middle": - setMiddle(plotId, blocks); - return true; + return setMiddle(plotId, blocks); case "outline": - setOutline(plotId, blocks); - return true; + return setOutline(plotId, blocks); case "border": - setWall(plotId, blocks); - return true; + return setWall(plotId, blocks); } return false; } @@ -54,8 +46,7 @@ public class ClassicPlotManager extends SquarePlotManager { @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING); setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); - GlobalBlockQueue.IMP.addTask(whenDone); - return true; + return GlobalBlockQueue.IMP.addTask(whenDone); } public boolean setFloor(PlotId plotId, BlockBucket blocks) { @@ -70,8 +61,7 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid(pos1, pos2, blocks); } } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setAll(PlotId plotId, BlockBucket blocks) { @@ -86,8 +76,7 @@ public class ClassicPlotManager extends SquarePlotManager { Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setAir(PlotId plotId, BlockBucket blocks) { @@ -103,8 +92,7 @@ public class ClassicPlotManager extends SquarePlotManager { Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setMain(PlotId plotId, BlockBucket blocks) { @@ -119,8 +107,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, region.maxX, classicPlotWorld.PLOT_HEIGHT - 1, region.maxZ); queue.setCuboid(pos1, pos2, blocks); } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setMiddle(PlotId plotId, BlockBucket blocks) { @@ -134,8 +121,7 @@ public class ClassicPlotManager extends SquarePlotManager { int x = MathMan.average(corners[0].getX(), corners[1].getX()); int z = MathMan.average(corners[0].getZ(), corners[1].getZ()); queue.setBlock(x, classicPlotWorld.PLOT_HEIGHT, z, blocks.getBlock()); - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setOutline(PlotId plotId, BlockBucket blocks) { @@ -187,8 +173,7 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid(pos1, pos2, blocks); } } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setWallFilling(PlotId plotId, BlockBucket blocks) { @@ -235,8 +220,7 @@ public class ClassicPlotManager extends SquarePlotManager { } } } - queue.enqueue(); - return true; + return queue.enqueue(); } public boolean setWall(PlotId plotId, BlockBucket blocks) { @@ -276,8 +260,7 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setBlock(x, y, z, blocks.getBlock()); } } - queue.enqueue(); - return true; + return queue.enqueue(); } /** @@ -308,8 +291,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean createRoadSouth(Plot plot) { @@ -337,8 +319,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean createRoadSouthEast(Plot plot) { @@ -356,8 +337,7 @@ public class ClassicPlotManager extends SquarePlotManager { PlotBlock.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean removeRoadEast(Plot plot) { @@ -377,8 +357,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), classicPlotWorld.TOP_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean removeRoadSouth(Plot plot) { @@ -398,8 +377,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } @Override public boolean removeRoadSouthEast(Plot plot) { @@ -416,38 +394,53 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); - queue.enqueue(); - return true; + return queue.enqueue(); } /** * Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED). + * + * @return false if part of the merge failed, otherwise true if successful. */ @Override public boolean finishPlotMerge(List plotIds) { final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; - plotIds.forEach(id -> setWall(id, block)); + boolean success = true; + for (PlotId plotId : plotIds) { + success &= setWall(plotId, block); + } if (Settings.General.MERGE_REPLACE_WALL) { final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING; - plotIds.forEach(id -> setWallFilling(id, wallBlock)); + for (PlotId id : plotIds) { + success &= setWallFilling(id, wallBlock); + } } - return true; + return success; } @Override public boolean finishPlotUnlink(List plotIds) { final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; - plotIds.forEach(id -> setWall(id, block)); - return true; + boolean success = true; + for (PlotId id : plotIds) { + success &= setWall(id, block); + } + return success; } + /** + * Sets all the blocks along all the plot walls to their correct state (claimed or unclaimed). + * + * @return true if the wall blocks were successfully set + */ @Override public boolean regenerateAllPlotWalls() { + boolean success = true; for (Plot plot : classicPlotWorld.getPlots()) { if (plot.hasOwner()) { - setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK); + success &= setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK); } else { - setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); + success &= setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); } } - return true; + return success; } @Override public boolean startPlotMerge(List plotIds) { @@ -460,8 +453,7 @@ public class ClassicPlotManager extends SquarePlotManager { @Override public boolean claimPlot(Plot plot) { final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - setWall(plot.getId(), claim); - return true; + return setWall(plot.getId(), claim); } @Override public String[] getPlotComponents(PlotId plotId) { @@ -469,7 +461,9 @@ public class ClassicPlotManager extends SquarePlotManager { } /** - * Remove sign for a plot. + * Retrieves the location of where a sign should be for a plot. + * @param plot The plot + * @return The location where a sign should be */ @Override public Location getSignLoc(Plot plot) { plot = plot.getBasePlot(false); 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 6bf38d22c..143879680 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 @@ -46,7 +46,7 @@ import java.util.Locale; * command - this may be useful if a config value can be changed at a later date, and has no impact on the actual * world generation

    */ - @Nonnull @Override public ConfigurationNode[] getSettingNodes() { + @NotNull @Override public ConfigurationNode[] getSettingNodes() { return new ConfigurationNode[] { new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height", Configuration.INTEGER), 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 773b427c9..0a3fc4de6 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 @@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.Sets; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockTypes; + import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -34,13 +35,13 @@ public class HybridPlotManager extends ClassicPlotManager { String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.worldname + File.separator; try { - File sideroad = + File sideRoad = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem"); String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator; - if (sideroad.exists()) { + if (sideRoad.exists()) { files.add(new FileBytes(newDir + "sideroad.schem", - Files.readAllBytes(sideroad.toPath()))); + Files.readAllBytes(sideRoad.toPath()))); } File intersection = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "intersection.schem"); @@ -146,8 +147,7 @@ public class HybridPlotManager extends ClassicPlotManager { if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { createSchemAbs(queue, pos1, pos2); } - queue.enqueue(); - return true; + return queue.enqueue(); } /** @@ -221,7 +221,9 @@ public class HybridPlotManager extends ClassicPlotManager { } /** - * Remove sign for a plot. + * Retrieves the location of where a sign should be for a plot. + * @param plot The plot + * @return The location where a sign should be */ @Override public Location getSignLoc(Plot plot) { return hybridPlotWorld.getSignLocation(plot); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index 101b6fcb3..2f8c7c823 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -44,7 +44,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { super(worldName, id, generator, min, max); } - @Override + @NotNull @Override protected PlotManager createManager() { return new HybridPlotManager(this); } 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 84c487bdb..3f4261440 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 @@ -140,7 +140,7 @@ public abstract class HybridUtils { } HybridUtils.UPDATE = true; Set regions = new HashSet<>(); - regions.add(ChunkManager.manager.getChunkChunk(plot.getCenter())); + regions.add(ChunkManager.getChunkChunk(plot.getCenter())); return scheduleRoadUpdate(plot.getArea(), regions, extend); } 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 c26c4231e..4911f9f47 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 @@ -122,7 +122,7 @@ public class PlotListener { } } Optional timeFlag = plot.getFlag(Flags.TIME); - if (timeFlag.isPresent()) { + if (timeFlag.isPresent() && !player.getAttribute("disabletime")) { try { long time = timeFlag.get(); player.setTime(time); @@ -138,18 +138,18 @@ public class PlotListener { final PlotBlock block = PlotBlock.get(id); final String rawId = block.getRawId().toString(); if (rawId.contains("disc") || PlotBlock.isEverything(block) || block.isAir()) { - Location loc = player.getLocation(); - Location lastLoc = player.getMeta("music"); - if (lastLoc != null) { - player.playMusic(lastLoc, PlotBlock.get("air")); + Location location = player.getLocation(); + Location lastLocation = player.getMeta("music"); + if (lastLocation != null) { + player.playMusic(lastLocation, PlotBlock.get("air")); if (PlotBlock.isEverything(block) || block.isAir()) { player.deleteMeta("music"); } } if (!(PlotBlock.isEverything(block) || block.isAir())) { try { - player.setMeta("music", loc); - player.playMusic(loc, block); + player.setMeta("music", location); + player.playMusic(location, block); } catch (Exception ignored) { } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 9f4677f4f..490a6e211 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -5,8 +5,8 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.UUID; public class ConsolePlayer extends PlotPlayer { @@ -15,15 +15,15 @@ public class ConsolePlayer extends PlotPlayer { private ConsolePlayer() { PlotArea area = PlotSquared.get().getFirstPlotArea(); - Location loc; + Location location; if (area != null) { RegionWrapper region = area.getRegion(); - loc = new Location(area.worldname, region.minX + region.maxX / 2, 0, + location = new Location(area.worldname, region.minX + region.maxX / 2, 0, region.minZ + region.maxZ / 2); } else { - loc = new Location("world", 0, 0, 0); + location = new Location("world", 0, 0, 0); } - setMeta("location", loc); + setMeta("location", location); } public static ConsolePlayer getConsole() { @@ -34,7 +34,7 @@ public class ConsolePlayer extends PlotPlayer { return instance; } - @Override public boolean canTeleport(@Nonnull Location loc) { + @Override public boolean canTeleport(@NotNull Location location) { return true; } @@ -42,7 +42,7 @@ public class ConsolePlayer extends PlotPlayer { public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { } - @Override public Location getLocation() { + @NotNull @Override public Location getLocation() { return this.getMeta("location"); } @@ -50,7 +50,7 @@ public class ConsolePlayer extends PlotPlayer { return getLocation(); } - @Nonnull @Override public UUID getUUID() { + @NotNull @Override public UUID getUUID() { return DBFunc.EVERYONE; } @@ -100,14 +100,14 @@ public class ConsolePlayer extends PlotPlayer { return RequiredType.CONSOLE; } - @Override public void setWeather(@Nonnull PlotWeather weather) { + @Override public void setWeather(@NotNull PlotWeather weather) { } - @Nonnull @Override public PlotGameMode getGameMode() { + @NotNull @Override public PlotGameMode getGameMode() { return PlotGameMode.NOT_SET; } - @Override public void setGameMode(@Nonnull PlotGameMode gameMode) { + @Override public void setGameMode(@NotNull PlotGameMode gameMode) { } @Override public void setTime(long time) { @@ -120,7 +120,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setFlight(boolean fly) { } - @Override public void playMusic(@Nonnull Location location, @Nonnull PlotBlock id) { + @Override public void playMusic(@NotNull Location location, @NotNull PlotBlock id) { } @Override public void kick(String message) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java index 0c7de4905..3c3900dc1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java @@ -1,9 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.object; public enum Direction { - NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4, - "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, "southwest"), NORTHWEST(7, - "northwest"), + ALL(-1, "all"), NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, + "west"), NORTHEAST(4, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, + "southwest"), NORTHWEST(7, "northwest"), ; @@ -16,6 +16,15 @@ public enum Direction { this.name = name; } + public static Direction getFromIndex(int index) { + for (Direction value : values()) { + if (value.getIndex() == index) { + return value; + } + } + return NORTH; + } + public int getIndex() { return index; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index b1098e6f3..30c5034a8 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 @@ -21,9 +21,9 @@ import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.sk89q.jnbt.CompoundTag; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.geom.Area; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; @@ -46,13 +46,14 @@ import java.util.stream.Collectors; public class Plot { private static final int MAX_HEIGHT = 256; + /** * @deprecated raw access is deprecated */ @Deprecated private static HashSet connected_cache; private static HashSet regions_cache; - private final PlotId id; + @NotNull private final PlotId id; /** * plot owner @@ -62,10 +63,12 @@ public class Plot { * @deprecated */ @Deprecated public UUID owner; + /** * Has the plot changed since the last save cycle? */ public boolean countsTowardsMax = true; + /** * Represents whatever the database manager needs it to:
    * - A value of -1 usually indicates the plot will not be stored in the DB
    @@ -74,23 +77,28 @@ public class Plot { * @deprecated magical */ @Deprecated public int temp; + /** * Plot creation timestamp (not accurate if the plot was created before this was implemented)
    * - Milliseconds since the epoch
    */ private long timestamp; + /** * List of trusted (with plot permissions). */ private HashSet trusted; + /** * List of members users (with plot permissions). */ private HashSet members; + /** * List of denied players. */ private HashSet denied; + /** * External settings class. * - Please favor the methods over direct access to this class
    @@ -99,6 +107,7 @@ public class Plot { private PlotSettings settings; private PlotArea area; + /** * Session only plot metadata (session is until the server stops)
    *
    @@ -107,6 +116,7 @@ public class Plot { * @see FlagManager */ private ConcurrentHashMap meta; + /** * The cached origin plot. * - The origin plot is used for plot grouping and relational data @@ -117,12 +127,12 @@ public class Plot { * Constructor for a new plot. * (Only changes after plot.create() will be properly set in the database) * - * @param area the PlotArea where the plot is located - * @param id the plot id + * @param area the PlotArea where the plot is located + * @param id the plot id * @param owner the plot owner * @see Plot#getPlot(Location) for existing plots */ - public Plot(PlotArea area, PlotId id, UUID owner) { + public Plot(PlotArea area, @NotNull PlotId id, UUID owner) { this.area = area; this.id = id; this.owner = owner; @@ -133,10 +143,10 @@ public class Plot { * (Only changes after plot.create() will be properly set in the database) * * @param area the PlotArea where the plot is located - * @param id the plot id + * @param id the plot id * @see Plot#getPlot(Location) for existing plots */ - public Plot(PlotArea area, PlotId id) { + public Plot(PlotArea area, @NotNull PlotId id) { this.area = area; this.id = id; } @@ -146,13 +156,13 @@ public class Plot { * The database will ignore any queries regarding temporary plots. * Please note that some bulk plot management functions may still affect temporary plots (TODO: fix this) * - * @param area the PlotArea where the plot is located - * @param id the plot id + * @param area the PlotArea where the plot is located + * @param id the plot id * @param owner the owner of the plot - * @param temp Represents whatever the database manager needs it to + * @param temp Represents whatever the database manager needs it to * @see Plot#getPlot(Location) for existing plots */ - public Plot(PlotArea area, PlotId id, UUID owner, int temp) { + public Plot(PlotArea area, @NotNull PlotId id, UUID owner, int temp) { this.area = area; this.id = id; this.owner = owner; @@ -162,14 +172,14 @@ public class Plot { /** * Constructor for a saved plots (Used by the database manager when plots are fetched) * - * @param id the plot id - * @param owner the plot owner + * @param id the plot id + * @param owner the plot owner * @param trusted the plot trusted players - * @param denied the plot denied players - * @param merged array giving merged plots + * @param denied the plot denied players + * @param merged an array giving merged plots * @see Plot#getPlot(Location) for existing plots */ - public Plot(PlotId id, UUID owner, HashSet trusted, HashSet members, + public Plot(@NotNull PlotId id, UUID owner, HashSet trusted, HashSet members, HashSet denied, String alias, BlockLoc position, Collection flags, PlotArea area, boolean[] merged, long timestamp, int temp) { this.id = id; @@ -194,8 +204,8 @@ public class Plot { /** * Gets a plot from a string e.g. [area];[id] * - * @param defaultArea If no area is specified - * @param string plot id/area + id + * @param defaultArea if no area is specified + * @param string plot id/area + id * @return New or existing plot object */ public static Plot fromString(PlotArea defaultArea, String string) { @@ -326,7 +336,7 @@ public class Plot { * @param uuid the player uuid * @return if the provided uuid is the owner of the plot */ - public boolean isOwner(@Nonnull UUID uuid) { + public boolean isOwner(@NotNull UUID uuid) { if (uuid.equals(this.getOwner())) { return true; } @@ -452,7 +462,7 @@ public class Plot { * * @return the PlotId for this plot */ - public PlotId getId() { + @NotNull public PlotId getId() { return this.id; } @@ -779,7 +789,7 @@ public class Plot { /** * Sets the plot owner (and update the database) * - * @param owner uuid to set as owner + * @param owner uuid to set as owner * @param initiator player initiating set owner * @return boolean */ @@ -864,8 +874,15 @@ public class Plot { } Plot current = queue.poll(); if (Plot.this.area.TERRAIN != 0) { - ChunkManager.manager - .regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, this); + try { + ChunkManager.manager + .regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, + this); + } catch (UnsupportedOperationException exception) { + MainUtil.sendMessage(null, + "Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience"); + return; + } return; } manager.clearPlot(current, this); @@ -919,8 +936,8 @@ public class Plot { /** * Unlink the plot and all connected plots. * - * @param createSign whether to recreate signs * @param createRoad whether to recreate road + * @param createSign whether to recreate signs * @return success/!cancelled */ public boolean unlinkPlot(boolean createRoad, boolean createSign) { @@ -982,7 +999,7 @@ public class Plot { * * @param name name */ - public void setSign(@Nonnull String name) { + public void setSign(@NotNull String name) { if (!isLoaded()) { return; } @@ -992,7 +1009,7 @@ public class Plot { } PlotManager manager = this.area.getPlotManager(); if (this.area.ALLOW_SIGNS) { - Location loc = manager.getSignLoc(this); + Location location = manager.getSignLoc(this); String id = this.id.x + ";" + this.id.y; String[] lines = new String[] {Captions.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), @@ -1002,7 +1019,9 @@ public class Plot { "%plr%", name), Captions.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll( "%plr%", name)}; - WorldUtil.IMP.setSign(this.getWorldName(), loc.getX(), loc.getY(), loc.getZ(), lines); + WorldUtil.IMP + .setSign(this.getWorldName(), location.getX(), location.getY(), location.getZ(), + lines); } } @@ -1199,18 +1218,18 @@ public class Plot { Location[] corners = getCorners(); Location top = corners[0]; Location bot = corners[1]; - Location loc = new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()), + Location location = + new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()), MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ())); if (!isLoaded()) { - return loc; + return location; } - int y = - isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), loc.getX(), loc.getZ()) : 62; + int y = WorldUtil.IMP.getHighestBlock(getWorldName(), location.getX(), location.getZ()); if (area.ALLOW_SIGNS) { y = Math.max(y, getManager().getSignLoc(this).getY()); } - loc.setY(1 + y); - return loc; + location.setY(1 + y); + return location; } public Location getSide() { @@ -1235,18 +1254,19 @@ public class Plot { if (home == null || home.x == 0 && home.z == 0) { return this.getDefaultHome(true); } else { - Location bot = this.getBottomAbs(); - Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, - bot.getZ() + home.z, home.yaw, home.pitch); + 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); if (!isLoaded()) { - return loc; + return location; } - if (!WorldUtil.IMP.getBlock(loc).isAir()) { - loc.setY(Math.max( - 1 + WorldUtil.IMP.getHighestBlock(this.getWorldName(), loc.getX(), loc.getZ()), - bot.getY())); + if (!WorldUtil.IMP.getBlock(location).isAir()) { + location.setY(Math.max(1 + WorldUtil.IMP + .getHighestBlock(this.getWorldName(), location.getX(), location.getZ()), + bottom.getY())); } - return loc; + return location; } } @@ -1413,9 +1433,9 @@ public class Plot { if (!this.area.ALLOW_SIGNS) { return; } - Location loc = manager.getSignLoc(this); + Location location = manager.getSignLoc(this); LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); - queue.setBlock(loc.getX(), loc.getY(), loc.getZ(), PlotBlock.get("air")); + queue.setBlock(location.getX(), location.getY(), location.getZ(), PlotBlock.get("air")); queue.flush(); } @@ -1510,7 +1530,7 @@ public class Plot { * @param notify notify * @return true if plot was created successfully */ - public boolean create(@Nonnull UUID uuid, final boolean notify) { + public boolean create(@NotNull UUID uuid, final boolean notify) { this.owner = uuid; Plot existing = this.area.getOwnedPlotAbs(this.id); if (existing != null) { @@ -1532,7 +1552,7 @@ public class Plot { DBFunc.createPlotAndSettings(this, () -> { PlotArea plotworld = Plot.this.area; if (notify && plotworld.AUTO_MERGE) { - Plot.this.autoMerge(-1, Integer.MAX_VALUE, uuid, true); + Plot.this.autoMerge(Direction.ALL, Integer.MAX_VALUE, uuid, true); } }); return true; @@ -1555,8 +1575,8 @@ public class Plot { * @return the name of the biome */ public String getBiome() { - Location loc = this.getCenter(); - return WorldUtil.IMP.getBiome(loc.getWorld(), loc.getX(), loc.getZ()); + Location location = this.getCenter(); + return WorldUtil.IMP.getBiome(location.getWorld(), location.getX(), location.getZ()); } //TODO Better documentation needed. @@ -1576,9 +1596,9 @@ public class Plot { * Returns the bottom location for the plot. */ public Location getBottomAbs() { - Location loc = getManager().getPlotBottomLocAbs(this.id); - loc.setWorld(getWorldName()); - return loc; + Location location = getManager().getPlotBottomLocAbs(this.id); + location.setWorld(getWorldName()); + return location; } /** @@ -1627,7 +1647,7 @@ public class Plot { /** * Moves the settings for a plot. * - * @param plot the plot to move + * @param plot the plot to move * @param whenDone * @return */ @@ -2009,17 +2029,11 @@ public class Plot { * Sets the raw merge data
    * - Updates DB
    * - Does not modify terrain
    - * ----------
    - * 0 = north
    - * 1 = east
    - * 2 = south
    - * 3 = west
    - * ----------
    * * @param direction * @param value */ - public void setMerged(int direction, boolean value) { + public void setMerged(Direction direction, boolean value) { if (this.getSettings().setMerged(direction, value)) { if (value) { Plot other = this.getRelative(direction).getBasePlot(false); @@ -2124,11 +2138,12 @@ public class Plot { return null; } try { - final Location loc = this.getManager().getSignLoc(this); + final Location location = this.getManager().getSignLoc(this); String[] lines = TaskManager.IMP.sync(new RunnableVal() { @Override public void run(String[] value) { - ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false); - this.value = WorldUtil.IMP.getSign(loc); + ChunkManager.manager + .loadChunk(location.getWorld(), location.getChunkLoc(), false); + this.value = WorldUtil.IMP.getSign(location); } }); if (lines == null) { @@ -2198,24 +2213,21 @@ public class Plot { } /** - * Auto merge a plot in a specific direction
    + * Auto merge a plot in a specific direction. * - * @param dir The direction to merge
    - * -1 = All directions
    - * 0 = north
    - * 1 = east
    - * 2 = south
    - * 3 = west
    - * @param max The max number of merges to do - * @param uuid The UUID it is allowed to merge with - * @param removeRoads Whether to remove roads + * @param dir the direction to merge + * @param max the max number of merges to do + * @param uuid the UUID it is allowed to merge with + * @param removeRoads whether to remove roads * @return true if a merge takes place */ - public boolean autoMerge(int dir, int max, UUID uuid, boolean removeRoads) { + public boolean autoMerge(Direction dir, int max, UUID uuid, boolean removeRoads) { + //Ignore merging if there is no owner for the plot if (this.owner == null) { return false; } - if (!EventUtil.manager.callMerge(this, dir, max)) { + //Call the merge event + if (!EventUtil.manager.callMerge(this, dir.getIndex(), max)) { return false; } Set connected = this.getConnectedPlots(); @@ -2231,7 +2243,7 @@ public class Plot { } visited.add(current); Set plots; - if ((dir == -1 || dir == 0) && !getMerged(Direction.NORTH)) { + if ((dir == Direction.ALL || dir == Direction.NORTH) && !getMerged(Direction.NORTH)) { Plot other = current.getRelative(Direction.NORTH); if (other != null && other.isOwner(uuid) && ( other.getBasePlot(false).equals(current.getBasePlot(false)) @@ -2250,7 +2262,8 @@ public class Plot { } } } - if (max >= 0 && (dir == -1 || dir == 1) && !current.getMerged(Direction.EAST)) { + if (max >= 0 && (dir == Direction.ALL || dir == Direction.EAST) && !current + .getMerged(Direction.EAST)) { Plot other = current.getRelative(Direction.EAST); if (other != null && other.isOwner(uuid) && ( other.getBasePlot(false).equals(current.getBasePlot(false)) @@ -2269,7 +2282,8 @@ public class Plot { } } } - if (max >= 0 && (dir == -1 || dir == 2) && !getMerged(Direction.SOUTH)) { + if (max >= 0 && (dir == Direction.ALL || dir == Direction.SOUTH) && !getMerged( + Direction.SOUTH)) { Plot other = current.getRelative(Direction.SOUTH); if (other != null && other.isOwner(uuid) && ( other.getBasePlot(false).equals(current.getBasePlot(false)) @@ -2288,7 +2302,8 @@ public class Plot { } } } - if (max >= 0 && (dir == -1 || dir == 3) && !getMerged(Direction.WEST)) { + if (max >= 0 && (dir == Direction.ALL || dir == Direction.WEST) && !getMerged( + Direction.WEST)) { Plot other = current.getRelative(Direction.WEST); if (other != null && other.isOwner(uuid) && ( other.getBasePlot(false).equals(current.getBasePlot(false)) @@ -2403,20 +2418,16 @@ public class Plot { * @param direction * @return */ - public Plot getRelative(int direction) { + @Deprecated public Plot getRelative(int direction) { return this.area.getPlotAbs(this.id.getRelative(direction)); } /** - * Gets the plot in a relative direction
    - * 0 = north
    - * 1 = east
    - * 2 = south
    - * 3 = west
    + * Gets the plot in a relative direction * Note: May be null if the partial plot area does not include the relative location * * @param direction - * @return + * @return the plot relative to this one */ public Plot getRelative(Direction direction) { return this.area.getPlotAbs(this.id.getRelative(direction)); @@ -2426,7 +2437,7 @@ public class Plot { * Gets a set of plots connected (and including) this plot
    * - This result is cached globally * - * @return + * @return a Set of Plots connected to this Plot */ public Set getConnectedPlots() { if (this.settings == null) { @@ -2451,10 +2462,10 @@ public class Plot { // invalid merge PlotSquared.debug("Fixing invalid merge: " + this); if (tmp.isOwnerAbs(this.owner)) { - tmp.getSettings().setMerged(2, true); + tmp.getSettings().setMerged(Direction.SOUTH, true); DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); } else { - this.getSettings().setMerged(0, false); + this.getSettings().setMerged(Direction.NORTH, false); DBFunc.setMerged(this, this.getSettings().getMerged()); } } @@ -2467,10 +2478,10 @@ public class Plot { // invalid merge PlotSquared.debug("Fixing invalid merge: " + this); if (tmp.isOwnerAbs(this.owner)) { - tmp.getSettings().setMerged(3, true); + tmp.getSettings().setMerged(Direction.WEST, true); DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); } else { - this.getSettings().setMerged(1, false); + this.getSettings().setMerged(Direction.EAST, false); DBFunc.setMerged(this, this.getSettings().getMerged()); } } @@ -2483,10 +2494,10 @@ public class Plot { // invalid merge PlotSquared.debug("Fixing invalid merge: " + this); if (tmp.isOwnerAbs(this.owner)) { - tmp.getSettings().setMerged(0, true); + tmp.getSettings().setMerged(Direction.NORTH, true); DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); } else { - this.getSettings().setMerged(2, false); + this.getSettings().setMerged(Direction.SOUTH, false); DBFunc.setMerged(this, this.getSettings().getMerged()); } } @@ -2499,10 +2510,10 @@ public class Plot { // invalid merge PlotSquared.debug("Fixing invalid merge: " + this); if (tmp.isOwnerAbs(this.owner)) { - tmp.getSettings().setMerged(1, true); + tmp.getSettings().setMerged(Direction.EAST, true); DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); } else { - this.getSettings().setMerged(3, false); + this.getSettings().setMerged(Direction.WEST, false); DBFunc.setMerged(this, this.getSettings().getMerged()); } } @@ -2560,7 +2571,7 @@ public class Plot { * * @return */ - @Nonnull public HashSet getRegions() { + @NotNull public HashSet getRegions() { if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) { return regions_cache; } @@ -2787,6 +2798,11 @@ public class Plot { return false; } + /** + * Checks if the owner of this Plot is online. + * + * @return true if the owner of the Plot is online + */ public boolean isOnline() { if (this.owner == null) { return false; @@ -2841,13 +2857,14 @@ public class Plot { } /** - * Merges 2 plots Removes the road in-between
    - Assumes plots are directly next to each other
    - saves to DB + * Merges two plots.
    - Assumes plots are directly next to each other
    - saves to DB * * @param lesserPlot * @param removeRoads */ public void mergePlot(Plot lesserPlot, boolean removeRoads) { Plot greaterPlot = this; + lesserPlot.removeSign(); if (lesserPlot.getId().x == greaterPlot.getId().x) { if (lesserPlot.getId().y > greaterPlot.getId().y) { Plot tmp = lesserPlot; @@ -2857,10 +2874,11 @@ public class Plot { if (!lesserPlot.getMerged(Direction.SOUTH)) { lesserPlot.clearRatings(); greaterPlot.clearRatings(); - lesserPlot.setMerged(2, true); - greaterPlot.setMerged(0, true); + lesserPlot.setMerged(Direction.SOUTH, true); + greaterPlot.setMerged(Direction.NORTH, true); lesserPlot.mergeData(greaterPlot); if (removeRoads) { + //lesserPlot.removeSign(); lesserPlot.removeRoadSouth(); Plot diagonal = greaterPlot.getRelative(Direction.EAST); if (diagonal.getMerged(Direction.NORTHWEST)) { @@ -2881,10 +2899,11 @@ public class Plot { if (!lesserPlot.getMerged(Direction.EAST)) { lesserPlot.clearRatings(); greaterPlot.clearRatings(); - lesserPlot.setMerged(1, true); - greaterPlot.setMerged(3, true); + lesserPlot.setMerged(Direction.EAST, true); + greaterPlot.setMerged(Direction.WEST, true); lesserPlot.mergeData(greaterPlot); if (removeRoads) { + //lesserPlot.removeSign(); Plot diagonal = greaterPlot.getRelative(Direction.SOUTH); if (diagonal.getMerged(Direction.NORTHWEST)) { lesserPlot.removeRoadSouthEast(); @@ -2897,6 +2916,7 @@ public class Plot { } } } + } /** @@ -3079,23 +3099,23 @@ public class Plot { return getFlags().containsKey(flag); } - @SuppressWarnings("deprecation") public boolean removeComment(PlotComment comment) { + public boolean removeComment(PlotComment comment) { return getSettings().removeComment(comment); } - @SuppressWarnings("deprecation") public void removeComments(List comments) { + public void removeComments(List comments) { getSettings().removeComments(comments); } - @SuppressWarnings("deprecation") public List getComments(String inbox) { + public List getComments(String inbox) { return getSettings().getComments(inbox); } - @SuppressWarnings("deprecation") public void addComment(PlotComment comment) { + public void addComment(PlotComment comment) { getSettings().addComment(comment); } - @SuppressWarnings("deprecation") public void setComments(List list) { + public void setComments(List list) { getSettings().setComments(list); } 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 3ed1e2c95..ff6668ea4 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 @@ -22,9 +22,8 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; @@ -37,12 +36,12 @@ public abstract class PlotArea { public final String worldname; public final String id; - public final PlotManager manager; + @NotNull public final PlotManager manager; public final int worldhash; protected final ConcurrentHashMap plots = new ConcurrentHashMap<>(); private final PlotId min; private final PlotId max; - private final IndependentPlotGenerator generator; + @NotNull private final IndependentPlotGenerator generator; private final BlockBucket[][] blockBucketChunk; public int MAX_PLOT_MEMBERS = 128; public boolean AUTO_MERGE = false; @@ -76,7 +75,7 @@ public abstract class PlotArea { private ConcurrentHashMap meta; private QuadMap clusters; - public PlotArea(@Nonnull final String worldName, @Nullable final String id, + public PlotArea(@NotNull final String worldName, @Nullable final String id, @NotNull IndependentPlotGenerator generator, @Nullable final PlotId min, @Nullable final PlotId max) { this.worldname = worldName; @@ -102,7 +101,7 @@ public abstract class PlotArea { } } - protected abstract PlotManager createManager(); + @NotNull protected abstract PlotManager createManager(); public LocalBlockQueue getQueue(final boolean autoQueue) { return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue); @@ -117,10 +116,7 @@ public abstract class PlotArea { if (blockBucketChunk != null) { return blockBucketChunk; } - if (generator != null) { - return generator.generateBlockBucketChunk(this); - } - return null; + return generator.generateBlockBucketChunk(this); } /** @@ -178,7 +174,7 @@ public abstract class PlotArea { * * @return the {@link IndependentPlotGenerator} */ - public IndependentPlotGenerator getGenerator() { + @NotNull public IndependentPlotGenerator getGenerator() { return this.generator; } @@ -394,7 +390,7 @@ public abstract class PlotArea { } } - @Nonnull @Override public String toString() { + @NotNull @Override public String toString() { if (this.id == null) { return this.worldname; } else { @@ -422,7 +418,7 @@ public abstract class PlotArea { * @param location the location * @return the {@code Plot} or null if none exists */ - @Nullable public Plot getPlotAbs(@Nonnull final Location location) { + @Nullable public Plot getPlotAbs(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -437,7 +433,7 @@ public abstract class PlotArea { * @param location the location * @return base Plot */ - @Nullable public Plot getPlot(@Nonnull final Location location) { + @Nullable public Plot getPlot(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -452,7 +448,7 @@ public abstract class PlotArea { * @param location the location * @return the base plot or null */ - @Nullable public Plot getOwnedPlot(@Nonnull final Location location) { + @Nullable public Plot getOwnedPlot(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -468,7 +464,7 @@ public abstract class PlotArea { * @param location the location * @return Plot or null */ - @Nullable public Plot getOwnedPlotAbs(@Nonnull final Location location) { + @Nullable public Plot getOwnedPlotAbs(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -483,11 +479,11 @@ public abstract class PlotArea { * @param id the {@code PlotId} * @return the plot or null */ - @Nullable public Plot getOwnedPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getOwnedPlotAbs(@NotNull final PlotId id) { return this.plots.get(id); } - @Nullable public Plot getOwnedPlot(@Nonnull final PlotId id) { + @Nullable public Plot getOwnedPlot(@NotNull final PlotId id) { Plot plot = this.plots.get(id); return plot == null ? null : plot.getBasePlot(false); } @@ -496,17 +492,17 @@ public abstract class PlotArea { return this.TYPE != 2 || getRegionAbs().isIn(x, z); } - public boolean contains(@Nonnull final PlotId id) { + public boolean contains(@NotNull final PlotId id) { return this.min == null || (id.x >= this.min.x && id.x <= this.max.x && id.y >= this.min.y && id.y <= this.max.y); } - public boolean contains(@Nonnull final Location location) { + public boolean contains(@NotNull final Location location) { return StringMan.isEqual(location.getWorld(), this.worldname) && (getRegionAbs() == null || this.region.isIn(location.getX(), location.getZ())); } - @Nonnull Set getPlotsAbs(final UUID uuid) { + @NotNull Set getPlotsAbs(final UUID uuid) { if (uuid == null) { return Collections.emptySet(); } @@ -519,7 +515,7 @@ public abstract class PlotArea { return myPlots; } - @Nonnull public Set getPlots(@Nonnull final UUID uuid) { + @NotNull public Set getPlots(@NotNull final UUID uuid) { return getPlots().stream().filter(plot -> plot.isBasePlot() && plot.isOwner(uuid)) .collect(ImmutableSet.toImmutableSet()); } @@ -533,7 +529,7 @@ public abstract class PlotArea { return this.plots.values(); } - public int getPlotCount(@Nonnull final UUID uuid) { + public int getPlotCount(@NotNull final UUID uuid) { if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { return (int) getPlotsAbs(uuid).stream().filter(plot -> !plot.hasFlag(Flags.DONE)) .count(); @@ -546,11 +542,11 @@ public abstract class PlotArea { * * @deprecated Use {@link #getPlots(UUID)} */ - @Deprecated public Set getPlots(@Nonnull final PlotPlayer player) { + @Deprecated public Set getPlots(@NotNull final PlotPlayer player) { return getPlots(player.getUUID()); } - public boolean hasPlot(@Nonnull final UUID uuid) { + public boolean hasPlot(@NotNull final UUID uuid) { return this.plots.entrySet().stream().anyMatch(entry -> entry.getValue().isOwner(uuid)); } @@ -559,7 +555,7 @@ public abstract class PlotArea { return player != null ? getPlotCount(player.getUUID()) : 0; } - @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y @@ -571,7 +567,7 @@ public abstract class PlotArea { return plot; } - @Nullable public Plot getPlot(@Nonnull final PlotId id) { + @Nullable public Plot getPlot(@NotNull final PlotId id) { final Plot plot = getOwnedPlotAbs(id); if (plot == null) { if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y @@ -592,7 +588,7 @@ public abstract class PlotArea { return this.plots.size(); } - @Nullable public PlotCluster getCluster(@Nonnull final Location location) { + @Nullable public PlotCluster getCluster(@NotNull final Location location) { final Plot plot = getPlot(location); if (plot == null) { return null; @@ -600,8 +596,8 @@ public abstract class PlotArea { return this.clusters != null ? this.clusters.get(plot.getId().x, plot.getId().y) : null; } - @Nullable public PlotCluster getFirstIntersectingCluster(@Nonnull final PlotId pos1, - @Nonnull final PlotId pos2) { + @Nullable public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1, + @NotNull final PlotId pos2) { if (this.clusters == null) { return null; } @@ -613,11 +609,11 @@ public abstract class PlotArea { return null; } - @Nullable PlotCluster getCluster(@Nonnull final PlotId id) { + @Nullable PlotCluster getCluster(@NotNull final PlotId id) { return this.clusters != null ? this.clusters.get(id.x, id.y) : null; } - public PlotManager getPlotManager() { + @NotNull public PlotManager getPlotManager() { return this.manager; } @@ -628,14 +624,14 @@ public abstract class PlotArea { * * @see FlagManager */ - public void setMeta(@Nonnull final String key, @Nullable final Object value) { + public void setMeta(@NotNull final String key, @Nullable final Object value) { if (this.meta == null) { this.meta = new ConcurrentHashMap<>(); } this.meta.put(key, value); } - @Nullable public T getMeta(@Nullable final String key, @Nullable final T def) { + @NotNull public T getMeta(@Nullable final String key, @NotNull final T def) { final Object v = getMeta(key); return v == null ? def : (T) v; } @@ -645,14 +641,14 @@ public abstract class PlotArea { *
    * For persistent metadata use the flag system */ - @Nullable public Object getMeta(@Nonnull final String key) { + @Nullable public Object getMeta(@NotNull final String key) { if (this.meta != null) { return this.meta.get(key); } return null; } - @SuppressWarnings("unused") @Nonnull public Set getBasePlots() { + @SuppressWarnings("unused") @NotNull public Set getBasePlots() { final HashSet myPlots = new HashSet<>(getPlots()); myPlots.removeIf(plot -> !plot.isBasePlot()); return myPlots; @@ -685,15 +681,15 @@ public abstract class PlotArea { * @deprecated Use {@link #getPlotsMap()} */ //todo eventually remove - @Deprecated @Nonnull public Map getPlotsRaw() { + @Deprecated @NotNull public Map getPlotsRaw() { return ImmutableMap.copyOf(plots); } - @Nonnull public Set> getPlotEntries() { + @NotNull public Set> getPlotEntries() { return this.plots.entrySet(); } - public boolean addPlot(@Nonnull final Plot plot) { + public boolean addPlot(@NotNull final Plot plot) { for (PlotPlayer pp : plot.getPlayersInPlot()) { pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); } @@ -731,7 +727,7 @@ public abstract class PlotArea { return null; } - public boolean addPlotIfAbsent(@Nonnull final Plot plot) { + public boolean addPlotIfAbsent(@NotNull final Plot plot) { if (this.plots.putIfAbsent(plot.getId(), plot) == null) { for (PlotPlayer pp : plot.getPlayersInPlot()) { pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); @@ -741,7 +737,7 @@ public abstract class PlotArea { return false; } - public boolean addPlotAbs(@Nonnull final Plot plot) { + public boolean addPlotAbs(@NotNull final Plot plot) { return this.plots.put(plot.getId(), plot) == null; } @@ -786,14 +782,14 @@ public abstract class PlotArea { * * @param key Meta data key */ - public void deleteMeta(@Nonnull final String key) { + public void deleteMeta(@NotNull final String key) { if (this.meta != null) { this.meta.remove(key); } } - public boolean canClaim(@Nullable final PlotPlayer player, @Nonnull final PlotId pos1, - @Nonnull final PlotId pos2) { + public boolean canClaim(@Nullable final PlotPlayer player, @NotNull final PlotId pos1, + @NotNull final PlotId pos2) { if (pos1.x == pos2.x && pos1.y == pos2.y) { if (getOwnedPlot(pos1) != null) { return false; @@ -819,11 +815,11 @@ public abstract class PlotArea { return true; } - public boolean removePlot(@Nonnull final PlotId id) { + public boolean removePlot(@NotNull final PlotId id) { return this.plots.remove(id) != null; } - public boolean mergePlots(@Nonnull final List plotIds, final boolean removeRoads) { + public boolean mergePlots(@NotNull final List plotIds, final boolean removeRoads) { if (plotIds.size() < 2) { return false; } @@ -901,7 +897,7 @@ public abstract class PlotArea { * @param pos2 second corner of selection * @return the plots in the selection which are owned */ - public Set getPlotSelectionOwned(@Nonnull final PlotId pos1, @Nonnull final PlotId pos2) { + public Set getPlotSelectionOwned(@NotNull final PlotId pos1, @NotNull final PlotId pos2) { final int size = (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); final Set result = new HashSet<>(); if (size < 16 || size < getPlotCount()) { 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 0b9427839..feaf64ddb 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 @@ -132,8 +132,8 @@ public class PlotCluster { toReturn = center.getHome(); if (toReturn.getY() == 0) { PlotManager manager = this.area.getPlotManager(); - Location loc = manager.getSignLoc(center); - toReturn.setY(loc.getY()); + Location location = manager.getSignLoc(center); + toReturn.setY(location.getY()); } } else { toReturn = getClusterBottom().add(home.x, home.y, home.z); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 10b9e4c71..21e7dc777 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class PlotId { /** @@ -32,14 +32,14 @@ public class PlotId { * @return the PlotId representation of the arguement * @throws IllegalArgumentException if the string does not contain a valid PlotId */ - @Nonnull public static PlotId fromString(@Nonnull String string) { + @NotNull public static PlotId fromString(@NotNull String string) { PlotId plot = fromStringOrNull(string); if (plot == null) throw new IllegalArgumentException("Cannot create PlotID. String invalid."); return plot; } - @Nullable public static PlotId fromStringOrNull(@Nonnull String string) { + @Nullable public static PlotId fromStringOrNull(@NotNull String string) { String[] parts = string.split("[;|,]"); if (parts.length < 2) { return null; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 74f0eddb7..0b39b2b7d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -39,6 +39,12 @@ public abstract class PlotManager { public abstract boolean unClaimPlot(Plot plot, Runnable whenDone); + /** + * Retrieves the location of where a sign should be for a plot. + * + * @param plot The plot + * @return The location where a sign should be + */ public abstract Location getSignLoc(Plot plot); /* @@ -47,8 +53,7 @@ public abstract class PlotManager { */ public abstract String[] getPlotComponents(PlotId plotId); - public abstract boolean setComponent(PlotId plotId, String component, - BlockBucket blocks); + public abstract boolean setComponent(PlotId plotId, String component, BlockBucket blocks); /* * PLOT MERGING (return false if your generator does not support plot 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 8981b2923..f8e21255b 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 @@ -14,8 +14,8 @@ import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.google.common.base.Preconditions; import lombok.NonNull; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.HashSet; @@ -306,7 +306,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @return The location */ - public Location getLocation() { + @NotNull public Location getLocation() { Location location = getMeta("location"); if (location != null) { return location; @@ -335,14 +335,14 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @return UUID */ - @Override @Nonnull public abstract UUID getUUID(); + @Override @NotNull public abstract UUID getUUID(); - public boolean canTeleport(@Nonnull final Location loc) { - Preconditions.checkNotNull(loc, "Specified location cannot be null"); + public boolean canTeleport(@NotNull final Location location) { + Preconditions.checkNotNull(location, "Specified location cannot be null"); final Location current = getLocationFull(); - teleport(loc); + teleport(location); boolean result = true; - if (!getLocation().equals(loc)) { + if (!getLocation().equals(location)) { result = false; } teleport(current); @@ -421,21 +421,21 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @param weather the weather visible to the player */ - public abstract void setWeather(@Nonnull PlotWeather weather); + public abstract void setWeather(@NotNull PlotWeather weather); /** * Get this player's gamemode. * * @return the gamemode of the player. */ - @Nonnull public abstract PlotGameMode getGameMode(); + @NotNull public abstract PlotGameMode getGameMode(); /** * Set this player's gameMode. * * @param gameMode the gamemode to set */ - public abstract void setGameMode(@Nonnull PlotGameMode gameMode); + public abstract void setGameMode(@NotNull PlotGameMode gameMode); /** * Set this player's local time (ticks). @@ -464,7 +464,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @param location where to play the music * @param id the record item id */ - public abstract void playMusic(@Nonnull Location location, @Nonnull PlotBlock id); + public abstract void playMusic(@NotNull Location location, @NotNull PlotBlock id); /** * Check if this player is banned. @@ -493,10 +493,10 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { ByteBuffer buffer = ByteBuffer.allocate(13); buffer.putShort((short) x); buffer.putShort((short) z); - Location loc = getLocation(); - buffer.putInt(loc.getX()); - buffer.put((byte) loc.getY()); - buffer.putInt(loc.getZ()); + Location location = getLocation(); + buffer.putInt(location.getX()); + buffer.put((byte) location.getY()); + buffer.putInt(location.getZ()); setPersistentMeta("quitLoc", buffer.array()); } else if (hasPersistentMeta("quitLoc")) { removePersistentMeta("quitLoc"); @@ -596,11 +596,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { return; } - final Location loc = new Location(plot.getWorldName(), x, y, z); + final Location location = new Location(plot.getWorldName(), x, y, z); if (plot.isLoaded()) { TaskManager.runTask(() -> { if (getMeta("teleportOnLogin", true)) { - teleport(loc); + teleport(location); sendMessage( Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX + "," + plotZ + ")"); @@ -612,7 +612,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { TaskManager.runTask(() -> { if (getMeta("teleportOnLogin", true)) { if (plot.isLoaded()) { - teleport(loc); + teleport(location); sendMessage(Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc-unloaded) (" + plotX + "," + plotZ + ")"); 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 829e42dbd..ce51fea33 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 @@ -5,7 +5,12 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import com.google.common.collect.ImmutableList; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; /** * Generic settings class. @@ -80,6 +85,17 @@ public class PlotSettings { return false; } + public boolean setMerged(Direction direction, boolean merged) { + if (Direction.ALL == direction) { + throw new IllegalArgumentException("You cannot use Direction.ALL in this method!"); + } + if (this.merged[direction.getIndex()] != merged) { + this.merged[direction.getIndex()] = merged; + return true; + } + return false; + } + public BlockLoc getPosition() { if (this.position == null) { return new BlockLoc(0, 0, 0); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java index b67b16b58..e2c222df5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java @@ -30,8 +30,8 @@ public class Schematic { public boolean setBlock(BlockVector3 position, BaseBlock block) throws WorldEditException { if (clipboard.getRegion().contains(position)) { - BlockVector3 v = position.subtract(clipboard.getRegion().getMinimumPoint()); - clipboard.setBlock(v, block); + BlockVector3 vector3 = position.subtract(clipboard.getRegion().getMinimumPoint()); + clipboard.setBlock(vector3, block); return true; } else { return false; @@ -39,9 +39,9 @@ public class Schematic { } public void save(File file) throws IOException { - try (SpongeSchematicWriter ssw = new SpongeSchematicWriter( + try (SpongeSchematicWriter schematicWriter = new SpongeSchematicWriter( new NBTOutputStream(new FileOutputStream(file)))) { - ssw.write(clipboard); + schematicWriter.write(clipboard); } } } 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 36d23c8f6..8c80e46a7 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 @@ -4,8 +4,8 @@ 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.google.common.collect.Sets; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.HashSet; import java.util.UUID; @@ -60,7 +60,7 @@ public class SinglePlot extends Plot { return super.isLoaded(); } - @Nonnull @Override public HashSet getRegions() { + @NotNull @Override public HashSet getRegions() { return regions; } 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 41801c087..8f8ac96b1 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 @@ -9,9 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -26,7 +26,7 @@ public class SinglePlotArea extends GridPlotWorld { this.DEFAULT_HOME = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE); } - @Override + @NotNull @Override protected PlotManager createManager() { return new SinglePlotManager(this); } @@ -76,8 +76,8 @@ public class SinglePlotArea extends GridPlotWorld { new File(dataDest, file.getName()).toPath()); } } - } catch (IOException ignore) { - ignore.printStackTrace(); + } catch (IOException exception) { + exception.printStackTrace(); } } } @@ -113,38 +113,38 @@ public class SinglePlotArea extends GridPlotWorld { new ConfigurationNode("void", this.VOID, "Void world", Configuration.BOOLEAN)}; } - @Nullable @Override public Plot getOwnedPlot(@Nonnull final Location location) { + @Nullable @Override public Plot getOwnedPlot(@NotNull final Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); Plot plot = pid == null ? null : this.plots.get(pid); return plot == null ? null : plot.getBasePlot(false); } - @Nullable @Override public Plot getOwnedPlotAbs(@Nonnull Location location) { + @Nullable @Override public Plot getOwnedPlotAbs(@NotNull Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : plots.get(pid); } - @Nullable @Override public Plot getPlot(@Nonnull final Location location) { + @Nullable @Override public Plot getPlot(@NotNull final Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : getPlot(pid); } - @Nullable @Override public Plot getPlotAbs(@Nonnull final Location location) { + @Nullable @Override public Plot getPlotAbs(@NotNull final Location location) { final PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : getPlotAbs(pid); } - public boolean addPlot(@Nonnull Plot plot) { + public boolean addPlot(@NotNull Plot plot) { plot = adapt(plot); return super.addPlot(plot); } - @Override public boolean addPlotAbs(@Nonnull Plot plot) { + @Override public boolean addPlotAbs(@NotNull Plot plot) { plot = adapt(plot); return super.addPlotAbs(plot); } - @Override public boolean addPlotIfAbsent(@Nonnull Plot plot) { + @Override public boolean addPlotIfAbsent(@NotNull Plot plot) { plot = adapt(plot); return super.addPlotIfAbsent(plot); } @@ -160,7 +160,7 @@ public class SinglePlotArea extends GridPlotWorld { return p; } - @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { return new SinglePlot(this, id); @@ -168,7 +168,7 @@ public class SinglePlotArea extends GridPlotWorld { return plot; } - @Nullable public Plot getPlot(@Nonnull PlotId id) { + @Nullable public Plot getPlot(@NotNull PlotId id) { // TODO Plot plot = getOwnedPlotAbs(id); if (plot == null) { 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 0a5b77515..b2b88d342 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 @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; -import javax.annotation.Nullable; +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/MainUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java index e45d70caf..1f42d6772 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 @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.stream.AbstractDelegateOutputStream; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.io.*; import java.net.HttpURLConnection; import java.net.MalformedURLException; @@ -329,7 +329,7 @@ public class MainUtil { * @param owner * @return The player's name, None, Everyone or Unknown */ - @Nonnull public static String getName(UUID owner) { + @NotNull public static String getName(UUID owner) { if (owner == null) { return Captions.NONE.getTranslated(); } @@ -358,7 +358,7 @@ public class MainUtil { * @return * @see Plot#getCorners() */ - @Nonnull public static Location[] getCorners(String world, Collection regions) { + @NotNull public static Location[] getCorners(String world, Collection regions) { Location min = null; Location max = null; for (RegionWrapper region : regions) { @@ -560,11 +560,11 @@ public class MainUtil { * Send a message to the player. * * @param player Player to receive message - * @param msg Message to send + * @param message Message to send * @return true Can be used in things such as commands (return PlayerFunctions.sendMessage(...)) */ - public static boolean sendMessage(PlotPlayer player, String msg) { - return sendMessage(player, msg, true); + public static boolean sendMessage(PlotPlayer player, String message) { + return sendMessage(player, message, true); } /** @@ -585,7 +585,7 @@ public class MainUtil { * @param prefix If the message should be prefixed with the configured prefix * @return */ - public static boolean sendMessage(CommandCaller player, String msg, boolean prefix) { + public static boolean sendMessage(CommandCaller player, @NotNull String msg, boolean prefix) { if (!msg.isEmpty()) { if (player == null) { String message = (prefix ? Captions.PREFIX.getTranslated() : "") + msg; 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 6ce59fe6c..9742ffb98 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 @@ -327,9 +327,9 @@ public abstract class SchematicHandler { public Schematic getSchematic(@NotNull URL url) { try { - ReadableByteChannel rbc = Channels.newChannel(url.openStream()); - InputStream is = Channels.newInputStream(rbc); - return getSchematic(is); + ReadableByteChannel readableByteChannel = Channels.newChannel(url.openStream()); + InputStream inputStream = Channels.newInputStream(readableByteChannel); + return getSchematic(inputStream); } catch (IOException e) { e.printStackTrace(); } @@ -338,15 +338,15 @@ public abstract class SchematicHandler { public Schematic getSchematic(@NotNull InputStream is) { try { - SpongeSchematicReader ssr = + SpongeSchematicReader schematicReader = new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is))); - BlockArrayClipboard clip = (BlockArrayClipboard) ssr.read(); + BlockArrayClipboard clip = (BlockArrayClipboard) schematicReader.read(); return new Schematic(clip); } catch (IOException ignored) { try { - MCEditSchematicReader msr = + MCEditSchematicReader schematicReader = new MCEditSchematicReader(new NBTInputStream(new GZIPInputStream(is))); - BlockArrayClipboard clip = (BlockArrayClipboard) msr.read(); + BlockArrayClipboard clip = (BlockArrayClipboard) schematicReader.read(); return new Schematic(clip); } catch (IOException e) { e.printStackTrace(); 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 315687463..60a0d778b 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 @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.google.common.collect.BiMap; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; +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 55ff35c95..17ab6b5ce 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 @@ -15,7 +15,7 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; +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/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 6993c3208..7f44d2931 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -102,8 +102,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { lastWrappedChunk.setBlock(x & 15, y, z & 15, id); LocalChunk previous = this.blockChunks.put(pair, lastWrappedChunk); if (previous == null) { - chunks.add(lastWrappedChunk); - return true; + return chunks.add(lastWrappedChunk); } this.blockChunks.put(pair, previous); lastWrappedChunk = previous; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index 0c797c706..c5c17b4a4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -102,9 +102,10 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { } } - @Override public void enqueue() { + @Override public boolean enqueue() { if (parent != null) { - parent.enqueue(); + return parent.enqueue(); } + return false; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java index 6d75b6bfb..3373f8e57 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java @@ -45,10 +45,10 @@ public class GlobalBlockQueue { public GlobalBlockQueue(QueueProvider provider, int threads) { this.provider = provider; - activeQueues = new ConcurrentLinkedDeque<>(); - inactiveQueues = new ConcurrentLinkedDeque<>(); - runnables = new ConcurrentLinkedDeque<>(); - running = new AtomicBoolean(); + this.activeQueues = new ConcurrentLinkedDeque<>(); + this.inactiveQueues = new ConcurrentLinkedDeque<>(); + this.runnables = new ConcurrentLinkedDeque<>(); + this.running = new AtomicBoolean(); this.PARALLEL_THREADS = threads; } @@ -151,12 +151,20 @@ public class GlobalBlockQueue { return false; } - public void enqueue(LocalBlockQueue queue) { - inactiveQueues.remove(queue); + /** + * TODO Documentation needed. + * + * @param queue todo + * @return true if added to queue, false otherwise + */ + public boolean enqueue(LocalBlockQueue queue) { + boolean success = false; + success = inactiveQueues.remove(queue); if (queue.size() > 0 && !activeQueues.contains(queue)) { queue.optimize(); - activeQueues.add(queue); + success = activeQueues.add(queue); } + return success; } public void dequeue(LocalBlockQueue queue) { 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 53196966e..04a9e2f0c 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 @@ -16,8 +16,12 @@ import java.util.Map; public abstract class LocalBlockQueue { - public LocalBlockQueue(String world) { - // Implement this elsewhere + /** + * Needed for compatibility with FAWE. + * + * @param world unused + */ + @Deprecated public LocalBlockQueue(String world) { } public ScopedLocalBlockQueue getForChunk(int x, int z) { @@ -92,8 +96,8 @@ public abstract class LocalBlockQueue { } } - public void enqueue() { - GlobalBlockQueue.IMP.enqueue(this); + public boolean enqueue() { + return GlobalBlockQueue.IMP.enqueue(this); } public void setCuboid(Location pos1, Location pos2, PlotBlock block) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java index c9065f65e..7e41887ed 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java @@ -80,22 +80,22 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { int bx = minX; int bz = minZ; PlotArea area = PlotSquared.get().getPlotArea(getWorld(), null); - Location loc = new Location(getWorld(), bx, 0, bz); + Location location = new Location(getWorld(), bx, 0, bz); if (area != null) { PlotManager manager = area.getPlotManager(); for (int x = 0; x < 16; x++) { - loc.setX(bx + x); + location.setX(bx + x); for (int z = 0; z < 16; z++) { - loc.setZ(bz + z); - task.run(area.getPlotAbs(loc), x, z); + location.setZ(bz + z); + task.run(area.getPlotAbs(location), x, z); } } } else { for (int x = 0; x < 16; x++) { - loc.setX(bx + x); + location.setX(bx + x); for (int z = 0; z < 16; z++) { - loc.setZ(bz + z); - task.run(loc.getPlotAbs(), x, z); + location.setZ(bz + z); + task.run(location.getPlotAbs(), x, z); } } } diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java index 1ef5c92ec..a2cc07d1b 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java @@ -1,11 +1,19 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.flag.Flag; -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.PlotCluster; +import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; public class AbstractDBTest implements AbstractDB { @@ -149,7 +157,7 @@ public class AbstractDBTest implements AbstractDB { @Override public void setComment(Plot plot, PlotComment comment) { } - @Override public void getComments(@Nonnull Plot plot, String inbox, + @Override public void getComments(@NotNull Plot plot, String inbox, RunnableVal> whenDone) { } diff --git a/Nukkit/src/main/resources/plugin.yml b/Nukkit/src/main/resources/plugin.yml index a25e26cf9..d17737c50 100644 --- a/Nukkit/src/main/resources/plugin.yml +++ b/Nukkit/src/main/resources/plugin.yml @@ -119,6 +119,7 @@ permissions: plots.toggle: true plots.toggle.titles: true plots.toggle.chat: true + plots.toggle.time: true plots.set.biome: true plots.set.home: true plots.set.alias: true diff --git a/gradlew b/gradlew index 8e25e6c19..b0d6d0ab5 100755 --- a/gradlew +++ b/gradlew @@ -7,7 +7,7 @@ # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/gradlew.bat b/gradlew.bat index 9618d8d96..9991c5032 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -5,7 +5,7 @@ @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem -@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem http://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, From 758c343e52350122990ac71a4453adc1046f1548 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 8 Sep 2019 20:25:12 +0200 Subject: [PATCH 117/258] Update bug-issue-report-for-plotsquared.md --- .../ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md index 7badf3ae8..43293d3c9 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -12,16 +12,14 @@ __*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and wil -**[REQUIRED] PlotSquared Version Number:** +**Debug paste link:** + **[REQUIRED] Spigot/Paper Version Number:** **[REQUIRED] Minecraft Version Number:** -**Links to worlds.yml file and settings.yml file:** - - **[REQUIRED] Description of the problem:** **Any relevant console output or screenshots:** @@ -29,10 +27,10 @@ __*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and wil **Plugins being used on the server:** -**How to replicate:** +**[REQUIRED] How to replicate:** -**Checklist**: +**[REQUIRED] Checklist**: - [] I included all information required in the sections above - [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) From fd6fbebd69ada98099a23c32a06d3e75078d6ffc Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 8 Sep 2019 18:43:47 -0400 Subject: [PATCH 118/258] Fixed #2496 --- .../plotsquared/bukkit/util/BukkitUtil.java | 5 +++++ .../plotsquared/plot/PlotVersionTest.java | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java 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 a2d0b0c9b..ebf67e075 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 @@ -22,6 +22,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.Sign; import org.bukkit.block.data.Directional; +import org.bukkit.block.data.type.WallSign; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; @@ -359,6 +360,10 @@ import java.util.Set; } else { block.setType(Material.valueOf("OAK_WALL_SIGN"), false); } + if (!(block.getBlockData() instanceof WallSign)) { + PlotSquared.debug(block.getBlockData().getAsString()); + throw new RuntimeException("Something went wrong generating a sign"); + } final Directional sign = (Directional) block.getBlockData(); sign.setFacing(facing); block.setBlockData(sign, false); diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java new file mode 100644 index 000000000..069c886da --- /dev/null +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java @@ -0,0 +1,13 @@ +package com.github.intellectualsites.plotsquared.plot; + +import org.junit.Test; + +public class PlotVersionTest { + + @Test public void tryParse() { + //These are all random values chosen to form the test class. + PlotVersion version = new PlotVersion("4.340", "f06903f", "19.08.05"); + System.out.println(version.build); + + } +} From ecfb71b08f5ec8e6bd4b5f5e0a5711c202c96725 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 8 Sep 2019 19:36:02 -0400 Subject: [PATCH 119/258] Changes made to GlobalBlockQueue to help diagnose lag. --- .../plot/util/block/GlobalBlockQueue.java | 90 ++++++++++--------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java index 3373f8e57..9725af48c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.List; +import java.util.Vector; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.atomic.AtomicBoolean; @@ -38,8 +39,7 @@ public class GlobalBlockQueue { } return; } - } while (((GlobalBlockQueue.this.secondLast = System.currentTimeMillis()) - - GlobalBlockQueue.this.last) < free); + } while (((GlobalBlockQueue.this.secondLast = System.currentTimeMillis())- GlobalBlockQueue.this.last) < free); } }; @@ -81,50 +81,50 @@ public class GlobalBlockQueue { return false; } running.set(true); - TaskManager.runTaskRepeat(() -> { - if (inactiveQueues.isEmpty() && activeQueues.isEmpty()) { - lastSuccess = System.currentTimeMillis(); - tasks(); - return; - } - SET_TASK.value1 = 50 + Math.min( - (50 + GlobalBlockQueue.this.last) - (GlobalBlockQueue.this.last = - System.currentTimeMillis()), - GlobalBlockQueue.this.secondLast - System.currentTimeMillis()); - SET_TASK.value2 = getNextQueue(); - if (SET_TASK.value2 == null) { - return; - } - if (!PlotSquared.get().isMainThread(Thread.currentThread())) { - throw new IllegalStateException( - "This shouldn't be possible for placement to occur off the main thread"); - } - // Disable the async catcher as it can't discern async vs parallel - SET_TASK.value2.startSet(true); - try { - if (PARALLEL_THREADS <= 1) { - SET_TASK.run(); - } else { - ArrayList threads = new ArrayList<>(); - for (int i = 0; i < PARALLEL_THREADS; i++) { - threads.add(new Thread(SET_TASK)); - } - for (Thread thread : threads) { - thread.start(); - } - for (Thread thread : threads) { - try { - thread.join(); - } catch (InterruptedException e) { - e.printStackTrace(); + TaskManager.runTaskRepeat(new Runnable() { + @Override public void run() { + if (inactiveQueues.isEmpty() && activeQueues.isEmpty()) { + lastSuccess = System.currentTimeMillis(); + GlobalBlockQueue.this.tasks(); + return; + } + SET_TASK.value1 = 50 + Math.min((50 + GlobalBlockQueue.this.last) - (GlobalBlockQueue.this.last = System.currentTimeMillis()), + GlobalBlockQueue.this.secondLast - System.currentTimeMillis()); + SET_TASK.value2 = GlobalBlockQueue.this.getNextQueue(); + if (SET_TASK.value2 == null) { + return; + } + if (!PlotSquared.get().isMainThread(Thread.currentThread())) { + throw new IllegalStateException( + "This shouldn't be possible for placement to occur off the main thread"); + } + // Disable the async catcher as it can't discern async vs parallel + SET_TASK.value2.startSet(true); + try { + if (PARALLEL_THREADS <= 1) { + SET_TASK.run(); + } else { + ArrayList threads = new ArrayList<>(); + for (int i = 0; i < PARALLEL_THREADS; i++) { + threads.add(new Thread(SET_TASK)); + } + for (Thread thread : threads) { + thread.start(); + } + for (Thread thread : threads) { + try { + thread.join(); + } catch (InterruptedException e) { + e.printStackTrace(); + } } } + } catch (Throwable e) { + e.printStackTrace(); + } finally { + // Enable it again (note that we are still on the main thread) + SET_TASK.value2.endSet(true); } - } catch (Throwable e) { - e.printStackTrace(); - } finally { - // Enable it again (note that we are still on the main thread) - SET_TASK.value2.endSet(true); } }, 1); return true; @@ -205,7 +205,9 @@ public class GlobalBlockQueue { } else { ArrayList threads = new ArrayList<>(); for (int i = 0; i < PARALLEL_THREADS; i++) { - threads.add(new Thread(SET_TASK)); + Thread thread = new Thread(SET_TASK); + thread.setName("PlotSquared Flush Task"); + threads.add(thread); } for (Thread thread : threads) { thread.start(); From 5b3426f4ac36fa893aecbe1574eba5e0bbc626ff Mon Sep 17 00:00:00 2001 From: 56738 <56738mc@gmail.com> Date: Mon, 9 Sep 2019 18:44:36 +0200 Subject: [PATCH 120/258] Make removing * remove the Everyone node before removing all members --- .../plotsquared/plot/commands/Remove.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java index 875eb6e4c..038355d83 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java @@ -66,18 +66,7 @@ import java.util.UUID; Set uuids = MainUtil.getUUIDsFromString(args[0]); if (!uuids.isEmpty()) { for (UUID uuid : uuids) { - if (uuid == DBFunc.EVERYONE) { - if (plot.removeTrusted(uuid)) { - EventUtil.manager.callTrusted(player, plot, uuid, false); - count++; - } else if (plot.removeMember(uuid)) { - EventUtil.manager.callMember(player, plot, uuid, false); - count++; - } else if (plot.removeDenied(uuid)) { - EventUtil.manager.callDenied(player, plot, uuid, false); - count++; - } - } else if (plot.getTrusted().contains(uuid)) { + if (plot.getTrusted().contains(uuid)) { if (plot.removeTrusted(uuid)) { EventUtil.manager.callTrusted(player, plot, uuid, false); count++; @@ -92,6 +81,17 @@ import java.util.UUID; EventUtil.manager.callDenied(player, plot, uuid, false); count++; } + } else if (uuid == DBFunc.EVERYONE) { + if (plot.removeTrusted(uuid)) { + EventUtil.manager.callTrusted(player, plot, uuid, false); + count++; + } else if (plot.removeMember(uuid)) { + EventUtil.manager.callMember(player, plot, uuid, false); + count++; + } else if (plot.removeDenied(uuid)) { + EventUtil.manager.callDenied(player, plot, uuid, false); + count++; + } } } } From 07b88e31479fa62df02e39d73577a791234e79e2 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 9 Sep 2019 15:15:44 -0400 Subject: [PATCH 121/258] Minor changes to the block queue classes to match FAWE more closely. --- .../bukkit/util/BukkitChunkManager.java | 4 +-- .../plotsquared/plot/commands/Clear.java | 2 +- .../plotsquared/plot/commands/Set.java | 2 +- .../plotsquared/plot/commands/Template.java | 2 +- .../plot/generator/ClassicPlotManager.java | 2 +- .../plot/generator/HybridPlotManager.java | 2 +- .../plot/generator/HybridUtils.java | 2 +- .../plotsquared/plot/object/Plot.java | 4 +-- .../plot/util/block/GlobalBlockQueue.java | 35 ++++++++++--------- 9 files changed, 29 insertions(+), 26 deletions(-) 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 a9c6b2518..5735d0b94 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 @@ -228,7 +228,7 @@ public class BukkitChunkManager extends ChunkManager { } } queue.enqueue(); - GlobalBlockQueue.IMP.addTask(() -> { + GlobalBlockQueue.IMP.addEmptyTask(() -> { //map.restoreBlocks(newWorld, 0, 0); map.restoreEntities(newWorld, relX, relZ); TaskManager.runTask(whenDone); @@ -444,7 +444,7 @@ public class BukkitChunkManager extends ChunkManager { maps.add(swapChunk(world1, world2, chunk1, chunk2, region1, region2)); } } - GlobalBlockQueue.IMP.addTask(() -> { + GlobalBlockQueue.IMP.addEmptyTask(() -> { for (ContentMap map : maps) { map.restoreEntities(world1, 0, 0); TaskManager.runTaskLater(whenDone, 1); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java index b45c52f65..9dcd475a1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java @@ -42,7 +42,7 @@ import java.util.concurrent.CompletableFuture; final long start = System.currentTimeMillis(); boolean result = plot.clear(true, false, () -> { plot.unlink(); - GlobalBlockQueue.IMP.addTask(() -> { + GlobalBlockQueue.IMP.addEmptyTask(() -> { plot.removeRunning(); // If the state changes, then mark it as no longer done if (plot.getFlag(Flags.DONE).isPresent()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index d3c65c8db..582dfb38a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -107,7 +107,7 @@ import java.util.stream.IntStream; current.setComponent(component, bucket); } MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); - GlobalBlockQueue.IMP.addTask(plot::removeRunning); + GlobalBlockQueue.IMP.addEmptyTask(plot::removeRunning); return true; } } 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 563956c46..fe41e61ab 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 @@ -158,7 +158,7 @@ import java.util.zip.ZipOutputStream; setup.step = new ConfigurationNode[0]; setup.world = world; SetupUtils.manager.setupWorld(setup); - GlobalBlockQueue.IMP.addTask(() -> { + GlobalBlockQueue.IMP.addEmptyTask(() -> { MainUtil.sendMessage(player, "Done!"); player.teleport(WorldUtil.IMP.getSpawn(world)); }); 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 320953963..f7ce683ba 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 @@ -46,7 +46,7 @@ public class ClassicPlotManager extends SquarePlotManager { @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING); setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); - return GlobalBlockQueue.IMP.addTask(whenDone); + return GlobalBlockQueue.IMP.addEmptyTask(whenDone); } public boolean setFloor(PlotId plotId, BlockBucket blocks) { 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 0a3fc4de6..cd711dd6e 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 @@ -207,7 +207,7 @@ public class HybridPlotManager extends ClassicPlotManager { }, () -> { queue.enqueue(); // And notify whatever called this when plot clearing is done - GlobalBlockQueue.IMP.addTask(whenDone); + GlobalBlockQueue.IMP.addEmptyTask(whenDone); }, 10); return true; } 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 3f4261440..3a5c29988 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 @@ -223,7 +223,7 @@ public abstract class HybridUtils { PlotSquared.debug("&d - Potentially skipping 1024 chunks"); PlotSquared.debug("&d - TODO: recommend chunkster if corrupt"); } - GlobalBlockQueue.IMP.addTask(() -> TaskManager.runTaskLater(task, 20)); + GlobalBlockQueue.IMP.addEmptyTask(() -> TaskManager.runTaskLater(task, 20)); }); } } 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 30c5034a8..852a1647b 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 @@ -869,7 +869,7 @@ public class Plot { manager.claimPlot(current); } } - GlobalBlockQueue.IMP.addTask(run); + GlobalBlockQueue.IMP.addEmptyTask(run); return; } Plot current = queue.poll(); @@ -982,7 +982,7 @@ public class Plot { current.setMerged(merged); } if (createSign) { - GlobalBlockQueue.IMP.addTask(() -> { + GlobalBlockQueue.IMP.addEmptyTask(() -> { for (Plot current : plots) { current.setSign(MainUtil.getName(current.owner)); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java index 9725af48c..049b13d32 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.List; -import java.util.Vector; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.atomic.AtomicBoolean; @@ -21,8 +20,10 @@ public class GlobalBlockQueue { private final ConcurrentLinkedDeque runnables; private final AtomicBoolean running; private QueueProvider provider; + /** - * Used to calculate elapsed time in milliseconds and ensure block placement doesn't lag the server + * Used to calculate elapsed time in milliseconds and ensure block placement doesn't lag the + * server */ private long last; private long secondLast; @@ -35,11 +36,12 @@ public class GlobalBlockQueue { if (!more) { lastSuccess = last; if (inactiveQueues.size() == 0 && activeQueues.size() == 0) { - tasks(); + runEmptyTasks(); } return; } - } while (((GlobalBlockQueue.this.secondLast = System.currentTimeMillis())- GlobalBlockQueue.this.last) < free); + } while (((GlobalBlockQueue.this.secondLast = System.currentTimeMillis()) + - GlobalBlockQueue.this.last) < free); } }; @@ -85,10 +87,12 @@ public class GlobalBlockQueue { @Override public void run() { if (inactiveQueues.isEmpty() && activeQueues.isEmpty()) { lastSuccess = System.currentTimeMillis(); - GlobalBlockQueue.this.tasks(); + GlobalBlockQueue.this.runEmptyTasks(); return; } - SET_TASK.value1 = 50 + Math.min((50 + GlobalBlockQueue.this.last) - (GlobalBlockQueue.this.last = System.currentTimeMillis()), + SET_TASK.value1 = 50 + Math.min( + (50 + GlobalBlockQueue.this.last) - (GlobalBlockQueue.this.last = + System.currentTimeMillis()), GlobalBlockQueue.this.secondLast - System.currentTimeMillis()); SET_TASK.value2 = GlobalBlockQueue.this.getNextQueue(); if (SET_TASK.value2 == null) { @@ -231,7 +235,7 @@ public class GlobalBlockQueue { public LocalBlockQueue getNextQueue() { long now = System.currentTimeMillis(); - while (activeQueues.size() > 0) { + while (!activeQueues.isEmpty()) { LocalBlockQueue queue = activeQueues.peek(); if (queue != null && queue.size() > 0) { queue.setModified(now); @@ -251,7 +255,7 @@ public class GlobalBlockQueue { long age = now - queue.getModified(); total += queue.size(); if (queue.size() == 0) { - if (age > 1000) { + if (age > 60000) { iter.remove(); } continue; @@ -263,7 +267,7 @@ public class GlobalBlockQueue { firstNonEmpty.setModified(now); return firstNonEmpty; } - if (age > 60000) { + if (age > 1000) { queue.setModified(now); return queue; } @@ -279,10 +283,10 @@ public class GlobalBlockQueue { return activeQueues.size() == 0 && inactiveQueues.size() == 0; } - public boolean addTask(final Runnable whenDone) { + public boolean addEmptyTask(final Runnable whenDone) { if (this.isDone()) { // Run - this.tasks(); + this.runEmptyTasks(); if (whenDone != null) { whenDone.run(); } @@ -294,19 +298,18 @@ public class GlobalBlockQueue { return false; } - public synchronized boolean tasks() { + private synchronized void runEmptyTasks() { if (this.runnables.isEmpty()) { - return false; + return; } - final ArrayList tmp = new ArrayList<>(this.runnables); + final ConcurrentLinkedDeque tmp = new ConcurrentLinkedDeque<>(this.runnables); this.runnables.clear(); for (final Runnable runnable : tmp) { runnable.run(); } - return true; } public enum QueueStage { - INACTIVE, ACTIVE, NONE; + INACTIVE, ACTIVE, NONE } } From 68a5166d2f2ad342436f4683afac04dc18f70888 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 11 Sep 2019 19:04:29 -0400 Subject: [PATCH 122/258] Fixes the major lag source from GlobalBlockQueue --- .../bukkit/listeners/ChunkListener.java | 90 +++++++------ .../bukkit/listeners/EntitySpawnListener.java | 3 +- .../bukkit/listeners/PlayerEvents.java | 5 +- .../bukkit/object/BukkitPlayer.java | 2 +- .../bukkit/util/BukkitChunkManager.java | 45 ++++--- .../bukkit/util/BukkitSetupUtils.java | 3 +- .../plotsquared/bukkit/util/SendChunk.java | 3 +- .../bukkit/util/block/BukkitLocalQueue.java | 57 ++++----- .../plot/commands/DebugClaimTest.java | 88 +++++++------ .../plot/generator/HybridUtils.java | 119 +++++++++--------- .../plotsquared/plot/object/ChunkLoc.java | 16 +++ .../plotsquared/plot/object/Plot.java | 2 +- .../plotsquared/plot/util/ChunkManager.java | 9 +- .../plot/util/block/BasicLocalBlockQueue.java | 3 +- 14 files changed, 231 insertions(+), 214 deletions(-) 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 c93767ea5..5634ff02f 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 @@ -9,6 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefCla import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefField; import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefMethod; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Material; @@ -168,23 +169,24 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils @EventHandler(priority = EventPriority.LOWEST) public void onItemSpawn(ItemSpawnEvent event) { Item entity = event.getEntity(); - Chunk chunk = entity.getLocation().getChunk(); - if (chunk == this.lastChunk) { - event.getEntity().remove(); - event.setCancelled(true); - return; - } - if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) { - return; - } - Entity[] entities = chunk.getEntities(); - if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) { - event.getEntity().remove(); - event.setCancelled(true); - this.lastChunk = chunk; - } else { - this.lastChunk = null; - } + PaperLib.getChunkAtAsync(event.getLocation()).thenAccept(chunk -> { + if (chunk == this.lastChunk) { + event.getEntity().remove(); + event.setCancelled(true); + return; + } + if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) { + return; + } + Entity[] entities = chunk.getEntities(); + if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) { + event.getEntity().remove(); + event.setCancelled(true); + this.lastChunk = chunk; + } else { + this.lastChunk = null; + } + }); } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @@ -197,23 +199,24 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils @EventHandler(priority = EventPriority.LOWEST) public void onEntitySpawn(CreatureSpawnEvent event) { LivingEntity entity = event.getEntity(); - Chunk chunk = entity.getLocation().getChunk(); - if (chunk == this.lastChunk) { - event.getEntity().remove(); - event.setCancelled(true); - return; - } - if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) { - return; - } - Entity[] entities = chunk.getEntities(); - if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) { - event.getEntity().remove(); - event.setCancelled(true); - this.lastChunk = chunk; - } else { - this.lastChunk = null; - } + PaperLib.getChunkAtAsync(event.getLocation()).thenAccept(chunk -> { + if (chunk == this.lastChunk) { + event.getEntity().remove(); + event.setCancelled(true); + return; + } + if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) { + return; + } + Entity[] entities = chunk.getEntities(); + if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) { + event.getEntity().remove(); + event.setCancelled(true); + this.lastChunk = chunk; + } else { + this.lastChunk = null; + } + }); } private void cleanChunk(final Chunk chunk) { @@ -223,8 +226,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (!chunk.isLoaded()) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared.debug(Captions.PREFIX.getTranslated() - + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug("Successfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -232,8 +234,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (tiles.length == 0) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared.debug(Captions.PREFIX.getTranslated() - + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug("Successfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -243,8 +244,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (i >= tiles.length) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared.debug(Captions.PREFIX.getTranslated() - + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug("Successfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -267,17 +267,11 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils ent.remove(); } } - PlotSquared.debug( - Captions.PREFIX.getTranslated() + "&a detected unsafe chunk and processed: " + ( - chunk.getX() - << 4) + "," + (chunk.getX() << 4)); + PlotSquared.debug("PlotSquared detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); } if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { - PlotSquared.debug( - Captions.PREFIX.getTranslated() + "&c detected unsafe chunk: " + (chunk.getX() - << 4) + "," - + (chunk.getX() << 4)); + PlotSquared.debug("PlotSquared detected unsafe chunk: " + (chunk.getX()<< 4) + "," + (chunk.getX() << 4)); cleanChunk(chunk); return true; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index 27a24ba9d..a982f39fd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -7,6 +7,7 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; 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 io.papermc.lib.PaperLib; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.ArmorStand; @@ -75,7 +76,7 @@ public class EntitySpawnListener implements Listener { if (!world.getName().equalsIgnoreCase(originWorld + "_the_end")) { try { ignoreTP = true; - entity.teleport(origin); + PaperLib.teleportAsync(entity,origin); } finally { ignoreTP = false; } 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 21c604dcc..f2e8f363a 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 @@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventTy import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.*; +import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.FluidCollisionMode; @@ -756,12 +757,12 @@ import java.util.regex.Pattern; if (passengers != null) { vehicle.eject(); vehicle.setVelocity(new Vector(0d, 0d, 0d)); - vehicle.teleport(dest); + PaperLib.teleportAsync(vehicle, dest); passengers.forEach(vehicle::addPassenger); } else { vehicle.eject(); vehicle.setVelocity(new Vector(0d, 0d, 0d)); - vehicle.teleport(dest); + PaperLib.teleportAsync(vehicle, dest); vehicle.addPassenger(player); } return; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 61862f899..918a5ab3b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -189,7 +189,7 @@ public class BukkitPlayer extends PlotPlayer { } final org.bukkit.Location bukkitLocation = new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch()); - PaperLib.teleportAsync(player, bukkitLocation); + PaperLib.teleportAsync(player, bukkitLocation, PlayerTeleportEvent.TeleportCause.PLUGIN); } @Override public String getName() { 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 5735d0b94..6771d1d3a 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 @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlock import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; +import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; @@ -26,6 +27,7 @@ import org.bukkit.entity.Player; import java.util.*; import java.util.Map.Entry; +import java.util.concurrent.CompletableFuture; public class BukkitChunkManager extends ChunkManager { @@ -152,19 +154,20 @@ public class BukkitChunkManager extends ChunkManager { if (doWhole) { for (Entity entity : entities) { org.bukkit.Location location = entity.getLocation(); - Chunk chunk = location.getChunk(); - if (chunks.contains(chunk)) { - int X = chunk.getX(); - int Z = chunk.getZ(); - if (X > bx && X < tx && Z > bz && Z < tz) { - count(count, entity); - } else { - Plot other = area.getPlot(BukkitUtil.getLocation(location)); - if (plot.equals(other)) { + PaperLib.getChunkAtAsync(location).thenAccept( chunk -> { + if (chunks.contains(chunk)) { + int X = chunk.getX(); + int Z = chunk.getZ(); + if (X > bx && X < tx && Z > bz && Z < tz) { count(count, entity); + } else { + Plot other = area.getPlot(BukkitUtil.getLocation(location)); + if (plot.equals(other)) { + count(count, entity); + } } } - } + }); } } else { for (Chunk chunk : chunks) { @@ -196,6 +199,8 @@ public class BukkitChunkManager extends ChunkManager { final World oldWorld = Bukkit.getWorld(pos1.getWorld()); final BukkitWorld oldBukkitWorld = new BukkitWorld(oldWorld); final World newWorld = Bukkit.getWorld(newPos.getWorld()); + assert newWorld != null; + assert oldWorld != null; final String newWorldName = newWorld.getName(); final ContentMap map = new ContentMap(); final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(newWorldName, false); @@ -208,13 +213,14 @@ public class BukkitChunkManager extends ChunkManager { ChunkLoc loc = new ChunkLoc(value[0], value[1]); int cxx = loc.x << 4; int czz = loc.z << 4; - Chunk chunk = oldWorld.getChunkAt(loc.x, loc.z); - map.saveEntitiesIn(chunk, region); - for (int x = bx & 15; x <= (tx & 15); x++) { - for (int z = bz & 15; z <= (tz & 15); z++) { - map.saveBlocks(oldBukkitWorld, 256, cxx + x, czz + z, relX, relZ); + PaperLib.getChunkAtAsync(oldWorld, loc.x, loc.z) + .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++) { + map.saveBlocks(oldBukkitWorld, 256, cxx + x, czz + z, relX, relZ); + } } - } + }); } }, () -> { for (Entry entry : map.allBlocks.entrySet()) { @@ -387,13 +393,12 @@ public class BukkitChunkManager extends ChunkManager { return true; } - @Override public boolean loadChunk(String world, ChunkLoc chunkLoc, boolean force) { - return BukkitUtil.getWorld(world).getChunkAt(chunkLoc.x, chunkLoc.z).load(force); + @Override public CompletableFuture loadChunk(String world, ChunkLoc chunkLoc, boolean force) { + return PaperLib.getChunkAtAsync(BukkitUtil.getWorld(world),chunkLoc.x, chunkLoc.z, force); } @Override - public void unloadChunk(final String world, final ChunkLoc chunkLoc, final boolean save, - final boolean safe) { + public void unloadChunk(final String world, final ChunkLoc chunkLoc, final boolean save) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) { TaskManager.runTask( () -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save)); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java index 958def626..59be5f5e7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -9,6 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.SetupObject; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; +import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; @@ -61,7 +62,7 @@ public class BukkitSetupUtils extends SetupUtils { } World dw = Bukkit.getWorlds().get(0); for (Player player : world.getPlayers()) { - player.teleport(dw.getSpawnLocation()); + PaperLib.teleportAsync(player,dw.getSpawnLocation()); } if (save) { for (Chunk chunk : world.getLoadedChunks()) { 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 cb525199c..09f8462bb 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 @@ -12,6 +12,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 io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; @@ -133,7 +134,7 @@ public class SendChunk { ArrayList chunks = new ArrayList<>(); for (ChunkLoc loc : chunkLocations) { if (myWorld.isChunkLoaded(loc.x, loc.z)) { - chunks.add(myWorld.getChunkAt(loc.x, loc.z)); + PaperLib.getChunkAtAsync(myWorld, loc.x, loc.z).thenAccept(chunks::add); } } sendChunk(chunks); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 5e26a26e3..e7d05eedc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -10,9 +10,9 @@ import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQ import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; +import io.papermc.lib.PaperLib; import lombok.NonNull; import org.bukkit.Bukkit; -import org.bukkit.Chunk; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Biome; @@ -75,44 +75,45 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { setBaseBlocks(lc); } - public void setBaseBlocks(LocalChunk lc) throws ExecutionException, InterruptedException { + public void setBaseBlocks(LocalChunk localChunk) { World worldObj = Bukkit.getWorld(getWorld()); if (worldObj == null) { throw new NullPointerException("World cannot be null."); } - //PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true).get(); - Chunk chunk = worldObj.getChunkAt(lc.getX(), lc.getZ()); - for (int layer = 0; layer < lc.baseblocks.length; layer++) { - BaseBlock[] blocksLayer = lc.baseblocks[layer]; - if (blocksLayer != null) { - for (int j = 0; j < blocksLayer.length; j++) { - if (blocksLayer[j] != null) { - BaseBlock block = blocksLayer[j]; - int x = MainUtil.x_loc[layer][j]; - int y = MainUtil.y_loc[layer][j]; - int z = MainUtil.z_loc[layer][j]; + PaperLib.getChunkAtAsync(worldObj, localChunk.getX(), localChunk.getZ(), true) + .thenAccept(chunk -> { + for (int layer = 0; layer < localChunk.baseblocks.length; layer++) { + BaseBlock[] blocksLayer = localChunk.baseblocks[layer]; + if (blocksLayer != null) { + for (int j = 0; j < blocksLayer.length; j++) { + if (blocksLayer[j] != null) { + BaseBlock block = blocksLayer[j]; + int x = MainUtil.x_loc[layer][j]; + int y = MainUtil.y_loc[layer][j]; + int z = MainUtil.z_loc[layer][j]; - BlockData blockData = BukkitAdapter.adapt(block); + BlockData blockData = BukkitAdapter.adapt(block); - Block existing = chunk.getBlock(x, y, z); - if (equals(PlotBlock.get(block), existing) && existing.getBlockData() - .matches(blockData)) { - continue; - } + Block existing = chunk.getBlock(x, y, z); + if (equals(PlotBlock.get(block), existing) && existing + .getBlockData().matches(blockData)) { + continue; + } - existing.setType(BukkitAdapter.adapt(block.getBlockType()), false); - existing.setBlockData(blockData, false); - if (block.hasNbtData()) { - CompoundTag tag = block.getNbtData(); - StateWrapper sw = new StateWrapper(tag); + existing.setType(BukkitAdapter.adapt(block.getBlockType()), false); + existing.setBlockData(blockData, false); + if (block.hasNbtData()) { + CompoundTag tag = block.getNbtData(); + StateWrapper sw = new StateWrapper(tag); - sw.restoreTag(worldObj.getName(), existing.getX(), existing.getY(), - existing.getZ()); + sw.restoreTag(worldObj.getName(), existing.getX(), + existing.getY(), existing.getZ()); + } + } } } } - } - } + }); } private void setMaterial(@NonNull final PlotBlock plotBlock, @NonNull final Block block) { 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 6dbcdfb57..de7d754a3 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 @@ -17,8 +17,7 @@ import java.util.UUID; @CommandDeclaration(command = "debugclaimtest", description = "If you accidentally delete your database, this command will attempt to restore all plots based on the data from plot signs. " - + "Execution time may vary", category = CommandCategory.DEBUG, - requiredType = RequiredType.CONSOLE, permission = "plots.debugclaimtest") + + "Execution time may vary", category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE, permission = "plots.debugclaimtest") public class DebugClaimTest extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { @@ -57,56 +56,53 @@ public class DebugClaimTest extends SubCommand { } Location location = manager.getSignLoc(plot); ChunkLoc chunk = new ChunkLoc(location.getX() >> 4, location.getZ() >> 4); - boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false); - if (!result) { - continue; - } - String[] lines = WorldUtil.IMP.getSign(location); - if (lines != null) { - String line = lines[2]; - if (line != null && line.length() > 2) { - line = line.substring(2); - BiMap map = UUIDHandler.getUuidMap(); - UUID uuid = map.get(new StringWrapper(line)); - if (uuid == null) { - for (Map.Entry stringWrapperUUIDEntry : map - .entrySet()) { - if (stringWrapperUUIDEntry.getKey().value.toLowerCase() - .startsWith(line.toLowerCase())) { - uuid = stringWrapperUUIDEntry.getValue(); - break; + ChunkManager.manager.loadChunk(area.worldname, chunk, false).thenRun(() -> { + String[] lines = WorldUtil.IMP.getSign(location); + if (lines != null) { + String line = lines[2]; + if (line != null && line.length() > 2) { + line = line.substring(2); + BiMap map = UUIDHandler.getUuidMap(); + UUID uuid = map.get(new StringWrapper(line)); + if (uuid == null) { + for (Map.Entry stringWrapperUUIDEntry : map + .entrySet()) { + if (stringWrapperUUIDEntry.getKey().value.toLowerCase() + .startsWith(line.toLowerCase())) { + uuid = stringWrapperUUIDEntry.getValue(); + break; + } } } - } - if (uuid == null) { - uuid = UUIDHandler.getUUID(line, null); - } - if (uuid != null) { - MainUtil - .sendMessage(player, " - &aFound plot: " + plot.getId() + " : " + line); - plot.setOwner(uuid); - plots.add(plot); - } else { - MainUtil.sendMessage(player, - " - &cInvalid PlayerName: " + plot.getId() + " : " + line); + if (uuid == null) { + uuid = UUIDHandler.getUUID(line, null); + } + if (uuid != null) { + MainUtil.sendMessage(player, + " - &aFound plot: " + plot.getId() + " : " + line); + plot.setOwner(uuid); + plots.add(plot); + } else { + MainUtil.sendMessage(player, + " - &cInvalid PlayerName: " + plot.getId() + " : " + line); + } } } - } - } - if (!plots.isEmpty()) { - MainUtil.sendMessage(player, - "&3Sign Block&8->&3Plot&8: &7Updating '" + plots.size() + "' plots!"); - DBFunc.createPlotsAndData(plots, new Runnable() { - @Override public void run() { - MainUtil.sendMessage(player, "&6Database update finished!"); + }).thenRun(() -> { + if (!plots.isEmpty()) { + MainUtil.sendMessage(player, + "&3Sign Block&8->&3Plot&8: &7Updating '" + plots.size() + "' plots!"); + DBFunc.createPlotsAndData(plots, + () -> MainUtil.sendMessage(player, "&6Database update finished!")); + for (Plot plot1 : plots) { + plot.create(); + } + MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: &7Complete!"); + } else { + MainUtil.sendMessage(player, "No plots were found for the given search."); } }); - for (Plot plot : plots) { - plot.create(); - } - MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: &7Complete!"); - } else { - MainUtil.sendMessage(player, "No plots were found for the given search."); + return true; } return true; } 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 3a5c29988..f7dc4d619 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 @@ -1,7 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.generator; 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.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; @@ -20,6 +19,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import java.io.File; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; public abstract class HybridUtils { @@ -144,8 +144,9 @@ public abstract class HybridUtils { return scheduleRoadUpdate(plot.getArea(), regions, extend); } - public boolean scheduleRoadUpdate(final PlotArea area, Set rgs, final int extend) { - HybridUtils.regions = rgs; + public boolean scheduleRoadUpdate(final PlotArea area, Set regions, + final int extend) { + HybridUtils.regions = regions; HybridUtils.area = area; chunks = new HashSet<>(); final AtomicInteger count = new AtomicInteger(0); @@ -156,35 +157,39 @@ public abstract class HybridUtils { while (iter.hasNext()) { ChunkLoc chunk = iter.next(); iter.remove(); - regenerateRoad(area, chunk, extend); - ChunkManager.manager.unloadChunk(area.worldname, chunk, true, true); + boolean regenedRoad = regenerateRoad(area, chunk, extend); + if (!regenedRoad) { + PlotSquared.debug("Failed to regenerate roads."); + } + ChunkManager.manager.unloadChunk(area.worldname, chunk, true); } - PlotSquared.debug("&cCancelled road task"); + PlotSquared.debug("Cancelled road task"); return; } count.incrementAndGet(); if (count.intValue() % 20 == 0) { PlotSquared.debug("PROGRESS: " + 100 * (2048 - chunks.size()) / 2048 + "%"); } - if (regions.isEmpty() && chunks.isEmpty()) { - PlotSquared.debug("&3Regenerating plot walls"); + if (HybridUtils.regions.isEmpty() && chunks.isEmpty()) { + PlotSquared.debug("Regenerating plot walls"); regeneratePlotWalls(area); HybridUtils.UPDATE = false; - PlotSquared.debug(Captions.PREFIX.getTranslated() + "Finished road conversion"); + PlotSquared.debug("Finished road conversion"); // CANCEL TASK } else { final Runnable task = this; TaskManager.runTaskAsync(() -> { try { if (chunks.size() < 1024) { - if (!regions.isEmpty()) { - Iterator iterator = regions.iterator(); + if (!HybridUtils.regions.isEmpty()) { + Iterator iterator = HybridUtils.regions.iterator(); ChunkLoc loc = iterator.next(); iterator.remove(); - PlotSquared.debug("&3Updating .mcr: " + loc.x + ", " + loc.z + PlotSquared.debug("Updating .mcr: " + loc.x + ", " + loc.z + " (approx 1024 chunks)"); - PlotSquared.debug(" - Remaining: " + regions.size()); + PlotSquared + .debug(" - Remaining: " + HybridUtils.regions.size()); chunks.addAll(getChunks(loc)); System.gc(); } @@ -198,30 +203,33 @@ public abstract class HybridUtils { .isEmpty()) { final ChunkLoc chunk = iterator.next(); iterator.remove(); - regenerateRoad(area, chunk, extend); + boolean regenedRoads = + regenerateRoad(area, chunk, extend); + if (!regenedRoads) { + PlotSquared.debug("Failed to regenerate road."); + } } } }); } } catch (Exception e) { e.printStackTrace(); - Iterator iterator = regions.iterator(); + Iterator iterator = HybridUtils.regions.iterator(); ChunkLoc loc = iterator.next(); iterator.remove(); PlotSquared.debug( - "&c[ERROR]&7 Could not update '" + area.worldname + "/region/r." - + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)"); + "[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; 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, - true); + .unloadChunk(area.worldname, new ChunkLoc(x, z), true); } } - PlotSquared.debug("&d - Potentially skipping 1024 chunks"); - PlotSquared.debug("&d - TODO: recommend chunkster if corrupt"); + PlotSquared.debug(" - Potentially skipping 1024 chunks"); + PlotSquared.debug(" - TODO: recommend chunkster if corrupt"); } GlobalBlockQueue.IMP.addEmptyTask(() -> TaskManager.runTaskLater(task, 20)); }); @@ -304,42 +312,43 @@ public abstract class HybridUtils { if (!plotWorld.ROAD_SCHEMATIC_ENABLED) { return false; } - boolean toCheck = false; + AtomicBoolean toCheck = new AtomicBoolean(false); if (plotWorld.TYPE == 2) { - boolean c1 = area.contains(x, z); - boolean c2 = area.contains(ex, ez); - if (!c1 && !c2) { + boolean chunk1 = area.contains(x, z); + boolean chunk2 = area.contains(ex, ez); + if (!chunk1 && !chunk2) { return false; } else { - toCheck = c1 ^ c2; + toCheck.set(chunk1 ^ chunk2); } } PlotManager manager = area.getPlotManager(); PlotId id1 = manager.getPlotId(x, 0, z); PlotId id2 = manager.getPlotId(ex, 0, ez); - x -= plotWorld.ROAD_OFFSET_X; + x = x - plotWorld.ROAD_OFFSET_X; z -= plotWorld.ROAD_OFFSET_Z; + final int finalX = x; + final int finalZ = z; LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(plotWorld.worldname, false); if (id1 == null || id2 == null || id1 != id2) { - boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false); - if (result) { + ChunkManager.manager.loadChunk(area.worldname, chunk, false).thenRun(() -> { if (id1 != null) { Plot p1 = area.getPlotAbs(id1); if (p1 != null && p1.hasOwner() && p1.isMerged()) { - toCheck = true; + toCheck.set(true); } } - if (id2 != null && !toCheck) { + if (id2 != null && !toCheck.get()) { Plot p2 = area.getPlotAbs(id2); if (p2 != null && p2.hasOwner() && p2.isMerged()) { - toCheck = true; + toCheck.set(true); } } int size = plotWorld.SIZE; for (int X = 0; X < 16; X++) { - short absX = (short) ((x + X) % size); + short absX = (short) ((finalX + X) % size); for (int Z = 0; Z < 16; Z++) { - short absZ = (short) ((z + Z) % size); + short absZ = (short) ((finalZ + Z) % size); if (absX < 0) { absX += size; } @@ -347,11 +356,9 @@ public abstract class HybridUtils { absZ += size; } boolean condition; - if (toCheck) { - condition = manager - .getPlotId(x + X + plotWorld.ROAD_OFFSET_X, 1, - z + Z + plotWorld.ROAD_OFFSET_Z) == null; - // condition = MainUtil.isPlotRoad(new Location(plotworld.worldname, x + X, 1, z + Z)); + if (toCheck.get()) { + condition = manager.getPlotId(finalX + X + plotWorld.ROAD_OFFSET_X, 1, + finalZ + Z + plotWorld.ROAD_OFFSET_Z) == null; } else { boolean gx = absX > plotWorld.PATH_WIDTH_LOWER; boolean gz = absZ > plotWorld.PATH_WIDTH_LOWER; @@ -362,26 +369,22 @@ public abstract class HybridUtils { if (condition) { BaseBlock[] blocks = plotWorld.G_SCH.get(MathMan.pair(absX, absZ)); int minY = plotWorld.SCHEM_Y; - if (!Settings.Schematics.PASTE_ON_TOP) + if (!Settings.Schematics.PASTE_ON_TOP) { minY = 1; + } int maxY = Math.max(extend, blocks.length); - if (blocks != null) { - for (int y = 0; y < maxY; y++) { - if (y > blocks.length - 1) { - queue.setBlock(x + X + plotWorld.ROAD_OFFSET_X, minY + y, - z + Z + plotWorld.ROAD_OFFSET_Z, WEExtent.AIRBASE); + for (int y = 0; y < maxY; y++) { + if (y > blocks.length - 1) { + queue.setBlock(finalX + X + plotWorld.ROAD_OFFSET_X, minY + y, + finalZ + Z + plotWorld.ROAD_OFFSET_Z, WEExtent.AIRBASE); + } else { + BaseBlock block = blocks[y]; + if (block != null) { + queue.setBlock(finalX + X + plotWorld.ROAD_OFFSET_X, minY + y, + finalZ + Z + plotWorld.ROAD_OFFSET_Z, block); } else { - BaseBlock block = blocks[y]; - if (block != null) { - queue - .setBlock(x + X + plotWorld.ROAD_OFFSET_X, minY + y, - z + Z + plotWorld.ROAD_OFFSET_Z, block); - } else { - queue - .setBlock(x + X + plotWorld.ROAD_OFFSET_X, minY + y, - z + Z + plotWorld.ROAD_OFFSET_Z, - WEExtent.AIRBASE); - } + queue.setBlock(finalX + X + plotWorld.ROAD_OFFSET_X, minY + y, + finalZ + Z + plotWorld.ROAD_OFFSET_Z, WEExtent.AIRBASE); } } } @@ -389,8 +392,8 @@ public abstract class HybridUtils { } } queue.enqueue(); - return true; - } + }); + return true; } return false; } 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 index 2035a8811..29bd3857f 100644 --- 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 @@ -10,6 +10,22 @@ public class ChunkLoc { 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); } 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 852a1647b..cafcae466 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 @@ -924,7 +924,7 @@ public class Plot { ChunkManager.manager.loadChunk(getWorldName(), loc, false); MainUtil.setBiome(getWorldName(), value[2], value[3], value[4], value[5], biome); - ChunkManager.manager.unloadChunk(getWorldName(), loc, true, true); + ChunkManager.manager.unloadChunk(getWorldName(), loc, true); } }, this, 5); 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 a960bc6db..55a99c9b9 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 @@ -16,6 +16,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; public abstract class ChunkManager { @@ -109,9 +110,7 @@ public abstract class ChunkManager { TaskManager.objectTask(chunks, new RunnableVal() { @Override public void run(ChunkLoc value) { - if (manager.loadChunk(world, value, false)) { - task.run(value); - } + manager.loadChunk(world, value, false).thenRun(()-> task.run(value)); } }, whenDone); }); @@ -212,9 +211,9 @@ public abstract class ChunkManager { */ public abstract int[] countEntities(Plot plot); - public abstract boolean loadChunk(String world, ChunkLoc loc, boolean force); + public abstract CompletableFuture loadChunk(String world, ChunkLoc loc, boolean force); - public abstract void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe); + public abstract void unloadChunk(String world, ChunkLoc loc, boolean save); public Set getChunkChunks(String world) { File folder = diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 7f44d2931..ad20a5b99 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -50,8 +50,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { LocalChunk chunk = chunks.poll(); if (chunk != null) { blockChunks.remove(chunk.longHash()); - this.execute(chunk); - return true; + return this.execute(chunk); } } } catch (Throwable e) { From 6e387f33217ee5511099b4cd67d9883271f5ba6d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 12 Sep 2019 03:44:31 +0200 Subject: [PATCH 123/258] Do not remove the schematic file extension --- .../plotsquared/plot/util/SchematicHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9742ffb98..326d151e6 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 @@ -291,7 +291,7 @@ public abstract class SchematicHandler { parent.list((dir, name) -> name.endsWith(".schematic") || name.endsWith(".schem")); if (rawNames != null) { final List transformed = Arrays.stream(rawNames) - .map(rawName -> rawName.substring(0, rawName.length() - 10)) + //.map(rawName -> rawName.substring(0, rawName.length() - 10)) .collect(Collectors.toList()); names.addAll(transformed); } From d20d95d29b3c203ece4ec27a00245e055234c970 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 12 Sep 2019 03:53:29 +0200 Subject: [PATCH 124/258] Remove schematic test command --- .../plot/commands/SchematicCmd.java | 34 +------------------ .../plotsquared/plot/config/Captions.java | 2 +- Core/src/main/resources/de-DE.yml | 3 +- Core/src/main/resources/es-ES.yml | 2 +- Core/src/main/resources/ko-KR.yml | 3 +- 5 files changed, 5 insertions(+), 39 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index e645b8781..130f2ad1d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -25,7 +25,7 @@ import java.util.UUID; @CommandDeclaration(command = "schematic", permission = "plots.schematic", description = "Schematic command", aliases = {"sch", "schem"}, - category = CommandCategory.SCHEMATIC, usage = "/plot schematic ") + category = CommandCategory.SCHEMATIC, usage = "/plot schematic ") public class SchematicCmd extends SubCommand { private boolean running = false; @@ -109,38 +109,6 @@ public class SchematicCmd extends SubCommand { }); break; } - // TODO test - // case "test": { - // if (!Permissions.hasPermission(plr, "plots.schematic.test")) { - // MainUtil.sendMessage(plr, Captions.NO_PERMISSION, "plots.schematic.test"); - // return false; - // } - // if (args.length < 2) { - // sendMessage(plr, Captions.SCHEMATIC_MISSING_ARG); - // return false; - // } - // final Location loc = plr.getLocation(); - // final Plot plot = MainUtil.getPlot(loc); - // if (plot == null) { - // sendMessage(plr, Captions.NOT_IN_PLOT); - // return false; - // } - // file = args[1]; - // schematic = SchematicHandler.manager.getSchematic(file); - // if (schematic == null) { - // sendMessage(plr, Captions.SCHEMATIC_INVALID, "non-existent"); - // return false; - // } - // final int l1 = schematic.getSchematicDimension().getX(); - // final int l2 = schematic.getSchematicDimension().getZ(); - // final int length = MainUtil.getPlotWidth(loc.getWorld(), plot.id); - // if ((l1 < length) || (l2 < length)) { - // sendMessage(plr, Captions.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length)); - // break; - // } - // sendMessage(plr, Captions.SCHEMATIC_VALID); - // break; - // } case "saveall": case "exportall": { if (!(player instanceof ConsolePlayer)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 9928f643a..3519a2249 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -321,7 +321,7 @@ public enum Captions { // SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"), - SCHEMATIC_MISSING_ARG("$2You need to specify an argument. Possible values: $1test $2 , $1save$2 , $1paste $2, $1exportall$2, $1list", "Schematics"), + SCHEMATIC_MISSING_ARG("$2You need to specify an argument. Possible values: $1save$2, $1paste $2, $1exportall$2, $1list", "Schematics"), SCHEMATIC_INVALID("$2That is not a valid schematic. Reason: $2%s", "Schematics"), SCHEMATIC_VALID("$2That is a valid schematic", "Schematics"), diff --git a/Core/src/main/resources/de-DE.yml b/Core/src/main/resources/de-DE.yml index 8a52ce9a6..db18eda66 100644 --- a/Core/src/main/resources/de-DE.yml +++ b/Core/src/main/resources/de-DE.yml @@ -130,8 +130,7 @@ setup: setup backn$2 - $1/plot setup cancel setup_invalid_generator: '$2Ungültiger Generarator. Mögliche Optionen: %s' schematics: - schematic_missing_arg: '$2Du musst einen Wert angeben. Gültige Werte: $1test $2 - , $1save$2 , $1paste $2, $1exportall' + schematic_missing_arg: '$2Du musst einen Wert angeben. Gültige Werte: $1save$2, $1paste $2, $1exportall' schematic_invalid: '$2Diese Schematic ist ungültig: $2%s' schematic_valid: $2Diese Schematic ist gültig. schematic_paste_failed: $2Einfügen der Schematic fehlgeschlagen. diff --git a/Core/src/main/resources/es-ES.yml b/Core/src/main/resources/es-ES.yml index f4459649d..5ce8ced99 100644 --- a/Core/src/main/resources/es-ES.yml +++ b/Core/src/main/resources/es-ES.yml @@ -145,7 +145,7 @@ setup: setup_invalid_generator: '$2Generador inválido. Opciones posibles: %s' schematics: schematic_missing_arg: '$2Necesitas especificar un argumento. Valores posibles: - $1test $2 , $1save$2 , $1paste $2, $1exportall' + $1save$2, $1paste $2, $1exportall' schematic_invalid: '$2Este no es un schematic valido. Razon: $2%s' schematic_valid: $2Este es un schematic valido. schematic_paste_failed: $2Fallo al pegar el schematic. diff --git a/Core/src/main/resources/ko-KR.yml b/Core/src/main/resources/ko-KR.yml index 07d6caca5..62548ead4 100644 --- a/Core/src/main/resources/ko-KR.yml +++ b/Core/src/main/resources/ko-KR.yml @@ -151,8 +151,7 @@ setup: cancel setup_invalid_generator: '$2올바르지 않은 생성기 입니다. 가능한 옵션: %s' schematics: - schematic_missing_arg: '$2당신은 인수를 지정해야 합니다. 가능한 값: $1test $2 , $1save$2 , - $1paste $2, $1exportall' + schematic_missing_arg: '$2당신은 인수를 지정해야 합니다. 가능한 값: $1save$2, $1paste $2, $1exportall' schematic_invalid: '$2이것은 올바르지 않은 schematic파일 입니다. 사유: $2%s' schematic_valid: $2이것은 올바른 schematic파일 입니다 schematic_paste_failed: $2schematic 적용에 실패하엿습니다 From 05ef076ef092965290065e399d39ca2a7f726691 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 12 Sep 2019 04:01:47 +0200 Subject: [PATCH 125/258] Remove unnecessary spaces --- .../plotsquared/plot/config/Captions.java | 22 ++++++++----------- Core/src/main/resources/fr-FR.yml | 2 +- Core/src/main/resources/it-IT.yml | 2 +- Core/src/main/resources/zh-CN.yml | 3 +-- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 3519a2249..35538a637 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -59,8 +59,8 @@ public enum Captions { PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"), PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"), - PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), PERMISSION_MERGE_KEEP_ROAD( - "plots.merge.keeproad", "static.permissions"), + PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), + PERMISSION_MERGE_KEEP_ROAD("plots.merge.keeproad", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"), PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"), PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"), @@ -70,8 +70,8 @@ public enum Captions { PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"), PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"), PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"), - PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT( - "plots.admin.build.heightlimit", "static.permissions"), + PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), + PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT("plots.admin.build.heightlimit", "static.permissions"), PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"), PERMISSION_ADMIN_COMMAND_RATE("plots.admin.command.rate", "static.permissions"), PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"), @@ -124,8 +124,8 @@ public enum Captions { PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"), PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"), PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"), - PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), PERMISSION_LIST_FOR_SALE( - "plots.list.forsale", "static.permissions"), + PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), + PERMISSION_LIST_FOR_SALE("plots.list.forsale", "static.permissions"), PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"), PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"), PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"), @@ -140,8 +140,8 @@ public enum Captions { PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"), PERMISSION_LIST_AREA("plots.list.area", "static.permissions"), PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"), - PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), PERMISSION_ADMIN_COMMAND_SET_OWNER( - "plots.admin.command.setowner", "static.permissions"), + PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), + PERMISSION_ADMIN_COMMAND_SET_OWNER("plots.admin.command.setowner", "static.permissions"), PERMISSION_COMMENT("plots.comment", "static.permissions"), PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"), PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"), @@ -308,7 +308,6 @@ public enum Captions { "$4You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or " + "your chosen world management plugin.", "Setup"), SETUP_WORLD_TAKEN("$2%s is already a world", "Setup"), - SETUP_MISSING_WORLD( "$2You need to specify a world name ($1/plot setup &l$1 $2)&-$1Additional commands:&-$2 - $1/plot setup &-$2 -" + " $1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), @@ -319,10 +318,8 @@ public enum Captions { SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"), // // - SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", - "Schematics"), + SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"), SCHEMATIC_MISSING_ARG("$2You need to specify an argument. Possible values: $1save$2, $1paste $2, $1exportall$2, $1list", "Schematics"), - SCHEMATIC_INVALID("$2That is not a valid schematic. Reason: $2%s", "Schematics"), SCHEMATIC_VALID("$2That is a valid schematic", "Schematics"), SCHEMATIC_PASTE_FAILED("$2Failed to paste the schematic", "Schematics"), @@ -583,7 +580,6 @@ public enum Captions { COMMAND_CATEGORY_DEBUG("Debug", "Category"), COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), - // GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), GRANTED_PLOT("$1You granted %s0 plot to $2%s1", "Grants"), diff --git a/Core/src/main/resources/fr-FR.yml b/Core/src/main/resources/fr-FR.yml index 4867aff98..3d71ea897 100644 --- a/Core/src/main/resources/fr-FR.yml +++ b/Core/src/main/resources/fr-FR.yml @@ -148,7 +148,7 @@ setup: setup_invalid_generator: '$2Générateur invalide. Options possibles: %s' schematics: schematic_too_large: $2Ce plot est trop grand pour cette action! - schematic_missing_arg: '$2Vous devez spécifier un argument. Valeurs possibles: $1test $2 , $1save$2 , $1paste $2, $1exportall' + schematic_missing_arg: '$2Vous devez spécifier un argument. Valeurs possibles: $1save$2, $1paste $2, $1exportall' schematic_invalid: '$2Ce n''est pas un schématic valide. Raison: $2%s' schematic_valid: '$2C''est un schématic valide' schematic_paste_failed: $2Impossible de coller le schématic diff --git a/Core/src/main/resources/it-IT.yml b/Core/src/main/resources/it-IT.yml index 6419a2234..d43771148 100644 --- a/Core/src/main/resources/it-IT.yml +++ b/Core/src/main/resources/it-IT.yml @@ -148,7 +148,7 @@ setup: setup_invalid_generator: '$2Generatore non valido. Opzioni possibili: %s' schematics: schematic_too_large: $2Il lotto è troppo grande per questa azione! - schematic_missing_arg: '$2Devi specificare un argomento. Valori possibili: $1test $2 , $1save$2 , $1paste $2, $1exportall' + schematic_missing_arg: '$2Devi specificare un argomento. Valori possibili: $1save$2, $1paste $2, $1exportall' schematic_invalid: '$2Quella non è una schematica valida. Motivo: $2%s' schematic_valid: $2Quella è una schematica valida schematic_paste_failed: $2L'incollaggio della schematica è fallito diff --git a/Core/src/main/resources/zh-CN.yml b/Core/src/main/resources/zh-CN.yml index 4afc3564a..b22959f1a 100644 --- a/Core/src/main/resources/zh-CN.yml +++ b/Core/src/main/resources/zh-CN.yml @@ -160,8 +160,7 @@ setup: setup_invalid_generator: '$2无效的生成器。可能选项:%s' schematics: schematic_too_large: $2此地皮过大无法进行此操作! - schematic_missing_arg: '$2阁下需要指定参数。可能的值:$1test - <名称>$2 , $1save$2 , $1paste $2, $1exportall' + schematic_missing_arg: '$2阁下需要指定参数。可能的值:$1save$2, $1paste $2, $1exportall' schematic_invalid: '$2布局无效。理由:$2%s' schematic_valid: $2布局无效 schematic_paste_failed: $2粘贴布局失败 From ae1273a7f327c00fe2e3e92809e53e16feb01eb4 Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Sat, 14 Sep 2019 12:58:22 +0200 Subject: [PATCH 126/258] Bugfixes for deny-teleport --- .../bukkit/listeners/PlayerEvents.java | 57 +++++++++---------- .../plot/flag/TeleportDenyFlag.java | 6 +- 2 files changed, 30 insertions(+), 33 deletions(-) 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 f2e8f363a..421be5e1b 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 @@ -679,37 +679,34 @@ import java.util.regex.Pattern; @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onTeleport(PlayerTeleportEvent event) { - if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld() - .equals(event.getTo().getWorld())) { - final Object lastLoc = - BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION); - final Object lastPlot = - BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT); - org.bukkit.Location to = event.getTo(); - if (to != null) { - Player player = event.getPlayer(); - PlotPlayer plotPlayer = PlotPlayer.wrap(player); - Location location = BukkitUtil.getLocation(to); - PlotArea area = location.getPlotArea(); - if (area == null) { - return; - } - Plot plot = area.getPlot(location); - if (plot != null) { - final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); - if (!result) { - MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, - Captions.PERMISSION_ADMIN_ENTRY_DENIED); - event.setCancelled(true); - if (lastLoc != null) { - plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc); - } - if (lastPlot != null) { - plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); - } - } else { - plotEntry(plotPlayer, plot); + final Object lastLoc = + BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION); + final Object lastPlot = + BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT); + org.bukkit.Location to = event.getTo(); + if (to != null) { + Player player = event.getPlayer(); + PlotPlayer plotPlayer = PlotPlayer.wrap(player); + Location location = BukkitUtil.getLocation(to); + PlotArea area = location.getPlotArea(); + if (area == null) { + return; + } + Plot plot = area.getPlot(location); + if (plot != null) { + final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); + if (!result) { + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_ENTRY_DENIED); + event.setCancelled(true); + if (lastLoc != null) { + plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc); } + if (lastPlot != null) { + plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); + } + } else { + plotEntry(plotPlayer, plot); } } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java index b24f14faf..90f6c292c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java @@ -22,14 +22,14 @@ public class TeleportDenyFlag extends EnumFlag { result = !plot.getMembers().contains(player.getUUID()); break; case "nonmembers": - result = !plot.isAdded(player.getUUID()); + result = plot.isAdded(player.getUUID()); break; case "nontrusted": - result = !plot.getTrusted().contains(player.getUUID()) && !plot + result = plot.getTrusted().contains(player.getUUID()) || plot .isOwner(player.getUUID()); break; case "nonowners": - result = !plot.isOwner(player.getUUID()); + result = plot.isOwner(player.getUUID()); break; default: return true; From becac84e6e86bea718035cb5d24b60ac098945d6 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 18 Sep 2019 02:06:28 +0200 Subject: [PATCH 127/258] Setup Actions test --- .github/workflows/gradle.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 000000000..22c3d6c65 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,24 @@ +name: Java CI + +on: + push: + branches: + - breaking + - master + pull_request: + branches: + - breaking + - master + +jobs: + test: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Test with Gradle + run: ./gradlew clean build From 58dbe96bd889c5d473f19f277e23247f296f8495 Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Thu, 19 Sep 2019 10:40:47 +0200 Subject: [PATCH 128/258] Added a plot flag 'untrusted visit', that allows /plot visit for untrusted players without the permission plot.visit.other. --- .../intellectualsites/plotsquared/plot/commands/Visit.java | 4 +++- .../github/intellectualsites/plotsquared/plot/flag/Flags.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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 ea5647b66..5c38ea63f 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 @@ -5,6 +5,7 @@ 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.config.Settings; +import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -129,7 +130,8 @@ import java.util.concurrent.CompletableFuture; return CompletableFuture.completedFuture(false); } } else { - if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OTHER)) { + if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OTHER) && + !Flags.UNTRUSTED_VISIT.isTrue(plot)) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OTHER); return CompletableFuture.completedFuture(false); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index fc203a00b..d3f98041c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -121,6 +121,7 @@ public final class Flags { public static final BooleanFlag SLEEP = new BooleanFlag("sleep"); public static final TeleportDenyFlag DENY_TELEPORT = new TeleportDenyFlag("deny-teleport"); public static final BooleanFlag DENY_EXIT = new BooleanFlag("deny-exit"); + public static final BooleanFlag UNTRUSTED_VISIT = new BooleanFlag("untrusted-visit"); private static final HashMap> flags; From 267bebd0e8e9c4e9508510ebdcbf7a6d43db1af7 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 1 Oct 2019 12:12:42 +0200 Subject: [PATCH 129/258] Improve world generator diagnosis --- .../plotsquared/plot/commands/DebugPaste.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index e9471e6e7..c3858265f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -115,6 +115,15 @@ import java.util.stream.Collectors; "&cSkipping PlotSquared.use_THIS.yml because it's empty"); } + try { + final File MultiverseWorlds = + new File(PlotSquared.get().IMP.getDirectory(), "../../plugins/Multiverse-Core/worlds.yml"); + incendoPaster + .addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml", readFile(MultiverseWorlds))); + } catch (final IOException ignored) { + MainUtil.sendMessage(player, "&cSkipping Multiverse worlds.yml because the plugin is not in use"); + } + try { final String rawResponse = incendoPaster.upload(); final JsonObject jsonObject = From b074e6e198b53676b457997ccde94ac2fe4663a2 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 1 Oct 2019 12:54:20 +0200 Subject: [PATCH 130/258] Update auto-comment.yml I created templates and setup Actions to ensure functionality. --- .github/auto-comment.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/auto-comment.yml b/.github/auto-comment.yml index f7584d42e..38721ffb9 100644 --- a/.github/auto-comment.yml +++ b/.github/auto-comment.yml @@ -6,10 +6,3 @@ issueOpened: > Failure to do so will prevent us from resolving the issue in a timely manner. Please note that suggestions are now to be submitted to https://git.io/fN5B4 rather than this issue tracker! - -pullRequestOpened: > - Thank your for raising your pull request. - - Please make sure you have followed our contributing guidelines and to take an extra look at the code to make sure that it is functional! - - We will review it as soon as possible! From ca25b7b3c80d4e00c7626ba06f967bddd3b4cae1 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 1 Oct 2019 13:02:32 +0200 Subject: [PATCH 131/258] Fix odd space --- .../github/intellectualsites/plotsquared/bukkit/BukkitMain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9596a25e9..272d09056 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 @@ -702,7 +702,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + "Bukkit"); } else { - PlotSquared.log(Captions.PREFIX + " " + getPluginName() + " is using online UUIDs"); + PlotSquared.log(Captions.PREFIX + "" + getPluginName() + " is using online UUIDs"); } if (Settings.UUID.USE_SQLUUIDHANDLER) { return new SQLUUIDHandler(wrapper); From 59bc6f19e5a5a8ddeb422ef653075c32082512ee Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 1 Oct 2019 14:01:50 +0200 Subject: [PATCH 132/258] General clarification of the config Certain values were rather vague and caused some confusion in the past, hopefully things are more clear now. --- .../plotsquared/plot/config/Settings.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index c03a0b82c..6cb5eb287 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -256,10 +256,10 @@ public class Settings extends Config { public static final class Done { - @Comment("Require a done plot to download") public static boolean REQUIRED_FOR_DOWNLOAD = + @Comment("Require a plot marked as done to download") public static boolean REQUIRED_FOR_DOWNLOAD = false; - @Comment("Only done plots can be rated") public static boolean REQUIRED_FOR_RATINGS = false; - @Comment("Restrict building when a plot is done") public static boolean RESTRICT_BUILDING = + @Comment("Only plots marked as done can be rated") public static boolean REQUIRED_FOR_RATINGS = false; + @Comment("Restrict building when a plot is marked as done") public static boolean RESTRICT_BUILDING = false; @Comment("The limit being how many plots a player can claim") public static boolean COUNTS_TOWARDS_LIMIT = true; @@ -269,14 +269,15 @@ public class Settings extends Config { public static final class Chat { @Comment("Sometimes console color doesn't work, you can disable it here") public static boolean CONSOLE_COLOR = true; - @Comment("Should chat be interactive") public static boolean INTERACTIVE = true; + @Comment("Should the chat be interactive?") public static boolean INTERACTIVE = true; } @Comment("Relating to how many plots someone can claim ") public static final class Limit { @Comment("Should the limit be global (over multiple worlds)") public static boolean GLOBAL = false; - @Comment("The range of permissions to check e.g. plots.plot.127") public static int + @Comment({"The max. range of permissions to check e.g. plots.plot.127", "The value covers the range to check only, you need to assign the permission to players/groups still", + "Modifying the value does NOT change the amount of plots players can claim"}) public static int MAX_PLOTS = 127; } @@ -291,7 +292,7 @@ public class Settings extends Config { @Comment("Teleport to your plot on death") public static boolean ON_DEATH = false; @Comment("Teleport to your plot on login") public static boolean ON_LOGIN = false; @Comment("Teleport to your plot on claim") public static boolean ON_CLAIM = true; - @Comment("Add a teleportation delay to all commands") public static int DELAY = 0; + @Comment("Add a delay to all teleport commands") public static int DELAY = 0; @Comment("The visit command is ordered by world instead of globally") public static boolean PER_WORLD_VISIT = false; } @@ -322,7 +323,7 @@ public class Settings extends Config { @Comment( - {"Enable or disable part of the plugin", "Note: A cache will use some memory if enabled"}) + {"Enable or disable parts of the plugin", "Note: A cache will use some memory if enabled"}) public static final class Enabled_Components { // Group the following values into a new config section @Comment("The database stores all the plots") public static boolean DATABASE = true; @Comment("Events are needed to track a lot of things") public static boolean EVENTS = true; @@ -339,7 +340,7 @@ public class Settings extends Config { @Comment("Allow WorldEdit to be restricted to plots") public static boolean WORLDEDIT_RESTRICTIONS = true; @Comment("Allow economy to be used") public static boolean ECONOMY = true; - @Comment("Send anonymous usage statistics. Bukkit only setting.") public static boolean + @Comment("Send anonymous usage statistics to bStats. Bukkit only setting.") public static boolean METRICS = true; @Comment("Expiry will clear old or simplistic plots") public static boolean PLOT_EXPIRY = false; @@ -355,7 +356,7 @@ public class Settings extends Config { @Comment("Actively purge invalid database entries") public static boolean DATABASE_PURGER = false; @Comment("Delete plots when a player is banned") public static boolean BAN_DELETER = false; - @Comment("Prevent possibly unsafe blocks from being used in plot components") + @Comment({"Prevent possibly unsafe blocks from being used in plot components", "Can be bypassed with `/plot debugallowunsafe`"}) public static boolean PREVENT_UNSAFE = true; } } From b92d42e7cc2a55194cae691fbf0a3aaf24223487 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 1 Oct 2019 14:46:19 +0200 Subject: [PATCH 133/258] Add clarification to what files are pasted --- .../intellectualsites/plotsquared/plot/commands/DebugPaste.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index c3858265f..e57ecf211 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -24,7 +24,7 @@ import java.util.List; import java.util.stream.Collectors; @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", - description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml and your latest.log to https://athion.net/ISPaster/paste", + description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste", permission = "plots.debugpaste", category = CommandCategory.DEBUG) public class DebugPaste extends SubCommand { From c8c5d777a1aeff01ca8bd20ad3635fab0d3147ff Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 3 Oct 2019 00:40:41 +0200 Subject: [PATCH 134/258] Make paths... idk what to say here --- .../intellectualsites/plotsquared/plot/commands/DebugPaste.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index e57ecf211..747d17161 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -117,7 +117,7 @@ import java.util.stream.Collectors; try { final File MultiverseWorlds = - new File(PlotSquared.get().IMP.getDirectory(), "../../plugins/Multiverse-Core/worlds.yml"); + new File(PlotSquared.get().IMP.getDirectory(), "../Multiverse-Core/worlds.yml"); incendoPaster .addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml", readFile(MultiverseWorlds))); } catch (final IOException ignored) { From 120d36e41381e4bb17eeb03eb1bab166e3abedf6 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 3 Oct 2019 01:12:08 +0200 Subject: [PATCH 135/258] Add a confirmation to the debugpaste That should prevent people from accidentally pressing buttons (whyever you would do that) --- .../plotsquared/plot/commands/DebugPaste.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 747d17161..9ea6d7bdd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -25,8 +25,8 @@ import java.util.stream.Collectors; @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste", - permission = "plots.debugpaste", category = CommandCategory.DEBUG) public class DebugPaste - extends SubCommand { + permission = "plots.debugpaste", category = CommandCategory.DEBUG, confirmation = true, requiredType = RequiredType.NONE) +public class DebugPaste extends SubCommand { private static String readFile(@NonNull final File file) throws IOException { final List lines; From ae0f1d2a15b30d951fcf6b2ea176407b95c3cc06 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 3 Oct 2019 01:26:31 +0200 Subject: [PATCH 136/258] Adding "website" to plugin.yml --- Bukkit/src/main/resources/plugin.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 0dbd861e0..c2e1350e4 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -6,6 +6,7 @@ load: STARTUP description: > Easy, yet powerful Plot World generation and management. authors: [Citymonstret, Empire92, MattBDev, dordsor21] +website: https://github.com/IntellectualSites/ softdepend: [BarAPI, CameraAPI, Vault] loadbefore: [MultiWorld, Multiverse-Core] depend: [WorldEdit] From b806a306391159a8120157104c77805f2658a95e Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 3 Oct 2019 01:32:19 +0200 Subject: [PATCH 137/258] Setting debug value default to false If the user is interested in the information or needs it for debugging, they can enable them, but we don't need to spam them unnecessarily with stats about his plot worlds on each startup, /plot reload, etc. The same information can be obtained from a debugpaste as well, so it's not a loss of information to offer assistance. --- .../intellectualsites/plotsquared/plot/config/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index 6cb5eb287..b1e239c78 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -26,7 +26,7 @@ public class Settings extends Config { @Final public static String COMMIT; // These values are set from P2 before loading @Final public static String PLATFORM; // These values are set from P2 before loading - @Comment("Show additional information in console") public static boolean DEBUG = true; + @Comment("Show additional information in console") public static boolean DEBUG = false; @Comment({"The big annoying text that appears when you enter a plot", "For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`"}) public static boolean TITLES = true; From 8927f50cc6666035b869bea5db5ee712ed90a048 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2019 15:16:31 +0000 Subject: [PATCH 138/258] Bump snakeyaml from 1.23 to 1.25 Bumps [snakeyaml](https://bitbucket.org/asomov/snakeyaml) from 1.23 to 1.25. - [Commits](https://bitbucket.org/asomov/snakeyaml/commits) Signed-off-by: dependabot-preview[bot] --- Core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/build.gradle b/Core/build.gradle index 90a33b8d2..6c7a93f31 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -4,7 +4,7 @@ repositories { def textVersion = "3.0.2" dependencies { - implementation("org.yaml:snakeyaml:1.23") + implementation("org.yaml:snakeyaml:1.25") implementation("com.google.code.gson:gson:2.8.0") { because("Minecraft uses GSON 2.8.0") force = true From 806867120071e2bdcd2436ba49a7360259f33c23 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2019 15:16:54 +0000 Subject: [PATCH 139/258] Bump kotlin-stdlib from 1.3.30 to 1.3.50 Bumps [kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.3.30 to 1.3.50. - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/v1.3.50/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.30...v1.3.50) Signed-off-by: dependabot-preview[bot] --- Bukkit/build.gradle | 2 +- Core/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index de4ca4e9b..94241b507 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -51,7 +51,7 @@ shadowJar { include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) include(dependency("com.squareup.okhttp3:okhttp:3.14.0")) include(dependency("com.squareup.okio:okio:2.2.2")) - include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.30")) + include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) include(dependency("io.papermc:paperlib:1.0.2")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) } diff --git a/Core/build.gradle b/Core/build.gradle index 90a33b8d2..2a6a0b7cf 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -17,7 +17,7 @@ dependencies { implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") implementation("com.squareup.okhttp3:okhttp:3.14.0") implementation("com.squareup.okio:okio:2.2.2") - implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.30") + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50") } sourceCompatibility = 1.8 From ec6c9dac49d04753e27a09257cf20e136ca967d2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2019 15:16:57 +0000 Subject: [PATCH 140/258] Bump lombok from 1.18.8 to 1.18.10 Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.8 to 1.18.10. - [Release notes](https://github.com/rzwitserloot/lombok/releases) - [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown) - [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.8...v1.18.10) Signed-off-by: dependabot-preview[bot] --- Core/build.gradle | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/build.gradle b/Core/build.gradle index 90a33b8d2..bc7b72708 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -9,7 +9,7 @@ dependencies { because("Minecraft uses GSON 2.8.0") force = true } - implementation("org.projectlombok:lombok:1.18.8") + implementation("org.projectlombok:lombok:1.18.10") compileOnly("org.projectlombok:lombok:1.18.8") testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") diff --git a/build.gradle b/build.gradle index 3d83a509b..54dd1bd80 100644 --- a/build.gradle +++ b/build.gradle @@ -75,7 +75,7 @@ subprojects { because("Minecraft uses Guava 21 as of 1.13") } compileOnly("org.jetbrains:annotations:17.0.0") - compileClasspath("org.projectlombok:lombok:1.18.8") + compileClasspath("org.projectlombok:lombok:1.18.10") testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") From 3d1cd4605306a10ae6fed9122b6b66dab74e98b7 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 7 Oct 2019 19:09:41 +0200 Subject: [PATCH 141/258] Update Sponsors --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 09c241a1b..00fe1784e 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,17 @@ Suggestions are welcome! We have a separate issue tracker for suggestions, that * [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/) # Sponsors -

    -

    -

    -

    +


    +IntelliJ IDEA is a Java integrated development environment (IDE) for developing computer software. It is developed by JetBrains and our top used development tool. Every aspect of IntelliJ IDEA is specifically designed to maximize developer productivity. +Together, the powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.

    +


    +YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. +YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler, and YourKit YouMonitor. We are using it to profile the performance of our plugins.

    +


    +Athion is the result of the merging of two of the oldest creative servers around in the community – Mithrintia and Pwego-Insomnia – fusing together to perfect a creative experience like no other to develop and harness your skills.

    +


    +Welcome to the Builders's Refuge. The refuge is a passion project we started to accommodate professional Minecraft builders who are looking for a personal or commercial space to build and create art. We offer premium services at no charge along with a network of other builders and resources to help you become successful. +

    +


    +The AJGaming Network is a modded and vanilla network. Either delve into magic on our magic servers, fight your enemies on our hardcore PvP modpacks or have a good time on our vanilla servers. The mods for our modpacks are handpicked by suggestions from our community making sure we can crate packs you love to play. +

    From a3905c68cf15ce571b4a564cbfc5521553a24cf6 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 7 Oct 2019 19:20:48 +0200 Subject: [PATCH 142/258] Fix links --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00fe1784e..5a23753a2 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ IntelliJ IDEA is a Java integrated development environment (IDE) for developing Together, the powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.


    YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. -YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler, and YourKit YouMonitor. We are using it to profile the performance of our plugins.

    +YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler, and YourKit YouMonitor. We are using YourKit to profile the performance of our plugins.


    Athion is the result of the merging of two of the oldest creative servers around in the community – Mithrintia and Pwego-Insomnia – fusing together to perfect a creative experience like no other to develop and harness your skills.


    From 599ef8aa44615f427e031b50968b894fa4ca2a1d Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Thu, 10 Oct 2019 01:33:37 +0200 Subject: [PATCH 143/258] Bugfix for #2524 (place flag) --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 1 + 1 file changed, 1 insertion(+) 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 f2e8f363a..f5856ed4d 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 @@ -2046,6 +2046,7 @@ import java.util.regex.Pattern; location = BukkitUtil .getLocation(block.getRelative(event.getBlockFace()).getLocation()); eventType = PlayerBlockEventType.PLACE_BLOCK; + lb = new BukkitLazyBlock(new StringPlotBlock(type.toString())); break; } lb = new BukkitLazyBlock(PlotBlock.get(type.toString())); From 1f4f78a1793b3ee8a4ecc0b6e281af55b91c8c31 Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Thu, 10 Oct 2019 01:53:27 +0200 Subject: [PATCH 144/258] this can be done more elegantly --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 f5856ed4d..d02159dd9 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 @@ -2042,14 +2042,14 @@ import java.util.regex.Pattern; if (type == Material.AIR) { type = offType; } + // in the following, lb needs to have the material of the item in hand i.e. type + lb = new BukkitLazyBlock(PlotBlock.get(type.toString())); if (type.isBlock()) { location = BukkitUtil .getLocation(block.getRelative(event.getBlockFace()).getLocation()); eventType = PlayerBlockEventType.PLACE_BLOCK; - lb = new BukkitLazyBlock(new StringPlotBlock(type.toString())); break; } - lb = new BukkitLazyBlock(PlotBlock.get(type.toString())); if (type.toString().toLowerCase().endsWith("egg")) { eventType = PlayerBlockEventType.SPAWN_MOB; } else { From 5315e1e3379a20e7bb6c1e73f281ea2f4057745b Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Thu, 10 Oct 2019 20:12:15 +0200 Subject: [PATCH 145/258] let untrusted-visit override deny-teleport --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 f2e8f363a..909b26214 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 @@ -697,7 +697,11 @@ import java.util.regex.Pattern; Plot plot = area.getPlot(location); if (plot != null) { final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); - if (!result) { + // there is one possibility to still allow teleportation: + // to is identical to the plot's home location, and untrusted-visit is true + // i.e. untrusted-visit can override deny-teleport + // this is acceptable, because otherwise it wouldn't make sense to have both flags set + if (!result && !(Flags.UNTRUSTED_VISIT.isTrue(plot) && plot.getHome().equals(location))) { MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_ENTRY_DENIED); event.setCancelled(true); From 0bcaaf3c0b059bbc4a1ad8234320b46ed83b0d8a Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Thu, 10 Oct 2019 20:11:54 +0200 Subject: [PATCH 146/258] copy yaw and pitch when converting between Bukkit Location and PlotSquared Location --- .../plotsquared/bukkit/util/BukkitUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 ebf67e075..06eb60cd7 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 @@ -212,12 +212,14 @@ import java.util.Set; public static Location getLocation(@NonNull final org.bukkit.Location location) { return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()), - MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ())); + MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), + location.getYaw(), location.getPitch()); } public static org.bukkit.Location getLocation(@NonNull final Location location) { return new org.bukkit.Location(getWorld(location.getWorld()), location.getX(), - location.getY(), location.getZ()); + location.getY(), location.getZ(), + location.getYaw(), location.getPitch()); } public static World getWorld(@NonNull final String string) { From 53e94cc0018837715cc0d62a9563a95ea41458a7 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:17:37 +0000 Subject: [PATCH 147/258] Bump gson from 2.8.0 to 2.8.6 Bumps [gson](https://github.com/google/gson) from 2.8.0 to 2.8.6. - [Release notes](https://github.com/google/gson/releases) - [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/gson/compare/gson-parent-2.8.0...gson-parent-2.8.6) Signed-off-by: dependabot-preview[bot] --- Core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/build.gradle b/Core/build.gradle index 2b0f40e2d..c1db0bf22 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -5,7 +5,7 @@ def textVersion = "3.0.2" dependencies { implementation("org.yaml:snakeyaml:1.25") - implementation("com.google.code.gson:gson:2.8.0") { + implementation("com.google.code.gson:gson:2.8.6") { because("Minecraft uses GSON 2.8.0") force = true } From 4a3c0155244031ca365f21d7f26c1604528d98a3 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:17:55 +0000 Subject: [PATCH 148/258] Bump asm from 7.1 to 7.2 Bumps asm from 7.1 to 7.2. Signed-off-by: dependabot-preview[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 54dd1bd80..667ba16f8 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ buildscript { } configurations.all { resolutionStrategy { - force("org.ow2.asm:asm:7.1") + force("org.ow2.asm:asm:7.2") force("org.jetbrains:annotations:17.0.0") } } From dd715a9c8a8fe3f842237d1237edf3f0cbc4fc08 Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Fri, 18 Oct 2019 07:51:01 +0200 Subject: [PATCH 149/258] Revert "copy yaw and pitch when converting between Bukkit Location and PlotSquared Location" Undo this since I can't guarantee that there aren't side effects. --- .../plotsquared/bukkit/util/BukkitUtil.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 06eb60cd7..ebf67e075 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 @@ -212,14 +212,12 @@ import java.util.Set; public static Location getLocation(@NonNull final org.bukkit.Location location) { return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()), - MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), - location.getYaw(), location.getPitch()); + MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ())); } public static org.bukkit.Location getLocation(@NonNull final Location location) { return new org.bukkit.Location(getWorld(location.getWorld()), location.getX(), - location.getY(), location.getZ(), - location.getYaw(), location.getPitch()); + location.getY(), location.getZ()); } public static World getWorld(@NonNull final String string) { From 20957a75d5b14cd2ae129e326c2003731b14602f Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Fri, 18 Oct 2019 08:02:44 +0200 Subject: [PATCH 150/258] use a new Location convert function to ensure that there will be no side effects --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 2 +- .../plotsquared/bukkit/util/BukkitUtil.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 909b26214..c10a7eacf 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 @@ -701,7 +701,7 @@ import java.util.regex.Pattern; // to is identical to the plot's home location, and untrusted-visit is true // i.e. untrusted-visit can override deny-teleport // this is acceptable, because otherwise it wouldn't make sense to have both flags set - if (!result && !(Flags.UNTRUSTED_VISIT.isTrue(plot) && plot.getHome().equals(location))) { + if (!result && !(Flags.UNTRUSTED_VISIT.isTrue(plot) && plot.getHome().equals(BukkitUtil.getLocationFull(to)))) { MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_ENTRY_DENIED); event.setCancelled(true); 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 ebf67e075..a6f49ca66 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 @@ -215,6 +215,12 @@ import java.util.Set; MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ())); } + public static Location getLocationFull(@NonNull final org.bukkit.Location location) { + return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()), + MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), + location.getYaw(), location.getPitch()); + } + public static org.bukkit.Location getLocation(@NonNull final Location location) { return new org.bukkit.Location(getWorld(location.getWorld()), location.getX(), location.getY(), location.getZ()); From 427cf081e3cfc3e5c3a42a69b0ff90711fae2182 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2019 21:37:55 +0000 Subject: [PATCH 151/258] Bump okio from 2.2.2 to 2.4.1 Bumps [okio](https://github.com/square/okio) from 2.2.2 to 2.4.1. - [Release notes](https://github.com/square/okio/releases) - [Changelog](https://github.com/square/okio/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okio/compare/2.2.2...2.4.1) Signed-off-by: dependabot-preview[bot] --- Bukkit/build.gradle | 2 +- Core/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 94241b507..d30483859 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -50,7 +50,7 @@ shadowJar { include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) include(dependency("com.squareup.okhttp3:okhttp:3.14.0")) - include(dependency("com.squareup.okio:okio:2.2.2")) + include(dependency("com.squareup.okio:okio:2.4.1")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) include(dependency("io.papermc:paperlib:1.0.2")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) diff --git a/Core/build.gradle b/Core/build.gradle index 8f84c938e..c460b60df 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -16,7 +16,7 @@ dependencies { testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") implementation("com.squareup.okhttp3:okhttp:3.14.0") - implementation("com.squareup.okio:okio:2.2.2") + implementation("com.squareup.okio:okio:2.4.1") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50") } From e029cc3fa10d8ba2ddc6b55506d00be279a5a05a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2019 21:40:43 +0000 Subject: [PATCH 152/258] Bump retrofit from 2.4.0 to 2.6.2 Bumps [retrofit](https://github.com/square/retrofit) from 2.4.0 to 2.6.2. - [Release notes](https://github.com/square/retrofit/releases) - [Changelog](https://github.com/square/retrofit/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/retrofit/commits) Signed-off-by: dependabot-preview[bot] --- Bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index d30483859..d8e52d3be 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -48,7 +48,7 @@ shadowJar { include(dependency(":Core")) // update notification stuff include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) - include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) + include(dependency("com.squareup.retrofit2:retrofit:2.6.2")) include(dependency("com.squareup.okhttp3:okhttp:3.14.0")) include(dependency("com.squareup.okio:okio:2.4.1")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) From d7d9b1793f63bd96f731f301b5b376fa945a278b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2019 21:40:45 +0000 Subject: [PATCH 153/258] Bump okhttp from 3.14.0 to 4.2.2 Bumps [okhttp](https://github.com/square/okhttp) from 3.14.0 to 4.2.2. - [Release notes](https://github.com/square/okhttp/releases) - [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okhttp/compare/parent-3.14.0...parent-4.2.2) Signed-off-by: dependabot-preview[bot] --- Bukkit/build.gradle | 2 +- Core/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index d30483859..8faad8e43 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -49,7 +49,7 @@ shadowJar { // update notification stuff include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) - include(dependency("com.squareup.okhttp3:okhttp:3.14.0")) + include(dependency("com.squareup.okhttp3:okhttp:4.2.2")) include(dependency("com.squareup.okio:okio:2.4.1")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) include(dependency("io.papermc:paperlib:1.0.2")) diff --git a/Core/build.gradle b/Core/build.gradle index c460b60df..1ba0b5505 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -15,7 +15,7 @@ dependencies { annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") - implementation("com.squareup.okhttp3:okhttp:3.14.0") + implementation("com.squareup.okhttp3:okhttp:4.2.2") implementation("com.squareup.okio:okio:2.4.1") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50") } From a601739fbd9151bc5a93bdd9a6efdfccd6a813a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 27 Oct 2019 11:25:33 +0100 Subject: [PATCH 154/258] Improve handling of list flags, which in turn resolves issues where add and remove would allow players to add flags with unrecognized values. --- .../plotsquared/plot/commands/FlagCmd.java | 46 ++++++++++--------- .../plot/flag/PlotBlockListFlag.java | 16 +++---- 2 files changed, 33 insertions(+), 29 deletions(-) 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 84446aa00..833c0b780 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 @@ -197,25 +197,26 @@ public class FlagCmd extends SubCommand { } if (args.length == 3 && flag instanceof ListFlag) { String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " "); - Optional flag1 = - plot.getFlag((Flag>) flag); - if (flag1.isPresent()) { - boolean o = flag1.get().removeAll((Collection) flag.parseValue(value)); - if (o) { - if (flag1.get().isEmpty()) { - final boolean result = plot.removeFlag(flag); - if (result) { - MainUtil.sendMessage(player, Captions.FLAG_REMOVED); + final ListFlag listFlag = (ListFlag) flag; + final Optional collectionOptional = plot.getFlag(listFlag); + if (collectionOptional.isPresent()) { + final Collection parsedCollection = (Collection) flag.parseValue(value); + if (parsedCollection.isEmpty()) { + return !MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); + } + final Collection flagCollection = collectionOptional.get(); + if (flagCollection.removeAll(parsedCollection)) { + if (flagCollection.isEmpty()) { + if (plot.removeFlag(flag)) { + return MainUtil.sendMessage(player, Captions.FLAG_REMOVED); } else { - MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); + return !MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); } - return true; } else { MainUtil.sendMessage(player, Captions.FLAG_REMOVED); } } else { - MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); - return false; + return !MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); } } DBFunc.setFlags(plot, plot.getFlags()); @@ -259,16 +260,19 @@ public class FlagCmd extends SubCommand { } Object val = parsed; if (flag instanceof ListFlag) { - Optional flag1 = - plot.getFlag((Flag>) flag); - if (flag1.isPresent()) { - boolean o = flag1.get().addAll((Collection) parsed); - if (o) { + final Collection parsedCollection = (Collection) parsed; + if (parsedCollection.isEmpty()) { + return !MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); + } + final ListFlag listFlag = (ListFlag) flag; + final Optional collectionOptional = plot.getFlag(listFlag); + if (collectionOptional.isPresent()) { + final Collection flagCollection = collectionOptional.get(); + if (flagCollection.addAll(parsedCollection)) { MainUtil.sendMessage(player, Captions.FLAG_ADDED); - val = flag1.get(); + val = flagCollection; } else { - MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); - return false; + return !MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); } } } 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 56cd0e901..4be8ac475 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 @@ -2,9 +2,14 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; 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> { @@ -17,14 +22,9 @@ public class PlotBlockListFlag extends ListFlag> { } @Override public HashSet parseValue(final String value) { - final HashSet list = new HashSet<>(); - for (final String item : value.split(",")) { - final PlotBlock block = PlotSquared.get().IMP.getLegacyMappings().fromAny(item); - if (block != null) { - list.add(block); - } - } - return list; + final LegacyMappings legacyMappings = PlotSquared.get().IMP.getLegacyMappings(); + return Arrays.stream(value.split(",")).map(legacyMappings::fromAny).filter(Objects::nonNull) + .collect(Collectors.toCollection(HashSet::new)); } @Override public String getValueDescription() { From 01eee306f10b8220dfd47d6419cefa74ef1aac46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 27 Oct 2019 11:45:18 +0100 Subject: [PATCH 155/258] Fixes #2462 by making flag categories translatable. This reflects (somewhat) recent changes to command categories. --- .../plotsquared/plot/commands/FlagCmd.java | 9 ++++---- .../plotsquared/plot/config/Captions.java | 21 ++++++++++++++++--- .../plotsquared/plot/flag/BooleanFlag.java | 3 ++- .../plotsquared/plot/flag/DoubleFlag.java | 4 +++- .../plotsquared/plot/flag/EnumFlag.java | 4 +++- .../plotsquared/plot/flag/Flag.java | 17 ++++++++++++++- .../plotsquared/plot/flag/Flags.java | 3 ++- .../plotsquared/plot/flag/GameModeFlag.java | 3 ++- .../plotsquared/plot/flag/IntegerFlag.java | 3 ++- .../plot/flag/IntegerListFlag.java | 3 ++- .../plotsquared/plot/flag/IntervalFlag.java | 3 ++- .../plotsquared/plot/flag/ListFlag.java | 5 +++++ .../plotsquared/plot/flag/LongFlag.java | 4 +++- .../plot/flag/PlotBlockListFlag.java | 3 ++- .../plot/flag/PlotWeatherFlag.java | 3 ++- .../plotsquared/plot/flag/StringFlag.java | 4 +++- .../plotsquared/plot/flag/StringListFlag.java | 3 ++- .../plot/flag/TeleportDenyFlag.java | 1 + 18 files changed, 75 insertions(+), 21 deletions(-) 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 833c0b780..35888fdde 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 @@ -293,11 +293,12 @@ public class FlagCmd extends SubCommand { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag list"); return false; } - HashMap> flags = new HashMap<>(); + final Map> flags = new HashMap<>(); for (Flag flag1 : Flags.getFlags()) { - String type = flag1.getClass().getSimpleName(); - flags.computeIfAbsent(type, k -> new ArrayList<>()); - flags.get(type).add(flag1.getName()); + final String category = flag1.getCategoryCaption(); + final Collection flagList = + flags.computeIfAbsent(category, k -> new ArrayList<>()); + flagList.add(flag1.getName()); } StringBuilder message = new StringBuilder(); String prefix = ""; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 35538a637..d0e386ea3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -567,9 +567,7 @@ public enum Captions { // BUCKET_ENTRIES_IGNORED("$2Total bucket values add up to 1 or more. Blocks without a specified chance will be ignored","Generator_Bucket"), - /** - * Command Categories - */ + // COMMAND_CATEGORY_CLAIMING("Claiming", "Category"), COMMAND_CATEGORY_TELEPORT("Teleport", "Category"), COMMAND_CATEGORY_SETTINGS("Protection", "Category"), @@ -579,6 +577,7 @@ public enum Captions { COMMAND_CATEGORY_INFO("Info", "Category"), COMMAND_CATEGORY_DEBUG("Debug", "Category"), COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), + // // GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), @@ -586,6 +585,22 @@ public enum Captions { GRANTED_PLOT_FAILED("$1Grant failed: $2%s", "Grants"), // + // + FLAG_CATEGORY_STRING("String Flags", "Flags"), + FLAG_CATEGORY_INTEGERS("Integer Flags", "Flags"), + FLAG_CATEGORY_TELEPORT_DENY("Teleport Deny Flag", "Flags"), + FLAG_CATEGORY_STRING_LIST("String List Flags", "Flags"), + FLAG_CATEGORY_WEATHER("Weather Flags", "Flags"), + FLAG_CATEGORY_BLOCK_LIST("Material Flags", "Flags"), + FLAG_CATEGORY_INTERVALS("Interval Flags", "Flags"), + FLAG_CATEGORY_INTEGER_LIST("Integer List Flags", "Flags"), + FLAG_CATEGORY_GAMEMODE("Game Mode Flags", "Flags"), + FLAG_CATEGORY_ENUM("Generic Enum Flags", "Flags"), + FLAG_CATEGORY_DECIMAL("Decimal Flags", "Flags"), + FLAG_CATEGORY_BOOLEAN("Boolean Flags", "Flags"), + FLAG_CATEGORY_MIXED("Mixed Value Flags", "Flags"), + // + /** * Legacy Configuration Conversion */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java index a492c9c0f..841df766c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java @@ -1,11 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; public class BooleanFlag extends Flag { public BooleanFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_BOOLEAN, name); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java index 9b46a2cde..8cc665471 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java @@ -1,9 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; + public class DoubleFlag extends Flag { public DoubleFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_DECIMAL, name); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java index 3ba6b2457..88119bbaa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java @@ -1,15 +1,17 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.Arrays; import java.util.HashSet; public class EnumFlag extends Flag { + private final HashSet values; public EnumFlag(String name, String... values) { - super(name); + super(Captions.FLAG_CATEGORY_ENUM, name); this.values = new HashSet<>(Arrays.asList(values)); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java index 3b247d87a..21047d9cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java @@ -1,13 +1,21 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; +import lombok.Getter; public abstract class Flag implements StringComparison.StringComparable { + @Getter private final Captions typeCaption; private final String name; private boolean reserved = false; + public Flag(Captions typeCaption, String name) { + this.typeCaption = typeCaption; + this.name = name; + } + /** * Flag object used to store basic information for a Plot. Flags are a * key/value pair. For a flag to be usable by a player, you need to @@ -16,7 +24,7 @@ public abstract class Flag implements StringComparison.StringComparable { * @param name the flag name */ public Flag(String name) { - this.name = name; + this(null, name); } public Flag reserve() { @@ -57,4 +65,11 @@ public abstract class Flag implements StringComparison.StringComparable { @Override public String getComparableString() { return getName(); } + + public String getCategoryCaption() { + return this.typeCaption == null ? + getClass().getSimpleName() : + this.typeCaption.getTranslated(); + } + } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index fc203a00b..ed5560f09 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -1,6 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.PlotSquared; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan; @@ -95,7 +96,7 @@ public final class Flags { public static final IntegerFlag ANIMAL_CAP = new IntegerFlag("animal-cap"); public static final IntegerFlag HOSTILE_CAP = new IntegerFlag("hostile-cap"); public static final IntegerFlag VEHICLE_CAP = new IntegerFlag("vehicle-cap"); - public static final Flag KEEP = new Flag("keep") { + public static final Flag KEEP = new Flag(Captions.FLAG_CATEGORY_MIXED, "keep") { @Override public String valueToString(Object value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index 80225c2aa..26510b35b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -1,11 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; public class GameModeFlag extends Flag { public GameModeFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_GAMEMODE, name); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java index 2cafed4d1..ced532cd1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java @@ -1,11 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; public class IntegerFlag extends Flag { public IntegerFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_INTEGERS, name); } @Override public String getValueDescription() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java index e46071b86..1f24cb4a3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java @@ -1,5 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.ArrayList; @@ -9,7 +10,7 @@ import java.util.List; public class IntegerListFlag extends ListFlag> { public IntegerListFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_INTEGER_LIST, name); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java index c8f490591..0468c59b2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java @@ -1,5 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -7,7 +8,7 @@ import lombok.RequiredArgsConstructor; public class IntervalFlag extends Flag { public IntervalFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_INTERVALS, name); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java index 518c3df11..3085288b1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java @@ -1,11 +1,16 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import java.util.Collection; public abstract class ListFlag> extends Flag { + public ListFlag(Captions typeCaption, String name) { + super(typeCaption, name); + } + public ListFlag(String name) { super(name); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java index 464780af8..8d57e8865 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java @@ -1,9 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; + public class LongFlag extends Flag { public LongFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_INTEGERS, name); } @Override public Long parseValue(String value) { 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 4be8ac475..93bd8c56f 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 @@ -1,6 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.PlotSquared; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; import com.github.intellectualsites.plotsquared.plot.util.StringMan; @@ -14,7 +15,7 @@ import java.util.stream.Collectors; public class PlotBlockListFlag extends ListFlag> { public PlotBlockListFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java index e6f93ee2d..43544748f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java @@ -1,11 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; public class PlotWeatherFlag extends Flag { public PlotWeatherFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_WEATHER, name); } @Override public String valueToString(Object value) { 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 36a68f66b..6438ec938 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,10 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; + public class StringFlag extends Flag { public StringFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_STRING, name); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java index 8f02a3801..a1e28aa3d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java @@ -1,5 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.ArrayList; @@ -9,7 +10,7 @@ import java.util.List; public class StringListFlag extends ListFlag> { public StringListFlag(String name) { - super(name); + super(Captions.FLAG_CATEGORY_STRING_LIST, name); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java index 90f6c292c..6c02516fd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java @@ -4,6 +4,7 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; public class TeleportDenyFlag extends EnumFlag { + public TeleportDenyFlag(String name) { super(name, "trusted", "members", "nonmembers", "nontrusted", "nonowners"); } From cb52ee8cfb0e48b36d291be0a7a43d053494d537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 27 Oct 2019 11:55:15 +0100 Subject: [PATCH 156/258] Make the flag list output message configurable. --- .../plotsquared/plot/commands/FlagCmd.java | 20 ++++++----- .../plotsquared/plot/config/Captions.java | 33 ++++++++++--------- 2 files changed, 29 insertions(+), 24 deletions(-) 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 35888fdde..18976edac 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 @@ -300,15 +300,19 @@ public class FlagCmd extends SubCommand { flags.computeIfAbsent(category, k -> new ArrayList<>()); flagList.add(flag1.getName()); } - StringBuilder message = new StringBuilder(); - String prefix = ""; - for (Map.Entry> entry : flags.entrySet()) { - String category = entry.getKey(); - List flagNames = entry.getValue(); + + final StringBuilder message = new StringBuilder(); + final Iterator>> iterator = + flags.entrySet().iterator(); + while (iterator.hasNext()) { + final Map.Entry> flagsEntry = iterator.next(); + final List flagNames = flagsEntry.getValue(); Collections.sort(flagNames); - message.append(prefix).append("&6").append(category).append(": &7") - .append(StringMan.join(flagNames, ", ")); - prefix = "\n"; + message.append(String.format(Captions.FLAG_LIST_ENTRY.formatted(), + flagsEntry.getKey(), StringMan.join(flagNames, ", "))); + if (iterator.hasNext()) { + message.append("\n"); + } } MainUtil.sendMessage(player, message.toString()); return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index d0e386ea3..f148d445b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -532,7 +532,24 @@ public enum Captions { FLAG_REMOVED("$4Successfully removed flag", "Flag"), FLAG_ADDED("$4Successfully added flag", "Flag"), FLAG_TUTORIAL_USAGE("$1Have an admin set the flag: $2%s", "CommandConfig"), + FLAG_LIST_ENTRY("$2%s: $1%s", "Flag"), // + // + FLAG_CATEGORY_STRING("String Flags", "Flags"), + FLAG_CATEGORY_INTEGERS("Integer Flags", "Flags"), + FLAG_CATEGORY_TELEPORT_DENY("Teleport Deny Flag", "Flags"), + FLAG_CATEGORY_STRING_LIST("String List Flags", "Flags"), + FLAG_CATEGORY_WEATHER("Weather Flags", "Flags"), + FLAG_CATEGORY_BLOCK_LIST("Material Flags", "Flags"), + FLAG_CATEGORY_INTERVALS("Interval Flags", "Flags"), + FLAG_CATEGORY_INTEGER_LIST("Integer List Flags", "Flags"), + FLAG_CATEGORY_GAMEMODE("Game Mode Flags", "Flags"), + FLAG_CATEGORY_ENUM("Generic Enum Flags", "Flags"), + FLAG_CATEGORY_DECIMAL("Decimal Flags", "Flags"), + FLAG_CATEGORY_BOOLEAN("Boolean Flags", "Flags"), + FLAG_CATEGORY_MIXED("Mixed Value Flags", "Flags"), + // + // TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), @@ -585,22 +602,6 @@ public enum Captions { GRANTED_PLOT_FAILED("$1Grant failed: $2%s", "Grants"), // - // - FLAG_CATEGORY_STRING("String Flags", "Flags"), - FLAG_CATEGORY_INTEGERS("Integer Flags", "Flags"), - FLAG_CATEGORY_TELEPORT_DENY("Teleport Deny Flag", "Flags"), - FLAG_CATEGORY_STRING_LIST("String List Flags", "Flags"), - FLAG_CATEGORY_WEATHER("Weather Flags", "Flags"), - FLAG_CATEGORY_BLOCK_LIST("Material Flags", "Flags"), - FLAG_CATEGORY_INTERVALS("Interval Flags", "Flags"), - FLAG_CATEGORY_INTEGER_LIST("Integer List Flags", "Flags"), - FLAG_CATEGORY_GAMEMODE("Game Mode Flags", "Flags"), - FLAG_CATEGORY_ENUM("Generic Enum Flags", "Flags"), - FLAG_CATEGORY_DECIMAL("Decimal Flags", "Flags"), - FLAG_CATEGORY_BOOLEAN("Boolean Flags", "Flags"), - FLAG_CATEGORY_MIXED("Mixed Value Flags", "Flags"), - // - /** * Legacy Configuration Conversion */ From 2e15934666faa7e765e281cb5de83e2bdbbd123b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 27 Oct 2019 12:01:04 +0100 Subject: [PATCH 157/258] Fix `/plot flag set` allowing for invalid flag values. (Fixes #2519) --- .../intellectualsites/plotsquared/plot/commands/FlagCmd.java | 5 +++++ 1 file changed, 5 insertions(+) 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 18976edac..af0389dec 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 @@ -163,6 +163,11 @@ public class FlagCmd extends SubCommand { MainUtil.sendMessage(player, "&c" + flag.getValueDescription()); return false; } + if (flag instanceof ListFlag) { + if (!(parsed instanceof Collection) || ((Collection) parsed).isEmpty()) { + return !MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); + } + } boolean result = plot.setFlag(flag, parsed); if (!result) { MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); From 3be0be1b604c8b58bbbb98e17a0b3fa0dd040083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 27 Oct 2019 12:11:48 +0100 Subject: [PATCH 158/258] Make sure DENY_EXIT checks for the admin override permission. Fixes #2411. --- .../plotsquared/plot/listener/PlotListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 4911f9f47..ce1007e15 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 @@ -200,7 +200,9 @@ public class PlotListener { if (pw == null) { return true; } - if (Flags.DENY_EXIT.isTrue(plot) && !player.getMeta("kick", false)) { + if (Flags.DENY_EXIT.isTrue(plot) + && !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_EXIT_DENIED) + && !player.getMeta("kick", false)) { if (previous != null) { player.setMeta(PlotPlayer.META_LAST_PLOT, previous); } From 25ca011bfecd8b495d5f5d09af10f786dce942a4 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 27 Oct 2019 15:10:15 +0100 Subject: [PATCH 159/258] Fixes #2550 --- Bukkit/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 997ec15c0..aa3925708 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -22,6 +22,7 @@ dependencies { implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile("io.papermc:paperlib:1.0.2") + compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.6.2") implementation("net.kyori:text-adapter-bukkit:3.0.3") compile("net.milkbowl.vault:VaultAPI:1.7") { exclude(module: "bukkit") From 1067e5f2c210f07719a7db900f0c6d7af16cdb3f Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 27 Oct 2019 15:19:49 +0100 Subject: [PATCH 160/258] Remove redundant empty line --- Bukkit/src/main/resources/plugin.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index c2e1350e4..797d21ba3 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -3,8 +3,7 @@ main: com.github.intellectualsites.plotsquared.bukkit.BukkitMain api-version: "1.13" version: "${version}" load: STARTUP -description: > - Easy, yet powerful Plot World generation and management. +description: "Easy, yet powerful Plot World generation and management." authors: [Citymonstret, Empire92, MattBDev, dordsor21] website: https://github.com/IntellectualSites/ softdepend: [BarAPI, CameraAPI, Vault] From 1f89948948ed63d73f6151b1decbd9728ce7b228 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 27 Oct 2019 16:01:57 +0100 Subject: [PATCH 161/258] Remove unused flags --- .../intellectualsites/plotsquared/plot/config/Captions.java | 1 - .../github/intellectualsites/plotsquared/plot/flag/Flags.java | 3 --- .../intellectualsites/plotsquared/plot/util/EventUtil.java | 3 +-- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index f148d445b..c319303b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -28,7 +28,6 @@ public enum Captions { FLAG_PVP("pvp", "static.flags"), FLAG_HANGING_PLACE("hanging-place", "static.flags"), FLAG_HANGING_BREAK("hanging-break", "static.flags"), - FLAG_HANGING_INTERACT("hanging-interact", "static.flags"), FLAG_MISC_INTERACT("misc-interact", "static.flags"), FLAG_MISC_BREAK("misc-break", "static.flags"), FLAG_MISC_PLACE("misc-place", "static.flags"), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index ed5560f09..74b83d887 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -53,7 +53,6 @@ public final class Flags { public static final BooleanFlag SNOW_MELT = new BooleanFlag("snow-melt"); public static final BooleanFlag SNOW_FORM = new BooleanFlag("snow-form"); public static final BooleanFlag ICE_MELT = new BooleanFlag("ice-melt"); - public static final BooleanFlag FIRE_SPREAD = new BooleanFlag("fire-spread"); public static final BooleanFlag BLOCK_BURN = new BooleanFlag("block-burn"); public static final BooleanFlag ICE_FORM = new BooleanFlag("ice-form"); public static final BooleanFlag BLOCK_IGNITION = new BooleanFlag("block-ignition"); @@ -68,7 +67,6 @@ public final class Flags { public static final BooleanFlag VEHICLE_USE = new BooleanFlag("vehicle-use"); public static final BooleanFlag HANGING_BREAK = new BooleanFlag("hanging-break"); public static final BooleanFlag HANGING_PLACE = new BooleanFlag("hanging-place"); - public static final BooleanFlag HANGING_INTERACT = new BooleanFlag("hanging-interact"); public static final BooleanFlag MISC_PLACE = new BooleanFlag("misc-place"); public static final BooleanFlag MISC_BREAK = new BooleanFlag("misc-break"); public static final BooleanFlag MISC_INTERACT = new BooleanFlag("misc-interact"); @@ -119,7 +117,6 @@ public final class Flags { return "Flag value must a timestamp or a boolean"; } }; - public static final BooleanFlag SLEEP = new BooleanFlag("sleep"); public static final TeleportDenyFlag DENY_TELEPORT = new TeleportDenyFlag("deny-teleport"); public static final BooleanFlag DENY_EXIT = new BooleanFlag("deny-exit"); 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 b2b88d342..fcb376355 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 @@ -302,8 +302,7 @@ public abstract class EventUtil { } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_HANGING_INTERACT - .getTranslated())); + Captions.FLAG_USE.getTranslated())); } return true; } From e29727827d154915e375ad13e1ee9d098353eb90 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 27 Oct 2019 16:02:34 +0100 Subject: [PATCH 162/258] Fix missing word --- .../github/intellectualsites/plotsquared/plot/flag/Flags.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index 74b83d887..1da139665 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -114,7 +114,7 @@ public final class Flags { } @Override public String getValueDescription() { - return "Flag value must a timestamp or a boolean"; + return "Flag value must be a timestamp or a boolean"; } }; public static final TeleportDenyFlag DENY_TELEPORT = new TeleportDenyFlag("deny-teleport"); From 6ec3951e4eab7dfadd2e382f17f292e7b022a2c5 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 30 Oct 2019 15:05:52 +0100 Subject: [PATCH 163/258] Add Bukkit module to maven --- Bukkit/build.gradle | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index aa3925708..cebffd2a6 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -41,8 +41,40 @@ processResources { ) } } -// We only want the shadow jar produced -jar.enabled = false + +//noinspection GroovyAssignabilityCheck +jar.archiveFileName = "PlotSquared-BukkitAPI-${project.parent.version}.jar" +jar.destinationDirectory = file("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/" + project.parent.version) +task createPom { + doLast { + pom { + project { + groupId = "com.github.intellectualsites.plotsquared" + artifactId = "PlotSquared-BukkitAPI" + version = project.parent.version + } + }.writeTo("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/${project.parent.version}/PlotSquared-BukkitAPI-${project.parent.version}.pom") + pom { + project { + groupId = "com.github.intellectualsites.plotsquared" + artifactId = "PlotSquared-BukkitAPI" + version = "latest" + } + }.writeTo("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/latest/PlotSquared-BukkitAPI-latest.pom") + } +} + +task copyFiles { + doLast { + copy { + from("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/${project.parent.version}/") + into("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/latest/") + include("PlotSquared-BukkitAPI*.jar") + rename("PlotSquared-BukkitAPI-${project.parent.version}.jar", "PlotSquared-BukkitAPI-latest.jar") + } + } +} + shadowJar { dependencies { @@ -69,3 +101,5 @@ shadowJar.doLast { } build.dependsOn(shadowJar) +build.finalizedBy(copyFiles) +copyFiles.dependsOn(createPom) From 17e784c2833bfe66c0d9e7ffa7ef90a980b0c254 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 1 Nov 2019 21:45:06 -0400 Subject: [PATCH 164/258] Revert dependency upgrades --- Bukkit/build.gradle | 8 ++++---- Core/build.gradle | 8 ++++---- build.gradle | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index cebffd2a6..10e61bb8d 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -22,7 +22,7 @@ dependencies { implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile("io.papermc:paperlib:1.0.2") - compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.6.2") + compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0") implementation("net.kyori:text-adapter-bukkit:3.0.3") compile("net.milkbowl.vault:VaultAPI:1.7") { exclude(module: "bukkit") @@ -81,9 +81,9 @@ shadowJar { include(dependency(":Core")) // update notification stuff include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) - include(dependency("com.squareup.retrofit2:retrofit:2.6.2")) - include(dependency("com.squareup.okhttp3:okhttp:4.2.2")) - include(dependency("com.squareup.okio:okio:2.4.1")) + include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) + include(dependency("com.squareup.okhttp3:okhttp:3.12.0")) + include(dependency("com.squareup.okio:okio:1.14.0")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) include(dependency("io.papermc:paperlib:1.0.2")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) diff --git a/Core/build.gradle b/Core/build.gradle index bc7737b71..0329af1fe 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -5,18 +5,18 @@ def textVersion = "3.0.2" dependencies { implementation("org.yaml:snakeyaml:1.25") - implementation("com.google.code.gson:gson:2.8.6") { + implementation("com.google.code.gson:gson:2.8.0") { because("Minecraft uses GSON 2.8.0") force = true } - implementation("org.projectlombok:lombok:1.18.10") + implementation("org.projectlombok:lombok:1.18.8") compileOnly("org.projectlombok:lombok:1.18.8") testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") - implementation("com.squareup.okhttp3:okhttp:4.2.2") - implementation("com.squareup.okio:okio:2.4.1") + implementation("com.squareup.okhttp3:okhttp:3.12.0") + implementation("com.squareup.okio:okio:1.14.0") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50") } diff --git a/build.gradle b/build.gradle index 667ba16f8..d7052ca6d 100644 --- a/build.gradle +++ b/build.gradle @@ -75,7 +75,7 @@ subprojects { because("Minecraft uses Guava 21 as of 1.13") } compileOnly("org.jetbrains:annotations:17.0.0") - compileClasspath("org.projectlombok:lombok:1.18.10") + compileClasspath("org.projectlombok:lombok:1.18.8") testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") From 7309e6122115de8cf2281ff7c4a818041ede8af8 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 2 Nov 2019 12:48:41 +0100 Subject: [PATCH 165/258] AeSix' template improvements --- .../bug-issue-report-for-plotsquared.md | 94 ++++++++++++++----- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md index 43293d3c9..a3399ecdb 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -2,37 +2,89 @@ name: Bug/Issue report for PlotSquared about: Bug / Issue report about this plugin title: '' -labels: '' +labels: "[?] Testing Required" assignees: '' --- -__*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and will receive limited support. Please consider upgrading to 1.13 for future support. Plugins exist for 1.13+ that bring back old behaviors found in 1.8*__ -# Bug report template - - - + -**Debug paste link:** - -**[REQUIRED] Spigot/Paper Version Number:** - + -**[REQUIRED] Minecraft Version Number:** +# NOTICE: +```diff +! PlotSquared for Minecraft Java Edition versions between 1.7 through to 1.12.2 are considered +! legacy, and will receive limited to no support. Please consider upgrading to 1.13+ for +! future support. Plugins exist for 1.13+ which bring back behaviors found in 1.8.8 +! All versions of PlotSquared for Sponge and Nukkit(X) will recieve limited to no support +! due to lack of developer interest and time. Additionally, NukkitX has not had feature +! updates since the Better Together, which prevents some PlotSquared features from ever +! functioning. Contributions are always welcome however! +``` -**[REQUIRED] Description of the problem:** +**Feature requests & Suggestions are to be submitted at the [PlotSquared Suggestions tracker](https://github.com/IntellectualSites/PlotSquaredSuggestions)** -**Any relevant console output or screenshots:** +**Code contributions are to be done through [PRs](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request), tagging the specific issue ticket(s) if applicable.** -**Plugins being used on the server:** - +**[DISCORD INVITE LINK](https://discord.gg/cSMxtGn)** and please, for the love of the little sanity we have left, use the correct channels! -**[REQUIRED] How to replicate:** +# BUG REPORT TEMPLATE: + +## Required Information section: +> ALL FIELDS IN THIS SECTION ARE REQUIRED, and must contain appropriate information +### Server config info (Debug/file paste links): + + + + + +### Server type: +**select one** + +- [ ] Spigot / Paper *(CraftBukkit should not be used, re-test with Spigot first!)* +- [ ] Sponge *- NOTE: NOT ACTIVELY MAINTAINED* +- [ ] NukkitX *- NOTE: NOT ACTIVELY MAINTAINED* + +### Minecraft Version: +**select one** + +- [ ] Minecraft 1.14.4 ***This is the ONLY actively maintained target for PlotSquared*** +- [ ] Minecraft 1.13.2 +- [ ] Minecraft Java Edition *other versions, please specify*: +- [ ] Minecraft Bedrock Edition *speicify version*: + +### Server build info: + +``` paste here, between the tick marks, replacing this text ``` + +### WorldEdit/FAWE versions: + +- [ ] FAWE *version*: +- [ ] WorldEdit *version*: + +### Description of the problem: + + + +### How to replicate: -**[REQUIRED] Checklist**: +## Additional Information: +> The information here is optional for you to provide, however it may help us to more readily diagnose any compatibility and bug issues. + +### Other plugins being used on the server: + + +### Relevant console output, log lines, and/or screenshots: + + +### Additional relevant comments/remarks: + + +# AFFIRMATION OF COMPLETION: -- [] I included all information required in the sections above -- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) -- [] I made sure I am using an up-to-date version of PlotSquared -- [] I made sure the bug/error is not caused by any other plugin +- [ ] I included all information required in the sections above +- [ ] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) +- [ ] I made sure I am using an up-to-date version of PlotSquared +- [ ] I made sure the bug/error is not caused by any other plugin +- [x] I didn't read but checked everything above. From e972cb4c1a021a144976c01a964b19aca6813ec9 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 4 Nov 2019 00:33:04 +0100 Subject: [PATCH 166/258] Make flag error messages translatable --- .../plotsquared/plot/config/Captions.java | 14 +++++++++++++- .../plotsquared/plot/flag/BooleanFlag.java | 2 +- .../plotsquared/plot/flag/DoubleFlag.java | 2 +- .../plotsquared/plot/flag/EnumFlag.java | 2 +- .../plotsquared/plot/flag/GameModeFlag.java | 2 +- .../plotsquared/plot/flag/IntegerFlag.java | 2 +- .../plotsquared/plot/flag/IntegerListFlag.java | 2 +- .../plotsquared/plot/flag/IntervalFlag.java | 2 +- .../plotsquared/plot/flag/LongFlag.java | 2 +- .../plotsquared/plot/flag/PlotBlockListFlag.java | 2 +- .../plotsquared/plot/flag/PlotWeatherFlag.java | 2 +- .../plotsquared/plot/flag/StringFlag.java | 2 +- .../plotsquared/plot/flag/StringListFlag.java | 2 +- 13 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index c319303b6..a27711e2b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -548,7 +548,19 @@ public enum Captions { FLAG_CATEGORY_BOOLEAN("Boolean Flags", "Flags"), FLAG_CATEGORY_MIXED("Mixed Value Flags", "Flags"), // - + // + FLAG_ERROR_BOOLEAN("Flag value must be a boolean (true|false)", "Flags"), + FLAG_ERROR_ENUM("Must be one of: %s", "Flags"), + FLAG_ERROR_GAMEMODE("Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator.", "Flags"), + FLAG_ERROR_INTEGER("Flag value must be a whole number", "Flags"), + FLAG_ERROR_INTEGER_LIST("Flag value must be an integer list", "Flags"), + FLAG_ERROR_INTERVAL("Value(s) must be numeric. /plot set flag [amount]", "Flags"), + FLAG_ERROR_LONG("Flag value must be a whole number (large numbers allowed)", "Flags"), + FLAG_ERROR_PLOTBLOCKLIST("Flag value must be a block list", "Flags"), + FLAG_ERROR_WEATHER("Flag must be a weather: 'rain' or 'sun'", "Flags"), + FLAG_ERROR_STRING("Flag value must be alphanumeric. Some special characters are allowed.", "Flags"), + FLAG_ERROR_STRINGLIST("Flag value must be a string list", "Flags"), + // // TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java index 841df766c..692c0b501 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java @@ -31,7 +31,7 @@ public class BooleanFlag extends Flag { } @Override public String getValueDescription() { - return "Flag value must be a boolean (true|false)"; + return Captions.FLAG_ERROR_BOOLEAN.getTranslated(); } public boolean isTrue(Plot plot) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java index 8cc665471..ab2c86c45 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java @@ -22,6 +22,6 @@ public class DoubleFlag extends Flag { } @Override public String getValueDescription() { - return "Flag value must be a number."; + return Captions.FLAG_ERROR_BOOLEAN.getTranslated(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java index 88119bbaa..06936d4df 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java @@ -28,6 +28,6 @@ public class EnumFlag extends Flag { } @Override public String getValueDescription() { - return "Must be one of: " + StringMan.getString(values); + return Captions.FLAG_ERROR_ENUM.getTranslated() + StringMan.getString(values); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index 26510b35b..023bf804a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -37,6 +37,6 @@ public class GameModeFlag extends Flag { } @Override public String getValueDescription() { - return "Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator'"; + return Captions.FLAG_ERROR_GAMEMODE.getTranslated(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java index ced532cd1..8b527c46a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java @@ -10,7 +10,7 @@ public class IntegerFlag extends Flag { } @Override public String getValueDescription() { - return "Flag value must be a whole number"; + return Captions.FLAG_ERROR_INTEGER.getTranslated(); } @Override public String valueToString(Object value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java index 1f24cb4a3..e9162000b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java @@ -27,6 +27,6 @@ public class IntegerListFlag extends ListFlag> { } @Override public String getValueDescription() { - return "Flag value must be an integer list"; + return Captions.FLAG_ERROR_INTEGER_LIST.getTranslated(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java index 0468c59b2..7b6b64d47 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java @@ -40,7 +40,7 @@ public class IntervalFlag extends Flag { } @Override public String getValueDescription() { - return "Value(s) must be numeric. /plot set flag [amount]"; + return Captions.FLAG_ERROR_INTERVAL.getTranslated(); } @EqualsAndHashCode @RequiredArgsConstructor @Getter public static final class Interval { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java index 8d57e8865..1d8846701 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java @@ -21,6 +21,6 @@ public class LongFlag extends Flag { } @Override public String getValueDescription() { - return "Flag value must be a whole number (large numbers allowed)"; + return Captions.FLAG_ERROR_LONG.getTranslated(); } } 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..1abaf32b0 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 @@ -29,6 +29,6 @@ public class PlotBlockListFlag extends ListFlag> { } @Override public String getValueDescription() { - return "Flag value must be a block list"; + return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java index 43544748f..1893d5370 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java @@ -31,6 +31,6 @@ public class PlotWeatherFlag extends Flag { } @Override public String getValueDescription() { - return "Flag must be a weather: 'rain' or 'sun'"; + return Captions.FLAG_ERROR_WEATHER.getTranslated(); } } 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..779f47e0d 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 @@ -18,6 +18,6 @@ public class StringFlag extends Flag { } @Override public String getValueDescription() { - return "Flag value must be alphanumeric. Some special characters are allowed."; + return Captions.FLAG_ERROR_STRING.getTranslated(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java index a1e28aa3d..eb76ec8c1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java @@ -22,6 +22,6 @@ public class StringListFlag extends ListFlag> { } @Override public String getValueDescription() { - return "Flag value must be a string list"; + return Captions.FLAG_ERROR_STRINGLIST.getTranslated(); } } From 315f26fb82c58b98f7dd0bf16bb06939c9ec663a Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 4 Nov 2019 00:46:08 +0100 Subject: [PATCH 167/258] Add missing color --- .../intellectualsites/plotsquared/bukkit/BukkitMain.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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..a7835f8db 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 @@ -698,11 +698,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } if (Settings.UUID.OFFLINE) { - PlotSquared.log(Captions.PREFIX + " &6" + getPluginName() + PlotSquared.log(Captions.PREFIX + "&6" + getPluginName() + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + "Bukkit"); } else { - PlotSquared.log(Captions.PREFIX + "" + getPluginName() + " is using online UUIDs"); + PlotSquared.log(Captions.PREFIX + "&6" + getPluginName() + " is using online UUIDs"); } if (Settings.UUID.USE_SQLUUIDHANDLER) { return new SQLUUIDHandler(wrapper); From 930dee9326d19dbcbdacc3df8d2aa9a090062173 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 4 Nov 2019 17:44:23 +0000 Subject: [PATCH 168/258] 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; From a25511c8496fa92b3bde9b3df07b32a87d9e3285 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 4 Nov 2019 19:22:54 +0100 Subject: [PATCH 169/258] Add custom translations for special flags --- .../intellectualsites/plotsquared/plot/config/Captions.java | 4 +++- .../github/intellectualsites/plotsquared/plot/flag/Flags.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index a27711e2b..68783e02e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -555,11 +555,13 @@ public enum Captions { FLAG_ERROR_INTEGER("Flag value must be a whole number", "Flags"), FLAG_ERROR_INTEGER_LIST("Flag value must be an integer list", "Flags"), FLAG_ERROR_INTERVAL("Value(s) must be numeric. /plot set flag [amount]", "Flags"), + FLAG_ERROR_KEEP("Flag value must be a timestamp or a boolean", "Flags"), FLAG_ERROR_LONG("Flag value must be a whole number (large numbers allowed)", "Flags"), FLAG_ERROR_PLOTBLOCKLIST("Flag value must be a block list", "Flags"), - FLAG_ERROR_WEATHER("Flag must be a weather: 'rain' or 'sun'", "Flags"), + FLAG_ERROR_PRICE("Flag value must be a positive number.", "Flags"), FLAG_ERROR_STRING("Flag value must be alphanumeric. Some special characters are allowed.", "Flags"), FLAG_ERROR_STRINGLIST("Flag value must be a string list", "Flags"), + FLAG_ERROR_WEATHER("Flag must be a weather: 'rain' or 'sun'", "Flags"), // // TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index b21d6fb25..07e71a348 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -40,7 +40,7 @@ public final class Flags { } @Override public String getValueDescription() { - return "Flag value must be a positive number."; + return Captions.FLAG_ERROR_PRICE.getTranslated(); } }; public static final BooleanFlag EXPLOSION = new BooleanFlag("explosion"); @@ -114,7 +114,7 @@ public final class Flags { } @Override public String getValueDescription() { - return "Flag value must be a timestamp or a boolean"; + return Captions.FLAG_ERROR_KEEP.getTranslated(); } }; public static final TeleportDenyFlag DENY_TELEPORT = new TeleportDenyFlag("deny-teleport"); From 37f608258fcbc016e5603414d41cf698a1bba9a1 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 4 Nov 2019 19:55:55 +0000 Subject: [PATCH 170/258] Remove PlotBlock --- .../plotsquared/bukkit/BukkitMain.java | 19 +- .../plotsquared/bukkit/chat/ArrayWrapper.java | 2 + .../plotsquared/bukkit/chat/FancyMessage.java | 2 + .../bukkit/chat/JsonRepresentedObject.java | 2 + .../plotsquared/bukkit/chat/JsonString.java | 2 + .../plotsquared/bukkit/chat/MessagePart.java | 2 + .../plotsquared/bukkit/chat/Reflection.java | 10 + .../bukkit/chat/TextualComponent.java | 2 + .../bukkit/commands/DebugUUID.java | 2 + .../bukkit/events/PlayerClaimPlotEvent.java | 2 + .../bukkit/events/PlayerEnterPlotEvent.java | 2 + .../bukkit/events/PlayerLeavePlotEvent.java | 2 + .../bukkit/events/PlayerPlotDeniedEvent.java | 2 + .../bukkit/events/PlayerPlotHelperEvent.java | 2 + .../bukkit/events/PlayerPlotTrustedEvent.java | 2 + .../events/PlayerTeleportToPlotEvent.java | 2 + .../bukkit/events/PlotAutoMergeEvent.java | 2 + .../bukkit/events/PlotChangeOwnerEvent.java | 2 + .../bukkit/events/PlotClearEvent.java | 2 + .../bukkit/events/PlotComponentSetEvent.java | 2 + .../bukkit/events/PlotDeleteEvent.java | 2 + .../plotsquared/bukkit/events/PlotEvent.java | 2 + .../bukkit/events/PlotFlagAddEvent.java | 2 + .../bukkit/events/PlotFlagRemoveEvent.java | 2 + .../bukkit/events/PlotMergeEvent.java | 2 + .../bukkit/events/PlotRateEvent.java | 2 + .../bukkit/events/PlotUnlinkEvent.java | 2 + .../generator/BukkitAugmentedGenerator.java | 2 + .../bukkit/generator/BukkitPlotGenerator.java | 4 +- .../generator/DelegatePlotGenerator.java | 7 +- .../bukkit/generator/PlotBlockPopulator.java | 4 +- .../bukkit/listeners/ChunkListener.java | 2 + .../bukkit/listeners/EntitySpawnListener.java | 2 + .../bukkit/listeners/ForceFieldListener.java | 2 + .../bukkit/listeners/PlayerEvents.java | 47 +- .../bukkit/listeners/PlotPlusListener.java | 2 + .../bukkit/listeners/SingleWorldListener.java | 2 + .../bukkit/listeners/WorldEvents.java | 2 + .../bukkit/object/BukkitBlockUtil.java | 30 + .../bukkit/object/BukkitLazyBlock.java | 25 - .../bukkit/object/BukkitOfflinePlayer.java | 2 + .../bukkit/object/BukkitPlayer.java | 12 +- .../bukkit/object/entity/AgeableStats.java | 2 + .../bukkit/object/entity/ArmorStandStats.java | 2 + .../bukkit/object/entity/EntityBaseStats.java | 2 + .../bukkit/object/entity/EntityWrapper.java | 2 + .../bukkit/object/entity/HorseStats.java | 2 + .../object/entity/LivingEntityStats.java | 2 + .../entity/ReplicatingEntityWrapper.java | 2 + .../bukkit/object/entity/TameableStats.java | 2 + .../object/entity/TeleportEntityWrapper.java | 2 + .../bukkit/object/schematic/StateWrapper.java | 9 +- .../bukkit/util/BukkitBlockRegistry.java | 18 - .../bukkit/util/BukkitChatManager.java | 2 + .../bukkit/util/BukkitChunkManager.java | 6 +- .../bukkit/util/BukkitCommand.java | 2 + .../bukkit/util/BukkitEconHandler.java | 2 + .../bukkit/util/BukkitEventUtil.java | 2 + .../bukkit/util/BukkitHybridUtils.java | 42 +- .../bukkit/util/BukkitInventoryUtil.java | 4 +- .../bukkit/util/BukkitLegacyMappings.java | 871 ------------------ .../bukkit/util/BukkitSchematicHandler.java | 2 + .../bukkit/util/BukkitSetupUtils.java | 2 + .../bukkit/util/BukkitTaskManager.java | 2 + .../plotsquared/bukkit/util/BukkitUtil.java | 73 +- .../bukkit/util/BukkitVersion.java | 2 + .../plotsquared/bukkit/util/Metrics.java | 3 + .../plotsquared/bukkit/util/NbtFactory.java | 2 + .../bukkit/util/OfflinePlayerUtil.java | 2 + .../plotsquared/bukkit/util/SendChunk.java | 2 + .../plotsquared/bukkit/util/SetGenCB.java | 2 + .../bukkit/util/block/BukkitLocalQueue.java | 49 +- .../bukkit/util/block/GenChunk.java | 42 +- .../bukkit/uuid/DatFileFilter.java | 2 + .../bukkit/uuid/DefaultUUIDWrapper.java | 2 + .../bukkit/uuid/FileUUIDHandler.java | 2 + .../bukkit/uuid/LowerOfflineUUIDWrapper.java | 2 + .../bukkit/uuid/OfflineUUIDWrapper.java | 2 + .../bukkit/uuid/SQLUUIDHandler.java | 2 + .../plotsquared/api/PlotAPI.java | 2 + .../plotsquared/commands/Argument.java | 2 + .../plotsquared/commands/Command.java | 2 + .../plotsquared/commands/CommandCaller.java | 2 + .../commands/CommandDeclaration.java | 2 + .../configuration/Configuration.java | 2 + .../configuration/ConfigurationOptions.java | 2 + .../configuration/ConfigurationSection.java | 2 + .../InvalidConfigurationException.java | 2 + .../configuration/MemoryConfiguration.java | 2 + .../MemoryConfigurationOptions.java | 2 + .../configuration/MemorySection.java | 2 + .../configuration/file/FileConfiguration.java | 2 + .../file/FileConfigurationOptions.java | 2 + .../configuration/file/YamlConfiguration.java | 2 + .../file/YamlConfigurationOptions.java | 2 + .../configuration/file/YamlConstructor.java | 2 + .../configuration/file/YamlRepresenter.java | 2 + .../ConfigurationSerializable.java | 2 + .../ConfigurationSerialization.java | 2 + .../DelegateDeserialization.java | 2 + .../serialization/SerializableAs.java | 2 + .../plotsquared/json/JSONArray.java | 2 + .../plotsquared/json/JSONException.java | 2 + .../plotsquared/json/JSONObject.java | 2 + .../plotsquared/json/JSONString.java | 2 + .../plotsquared/json/JSONTokener.java | 2 + .../plotsquared/json/Property.java | 2 + .../plotsquared/json/XML.java | 2 + .../plotsquared/json/XMLTokener.java | 2 + .../plotsquared/plot/IPlotMain.java | 11 +- .../plotsquared/plot/Platform.java | 2 + .../plotsquared/plot/PlotSquared.java | 6 +- .../plotsquared/plot/PlotVersion.java | 2 + .../plotsquared/plot/commands/Add.java | 2 + .../plotsquared/plot/commands/Alias.java | 2 + .../plotsquared/plot/commands/Area.java | 2 + .../plotsquared/plot/commands/Auto.java | 2 + .../plotsquared/plot/commands/Biome.java | 2 + .../plotsquared/plot/commands/Buy.java | 2 + .../plotsquared/plot/commands/Chat.java | 2 + .../plotsquared/plot/commands/Claim.java | 2 + .../plotsquared/plot/commands/Clear.java | 2 + .../plotsquared/plot/commands/Cluster.java | 2 + .../plot/commands/CommandCategory.java | 2 + .../plotsquared/plot/commands/Comment.java | 2 + .../plotsquared/plot/commands/Condense.java | 2 + .../plotsquared/plot/commands/Confirm.java | 2 + .../plotsquared/plot/commands/Continue.java | 2 + .../plotsquared/plot/commands/Copy.java | 2 + .../plot/commands/CreateRoadSchematic.java | 2 + .../plotsquared/plot/commands/Database.java | 2 + .../plotsquared/plot/commands/Debug.java | 2 + .../plot/commands/DebugAllowUnsafe.java | 2 + .../plot/commands/DebugClaimTest.java | 2 + .../plotsquared/plot/commands/DebugExec.java | 6 +- .../plot/commands/DebugFixFlags.java | 2 + .../plot/commands/DebugImportWorlds.java | 2 + .../plot/commands/DebugLoadTest.java | 2 + .../plotsquared/plot/commands/DebugPaste.java | 2 + .../plot/commands/DebugRoadRegen.java | 2 + .../plot/commands/DebugSaveTest.java | 2 + .../plotsquared/plot/commands/Delete.java | 2 + .../plotsquared/plot/commands/Deny.java | 2 + .../plotsquared/plot/commands/Desc.java | 2 + .../plotsquared/plot/commands/Dislike.java | 2 + .../plotsquared/plot/commands/Done.java | 2 + .../plotsquared/plot/commands/Download.java | 2 + .../plotsquared/plot/commands/FlagCmd.java | 18 +- .../plot/commands/GenerateDocs.java | 2 + .../plotsquared/plot/commands/Grant.java | 2 + .../plotsquared/plot/commands/Help.java | 2 + .../plotsquared/plot/commands/Inbox.java | 2 + .../plotsquared/plot/commands/Info.java | 2 + .../plotsquared/plot/commands/Kick.java | 2 + .../plotsquared/plot/commands/Leave.java | 2 + .../plotsquared/plot/commands/Like.java | 2 + .../plotsquared/plot/commands/ListCmd.java | 2 + .../plotsquared/plot/commands/Load.java | 2 + .../plot/commands/MainCommand.java | 2 + .../plotsquared/plot/commands/Merge.java | 2 + .../plotsquared/plot/commands/Middle.java | 2 + .../plotsquared/plot/commands/Move.java | 2 + .../plotsquared/plot/commands/Music.java | 7 +- .../plotsquared/plot/commands/Near.java | 2 + .../plotsquared/plot/commands/Owner.java | 2 + .../plotsquared/plot/commands/PluginCmd.java | 2 + .../plotsquared/plot/commands/Purge.java | 2 + .../plotsquared/plot/commands/Rate.java | 2 + .../plot/commands/RegenAllRoads.java | 2 + .../plotsquared/plot/commands/Relight.java | 2 + .../plotsquared/plot/commands/Reload.java | 2 + .../plotsquared/plot/commands/Remove.java | 2 + .../plot/commands/RequiredType.java | 2 + .../plotsquared/plot/commands/Save.java | 2 + .../plot/commands/SchematicCmd.java | 2 + .../plotsquared/plot/commands/Set.java | 12 +- .../plotsquared/plot/commands/SetCommand.java | 2 + .../plotsquared/plot/commands/SetHome.java | 2 + .../plotsquared/plot/commands/Setup.java | 2 + .../plotsquared/plot/commands/SubCommand.java | 2 + .../plotsquared/plot/commands/Swap.java | 2 + .../plotsquared/plot/commands/Target.java | 2 + .../plotsquared/plot/commands/Template.java | 2 + .../plotsquared/plot/commands/Toggle.java | 2 + .../plotsquared/plot/commands/Trim.java | 2 + .../plotsquared/plot/commands/Trust.java | 2 + .../plotsquared/plot/commands/Unlink.java | 2 + .../plotsquared/plot/commands/Visit.java | 2 + .../plot/commands/WE_Anywhere.java | 2 + .../plotsquared/plot/config/Captions.java | 2 + .../plotsquared/plot/config/Config.java | 2 + .../plot/config/Configuration.java | 16 +- .../plot/config/ConfigurationNode.java | 6 +- .../plotsquared/plot/config/Settings.java | 2 + .../plotsquared/plot/config/Storage.java | 2 + .../plotsquared/plot/database/AbstractDB.java | 2 + .../plotsquared/plot/database/DBFunc.java | 2 + .../plotsquared/plot/database/Database.java | 2 + .../plotsquared/plot/database/MySQL.java | 2 + .../plotsquared/plot/database/SQLManager.java | 2 + .../plotsquared/plot/database/SQLite.java | 2 + .../plotsquared/plot/database/StmtMod.java | 2 + .../plot/flag/BlockStateListFlag.java | 40 + .../plotsquared/plot/flag/BooleanFlag.java | 2 + .../plotsquared/plot/flag/DoubleFlag.java | 2 + .../plotsquared/plot/flag/EnumFlag.java | 2 + .../plotsquared/plot/flag/Flag.java | 2 + .../plotsquared/plot/flag/FlagManager.java | 2 + .../plotsquared/plot/flag/Flags.java | 8 +- .../plotsquared/plot/flag/GameModeFlag.java | 2 + .../plotsquared/plot/flag/IntegerFlag.java | 2 + .../plot/flag/IntegerListFlag.java | 2 + .../plotsquared/plot/flag/IntervalFlag.java | 2 + .../plotsquared/plot/flag/ListFlag.java | 2 + .../plotsquared/plot/flag/LongFlag.java | 2 + .../plot/flag/PlotBlockListFlag.java | 33 - .../plot/flag/PlotWeatherFlag.java | 2 + .../plotsquared/plot/flag/StringFlag.java | 2 + .../plotsquared/plot/flag/StringListFlag.java | 2 + .../plot/flag/TeleportDenyFlag.java | 2 + .../plot/generator/AugmentedUtils.java | 13 +- .../plot/generator/ClassicPlotManager.java | 22 +- .../plot/generator/ClassicPlotWorld.java | 28 +- .../plot/generator/GeneratorWrapper.java | 2 + .../plot/generator/GridPlotManager.java | 2 + .../plot/generator/GridPlotWorld.java | 2 + .../plotsquared/plot/generator/HybridGen.java | 8 +- .../plot/generator/HybridPlotManager.java | 12 +- .../plot/generator/HybridPlotWorld.java | 12 +- .../plot/generator/HybridUtils.java | 12 +- .../generator/IndependentPlotGenerator.java | 2 + .../plot/generator/PlotGenerator.java | 2 + .../plot/generator/SquarePlotManager.java | 2 + .../plot/generator/SquarePlotWorld.java | 2 + .../plot/listener/ExtentWrapper.java | 2 + .../plot/listener/PlayerBlockEventType.java | 2 + .../plot/listener/PlotListener.java | 25 +- .../plot/listener/ProcessedWEExtent.java | 2 + .../plotsquared/plot/listener/WEExtent.java | 2 + .../plotsquared/plot/listener/WEManager.java | 2 + .../plot/listener/WESubscriber.java | 2 + .../plot/logger/DelegateLogger.java | 2 + .../plotsquared/plot/logger/ILogger.java | 2 + .../plotsquared/plot/object/BlockBucket.java | 51 +- .../plotsquared/plot/object/BlockLoc.java | 2 + .../plot/object/BlockRegistry.java | 34 - .../plotsquared/plot/object/ChunkWrapper.java | 2 + .../plotsquared/plot/object/CmdInstance.java | 2 + .../plot/object/ConsolePlayer.java | 7 +- .../plotsquared/plot/object/Direction.java | 2 + .../plotsquared/plot/object/Expression.java | 2 + .../plotsquared/plot/object/FileBytes.java | 2 + .../plotsquared/plot/object/LazyBlock.java | 7 +- .../plotsquared/plot/object/LazyResult.java | 2 + .../plot/object/LegacyPlotBlock.java | 71 -- .../plotsquared/plot/object/Location.java | 2 + .../plot/object/OfflinePlotPlayer.java | 2 + .../plotsquared/plot/object/Plot.java | 6 +- .../plotsquared/plot/object/PlotArea.java | 2 + .../plotsquared/plot/object/PlotBlock.java | 138 --- .../plotsquared/plot/object/PlotCluster.java | 2 + .../plotsquared/plot/object/PlotFilter.java | 2 + .../plotsquared/plot/object/PlotHandler.java | 2 + .../plotsquared/plot/object/PlotId.java | 2 + .../plot/object/PlotInventory.java | 2 + .../plot/object/PlotItemStack.java | 18 +- .../plotsquared/plot/object/PlotLoc.java | 2 + .../plotsquared/plot/object/PlotManager.java | 2 + .../plotsquared/plot/object/PlotMessage.java | 2 + .../plotsquared/plot/object/PlotPlayer.java | 6 +- .../plotsquared/plot/object/PlotSettings.java | 2 + .../plotsquared/plot/object/PseudoRandom.java | 2 + .../plotsquared/plot/object/Rating.java | 2 + .../plot/object/RegionWrapper.java | 2 + .../plotsquared/plot/object/RunnableVal.java | 2 + .../plotsquared/plot/object/RunnableVal2.java | 2 + .../plotsquared/plot/object/RunnableVal3.java | 2 + .../plotsquared/plot/object/SetupObject.java | 2 + .../plot/object/StringPlotBlock.java | 100 -- .../plot/object/StringWrapper.java | 2 + .../plot/object/chat/PlainChatManager.java | 2 + .../collection/FlatRandomCollection.java | 2 + .../object/collection/RandomCollection.java | 2 + .../collection/SimpleRandomCollection.java | 2 + .../plot/object/comment/CommentInbox.java | 2 + .../plot/object/comment/InboxOwner.java | 2 + .../plot/object/comment/InboxPublic.java | 2 + .../plot/object/comment/InboxReport.java | 2 + .../plot/object/comment/PlotComment.java | 2 + .../plot/object/schematic/ItemType.java | 307 ------ .../plot/object/schematic/PlotItem.java | 9 +- .../plot/object/schematic/Schematic.java | 8 +- .../plot/object/schematic/StoredEntity.java | 2 + .../stream/AbstractDelegateOutputStream.java | 2 + .../object/worlds/DefaultPlotAreaManager.java | 2 + .../plot/object/worlds/PlotAreaManager.java | 2 + .../plot/object/worlds/SinglePlot.java | 2 + .../plot/object/worlds/SinglePlotArea.java | 2 + .../object/worlds/SinglePlotAreaManager.java | 2 + .../plot/object/worlds/SinglePlotManager.java | 2 + .../object/worlds/SingleWorldGenerator.java | 18 +- .../plotsquared/plot/util/ArrayUtil.java | 2 + .../plot/util/ByteArrayUtilities.java | 2 + .../plotsquared/plot/util/ChatManager.java | 2 + .../plotsquared/plot/util/ChunkManager.java | 2 + .../plotsquared/plot/util/CmdConfirm.java | 2 + .../plotsquared/plot/util/CommentManager.java | 2 + .../plotsquared/plot/util/ConsoleColors.java | 2 + .../plotsquared/plot/util/EconHandler.java | 2 + .../plotsquared/plot/util/EntityUtil.java | 2 + .../plotsquared/plot/util/EventUtil.java | 98 +- .../plotsquared/plot/util/HttpUtil.java | 2 + .../plotsquared/plot/util/IncendoPaster.java | 2 + .../plotsquared/plot/util/InventoryUtil.java | 2 + .../plot/util/LegacyConverter.java | 22 +- .../plotsquared/plot/util/LegacyMappings.java | 15 - .../plotsquared/plot/util/MainUtil.java | 2 + .../plotsquared/plot/util/MathMan.java | 2 + .../plotsquared/plot/util/Permissions.java | 2 + .../plotsquared/plot/util/PlotGameMode.java | 2 + .../plotsquared/plot/util/PlotWeather.java | 2 + .../plot/util/ReflectionUtils.java | 2 + .../plotsquared/plot/util/RegExUtil.java | 2 + .../plot/util/SchematicHandler.java | 12 +- .../plotsquared/plot/util/SetupUtils.java | 2 + .../plot/util/StringComparison.java | 2 + .../plotsquared/plot/util/StringMan.java | 2 + .../plotsquared/plot/util/TaskManager.java | 2 + .../plotsquared/plot/util/UUIDHandler.java | 2 + .../plot/util/UUIDHandlerImplementation.java | 2 + .../plotsquared/plot/util/UpdateUtility.java | 2 + .../plotsquared/plot/util/WorldUtil.java | 14 +- .../plotsquared/plot/util/area/QuadMap.java | 2 + .../plot/util/block/BasicLocalBlockQueue.java | 16 +- .../plot/util/block/BlockUtil.java | 89 ++ .../util/block/DelegateLocalBlockQueue.java | 8 +- .../plot/util/block/GlobalBlockQueue.java | 2 + .../plotsquared/plot/util/block/ItemUtil.java | 30 + .../plot/util/block/LocalBlockQueue.java | 10 +- .../util/block/OffsetLocalBlockQueue.java | 2 + .../plot/util/block/QueueProvider.java | 2 + .../util/block/ScopedLocalBlockQueue.java | 6 +- .../plot/util/expiry/ExpireManager.java | 2 + .../plot/util/expiry/ExpirySettings.java | 2 + .../plot/util/expiry/ExpiryTask.java | 2 + .../plot/util/expiry/PlotAnalysis.java | 2 + .../plot/util/helpmenu/HelpMenu.java | 2 + .../plot/util/helpmenu/HelpObject.java | 2 + .../plot/util/helpmenu/HelpPage.java | 2 + .../plotsquared/plot/uuid/UUIDWrapper.java | 2 + .../plotsquared/plot/FlagTest.java | 12 +- .../plotsquared/plot/PlotVersionTest.java | 2 + .../plot/database/AbstractDBTest.java | 2 + .../plotsquared/plot/object/LocationTest.java | 2 + .../plotsquared/plot/util/EventUtilTest.java | 2 + .../util/UUIDHandlerImplementationTest.java | 2 + build.gradle | 8 + 357 files changed, 1254 insertions(+), 2020 deletions(-) create mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java delete mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitLazyBlock.java delete mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitBlockRegistry.java delete mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockRegistry.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/ItemType.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyMappings.java create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.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 a851207cd..08a8dc4be 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.bukkit.listeners.ChunkListener; import com.github.intellectualsites.plotsquared.bukkit.listeners.EntitySpawnListener; @@ -7,7 +9,6 @@ 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.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; @@ -15,7 +16,6 @@ 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; @@ -38,7 +38,6 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.HybridGen; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; @@ -55,7 +54,6 @@ 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; @@ -69,6 +67,7 @@ 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 com.sk89q.worldedit.bukkit.BukkitBlockRegistry; import io.papermc.lib.PaperLib; import lombok.Getter; import lombok.NonNull; @@ -113,9 +112,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } - private final LegacyMappings legacyMappings = new BukkitLegacyMappings(); - private final BlockRegistry blockRegistry = - new BukkitBlockRegistry(Material.values()); private int[] version; @Getter private String pluginName; @Getter private SingleWorldListener singleWorldListener; @@ -831,13 +827,4 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } return names; } - - @Override public BlockRegistry getBlockRegistry() { - return this.blockRegistry; - } - - @Override public LegacyMappings getLegacyMappings() { - return this.legacyMappings; - } - } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java index 064d77d86..2b61b3d53 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.apache.commons.lang.Validate; import java.lang.reflect.Array; 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 348f50f9a..911ca6b3c 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java index 04f036526..32c365171 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.gson.stream.JsonWriter; import java.io.IOException; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java index 7f8dd4d29..9d9d7ab9c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.gson.stream.JsonWriter; import org.bukkit.configuration.serialization.ConfigurationSerializable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java index 64bdda48d..deeeea0b3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; import com.google.gson.stream.JsonWriter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java index f3f004284..3d9e731c1 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.Bukkit; import java.lang.reflect.Field; @@ -21,6 +23,8 @@ public final class Reflection { private static final Map> _loadedNMSClasses = new HashMap<>(); /** * Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages). + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; */ private static final Map> _loadedOBCClasses = new HashMap<>(); private static final Map, Map> _loadedFields = new HashMap<>(); @@ -37,7 +41,11 @@ public final class Reflection { /** * Gets the version string from the package name of the CraftBukkit server implementation. + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * This is needed to bypass the JAR package name changing on each update. + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * * @return The version string of the OBC and NMS packages, including the trailing dot. */ @@ -79,6 +87,8 @@ public final class Reflection { * The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously). * * @param className The name of the class, excluding the package, within OBC. This name may contain a subpackage name, such as {@code inventory.CraftItemStack}. + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * @return The class instance representing the specified OBC class, or {@code null} if it could not be loaded. */ public synchronized static Class getOBCClass(String className) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java index 14e3d2305..c292f7d5f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.gson.stream.JsonWriter; 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 49d399da1..9765d38b9 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.uuid.DatFileFilter; import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper; import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java index 269b64296..c8fbc78a4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java index a40365b40..c0b0702e0 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java index 36482d44c..04ea1a344 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java index c9c4d56b9..23c011e8f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java index 573d53ea8..174bd1673 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java index f2f9efe71..4ee2d9ca0 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java index 79d43391e..6a4c4bccd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java index 059b296cf..8722d86b4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import lombok.Getter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java index 3fba03284..4c71093b3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.entity.Player; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java index b4ab469a2..e4354d4fe 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java index 6911ccdd4..4c347657e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java index 5199496ff..4720a0353 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java index ae4b0c1d7..d8ea39fc3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Event; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java index e8c4ac63c..e55b33920 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java index 3e3e48b55..b8617e361 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java index 55488011e..9e1822960 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import lombok.Getter; import lombok.Setter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java index b6ca46593..9e494ba1c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.Rating; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java index 5db7d04d4..00a4d39dc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import lombok.Getter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java index 03b0c8123..85872ca9c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; import org.bukkit.Chunk; import org.bukkit.World; 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 53a7dd358..4fc0618cd 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.bukkit.util.block.GenChunk; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -41,7 +43,7 @@ public class BukkitPlotGenerator extends ChunkGenerator this.plotGenerator = generator; this.platformGenerator = this; this.populators = new ArrayList<>(); - this.populators.add(new PlotBlockPopulator(this.plotGenerator)); + this.populators.add(new BlockStatePopulator(this.plotGenerator)); this.full = true; MainUtil.initCache(); } 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 6a2655d24..0ffcad59c 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; @@ -7,7 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGe 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.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; 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; @@ -45,7 +48,7 @@ import java.util.Random; for (short x = 0; x < 16; x++) { for (short z = 0; z < 16; z++) { blockBuckets[0][(z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("bedrock")); + BlockBucket.withSingle(BlockUtil.get("bedrock")); } } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java index 9236e184a..3e24f900f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; @@ -15,7 +17,7 @@ import org.jetbrains.annotations.NotNull; import java.util.Random; -@RequiredArgsConstructor final class PlotBlockPopulator extends BlockPopulator { +@RequiredArgsConstructor final class BlockStatePopulator extends BlockPopulator { private final IndependentPlotGenerator plotGenerator; private LocalBlockQueue queue; 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 046c0de8f..aa13e9dc5 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index a982f39fd..2e5c8fcc8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java index d2d588970..86136afeb 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 f70d7f46b..d622d6d71 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 @@ -1,7 +1,9 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; -import com.github.intellectualsites.plotsquared.bukkit.object.BukkitLazyBlock; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -13,7 +15,8 @@ import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; 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.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotHandler; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; @@ -29,6 +32,7 @@ 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 com.sk89q.worldedit.world.block.BlockType; import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -37,7 +41,6 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; 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.Ageable; @@ -142,6 +145,7 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.function.Supplier; import java.util.regex.Pattern; /** @@ -1103,10 +1107,10 @@ import java.util.regex.Pattern; return; } if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() - .contains(PlotBlock.get(block.getType().name()))) { + .contains(BukkitAdapter.asBlockType(block.getType()))) { return; } if (Permissions @@ -1388,10 +1392,10 @@ import java.util.regex.Pattern; } PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() - .contains(PlotBlock.get(block.getType().name())) || Permissions + .contains(BukkitBlockUtil.get(block)) || Permissions .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { return; } @@ -1623,7 +1627,7 @@ import java.util.regex.Pattern; if (!PlotSquared.get().hasPlotArea(event.getWorld().getName())) { return; } - List blocks = event.getBlocks(); + List blocks = event.getBlocks(); if (blocks.isEmpty()) { return; } @@ -1737,7 +1741,7 @@ import java.util.regex.Pattern; } } Block block = player.getTargetBlock(null, 7); - BlockState state = block.getState(); + org.bukkit.block.BlockState state = block.getState(); if (state == null) { return; } @@ -1916,9 +1920,10 @@ import java.util.regex.Pattern; Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY); if (block != null && block.getType() != Material.AIR) { Location location = BukkitUtil.getLocation(block.getLocation()); + Material finalType = type; if (!EventUtil.manager - .checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, - new BukkitLazyBlock(PlotBlock.get(type.toString())), true)) { + .checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, () -> BukkitAdapter.asBlockType( + finalType).getDefaultState(), true)) { event.setCancelled(true); event.setUseItemInHand(Event.Result.DENY); } @@ -1936,14 +1941,14 @@ import java.util.regex.Pattern; return; } PlayerBlockEventType eventType = null; - BukkitLazyBlock lb; + Supplier lb; Location location; Action action = event.getAction(); switch (action) { case PHYSICAL: { eventType = PlayerBlockEventType.TRIGGER_PHYSICAL; Block block = event.getClickedBlock(); - lb = new BukkitLazyBlock(block); + lb = BukkitBlockUtil.supply(block); location = BukkitUtil.getLocation(block.getLocation()); break; } @@ -2112,7 +2117,7 @@ import java.util.regex.Pattern; eventType = PlayerBlockEventType.INTERACT_BLOCK; } } - lb = new BukkitLazyBlock(PlotBlock.get(block.getType().toString())); + lb = BukkitBlockUtil.supply(block); if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK || !player.isSneaking())) { break; @@ -2131,7 +2136,7 @@ import java.util.regex.Pattern; type = offType; } // in the following, lb needs to have the material of the item in hand i.e. type - lb = new BukkitLazyBlock(PlotBlock.get(type.toString())); + lb = BukkitBlockUtil.supply(type); if (type.isBlock()) { location = BukkitUtil .getLocation(block.getRelative(event.getBlockFace()).getLocation()); @@ -2214,7 +2219,7 @@ import java.util.regex.Pattern; Block block = event.getClickedBlock(); location = BukkitUtil.getLocation(block.getLocation()); eventType = PlayerBlockEventType.BREAK_BLOCK; - lb = new BukkitLazyBlock(block); + lb = BukkitBlockUtil.supply(block); break; default: return; @@ -2473,7 +2478,7 @@ import java.util.regex.Pattern; Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(pp.getUUID())) { - if (Flags.USE.contains(plot, PlotBlock.get(event.getBucket().name()))) { + if (Flags.USE.contains(plot, BukkitBlockUtil.get(block))) { return; } if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -2533,9 +2538,9 @@ import java.util.regex.Pattern; Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> use = plot.getFlag(Flags.USE); + Optional> use = plot.getFlag(Flags.USE); Block block = event.getBlockClicked(); - if (use.isPresent() && use.get().contains(PlotBlock.get(block.getType().name()))) { + if (use.isPresent() && use.get().contains(BukkitBlockUtil.get(block))) { return; } if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -3091,10 +3096,10 @@ import java.util.regex.Pattern; return; } } else if (!plot.isAdded(pp.getUUID())) { - Set place = plot.getFlag(Flags.PLACE, null); + Set place = plot.getFlag(Flags.PLACE, null); if (place != null) { Block block = event.getBlock(); - if (place.contains(PlotBlock.get(block.getType().name()))) { + if (place.contains(BukkitBlockUtil.get(block))) { return; } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java index b103ed7de..a3a82441d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java index a53527fc9..47274c696 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java index afa821975..243e72dcb 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java new file mode 100644 index 000000000..9c6672a49 --- /dev/null +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java @@ -0,0 +1,30 @@ +package com.github.intellectualsites.plotsquared.bukkit.object; + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.github.intellectualsites.plotsquared.plot.object.LazyBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockState; +import org.bukkit.Material; +import org.bukkit.block.Block; + +import java.util.function.Supplier; + +public class BukkitBlockUtil { + public static Supplier supply(Block block) { + return () -> BukkitAdapter.asBlockType(block.getType()).getDefaultState(); + } + + public static Supplier supply(Material type) { + return () -> BukkitAdapter.asBlockType(type).getDefaultState(); + } + + public static BlockState get(Block block) { + return get(block.getType()); + } + + public static BlockState get(Material material) { + return BukkitAdapter.asBlockType(material).getDefaultState(); + } +} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitLazyBlock.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitLazyBlock.java deleted file mode 100644 index 0903e78d9..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitLazyBlock.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.object; - -import com.github.intellectualsites.plotsquared.plot.object.LazyBlock; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; -import org.bukkit.block.Block; - -public class BukkitLazyBlock extends LazyBlock { - - private StringPlotBlock pb; - - public BukkitLazyBlock(Block block) { - this.pb = (StringPlotBlock) PlotBlock.get(block.getType().toString()); - } - - public BukkitLazyBlock(StringPlotBlock pb) { - this.pb = pb; - } - - public StringPlotBlock getPlotBlock() { - return this.pb; - } - - -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java index 7c52a25de..b26182f3f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 918a5ab3b..80b4fb9c5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -1,10 +1,13 @@ package com.github.intellectualsites.plotsquared.bukkit.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + 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.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -12,6 +15,7 @@ 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.UUIDHandler; +import com.sk89q.worldedit.world.item.ItemType; import io.papermc.lib.PaperLib; import org.bukkit.GameMode; import org.bukkit.Material; @@ -277,8 +281,8 @@ public class BukkitPlayer extends PlotPlayer { this.player.setAllowFlight(fly); } - @Override public void playMusic(@NotNull final Location location, @NotNull final PlotBlock id) { - if (PlotBlock.isEverything(id) || id.isAir()) { + @Override public void playMusic(@NotNull final Location location, @NotNull final ItemType id) { + if (id.getBlockType().getMaterial().isAir()) { // Let's just stop all the discs because why not? for (final Sound sound : Arrays.stream(Sound.values()) .filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) { @@ -288,7 +292,7 @@ public class BukkitPlayer extends PlotPlayer { } else { // this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, id.to(Material.class)); this.player.playSound(BukkitUtil.getLocation(location), - Sound.valueOf(id.to(Material.class).name()), Float.MAX_VALUE, 1f); + Sound.valueOf(BukkitAdapter.adapt(id).name()), Float.MAX_VALUE, 1f); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java index 5769f0e46..b53edc5ea 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + class AgeableStats { int age; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java index 56b36e2bb..44ebdb8b6 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + class ArmorStandStats { final float[] head = new float[3]; 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 c36236a5d..94c93f1fb 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + class EntityBaseStats { EntityWrapper passenger; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java index d0b6f28b5..b0e34a99c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import lombok.Getter; import lombok.NonNull; import org.bukkit.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java index 7fd976258..86c10e868 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.entity.Horse; class HorseStats { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java index c702ffaa7..e6f8411f2 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; 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 a237bf96a..5e7b8f2d2 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import org.bukkit.Art; import org.bukkit.DyeColor; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java index f9e8ded36..4dfa1939b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.entity.AnimalTamer; class TameableStats { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java index 7456ae10e..fcfbce2b8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import org.bukkit.Chunk; import org.bukkit.Location; 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 3d5c75edf..8f05a41f7 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.schematic; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -12,7 +14,6 @@ import com.sk89q.jnbt.Tag; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; -import org.bukkit.block.BlockState; import org.bukkit.block.Container; import org.bukkit.block.Sign; import org.bukkit.enchantments.Enchantment; @@ -28,10 +29,10 @@ import java.util.Map.Entry; public class StateWrapper { - public BlockState state = null; + public org.bukkit.block.BlockState state = null; public CompoundTag tag = null; - public StateWrapper(BlockState state) { + public StateWrapper(org.bukkit.block.BlockState state) { this.state = state; } @@ -156,7 +157,7 @@ public class StateWrapper { if (block == null) { return false; } - BlockState state = block.getState(); + org.bukkit.block.BlockState state = block.getState(); switch (tileid) { case "chest": case "beacon": diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitBlockRegistry.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitBlockRegistry.java deleted file mode 100644 index b5ac5f1fb..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitBlockRegistry.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.util; - -import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import lombok.NonNull; -import org.bukkit.Material; - -public class BukkitBlockRegistry extends BlockRegistry { - - public BukkitBlockRegistry(final Material... preInitializedItems) { - super(Material.class, preInitializedItems); - } - - @Override public PlotBlock getPlotBlock(@NonNull final Material item) { - return PlotBlock.get(item.name()); - } - -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java index ef3af32d9..5f5f50ddd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.chat.FancyMessage; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 d768ac32b..c92bf2452 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.entity.EntityWrapper; import com.github.intellectualsites.plotsquared.bukkit.object.entity.ReplicatingEntityWrapper; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -8,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotLoc; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -369,7 +371,7 @@ public class BukkitChunkManager extends ChunkManager { if (id != null) { value.setBlock(x1, y, z1, id); } else { - value.setBlock(x1, y, z1, PlotBlock.get("air")); + value.setBlock(x1, y, z1, BlockUtil.get("air")); } } for (int y = Math.min(128, ids.length); 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 190aa077a..49f6bf87a 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.commands.DebugUUID; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java index a9978b76c..9dfb2c725 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; 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 25ca0e16e..8fb7a41db 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.events.PlayerClaimPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent; 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 2d0e2cfa2..063c1363b 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -8,10 +10,11 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; 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.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -20,6 +23,8 @@ 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.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.World; @@ -28,6 +33,7 @@ import org.bukkit.block.data.Directional; import org.bukkit.generator.ChunkGenerator; import java.util.HashSet; +import java.util.Set; public class BukkitHybridUtils extends HybridUtils { @@ -36,7 +42,7 @@ public class BukkitHybridUtils extends HybridUtils { // int diff, int variety, int vertices, int rotation, int height_sd /* * diff: compare to base by looping through all blocks - * variety: add to HashSet for each PlotBlock + * variety: add to HashSet for each BlockState * height_sd: loop over all blocks and get top block * * vertices: store air map and compare with neighbours @@ -71,8 +77,8 @@ public class BukkitHybridUtils extends HybridUtils { System.gc(); System.gc(); final BlockBucket[][][] oldBlocks = new BlockBucket[256][width][length]; - final PlotBlock[][][] newBlocks = new PlotBlock[256][width][length]; - final BlockBucket airBucket = BlockBucket.withSingle(StringPlotBlock.EVERYTHING); + final BlockState[][][] newBlocks = new BlockState[256][width][length]; + final BlockBucket airBucket = BlockBucket.withSingle(BlockTypes.AIR.getDefaultState()); PlotArea area = PlotSquared.get().getPlotArea(world, null); @@ -128,7 +134,7 @@ public class BukkitHybridUtils extends HybridUtils { for (int y = 0; y < blocks.length; y++) { if (blocks[y] != null) { result[(minY + y) >> 4][(((minY + y) & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get(blocks[y])); + BlockBucket.withSingle(blocks[y].toImmutableState()); } } } @@ -183,45 +189,45 @@ public class BukkitHybridUtils extends HybridUtils { int i = 0; for (int x = 0; x < width; x++) { for (int z = 0; z < length; z++) { - HashSet types = new HashSet<>(); + Set types = new HashSet<>(); for (int y = 0; y < 256; y++) { BlockBucket old = oldBlocks[y][x][z]; try { if (old == null) { old = airBucket; } - PlotBlock now = newBlocks[y][x][z]; + BlockState now = newBlocks[y][x][z]; if (!old.getBlocks().contains(now)) { changes[i]++; } - if (now.isAir()) { + if (now.getBlockType().getMaterial().isAir()) { air[i]++; } else { // check vertices // modifications_adjacent if (x > 0 && z > 0 && y > 0 && x < width - 1 && z < length - 1 && y < 255) { - if (newBlocks[y - 1][x][z].isAir()) { + if (newBlocks[y - 1][x][z].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y][x - 1][z].isAir()) { + if (newBlocks[y][x - 1][z].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y][x][z - 1].isAir()) { + if (newBlocks[y][x][z - 1].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y + 1][x][z].isAir()) { + if (newBlocks[y + 1][x][z].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y][x + 1][z].isAir()) { + if (newBlocks[y][x + 1][z].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y][x][z + 1].isAir()) { + if (newBlocks[y][x][z + 1].getBlockType().getMaterial().isAir()) { faces[i]++; } } - Material material = now.to(Material.class); + Material material = BukkitAdapter.adapt(now.getBlockType()); if (material != null) { BlockData blockData = material.createBlockData(); if (blockData instanceof Directional) { @@ -230,7 +236,7 @@ public class BukkitHybridUtils extends HybridUtils { data[i]++; } } - types.add(now); + types.add(now.getBlockType()); } } catch (NullPointerException e) { e.printStackTrace(); @@ -303,7 +309,7 @@ public class BukkitHybridUtils extends HybridUtils { for (int z = minZ; z <= maxZ; z++) { int zz = cbz + z; for (int y = 0; y < 256; y++) { - PlotBlock block = queue.getBlock(xx, y, zz); + BlockState block = queue.getBlock(xx, y, zz); int xr = xb + x; int zr = zb + z; newBlocks[y][xr][zr] = block; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java index 2c66f8d3f..60408171b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; @@ -56,7 +58,7 @@ public class BukkitInventoryUtil extends InventoryUtil { if (item == null) { return null; } - ItemStack stack = new ItemStack(BukkitUtil.getMaterial(item.getPlotBlock()), item.amount); + ItemStack stack = new ItemStack(BukkitUtil.getMaterial(item.getBlockState()), item.amount); ItemMeta meta = null; if (item.name != null) { meta = stack.getItemMeta(); 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 deleted file mode 100644 index c7d953ea7..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java +++ /dev/null @@ -1,871 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.util; - -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; -import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; -import com.github.intellectualsites.plotsquared.plot.util.StringComparison; -import lombok.AccessLevel; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; -import lombok.ToString; -import org.bukkit.Bukkit; -import org.bukkit.Material; - -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; - -/** - * Borrowed from https://github.com/Phoenix616/IDConverter/blob/master/mappings/src/main/java/de/themoep/idconverter/IdMappings.java - * Original License: - *

    - * Minecraft ID mappings Copyright (C) 2017 Max Lee (https://github.com/Phoenix616) - *

    - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - *

    - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - *

    - * You should have received a copy of the GNU General Public License along with this program. If - * not, see . - */ -public final class BukkitLegacyMappings extends LegacyMappings { - - private static final LegacyBlock[] BLOCKS = - new LegacyBlock[] {new LegacyBlock(0, "air"), new LegacyBlock(1, "stone"), - new LegacyBlock(1, 1, "stone", "granite"), - new LegacyBlock(1, 2, "stone", "polished_granite"), - new LegacyBlock(1, 3, "stone", "diorite"), - new LegacyBlock(1, 4, "stone", "polished_diorite"), - new LegacyBlock(1, 5, "stone", "andesite"), - new LegacyBlock(1, 6, "stone", "polished_andesite"), - new LegacyBlock(2, "grass", "grass_block"), new LegacyBlock(3, "dirt"), - new LegacyBlock(3, 1, "dirt", "coarse_dirt"), new LegacyBlock(3, 2, "dirt", "podzol"), - new LegacyBlock(4, "cobblestone"), new LegacyBlock(5, "wood", "oak_planks"), - new LegacyBlock(5, 1, "wood", "spruce_planks"), - new LegacyBlock(5, 2, "wood", "birch_planks"), - new LegacyBlock(5, 3, "wood", "jungle_planks"), - new LegacyBlock(5, 4, "wood", "acacia_planks"), - new LegacyBlock(5, 5, "wood", "dark_oak_planks"), - new LegacyBlock(6, "sapling", "oak_sapling"), - new LegacyBlock(6, 1, "sapling", "spruce_sapling"), - new LegacyBlock(6, 2, "sapling", "birch_sapling"), - new LegacyBlock(6, 3, "sapling", "jungle_sapling"), - new LegacyBlock(6, 4, "sapling", "acacia_sapling"), - new LegacyBlock(6, 5, "sapling", "dark_oak_sapling"), new LegacyBlock(7, "bedrock"), - new LegacyBlock(8, "water", "flowing_water"), - new LegacyBlock(9, "stationary_water", "water"), - new LegacyBlock(10, "lava", "flowing_lava"), - new LegacyBlock(11, "stationary_lava", "lava"), new LegacyBlock(12, "sand"), - new LegacyBlock(12, 1, "sand", "red_sand"), new LegacyBlock(13, "gravel"), - new LegacyBlock(14, "gold_ore"), new LegacyBlock(15, "iron_ore"), - new LegacyBlock(16, "coal_ore"), new LegacyBlock(17, "log", "oak_log"), - new LegacyBlock(17, 1, "log", "oak_log"), new LegacyBlock(17, 2, "log", "spruce_log"), - new LegacyBlock(17, 3, "log", "birch_log"), new LegacyBlock(17, 4, "log", "jungle_log"), - new LegacyBlock(17, 5, "log", "oak_bark"), new LegacyBlock(17, 6, "log", "spruce_bark"), - new LegacyBlock(17, 7, "log", "birch_bark"), - new LegacyBlock(17, 8, "log", "jungle_bark"), - new LegacyBlock(18, "leaves", "oak_leaves"), - new LegacyBlock(18, 1, "leaves", "spruce_leaves"), - new LegacyBlock(18, 2, "leaves", "birch_leaves"), - new LegacyBlock(18, 3, "leaves", "jungle_leaves"), new LegacyBlock(19, "sponge"), - new LegacyBlock(19, 1, "sponge", "wet_sponge"), new LegacyBlock(20, "glass"), - new LegacyBlock(21, "lapis_ore"), new LegacyBlock(22, "lapis_block"), - new LegacyBlock(23, "dispenser"), new LegacyBlock(24, "sandstone"), - new LegacyBlock(24, 1, "sandstone", "chiseled_sandstone"), - new LegacyBlock(24, 2, "sandstone", "cut_sandstone"), new LegacyBlock(25, "note_block"), - new LegacyBlock(26, "bed_block"), new LegacyBlock(27, "powered_rail"), - new LegacyBlock(28, "detector_rail"), - new LegacyBlock(29, "piston_sticky_base", "sticky_piston"), - new LegacyBlock(30, "web", "cobweb"), new LegacyBlock(31, "long_grass", "dead_bush"), - new LegacyBlock(31, 1, "long_grass", "grass"), - new LegacyBlock(31, 2, "long_grass", "fern"), new LegacyBlock(32, "dead_bush"), - new LegacyBlock(33, "piston_base", "piston"), - new LegacyBlock(34, "piston_extension", "piston_head"), - new LegacyBlock(35, "wool", "white_wool"), - new LegacyBlock(35, 1, "wool", "orange_wool"), - new LegacyBlock(35, 2, "wool", "magenta_wool"), - new LegacyBlock(35, 3, "wool", "light_blue_wool"), - new LegacyBlock(35, 4, "wool", "yellow_wool"), - new LegacyBlock(35, 5, "wool", "lime_wool"), - new LegacyBlock(35, 6, "wool", "pink_wool"), - new LegacyBlock(35, 7, "wool", "gray_wool"), - new LegacyBlock(35, 8, "wool", "light_gray_wool"), - new LegacyBlock(35, 9, "wool", "cyan_wool"), - new LegacyBlock(35, 10, "wool", "purple_wool"), - new LegacyBlock(35, 11, "wool", "blue_wool"), - new LegacyBlock(35, 12, "wool", "brown_wool"), - new LegacyBlock(35, 13, "wool", "green_wool"), - new LegacyBlock(35, 14, "wool", "red_wool"), - new LegacyBlock(35, 15, "wool", "black_wool"), - new LegacyBlock(36, "piston_moving_piece", "moving_piston"), - new LegacyBlock(37, "yellow_flower", "dandelion"), - new LegacyBlock(38, "red_rose", "poppy"), - new LegacyBlock(38, 1, "red_rose", "blue_orchid"), - new LegacyBlock(38, 2, "red_rose", "allium"), - new LegacyBlock(38, 3, "red_rose", "azure_bluet"), - new LegacyBlock(38, 4, "red_rose", "red_tulip"), - new LegacyBlock(38, 5, "red_rose", "orange_tulip"), - new LegacyBlock(38, 6, "red_rose", "white_tulip"), - new LegacyBlock(38, 7, "red_rose", "pink_tulip"), - new LegacyBlock(38, 8, "red_rose", "oxeye_daisy"), - new LegacyBlock(39, "brown_mushroom"), new LegacyBlock(40, "red_mushroom"), - new LegacyBlock(41, "gold_block"), new LegacyBlock(42, "iron_block"), - new LegacyBlock(43, "double_step"), - new LegacyBlock(43, 6, "double_step", "smooth_quartz"), - new LegacyBlock(43, 8, "double_step", "smooth_stone"), - new LegacyBlock(43, 9, "double_step", "smooth_sandstone"), - new LegacyBlock(44, "step", "stone_slab", "smooth_stone_slab"), - new LegacyBlock(44, 1, "step", "sandstone_slab"), - new LegacyBlock(44, 2, "step", "petrified_oak_slab"), - new LegacyBlock(44, 3, "step", "cobblestone_slab"), - new LegacyBlock(44, 4, "step", "brick_slab"), - new LegacyBlock(44, 5, "step", "stone_brick_slab"), - new LegacyBlock(44, 6, "step", "nether_brick_slab"), - new LegacyBlock(44, 7, "step", "quartz_slab"), new LegacyBlock(45, "brick", "bricks"), - new LegacyBlock(46, "tnt"), new LegacyBlock(47, "bookshelf"), - new LegacyBlock(48, "mossy_cobblestone"), new LegacyBlock(49, "obsidian"), - new LegacyBlock(50, "torch"), new LegacyBlock(50, 1, "torch", "wall_torch"), - new LegacyBlock(50, 2, "torch", "wall_torch"), - new LegacyBlock(50, 3, "torch", "wall_torch"), - new LegacyBlock(50, 4, "torch", "wall_torch"), new LegacyBlock(50, 5, "torch"), - new LegacyBlock(51, "fire"), new LegacyBlock(52, "mob_spawner"), - new LegacyBlock(53, "wood_stairs", "oak_stairs"), new LegacyBlock(54, "chest", "chest"), - new LegacyBlock(55, "redstone_wire"), new LegacyBlock(56, "diamond_ore"), - new LegacyBlock(57, "diamond_block"), - new LegacyBlock(58, "workbench", "crafting_table"), - new LegacyBlock(59, "crops", "wheat"), new LegacyBlock(60, "soil", "farmland"), - new LegacyBlock(61, "furnace"), new LegacyBlock(62, "burning_furnace"), - new LegacyBlock(63, "sign_post", "sign", "oak_sign"), - new LegacyBlock(64, "wooden_door", "oak_door"), new LegacyBlock(65, "ladder"), - new LegacyBlock(66, "rails", "rail"), new LegacyBlock(67, "cobblestone_stairs"), - new LegacyBlock(68, "wall_sign", "wall_sign", "oak_wall_sign"), - new LegacyBlock(69, "lever"), - new LegacyBlock(70, "stone_plate", "stone_pressure_plate"), - new LegacyBlock(71, "iron_door_block", "iron_door"), - new LegacyBlock(72, "wood_plate", "oak_pressure_plate"), - new LegacyBlock(73, "redstone_ore"), new LegacyBlock(74, "glowing_redstone_ore"), - new LegacyBlock(75, "redstone_torch_off"), - new LegacyBlock(76, "redstone_torch_on", "redstone_torch"), - new LegacyBlock(76, 1, "redstone_torch_on", "redstone_wall_torch"), - new LegacyBlock(76, 2, "redstone_torch_on", "redstone_wall_torch"), - new LegacyBlock(76, 3, "redstone_torch_on", "redstone_wall_torch"), - new LegacyBlock(76, 4, "redstone_torch_on", "redstone_wall_torch"), - new LegacyBlock(76, 5, "redstone_torch_on", "redstone_torch"), - new LegacyBlock(77, "stone_button"), new LegacyBlock(78, "snow"), - new LegacyBlock(79, "ice"), new LegacyBlock(80, "snow_block"), - new LegacyBlock(81, "cactus"), new LegacyBlock(82, "clay"), - new LegacyBlock(83, "sugar_cane_block", "sugar_cane"), new LegacyBlock(84, "jukebox"), - new LegacyBlock(85, "fence", "oak_fence"), - new LegacyBlock(86, "pumpkin", "carved_pumpkin"), new LegacyBlock(87, "netherrack"), - new LegacyBlock(88, "soul_sand"), new LegacyBlock(89, "glowstone"), - new LegacyBlock(90, "portal"), new LegacyBlock(91, "jack_o_lantern"), - new LegacyBlock(92, "cake_block", "cake"), new LegacyBlock(93, "diode_block_off"), - new LegacyBlock(94, "diode_block_on", "repeater"), - new LegacyBlock(95, "stained_glass", "white_stained_glass"), - new LegacyBlock(95, 1, "stained_glass", "orange_stained_glass"), - new LegacyBlock(95, 2, "stained_glass", "magenta_stained_glass"), - new LegacyBlock(95, 3, "stained_glass", "light_blue_stained_glass"), - new LegacyBlock(95, 4, "stained_glass", "yellow_stained_glass"), - new LegacyBlock(95, 5, "stained_glass", "lime_stained_glass"), - new LegacyBlock(95, 6, "stained_glass", "pink_stained_glass"), - new LegacyBlock(95, 7, "stained_glass", "gray_stained_glass"), - new LegacyBlock(95, 8, "stained_glass", "light_gray_stained_glass"), - new LegacyBlock(95, 9, "stained_glass", "cyan_stained_glass"), - new LegacyBlock(95, 10, "stained_glass", "purple_stained_glass"), - new LegacyBlock(95, 11, "stained_glass", "blue_stained_glass"), - new LegacyBlock(95, 12, "stained_glass", "brown_stained_glass"), - new LegacyBlock(95, 13, "stained_glass", "green_stained_glass"), - new LegacyBlock(95, 14, "stained_glass", "red_stained_glass"), - new LegacyBlock(95, 15, "stained_glass", "black_stained_glass"), - new LegacyBlock(96, "trap_door", "oak_trapdoor"), - new LegacyBlock(97, "monster_eggs", "infested_stone"), - new LegacyBlock(97, 1, "monster_eggs", "infested_cobblestone"), - new LegacyBlock(97, 2, "monster_eggs", "infested_stone_bricks"), - new LegacyBlock(97, 3, "monster_eggs", "infested_mossy_stone_bricks"), - new LegacyBlock(97, 4, "monster_eggs", "infested_cracked_stone_bricks"), - new LegacyBlock(97, 5, "monster_eggs", "infested_chiseled_stone_bricks"), - new LegacyBlock(98, "smooth_brick", "stone_bricks"), - new LegacyBlock(98, 1, "smooth_brick", "mossy_stone_bricks"), - new LegacyBlock(98, 2, "smooth_brick", "cracked_stone_bricks"), - new LegacyBlock(98, 3, "smooth_brick", "chiseled_bricks"), - new LegacyBlock(99, "huge_mushroom_1", "brown_mushroom_block"), - new LegacyBlock(99, 1, "huge_mushroom_1"), new LegacyBlock(99, 2, "huge_mushroom_1"), - new LegacyBlock(99, 3, "huge_mushroom_1"), new LegacyBlock(99, 4, "huge_mushroom_1"), - new LegacyBlock(99, 5, "huge_mushroom_1"), new LegacyBlock(99, 6, "huge_mushroom_1"), - new LegacyBlock(99, 7, "huge_mushroom_1"), new LegacyBlock(99, 8, "huge_mushroom_1"), - new LegacyBlock(99, 9, "huge_mushroom_1"), - new LegacyBlock(99, 10, "huge_mushroom_1", "mushroom_stem"), - new LegacyBlock(99, 14, "huge_mushroom_1"), new LegacyBlock(99, 15, "huge_mushroom_1"), - new LegacyBlock(100, "huge_mushroom_2", "red_mushroom_block"), - new LegacyBlock(100, 1, "huge_mushroom_2"), new LegacyBlock(100, 2, "huge_mushroom_2"), - new LegacyBlock(100, 3, "huge_mushroom_2"), new LegacyBlock(100, 4, "huge_mushroom_2"), - new LegacyBlock(100, 5, "huge_mushroom_2"), new LegacyBlock(100, 6, "huge_mushroom_2"), - new LegacyBlock(100, 7, "huge_mushroom_2"), new LegacyBlock(100, 8, "huge_mushroom_2"), - new LegacyBlock(100, 9, "huge_mushroom_2"), - new LegacyBlock(100, 10, "huge_mushroom_2", "mushroom_stem"), - new LegacyBlock(100, 14, "huge_mushroom_2"), - new LegacyBlock(100, 15, "huge_mushroom_2"), - new LegacyBlock(101, "iron_fence", "iron_bars"), - new LegacyBlock(102, "thin_glass", "glass_pane"), new LegacyBlock(103, "melon_block"), - new LegacyBlock(104, "pumpkin_stem"), new LegacyBlock(105, "melon_stem"), - new LegacyBlock(106, "vine"), new LegacyBlock(107, "fence_gate", "oak_fence_gate"), - new LegacyBlock(108, "brick_stairs"), - new LegacyBlock(109, "smooth_stairs", "stone_brick_stairs"), - new LegacyBlock(110, "mycel", "mycelium"), - new LegacyBlock(111, "water_lily", "lily_pad"), - new LegacyBlock(112, "nether_brick", "nether_bricks"), - new LegacyBlock(113, "nether_fence", "nether_brick_fence"), - new LegacyBlock(114, "nether_brick_stairs"), - new LegacyBlock(115, "nether_warts", "nether_wart"), - new LegacyBlock(116, "enchantment_table", "enchanting_table"), - new LegacyBlock(117, "brewing_stand"), new LegacyBlock(118, "cauldron"), - new LegacyBlock(119, "ender_portal", "end_portal"), - new LegacyBlock(120, "ender_portal_frame", "end_portal_frame"), - new LegacyBlock(121, "ender_stone", "end_stone"), new LegacyBlock(122, "dragon_egg"), - new LegacyBlock(123, "redstone_lamp_off"), - new LegacyBlock(124, "redstone_lamp_on", "redstone_lamp"), - new LegacyBlock(125, "wood_double_step"), new LegacyBlock(125, 1, "wood_double_step"), - new LegacyBlock(125, 2, "wood_double_step"), - new LegacyBlock(125, 3, "wood_double_step"), - new LegacyBlock(125, 4, "wood_double_step"), - new LegacyBlock(125, 5, "wood_double_step"), - new LegacyBlock(126, "wood_step", "oak_slab"), - new LegacyBlock(126, 1, "wood_step", "spruce_slab"), - new LegacyBlock(126, 2, "wood_step", "birch_slab"), - new LegacyBlock(126, 3, "wood_step", "jungle_slab"), - new LegacyBlock(126, 4, "wood_step", "acacia_slab"), - new LegacyBlock(126, 5, "wood_step", "dark_oak_slab"), new LegacyBlock(127, "cocoa"), - new LegacyBlock(128, "sandstone_stairs"), new LegacyBlock(129, "emerald_ore"), - new LegacyBlock(130, "ender_chest"), new LegacyBlock(131, "tripwire_hook"), - new LegacyBlock(132, "tripwire"), new LegacyBlock(133, "emerald_block"), - new LegacyBlock(134, "spruce_wood_stairs", "spruce_stairs"), - new LegacyBlock(135, "birch_wood_stairs", "birch_stairs"), - new LegacyBlock(136, "jungle_wood_stairs", "jungle_stairs"), - new LegacyBlock(137, "command", "command_block"), new LegacyBlock(138, "beacon"), - new LegacyBlock(139, "cobble_wall", "cobblestone_wall"), - new LegacyBlock(139, 1, "cobble_wall", "mossy_cobblestone_wall"), - new LegacyBlock(140, "flower_pot"), new LegacyBlock(141, "carrot", "carrots"), - new LegacyBlock(142, "potato", "potatoes"), - new LegacyBlock(143, "wood_button", "oak_button"), - new LegacyBlock(144, "skull", "skeleton_skull"), - new LegacyBlock(144, 1, "skull", "skeleton_wall_skull"), - new LegacyBlock(144, 2, "skull", "skeleton_wall_skull"), - new LegacyBlock(144, 3, "skull", "skeleton_wall_skull"), - new LegacyBlock(144, 4, "skull", "skeleton_wall_skull"), - new LegacyBlock(144, 5, "skull", "skeleton_wall_skull"), new LegacyBlock(145, "anvil"), - new LegacyBlock(145, 1, "anvil", "chipped_anvil"), - new LegacyBlock(145, 2, "anvil", "damaged_anvil"), - new LegacyBlock(146, "trapped_chest"), - new LegacyBlock(147, "gold_plate", "light_weighted_pressure_plate"), - new LegacyBlock(148, "iron_plate", "heavy_weighted_pressure_plate"), - new LegacyBlock(149, "redstone_comparator_off"), - new LegacyBlock(150, "redstone_comparator_on", "comparator"), - new LegacyBlock(151, "daylight_detector"), new LegacyBlock(152, "redstone_block"), - new LegacyBlock(153, "quartz_ore", "nether_quartz_ore"), new LegacyBlock(154, "hopper"), - new LegacyBlock(155, "quartz_block"), new LegacyBlock(156, "quartz_stairs"), - new LegacyBlock(157, "activator_rail"), new LegacyBlock(158, "dropper"), - new LegacyBlock(159, "stained_clay", "white_terracotta"), - new LegacyBlock(159, 1, "stained_clay", "orange_terracotta"), - new LegacyBlock(159, 2, "stained_clay", "magenta_terracotta"), - new LegacyBlock(159, 3, "stained_clay", "light_blue_terracotta"), - new LegacyBlock(159, 4, "stained_clay", "yellow_terracotta"), - new LegacyBlock(159, 5, "stained_clay", "lime_terracotta"), - new LegacyBlock(159, 6, "stained_clay", "pink_terracotta"), - new LegacyBlock(159, 7, "stained_clay", "gray_terracotta"), - new LegacyBlock(159, 8, "stained_clay", "light_gray_terracotta"), - new LegacyBlock(159, 9, "stained_clay", "cyan_terracotta"), - new LegacyBlock(159, 10, "stained_clay", "purple_terracotta"), - new LegacyBlock(159, 11, "stained_clay", "blue_terracotta"), - new LegacyBlock(159, 12, "stained_clay", "brown_terracotta"), - new LegacyBlock(159, 13, "stained_clay", "green_terracotta"), - new LegacyBlock(159, 14, "stained_clay", "red_terracotta"), - new LegacyBlock(159, 15, "stained_clay", "black_terracotta"), - new LegacyBlock(160, "stained_glass_pane", "white_stained_glass_pane"), - new LegacyBlock(160, 1, "stained_glass_pane", "orange_stained_glass_pane"), - new LegacyBlock(160, 2, "stained_glass_pane", "magenta_stained_glass_pane"), - new LegacyBlock(160, 3, "stained_glass_pane", "light_blue_stained_glass_pane"), - new LegacyBlock(160, 4, "stained_glass_pane", "yellow_stained_glass_pane"), - new LegacyBlock(160, 5, "stained_glass_pane", "lime_stained_glass_pane"), - new LegacyBlock(160, 6, "stained_glass_pane", "pink_stained_glass_pane"), - new LegacyBlock(160, 7, "stained_glass_pane", "gray_stained_glass_pane"), - new LegacyBlock(160, 8, "stained_glass_pane", "light_gray_stained_glass_pane"), - new LegacyBlock(160, 9, "stained_glass_pane", "cyan_stained_glass_pane"), - new LegacyBlock(160, 10, "stained_glass_pane", "purple_stained_glass_pane"), - new LegacyBlock(160, 11, "stained_glass_pane", "blue_stained_glass_pane"), - new LegacyBlock(160, 12, "stained_glass_pane", "brown_stained_glass_pane"), - new LegacyBlock(160, 13, "stained_glass_pane", "green_stained_glass_pane"), - new LegacyBlock(160, 14, "stained_glass_pane", "red_stained_glass_pane"), - new LegacyBlock(160, 15, "stained_glass_pane", "black_stained_glass_pane"), - new LegacyBlock(161, "leaves_2", "acacia_leaves"), - new LegacyBlock(161, 1, "leaves_2", "dark_oak_leaves"), - new LegacyBlock(162, "log_2", "acacia_log"), - new LegacyBlock(162, 1, "log_2", "spruce_log"), - new LegacyBlock(162, 2, "log_2", "birch_log"), - new LegacyBlock(162, 3, "log_2", "jungle_log"), - new LegacyBlock(163, "acacia_stairs", "acacia_stairs"), - new LegacyBlock(164, "dark_oak_stairs", "dark_oak_stairs"), - new LegacyBlock(165, "slime_block", "slime_block"), - new LegacyBlock(166, "barrier", "barrier"), - new LegacyBlock(167, "iron_trapdoor", "iron_trapdoor"), - new LegacyBlock(168, "prismarine"), - new LegacyBlock(168, 1, "prismarine", "prismarine_bricks"), - new LegacyBlock(168, 2, "prismarine", "dark_prismarine"), - new LegacyBlock(169, "sea_lantern"), new LegacyBlock(170, "hay_block"), - new LegacyBlock(171, "carpet", "white_carpet"), - new LegacyBlock(171, 1, "carpet", "orange_carpet"), - new LegacyBlock(171, 2, "carpet", "magenta_carpet"), - new LegacyBlock(171, 3, "carpet", "light_blue_carpet"), - new LegacyBlock(171, 4, "carpet", "yellow_carpet"), - new LegacyBlock(171, 5, "carpet", "lime_carpet"), - new LegacyBlock(171, 6, "carpet", "pink_carpet"), - new LegacyBlock(171, 7, "carpet", "gray_carpet"), - new LegacyBlock(171, 8, "carpet", "light_gray_carpet"), - new LegacyBlock(171, 9, "carpet", "cyan_carpet"), - new LegacyBlock(171, 10, "carpet", "purple_carpet"), - new LegacyBlock(171, 11, "carpet", "blue_carpet"), - new LegacyBlock(171, 12, "carpet", "brown_carpet"), - new LegacyBlock(171, 13, "carpet", "green_carpet"), - new LegacyBlock(171, 14, "carpet", "red_carpet"), - new LegacyBlock(171, 15, "carpet", "black_carpet"), - new LegacyBlock(172, "hard_clay", "terracotta"), new LegacyBlock(173, "coal_block"), - new LegacyBlock(174, "packed_ice"), new LegacyBlock(175, "double_plant", "sunflower"), - new LegacyBlock(175, 1, "double_plant", "lilac"), - new LegacyBlock(175, 2, "double_plant", "tall_grass"), - new LegacyBlock(175, 3, "double_plant", "large_fern"), - new LegacyBlock(175, 4, "double_plant", "rose_bush"), - new LegacyBlock(175, 5, "double_plant", "peony"), - new LegacyBlock(176, "standing_banner"), new LegacyBlock(177, "wall_banner"), - new LegacyBlock(178, "daylight_detector_inverted"), - new LegacyBlock(179, "red_sandstone", "red_sandstone"), - new LegacyBlock(179, 1, "red_sandstone", "chiseled_red_sandstone"), - new LegacyBlock(179, 2, "red_sandstone", "cut_red_sandstone"), - new LegacyBlock(180, "red_sandstone_stairs"), - new LegacyBlock(181, "double_stone_slab2"), - new LegacyBlock(181, 8, "double_stone_slab2", "smooth_red_sandstone"), - new LegacyBlock(182, "stone_slab2", "red_sandstone_slab"), - new LegacyBlock(183, "spruce_fence_gate"), new LegacyBlock(184, "birch_fence_gate"), - new LegacyBlock(185, "jungle_fence_gate"), new LegacyBlock(186, "dark_oak_fence_gate"), - new LegacyBlock(187, "acacia_fence_gate"), new LegacyBlock(188, "spruce_fence"), - new LegacyBlock(189, "birch_fence"), new LegacyBlock(190, "jungle_fence"), - new LegacyBlock(191, "dark_oak_fence"), new LegacyBlock(192, "acacia_fence"), - new LegacyBlock(193, "spruce_door"), new LegacyBlock(194, "birch_door"), - new LegacyBlock(195, "jungle_door"), new LegacyBlock(196, "acacia_door"), - new LegacyBlock(197, "dark_oak_door"), new LegacyBlock(198, "end_rod"), - new LegacyBlock(199, "chorus_plant"), new LegacyBlock(200, "chorus_flower"), - new LegacyBlock(201, "purpur_block"), new LegacyBlock(202, "purpur_pillar"), - new LegacyBlock(203, "purpur_stairs"), new LegacyBlock(204, "purpur_double_slab"), - new LegacyBlock(205, "purpur_slab"), - new LegacyBlock(206, "end_bricks", "end_stone_bricks"), - new LegacyBlock(207, "beetroot_block", "beetroots"), new LegacyBlock(208, "grass_path"), - new LegacyBlock(209, "end_gateway"), - new LegacyBlock(210, "command_repeating", "repeating_command_block"), - new LegacyBlock(211, "command_chain", "chain_command_block"), - new LegacyBlock(212, "frosted_ice"), new LegacyBlock(213, "magma", "magma_block"), - new LegacyBlock(214, "nether_wart_block"), - new LegacyBlock(215, "red_nether_brick", "red_nether_bricks"), - new LegacyBlock(216, "bone_block"), new LegacyBlock(217, "structure_void"), - new LegacyBlock(218, "observer"), new LegacyBlock(219, "white_shulker_box"), - new LegacyBlock(220, "orange_shulker_box"), new LegacyBlock(221, "magenta_shulker_box"), - new LegacyBlock(222, "light_blue_shulker_box"), - new LegacyBlock(223, "yellow_shulker_box"), new LegacyBlock(224, "lime_shulker_box"), - new LegacyBlock(225, "pink_shulker_box"), new LegacyBlock(226, "gray_shulker_box"), - new LegacyBlock(227, "silver_shulker_box", "light_gray_shulker_box"), - new LegacyBlock(228, "cyan_shulker_box"), new LegacyBlock(229, "purple_shulker_box"), - new LegacyBlock(230, "blue_shulker_box"), new LegacyBlock(231, "brown_shulker_box"), - new LegacyBlock(232, "green_shulker_box"), new LegacyBlock(233, "red_shulker_box"), - new LegacyBlock(234, "black_shulker_box"), - new LegacyBlock(235, "white_glazed_terracotta"), - new LegacyBlock(236, "orange_glazed_terracotta"), - new LegacyBlock(237, "magenta_glazed_terracotta"), - new LegacyBlock(238, "light_blue_glazed_terracotta"), - new LegacyBlock(239, "yellow_glazed_terracotta"), - new LegacyBlock(240, "lime_glazed_terracotta"), - new LegacyBlock(241, "pink_glazed_terracotta"), - new LegacyBlock(242, "gray_glazed_terracotta"), - new LegacyBlock(243, "silver_glazed_terracotta", "light_gray_glazed_terracotta"), - new LegacyBlock(244, "cyan_glazed_terracotta"), - new LegacyBlock(245, "purple_glazed_terracotta"), - new LegacyBlock(246, "blue_glazed_terracotta"), - new LegacyBlock(247, "brown_glazed_terracotta"), - new LegacyBlock(248, "green_glazed_terracotta"), - new LegacyBlock(249, "red_glazed_terracotta"), - new LegacyBlock(250, "black_glazed_terracotta"), - new LegacyBlock(251, "concrete", "white_concrete"), - new LegacyBlock(251, 1, "concrete", "orange_concrete"), - new LegacyBlock(251, 2, "concrete", "magenta_concrete"), - new LegacyBlock(251, 3, "concrete", "light_blue_concrete"), - new LegacyBlock(251, 4, "concrete", "yellow_concrete"), - new LegacyBlock(251, 5, "concrete", "lime_concrete"), - new LegacyBlock(251, 6, "concrete", "pink_concrete"), - new LegacyBlock(251, 7, "concrete", "gray_concrete"), - new LegacyBlock(251, 8, "concrete", "light_gray_concrete"), - new LegacyBlock(251, 9, "concrete", "cyan_concrete"), - new LegacyBlock(251, 10, "concrete", "purple_concrete"), - new LegacyBlock(251, 11, "concrete", "blue_concrete"), - new LegacyBlock(251, 12, "concrete", "brown_concrete"), - new LegacyBlock(251, 13, "concrete", "green_concrete"), - new LegacyBlock(251, 14, "concrete", "red_concrete"), - new LegacyBlock(251, 15, "concrete", "black_concrete"), - new LegacyBlock(252, "concrete_powder", "white_concrete_powder"), - new LegacyBlock(252, 1, "concrete_powder", "orange_concrete_powder"), - new LegacyBlock(252, 2, "concrete_powder", "magenta_concrete_powder"), - new LegacyBlock(252, 3, "concrete_powder", "light_blue_concrete_powder"), - new LegacyBlock(252, 4, "concrete_powder", "yellow_concrete_powder"), - new LegacyBlock(252, 5, "concrete_powder", "lime_concrete_powder"), - new LegacyBlock(252, 6, "concrete_powder", "pink_concrete_powder"), - new LegacyBlock(252, 7, "concrete_powder", "gray_concrete_powder"), - new LegacyBlock(252, 8, "concrete_powder", "light_gray_concrete_powder"), - new LegacyBlock(252, 9, "concrete_powder", "cyan_concrete_powder"), - new LegacyBlock(252, 10, "concrete_powder", "purple_concrete_powder"), - new LegacyBlock(252, 11, "concrete_powder", "blue_concrete_powder"), - new LegacyBlock(252, 12, "concrete_powder", "brown_concrete_powder"), - new LegacyBlock(252, 13, "concrete_powder", "green_concrete_powder"), - new LegacyBlock(252, 14, "concrete_powder", "red_concrete_powder"), - new LegacyBlock(252, 15, "concrete_powder", "black_concrete_powder"), - new LegacyBlock(255, "structure_block"), - new LegacyBlock(256, "iron_spade", "iron_shovel"), new LegacyBlock(257, "iron_pickaxe"), - new LegacyBlock(258, "iron_axe"), new LegacyBlock(259, "flint_and_steel"), - new LegacyBlock(260, "apple"), new LegacyBlock(261, "bow"), - new LegacyBlock(262, "arrow"), new LegacyBlock(263, "coal"), - new LegacyBlock(263, 1, "coal", "charcoal"), new LegacyBlock(264, "diamond"), - new LegacyBlock(265, "iron_ingot"), new LegacyBlock(266, "gold_ingot"), - new LegacyBlock(267, "iron_sword"), new LegacyBlock(268, "wood_sword", "wooden_sword"), - new LegacyBlock(269, "wood_spade", "wooden_shovel"), - new LegacyBlock(270, "wood_pickaxe", "wooden_pickaxe"), - new LegacyBlock(271, "wood_axe", "wooden_axe"), new LegacyBlock(272, "stone_sword"), - new LegacyBlock(273, "stone_spade", "stone_shovel"), - new LegacyBlock(274, "stone_pickaxe"), new LegacyBlock(275, "stone_axe"), - new LegacyBlock(276, "diamond_sword"), - new LegacyBlock(277, "diamond_spade", "diamond_shovel"), - new LegacyBlock(278, "diamond_pickaxe"), new LegacyBlock(279, "diamond_axe"), - new LegacyBlock(280, "stick"), new LegacyBlock(281, "bowl"), - new LegacyBlock(282, "mushroom_soup", "mushroom_stew"), - new LegacyBlock(283, "gold_sword", "golden_sword"), - new LegacyBlock(284, "gold_spade", "golden_shovel"), - new LegacyBlock(285, "gold_pickaxe", "golden_pickaxe"), - new LegacyBlock(286, "gold_axe", "golden_axe"), new LegacyBlock(287, "string"), - new LegacyBlock(288, "feather"), new LegacyBlock(289, "sulphur", "gunpowder"), - new LegacyBlock(290, "wood_hoe", "wooden_hoe"), new LegacyBlock(291, "stone_hoe"), - new LegacyBlock(292, "iron_hoe"), new LegacyBlock(293, "diamond_hoe"), - new LegacyBlock(294, "gold_hoe", "golden_hoe"), - new LegacyBlock(295, "seeds", "wheat_seeds"), new LegacyBlock(296, "wheat"), - new LegacyBlock(297, "bread"), new LegacyBlock(298, "leather_helmet"), - new LegacyBlock(299, "leather_chestplate"), new LegacyBlock(300, "leather_leggings"), - new LegacyBlock(301, "leather_boots"), new LegacyBlock(302, "chainmail_helmet"), - new LegacyBlock(303, "chainmail_chestplate"), - new LegacyBlock(304, "chainmail_leggings"), new LegacyBlock(305, "chainmail_boots"), - new LegacyBlock(306, "iron_helmet"), new LegacyBlock(307, "iron_chestplate"), - new LegacyBlock(308, "iron_leggings"), new LegacyBlock(309, "iron_boots"), - new LegacyBlock(310, "diamond_helmet"), new LegacyBlock(311, "diamond_chestplate"), - new LegacyBlock(312, "diamond_leggings"), new LegacyBlock(313, "diamond_boots"), - new LegacyBlock(314, "gold_helmet", "golden_helmet"), - new LegacyBlock(315, "gold_chestplate", "golden_chestplate"), - new LegacyBlock(316, "gold_leggings", "golden_leggings"), - new LegacyBlock(317, "gold_boots", "golden_boots"), new LegacyBlock(318, "flint"), - new LegacyBlock(319, "pork", "porkchop"), - new LegacyBlock(320, "grilled_pork", "cooked_porkchop"), - new LegacyBlock(321, "painting"), new LegacyBlock(322, "golden_apple", "golden_apple"), - new LegacyBlock(322, 1, "golden_apple", "enchanted_golden_apple"), - new LegacyBlock(323, "sign"), new LegacyBlock(324, "wood_door", "oak_door"), - new LegacyBlock(325, "bucket"), new LegacyBlock(326, "water_bucket"), - new LegacyBlock(327, "lava_bucket"), new LegacyBlock(328, "minecart"), - new LegacyBlock(329, "saddle"), new LegacyBlock(330, "iron_door"), - new LegacyBlock(331, "redstone"), new LegacyBlock(332, "snow_ball", "snowball"), - new LegacyBlock(333, "boat", "oak_boat"), new LegacyBlock(334, "leather"), - new LegacyBlock(335, "milk_bucket"), new LegacyBlock(336, "clay_brick", "brick"), - new LegacyBlock(337, "clay_ball"), new LegacyBlock(338, "sugar_cane"), - new LegacyBlock(339, "paper"), new LegacyBlock(340, "book"), - new LegacyBlock(341, "slime_ball"), - new LegacyBlock(342, "storage_minecart", "chest_minecart"), - new LegacyBlock(343, "powered_minecart", "furnace_minecart"), - new LegacyBlock(344, "egg"), new LegacyBlock(345, "compass"), - new LegacyBlock(346, "fishing_rod"), new LegacyBlock(347, "watch", "clock"), - new LegacyBlock(348, "glowstone_dust"), new LegacyBlock(349, "raw_fish", "cod"), - new LegacyBlock(349, 1, "raw_fish", "salmon"), - new LegacyBlock(349, 2, "raw_fish", "tropical_fish"), - new LegacyBlock(349, 3, "raw_fish", "pufferfish"), - new LegacyBlock(350, "cooked_fish", "cooked_cod"), - new LegacyBlock(350, 1, "cooked_fish", "cooked_salmon"), - new LegacyBlock(351, "ink_sack", "ink_sac"), - new LegacyBlock(351, 1, "ink_sack", "rose_red"), - new LegacyBlock(351, 2, "ink_sack", "cactus_green"), - new LegacyBlock(351, 3, "ink_sack", "cocoa_beans"), - new LegacyBlock(351, 4, "ink_sack", "lapis_lazuli"), - new LegacyBlock(351, 5, "ink_sack", "purple_dye"), - new LegacyBlock(351, 6, "ink_sack", "cyan_dye"), - new LegacyBlock(351, 7, "ink_sack", "light_gray_dye"), - new LegacyBlock(351, 8, "ink_sack", "gray_dye"), - new LegacyBlock(351, 9, "ink_sack", "pink_dye"), - new LegacyBlock(351, 10, "ink_sack", "lime_dye"), - new LegacyBlock(351, 11, "ink_sack", "dandelion_yellow"), - new LegacyBlock(351, 12, "ink_sack", "light_blue_dye"), - new LegacyBlock(351, 13, "ink_sack", "magenta_dye"), - new LegacyBlock(351, 14, "ink_sack", "orange_dye"), - new LegacyBlock(351, 15, "ink_sack", "bone_meal"), new LegacyBlock(352, "bone"), - new LegacyBlock(353, "sugar", "sugar"), new LegacyBlock(354, "cake", "cake"), - new LegacyBlock(355, "bed", "white_bed"), new LegacyBlock(355, 1, "bed", "orange_bed"), - new LegacyBlock(355, 2, "bed", "magenta_bed"), - new LegacyBlock(355, 3, "bed", "light_blue_bed"), - new LegacyBlock(355, 4, "bed", "yellow_bed"), - new LegacyBlock(355, 5, "bed", "lime_bed"), new LegacyBlock(355, 6, "bed", "pink_bed"), - new LegacyBlock(355, 7, "bed", "gray_bed"), - new LegacyBlock(355, 8, "bed", "light_gray_bed"), - new LegacyBlock(355, 9, "bed", "cyan_bed"), - new LegacyBlock(355, 10, "bed", "purple_bed"), - new LegacyBlock(355, 11, "bed", "blue_bed"), - new LegacyBlock(355, 12, "bed", "brown_bed"), - new LegacyBlock(355, 13, "bed", "green_bed"), - new LegacyBlock(355, 14, "bed", "red_bed"), - new LegacyBlock(355, 15, "bed", "black_bed"), new LegacyBlock(356, "diode", "repeater"), - new LegacyBlock(357, "cookie", "cookie"), new LegacyBlock(358, "map"), - new LegacyBlock(359, "shears"), new LegacyBlock(360, "melon", "melon"), - new LegacyBlock(361, "pumpkin_seeds", "pumpkin_seeds"), - new LegacyBlock(362, "melon_seeds", "melon_seeds"), - new LegacyBlock(363, "raw_beef", "beef"), new LegacyBlock(364, "cooked_beef"), - new LegacyBlock(365, "raw_chicken", "chicken"), new LegacyBlock(366, "cooked_chicken"), - new LegacyBlock(367, "rotten_flesh"), new LegacyBlock(368, "ender_pearl"), - new LegacyBlock(369, "blaze_rod"), new LegacyBlock(370, "ghast_tear"), - new LegacyBlock(371, "gold_nugget"), - new LegacyBlock(372, "nether_stalk", "nether_wart"), - new LegacyBlock(373, "potion", "potion"), new LegacyBlock(374, "glass_bottle"), - new LegacyBlock(375, "spider_eye"), new LegacyBlock(376, "fermented_spider_eye"), - new LegacyBlock(377, "blaze_powder"), new LegacyBlock(378, "magma_cream"), - new LegacyBlock(379, "brewing_stand_item", "brewing_stand"), - new LegacyBlock(380, "cauldron_item", "cauldron"), - new LegacyBlock(381, "eye_of_ender", "ender_eye"), - new LegacyBlock(382, "speckled_melon"), new LegacyBlock(383, "monster_egg"), - new LegacyBlock(383, 4, "monster_egg", "elder_guardian_spawn_egg"), - new LegacyBlock(383, 5, "monster_egg", "wither_skeleton_spawn_egg"), - new LegacyBlock(383, 6, "monster_egg", "stray_spawn_egg"), - new LegacyBlock(383, 23, "monster_egg", "husk_spawn_egg"), - new LegacyBlock(383, 27, "monster_egg", "zombie_villager_spawn_egg"), - new LegacyBlock(383, 28, "monster_egg", "skeleton_horse_spawn_egg"), - new LegacyBlock(383, 29, "monster_egg", "zombie_horse_spawn_egg"), - new LegacyBlock(383, 31, "monster_egg", "donkey_spawn_egg"), - new LegacyBlock(383, 32, "monster_egg", "mule_spawn_egg"), - new LegacyBlock(383, 34, "monster_egg", "evocation_illager_spawn_egg"), - new LegacyBlock(383, 35, "monster_egg", "vex_spawn_egg"), - new LegacyBlock(383, 36, "monster_egg", "vindication_illager_spawn_egg"), - new LegacyBlock(383, 50, "monster_egg", "creeper_spawn_egg"), - new LegacyBlock(383, 51, "monster_egg", "skeleton_spawn_egg"), - new LegacyBlock(383, 52, "monster_egg", "spider_spawn_egg"), - new LegacyBlock(383, 54, "monster_egg", "zombie_spawn_egg"), - new LegacyBlock(383, 55, "monster_egg", "slime_spawn_egg"), - new LegacyBlock(383, 56, "monster_egg", "ghast_spawn_egg"), - new LegacyBlock(383, 57, "monster_egg", "zombie_pigman_spawn_egg"), - new LegacyBlock(383, 58, "monster_egg", "enderman_spawn_egg"), - new LegacyBlock(383, 59, "monster_egg", "cave_spider_spawn_egg"), - new LegacyBlock(383, 60, "monster_egg", "silverfish_spawn_egg"), - new LegacyBlock(383, 61, "monster_egg", "blaze_spawn_egg"), - new LegacyBlock(383, 62, "monster_egg", "magma_cube_spawn_egg"), - new LegacyBlock(383, 65, "monster_egg", "bat_spawn_egg"), - new LegacyBlock(383, 66, "monster_egg", "witch_spawn_egg"), - new LegacyBlock(383, 67, "monster_egg", "endermite_spawn_egg"), - new LegacyBlock(383, 68, "monster_egg", "guardian_spawn_egg"), - new LegacyBlock(383, 69, "monster_egg", "shulker_spawn_egg"), - new LegacyBlock(383, 90, "monster_egg", "pig_spawn_egg"), - new LegacyBlock(383, 91, "monster_egg", "sheep_spawn_egg"), - new LegacyBlock(383, 92, "monster_egg", "cow_spawn_egg"), - new LegacyBlock(383, 93, "monster_egg", "chicken_spawn_egg"), - new LegacyBlock(383, 94, "monster_egg", "squid_spawn_egg"), - new LegacyBlock(383, 95, "monster_egg", "wolf_spawn_egg"), - new LegacyBlock(383, 96, "monster_egg", "mooshroom_spawn_egg"), - new LegacyBlock(383, 98, "monster_egg", "ocelot_spawn_egg"), - new LegacyBlock(383, 100, "monster_egg", "horse_spawn_egg"), - new LegacyBlock(383, 101, "monster_egg", "rabbit_spawn_egg"), - new LegacyBlock(383, 102, "monster_egg", "polar_bear_spawn_egg"), - new LegacyBlock(383, 103, "monster_egg", "llama_spawn_egg"), - new LegacyBlock(383, 120, "monster_egg", "villager_spawn_egg"), - new LegacyBlock(384, "exp_bottle", "experience_bottle"), - new LegacyBlock(385, "fireball", "fire_charge"), - new LegacyBlock(386, "book_and_quill", "writable_book"), - new LegacyBlock(387, "written_book"), new LegacyBlock(388, "emerald"), - new LegacyBlock(389, "item_frame"), - new LegacyBlock(390, "flower_pot_item", "flower_pot"), - new LegacyBlock(391, "carrot_item", "carrot"), - new LegacyBlock(392, "potato_item", "potato"), new LegacyBlock(393, "baked_potato"), - new LegacyBlock(394, "poisonous_potato"), new LegacyBlock(395, "empty_map", "map"), - new LegacyBlock(396, "golden_carrot"), - new LegacyBlock(397, "skull_item", "skeleton_skull"), - new LegacyBlock(397, 1, "skull_item", "wither_skeleton_skull"), - new LegacyBlock(397, 2, "skull_item", "zombie_head"), - new LegacyBlock(397, 3, "skull_item", "player_head"), - new LegacyBlock(397, 4, "skull_item", "creeper_head"), - new LegacyBlock(397, 5, "skull_item", "dragon_head"), - new LegacyBlock(398, "carrot_stick"), new LegacyBlock(399, "nether_star"), - new LegacyBlock(400, "pumpkin_pie"), - new LegacyBlock(401, "firework", "firework_rocket"), - new LegacyBlock(402, "firework_charge", "firework_star"), - new LegacyBlock(403, "enchanted_book"), - new LegacyBlock(404, "redstone_comparator", "comparator"), - new LegacyBlock(405, "nether_brick_item", "nether_brick"), - new LegacyBlock(406, "quartz"), - new LegacyBlock(407, "explosive_minecart", "tnt_minecart"), - new LegacyBlock(408, "hopper_minecart"), new LegacyBlock(409, "prismarine_shard"), - new LegacyBlock(410, "prismarine_crystals"), new LegacyBlock(411, "rabbit"), - new LegacyBlock(412, "cooked_rabbit"), new LegacyBlock(413, "rabbit_stew"), - new LegacyBlock(414, "rabbit_foot"), new LegacyBlock(415, "rabbit_hide"), - new LegacyBlock(416, "armor_stand"), - new LegacyBlock(417, "iron_barding", "iron_horse_armor"), - new LegacyBlock(418, "gold_barding", "gold_horse_armor"), - new LegacyBlock(419, "diamond_barding", "diamond_horse_armor"), - new LegacyBlock(420, "leash", "lead"), new LegacyBlock(421, "name_tag"), - new LegacyBlock(422, "command_minecart", "command_block_minecart"), - new LegacyBlock(423, "mutton"), new LegacyBlock(424, "cooked_mutton"), - new LegacyBlock(425, "banner", "white_banner"), - new LegacyBlock(425, 1, "banner", "orange_banner"), - new LegacyBlock(425, 2, "banner", "magenta_banner"), - new LegacyBlock(425, 3, "banner", "light_blue_banner"), - new LegacyBlock(425, 4, "banner", "yellow_banner"), - new LegacyBlock(425, 5, "banner", "lime_banner"), - new LegacyBlock(425, 6, "banner", "pink_banner"), - new LegacyBlock(425, 7, "banner", "gray_banner"), - new LegacyBlock(425, 8, "banner", "light_gray_banner"), - new LegacyBlock(425, 9, "banner", "cyan_banner"), - new LegacyBlock(425, 10, "banner", "purple_banner"), - new LegacyBlock(425, 11, "banner", "blue_banner"), - new LegacyBlock(425, 12, "banner", "brown_banner"), - new LegacyBlock(425, 13, "banner", "green_banner"), - new LegacyBlock(425, 14, "banner", "red_banner"), - new LegacyBlock(425, 15, "banner", "black_banner"), new LegacyBlock(426, "end_crystal"), - new LegacyBlock(427, "spruce_door_item", "spruce_door"), - new LegacyBlock(428, "birch_door_item", "birch_door"), - new LegacyBlock(429, "jungle_door_item", "jungle_door"), - new LegacyBlock(430, "acacia_door_item", "acacia_door"), - new LegacyBlock(431, "dark_oak_door_item", "dark_oak_door"), - new LegacyBlock(432, "chorus_fruit"), new LegacyBlock(433, "chorus_fruit_popped"), - new LegacyBlock(434, "beetroot"), new LegacyBlock(435, "beetroot_seeds"), - new LegacyBlock(436, "beetroot_soup"), - new LegacyBlock(437, "dragons_breath", "dragon_breath"), - new LegacyBlock(438, "splash_potion"), new LegacyBlock(439, "spectral_arrow"), - new LegacyBlock(440, "tipped_arrow"), new LegacyBlock(441, "lingering_potion"), - new LegacyBlock(442, "shield"), new LegacyBlock(443, "elytra"), - new LegacyBlock(444, "boat_spruce", "spruce_boat"), - new LegacyBlock(445, "boat_birch", "birch_boat"), - new LegacyBlock(446, "boat_jungle", "jungle_boat"), - new LegacyBlock(447, "boat_acacia", "acacia_boat"), - new LegacyBlock(448, "boat_dark_oak", "dark_oak_boat"), - new LegacyBlock(449, "totem", "totem_of_undying"), - new LegacyBlock(450, "shulker_shell"), new LegacyBlock(452, "iron_nugget"), - new LegacyBlock(453, "knowledge_book"), - new LegacyBlock(2256, "gold_record", "music_disc_13"), - new LegacyBlock(2257, "green_record", "music_disc_cat"), - new LegacyBlock(2258, "record_3", "music_disc_blocks"), - new LegacyBlock(2259, "record_4", "music_disc_chirp"), - new LegacyBlock(2260, "record_5", "music_disc_far"), - new LegacyBlock(2261, "record_6", "music_disc_mall"), - new LegacyBlock(2262, "record_7", "music_disc_mellohi"), - new LegacyBlock(2263, "record_8", "music_disc_stal"), - new LegacyBlock(2264, "record_9", "music_disc_strad"), - new LegacyBlock(2265, "record_10", "music_disc_ward"), - new LegacyBlock(2266, "record_11", "music_disc_11"), - new LegacyBlock(2267, "record_12", "music_disc_wait")}; - - private static final Map LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK = - new HashMap<>(); - private static final Map NEW_STRING_TO_LEGACY_PLOT_BLOCK = new HashMap<>(); - private static final Map OLD_STRING_TO_STRING_PLOT_BLOCK = new HashMap<>(); - - @SuppressWarnings("deprecation") public BukkitLegacyMappings() { - this.addAll(Arrays.asList(BLOCKS)); - // Make sure to add new blocks as well - final List missing = new ArrayList<>(); - for (final Material material : Material.values()) { - final String materialName = material.name().toLowerCase(Locale.ENGLISH); - if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.get(materialName) == null) { - try { - final LegacyBlock missingBlock = - new LegacyBlock(material.getId(), materialName, materialName); - missing.add(missingBlock); - } catch (Exception ignored) { - } - } - } - addAll(missing); - } - - private void addAll(@NonNull final Collection blocks) { - for (final LegacyBlock legacyBlock : blocks) { - LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK - .put(new IdDataPair(legacyBlock.getNumericalId(), legacyBlock.getDataValue()), - legacyBlock.toStringPlotBlock()); - NEW_STRING_TO_LEGACY_PLOT_BLOCK - .put(legacyBlock.getNewName(), legacyBlock.toLegacyPlotBlock()); - OLD_STRING_TO_STRING_PLOT_BLOCK - .put(legacyBlock.getLegacyName(), legacyBlock.toStringPlotBlock()); - Material material; - try { - material = Material.valueOf(legacyBlock.getNewName()); - } catch (final Exception e) { - try { - material = Material.getMaterial(legacyBlock.getLegacyName(), true); - } catch (NoSuchMethodError error) { - PlotSquared.log("You can't use this version of PlotSquared on a server " - + "less than Minecraft 1.13.2"); - Bukkit.shutdown(); - break; - } - } - legacyBlock.material = material; - } - } - - public Collection getPlotBlocks() { - return Arrays.stream(BLOCKS).map(block -> PlotBlock.get(block.getNewName())) - .collect(Collectors.toList()); - } - - public StringComparison.ComparisonResult getClosestsMatch( - @NonNull final String string) { - final StringComparison comparison = - new StringComparison<>(string, getPlotBlocks()); - return comparison.getBestMatchAdvanced(); - } - - /** - * Try to find a legacy plot block by any means possible. Strategy: - Check if the name contains - * a namespace, if so, strip it - Check if there's a (new) material matching the name - Check if - * there's a legacy material matching the name - Check if there's a numerical ID matching the - * name - Return null if everything else fails - * - * @param string String ID - * @return LegacyBlock if found, else null - */ - public PlotBlock fromAny(@NonNull final String string) { - if (string.isEmpty()) { - return StringPlotBlock.EVERYTHING; - } - String workingString = string; - String[] parts = null; - IdDataPair idDataPair = null; - if (string.contains(":")) { - parts = string.split(":"); - if (parts.length > 1) { - if (parts[0].equalsIgnoreCase("minecraft")) { - workingString = parts[1]; - } else { - if (parts[0].matches("^\\d+$")) { - idDataPair = - new IdDataPair(Integer.parseInt(parts[0]), Integer.parseInt(parts[0])); - } else { - workingString = parts[0]; - } - } - } - } else if (string.matches("^\\d+$")) { - idDataPair = new IdDataPair(Integer.parseInt(string), 0); - } - PlotBlock plotBlock; - if (Material.matchMaterial(workingString) != null) { - return PlotBlock.get(workingString); - } else if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.containsKey(workingString.toLowerCase())) { - return PlotBlock.get(workingString); - } else if ((plotBlock = fromLegacyToString(idDataPair)) != null) { - return plotBlock; - } else if ((plotBlock = fromLegacyToString(workingString)) != null) { - return plotBlock; - } else { - try { - if (parts != null && parts.length > 1) { - final int id = Integer.parseInt(parts[0]); - final int data = Integer.parseInt(parts[1]); - return fromLegacyToString(id, data); - } else { - return fromLegacyToString(Integer.parseInt(workingString), 0); - } - } catch (final Throwable exception) { - return null; - } - } - } - - public PlotBlock fromLegacyToString(final int id, final int data) { - return LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK.get(new IdDataPair(id, data)); - } - - public PlotBlock fromLegacyToString(IdDataPair idDataPair) { - if (idDataPair == null) { - return null; - } - return LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK.get(idDataPair); - } - - public PlotBlock fromLegacyToString(final String id) { - return OLD_STRING_TO_STRING_PLOT_BLOCK.get(id); - } - - public PlotBlock fromStringToLegacy(final String id) { - return NEW_STRING_TO_LEGACY_PLOT_BLOCK.get(id.toLowerCase(Locale.ENGLISH)); - } - - @Getter @EqualsAndHashCode @ToString @RequiredArgsConstructor - private static final class IdDataPair { - private final int id; - private final int data; - } - - - @Getter @RequiredArgsConstructor(access = AccessLevel.PRIVATE) - public static final class LegacyBlock { - - private final int numericalId; - private final int dataValue; - private final String legacyName; - private final String newName; - - private Material material; - - LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName) { - this(numericalId, dataValue, legacyName, legacyName); - } - - LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName, - @NonNull final String newName, @NonNull final String new14Name) { - this(numericalId, dataValue, legacyName, - PlotSquared.get().IMP.getServerVersion()[1] == 13 ? newName : new14Name); - } - - LegacyBlock(final int numericalId, @NonNull final String legacyName, - @NonNull final String newName, @NonNull final String new14Name) { - this(numericalId, 0, legacyName, - Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1].equals("13") ? - newName : - new14Name); - } - - LegacyBlock(final int numericalId, @NonNull final String legacyName, - @NonNull final String newName) { - this(numericalId, 0, legacyName, newName); - } - - LegacyBlock(final int numericalId, @NonNull final String legacyName) { - this(numericalId, legacyName, legacyName); - } - - PlotBlock toStringPlotBlock() { - return StringPlotBlock.get(newName); - } - - PlotBlock toLegacyPlotBlock() { - return LegacyPlotBlock.get(numericalId, dataValue); - } - - @Override public String toString() { - return this.newName; - } - } - -} 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 3f980d37c..ad2233ed2 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java index 59be5f5e7..44c2e13d5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java index 56448ff34..aaf9c787f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import org.bukkit.Bukkit; 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 00bc7809f..d264cdc05 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 @@ -1,15 +1,16 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + 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.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.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; 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; @@ -25,7 +26,6 @@ import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; import org.bukkit.block.Sign; import org.bukkit.block.data.Directional; import org.bukkit.block.data.type.WallSign; @@ -263,23 +263,11 @@ import java.util.Set; location.getPitch()); } - public static BukkitLegacyMappings getBukkitLegacyMappings() { - return (BukkitLegacyMappings) PlotSquared.imp().getLegacyMappings(); + public static Material getMaterial(@NonNull final BlockState plotBlock) { + return BukkitAdapter.adapt(plotBlock.getBlockType()); } - public static Material getMaterial(@NonNull final PlotBlock plotBlock) { - if (plotBlock instanceof StringPlotBlock) { - return Material - .getMaterial(((StringPlotBlock) plotBlock).getItemId().toUpperCase(Locale.ENGLISH)); - } else { - final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock; - return getBukkitLegacyMappings() - .fromLegacyToString(legacyPlotBlock.getId(), legacyPlotBlock.getData()) - .to(Material.class); - } - } - - @Override public boolean isBlockSame(PlotBlock block1, PlotBlock block2) { + @Override public boolean isBlockSame(BlockState block1, BlockState block2) { if (block1.equals(block2)) { return true; } @@ -380,7 +368,7 @@ import java.util.Set; sign.setFacing(facing); block.setBlockData(sign, false); } - final BlockState blockstate = block.getState(); + final org.bukkit.block.BlockState blockstate = block.getState(); if (blockstate instanceof Sign) { final Sign sign = (Sign) blockstate; for (int i = 0; i < lines.length; i++) { @@ -408,13 +396,13 @@ import java.util.Set; public boolean addItems(@NonNull final String worldName, @NonNull final PlotItem items) { final World world = getWorld(worldName); final Block block = world.getBlockAt(items.x, items.y, items.z); - final BlockState state = block.getState(); + final org.bukkit.block.BlockState state = block.getState(); if (state instanceof InventoryHolder) { InventoryHolder holder = (InventoryHolder) state; Inventory inv = holder.getInventory(); for (int i = 0; i < items.types.length; i++) { // ItemStack item = new ItemStack(LegacyMappings.fromLegacyId(items.id[i]).getMaterial(), items.amount[i], items.data[i]); - ItemStack item = new ItemStack(items.types[i].to(Material.class), items.amount[i]); + ItemStack item = new ItemStack(BukkitAdapter.adapt(items.types[i]), items.amount[i]); inv.addItem(item); } state.update(true); @@ -423,33 +411,11 @@ import java.util.Set; return false; } - @Override public boolean isBlockSolid(@NonNull final PlotBlock block) { - try { - Material material = getMaterial(block); - if (material.isLegacy()) { - material = getBukkitLegacyMappings().fromLegacyToString(material.name()) - .to(Material.class); - } - if (material.isBlock() && material.isSolid() && !material.hasGravity()) { - String name = material.name().toLowerCase(Locale.ENGLISH); - if (material.isOccluding() || name.contains("stairs") || name.contains("slab") - || name.contains("wool")) { - switch (material) { - case NOTE_BLOCK: - case SPAWNER: - return false; - default: - return true; - } - } - } - return false; - } catch (Exception ignored) { - return false; - } + @Override public boolean isBlockSolid(@NonNull final BlockState block) { + return block.getBlockType().getMaterial().isSolid(); } - @Override public String getClosestMatchingName(@NonNull final PlotBlock block) { + @Override public String getClosestMatchingName(@NonNull final BlockState block) { try { return getMaterial(block).name(); } catch (Exception ignored) { @@ -458,12 +424,9 @@ import java.util.Set; } @Override @Nullable - public StringComparison.ComparisonResult getClosestBlock(String name) { - final PlotBlock plotBlock = BukkitUtil.getBukkitLegacyMappings().fromAny(name); - if (plotBlock != null) { - return new StringComparison().new ComparisonResult(1, plotBlock); - } - return BukkitUtil.getBukkitLegacyMappings().getClosestsMatch(name); + public StringComparison.ComparisonResult getClosestBlock(String name) { + BlockState state = BlockUtil.get(name); + return new StringComparison().new ComparisonResult(1, state); } @Override @@ -482,10 +445,10 @@ import java.util.Set; return new BukkitWorld(Bukkit.getWorld(world)); } - @Override public PlotBlock getBlock(@NonNull final Location location) { + @Override public BlockState getBlock(@NonNull final Location location) { final World world = getWorld(location.getWorld()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); - return PlotBlock.get(block.getType().name()); + return BlockUtil.get(block.getType().name()); } @Override public String getMainWorld() { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java index 8bfa3da59..a073aa23d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class BukkitVersion { public static int[] v1_13_2 = {1, 13, 2}; public static int[] v1_13_1 = {1, 13, 1}; 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 e3870d940..45b6568d9 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; @@ -48,6 +50,7 @@ public class Metrics { new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'}); final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'}); // We want to make sure nobody just copy & pastes the example and use the wrong package names + if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) { throw new IllegalStateException("bStats Metrics class has not been relocated correctly!"); } 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 10407f5ec..35030fa6a 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.common.base.Splitter; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; 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 a4ee94f80..7a2d53b27 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Entity; 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 8b5e89b27..0b8683cc8 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java index 45814d639..17b046ec9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitAugmentedGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index e7d05eedc..687626ad0 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -1,10 +1,11 @@ package com.github.intellectualsites.plotsquared.bukkit.util.block; +import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQueue; import com.sk89q.jnbt.CompoundTag; @@ -19,7 +20,6 @@ import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; -import java.util.Locale; import java.util.concurrent.ExecutionException; public class BukkitLocalQueue extends BasicLocalBlockQueue { @@ -38,13 +38,13 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { } - @Override public PlotBlock getBlock(int x, int y, int z) { + @Override public BlockState getBlock(int x, int y, int z) { World worldObj = Bukkit.getWorld(getWorld()); if (worldObj != null) { Block block = worldObj.getBlockAt(x, y, z); - return PlotBlock.get(block.getType().toString()); + return BukkitBlockUtil.get(block); } else { - return PlotBlock.get(0, 0); + return BlockUtil.get(0, 0); } } @@ -95,7 +95,7 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { BlockData blockData = BukkitAdapter.adapt(block); Block existing = chunk.getBlock(x, y, z); - if (equals(PlotBlock.get(block), existing) && existing + if (BukkitBlockUtil.get(existing).equals(block) && existing .getBlockData().matches(blockData)) { continue; } @@ -116,38 +116,13 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { }); } - private void setMaterial(@NonNull final PlotBlock plotBlock, @NonNull final Block block) { - final Material material; - if (plotBlock instanceof StringPlotBlock) { - material = Material - .getMaterial(((StringPlotBlock) plotBlock).getItemId().toUpperCase(Locale.ENGLISH)); - if (material == null) { - throw new IllegalStateException(String - .format("Could not find material that matches %s", - ((StringPlotBlock) plotBlock).getItemId())); - } - } else { - final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock; - material = PlotSquared.get().IMP.getLegacyMappings() - .fromLegacyToString(legacyPlotBlock.getId(), legacyPlotBlock.getData()) - .to(Material.class); - if (material == null) { - throw new IllegalStateException(String - .format("Could not find material that matches %s", legacyPlotBlock.toString())); - } - } + private void setMaterial(@NonNull final BlockState plotBlock, @NonNull final Block block) { + Material material = BukkitAdapter.adapt(plotBlock.getBlockType()); block.setType(material, false); } - private boolean equals(@NonNull final PlotBlock plotBlock, @NonNull final Block block) { - if (plotBlock instanceof StringPlotBlock) { - return ((StringPlotBlock) plotBlock).idEquals(block.getType().name()); - } - final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock; - return Material.getMaterial(PlotSquared.get().IMP.getLegacyMappings() - .fromLegacyToString(((LegacyPlotBlock) plotBlock).id, - ((LegacyPlotBlock) plotBlock).data).toString()) == block.getType() && ( - legacyPlotBlock.id == 0 || legacyPlotBlock.data == block.getData()); + private boolean equals(@NonNull final BlockState plotBlock, @NonNull final Block block) { + return plotBlock.equals(BukkitBlockUtil.get(block)); } public void setBiomes(LocalChunk lc) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index fc2bc3574..41d04222c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -1,9 +1,12 @@ package com.github.intellectualsites.plotsquared.bukkit.util.block; +import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import com.sk89q.worldedit.bukkit.BukkitAdapter; @@ -22,7 +25,7 @@ import java.util.Arrays; public class GenChunk extends ScopedLocalBlockQueue { public final Biome[] biomes; - public PlotBlock[][] result; + public BlockState[][] result; public BiomeGrid biomeGrid; public Chunk chunk; public String world; @@ -68,14 +71,14 @@ public class GenChunk extends ScopedLocalBlockQueue { } } - @Override public void setCuboid(Location pos1, Location pos2, PlotBlock block) { + @Override public void setCuboid(Location pos1, Location pos2, BlockState block) { if (result != null && pos1.getX() == 0 && pos1.getZ() == 0 && pos2.getX() == 15 && pos2.getZ() == 15) { for (int y = pos1.getY(); y <= pos2.getY(); y++) { int layer = y >> 4; - PlotBlock[] data = result[layer]; + BlockState[] data = result[layer]; if (data == null) { - result[layer] = data = new PlotBlock[4096]; + result[layer] = data = new BlockState[4096]; } int start = y << 8; int end = start + 256; @@ -88,8 +91,7 @@ public class GenChunk extends ScopedLocalBlockQueue { int maxX = Math.max(pos1.getX(), pos2.getX()); int maxY = Math.max(pos1.getY(), pos2.getY()); int maxZ = Math.max(pos1.getZ(), pos2.getZ()); - chunkData - .setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, block.to(Material.class)); + chunkData.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, BukkitAdapter.adapt(block)); } @Override public boolean setBiome(int x, int z, String biome) { @@ -104,21 +106,21 @@ public class GenChunk extends ScopedLocalBlockQueue { return false; } - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { if (this.result == null) { - this.chunkData.setBlock(x, y, z, id.to(Material.class)); + this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); return true; } - this.chunkData.setBlock(x, y, z, id.to(Material.class)); + this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); this.storeCache(x, y, z, id); return true; } - private void storeCache(final int x, final int y, final int z, final PlotBlock id) { + private void storeCache(final int x, final int y, final int z, final BlockState id) { int i = MainUtil.CACHE_I[y][x][z]; - PlotBlock[] v = this.result[i]; + BlockState[] v = this.result[i]; if (v == null) { - this.result[i] = v = new PlotBlock[4096]; + this.result[i] = v = new BlockState[4096]; } int j = MainUtil.CACHE_J[y][x][z]; v[j] = id; @@ -130,18 +132,18 @@ public class GenChunk extends ScopedLocalBlockQueue { return true; } this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); - this.storeCache(x, y, z, PlotBlock.get(id.getBlockType().getId())); + this.storeCache(x, y, z, BlockUtil.get(id.getBlockType().getId())); return true; } - @Override public PlotBlock getBlock(int x, int y, int z) { + @Override public BlockState getBlock(int x, int y, int z) { int i = MainUtil.CACHE_I[y][x][z]; if (result == null) { - return PlotBlock.get(chunkData.getType(x, y, z)); + return BukkitBlockUtil.get(chunkData.getType(x, y, z)); } - PlotBlock[] array = result[i]; + BlockState[] array = result[i]; if (array == null) { - return PlotBlock.get(""); + return BlockUtil.get(""); } int j = MainUtil.CACHE_J[y][x][z]; return array[j]; @@ -171,9 +173,9 @@ public class GenChunk extends ScopedLocalBlockQueue { GenChunk toReturn = new GenChunk(); if (this.result != null) { for (int i = 0; i < this.result.length; i++) { - PlotBlock[] matrix = this.result[i]; + BlockState[] matrix = this.result[i]; if (matrix != null) { - toReturn.result[i] = new PlotBlock[matrix.length]; + toReturn.result[i] = new BlockState[matrix.length]; System.arraycopy(matrix, 0, toReturn.result[i], 0, matrix.length); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java index 2fb0892a7..2be775fb3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.File; import java.io.FilenameFilter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java index 40d902f8e..04cdea922 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 440aca318..351668cb5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java index 3f33387b9..41129644e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.google.common.base.Charsets; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java index 306f67e4e..74f067cc9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 4c74be5b6..434bd8760 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java index 610362953..adb7235cf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.api; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java index 7ae1985ce..f50397294 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotId; public abstract class Argument { 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 691daa93e..6472310fd 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java index 3b5ee295e..eca768ecc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; public interface CommandCaller { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java index 851a03174..6377796fc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java index c2b4b4d95..be132d9d3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java index 81c96196d..808f942c9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * Various settings for controlling the input and output of a {@link * Configuration}. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java index 0752dfb57..6579332c8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.List; import java.util.Map; import java.util.Set; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java index e9c099ed1..81377a83e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * Exception thrown when attempting to load an invalid {@link Configuration}. */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java index 20131cbe1..0dbb112a6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java index 22f9d751b..89b99ffb3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * Various settings for controlling the input and output of a {@link * MemoryConfiguration}. 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 14233b758..68ef0f660 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.LinkedHashSet; 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 e8123cfc9..686347a17 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; import com.github.intellectualsites.plotsquared.configuration.MemoryConfiguration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java index 6eb99bb6e..fe1e19ce2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.MemoryConfiguration; import com.github.intellectualsites.plotsquared.configuration.MemoryConfigurationOptions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java index d8c41c3da..7388ecd53 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java index a7e71cdaf..b0dfae09d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * Various settings for controlling the input and output of a {@link * YamlConfiguration}. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java index 1f52f7abb..b0e288250 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization; import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.error.YAMLException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java index ebe1aebee..99263c761 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java index f83e7a468..415f162d9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java index cb1abd54a..9f0374354 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.Configuration; import java.lang.reflect.Constructor; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java index 8a071cb2e..7267d5c2d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java index 79b50998c..c88a9c277 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java index 62ee01329..cb4d5f99f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.IOException; import java.io.StringWriter; import java.io.Writer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java index 67de10815..690dd78b2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * The JSONException is thrown by the JSON.org classes when things are amiss. * 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 965e95644..dc4d37bac 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.IOException; import java.io.StringWriter; import java.io.Writer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java index 019776e58..116091822 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * The JSONString interface allows a toJSONString() method so that a class can change the * behavior of JSONObject.toString(), JSONArray.toString(), and 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 195ceeb5d..673202d3b 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java index 7ace1989b..50faeb1c6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Enumeration; import java.util.Iterator; import java.util.Properties; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java index 51a0cdb10..65ce81e65 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Iterator; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java index 96d65541f..84ee565f4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.HashMap; /** 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 fb62a61ce..77f36bb41 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 @@ -4,14 +4,12 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; 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.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; @@ -89,8 +87,12 @@ public interface IPlotMain extends ILogger { /** * Gets the NMS package prefix. + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * * @return The NMS package prefix + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; */ String getNMSPackage(); @@ -246,9 +248,4 @@ public interface IPlotMain extends ILogger { @NotNull IndependentPlotGenerator getDefaultGenerator(); List getPluginIds(); - - BlockRegistry getBlockRegistry(); - - LegacyMappings getLegacyMappings(); - } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java index 1736edf6f..0278e90b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum Platform { Bukkit, Sponge, Spigot, Paper 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 d6c7b437c..88c9009a8 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; @@ -24,7 +26,7 @@ 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotCluster; import com.github.intellectualsites.plotsquared.plot.object.PlotFilter; import com.github.intellectualsites.plotsquared.plot.object.PlotId; @@ -154,7 +156,7 @@ import java.util.zip.ZipInputStream; // // Register configuration serializable classes // - ConfigurationSerialization.registerClass(PlotBlock.class, "PlotBlock"); +// ConfigurationSerialization.registerClass(BlockState.class, "BlockState"); ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket"); try { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java index 4646a787a..13cd48798 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class PlotVersion { public final int year, month, day, hash, build; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java index d92dd4ea3..c51dbb1e7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 401446243..8250c4d20 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 0f39ebe94..a01145e72 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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 bf0a221b8..45a6fae1c 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java index 8b9ecb790..1a18c5150 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java index dbfd37768..343c7d96b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java index c2a3daf84..b8fca9445 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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 aba59ad05..a691ff4b3 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java index 9dcd475a1..fe3a45a8c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 088273c9c..d0bc4127f 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java index 3958f2d39..fc910e50a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import lombok.RequiredArgsConstructor; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java index 171a5bfe5..4ddd2b302 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index a9341f373..c00065f20 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java index 75a4709b8..4d9473387 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java index 961742c1b..9261ef796 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index de77513bc..9ca4816f9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java index 14fa6347e..52d00568d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index abbddc9ca..13e957a08 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index c1970f969..fe86acaaa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java index 8413eae22..f827a5ffa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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 411a3290b..7876177b5 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 6d5894616..82dc57b24 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -15,7 +17,7 @@ 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -124,7 +126,7 @@ import java.util.concurrent.CompletableFuture; // Classes this.scope.put("Location", Location.class); - this.scope.put("PlotBlock", PlotBlock.class); + this.scope.put("BlockState", BlockState.class); this.scope.put("Plot", Plot.class); this.scope.put("PlotId", PlotId.class); this.scope.put("Runnable", Runnable.class); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java index ca848a6bb..946abaf82 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index 978c95e34..1d72d34a6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java index f12ce8d1e..adfd640b9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 9ea6d7bdd..522f11b8f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index a268f8903..33559079c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java index 0c544d096..698e7099a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java index 72c6da126..adf8491e5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 5ddfde305..dc9dec874 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java index d3b261ba8..2ef572d73 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java index 372231481..315a9fea8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java index 055cfabd9..282ab8331 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java index 776cff0f8..fbbffdf2d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 746ddfe98..a0d1598b3 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -10,10 +12,10 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.IntegerFlag; import com.github.intellectualsites.plotsquared.plot.flag.ListFlag; -import com.github.intellectualsites.plotsquared.plot.flag.PlotBlockListFlag; +import com.github.intellectualsites.plotsquared.plot.flag.BlockStateListFlag; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -21,6 +23,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; 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 com.sk89q.worldedit.world.block.BlockType; import java.util.ArrayList; import java.util.Arrays; @@ -32,6 +35,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; @CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setflag"}, usage = "/plot flag ", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag") @@ -61,12 +65,12 @@ public class FlagCmd extends SubCommand { } catch (NumberFormatException ignore) { } - } else if (flag instanceof PlotBlockListFlag) { - final PlotBlockListFlag blockListFlag = (PlotBlockListFlag) flag; - final HashSet parsedBlocks = blockListFlag.parseValue(value); - for (final PlotBlock block : parsedBlocks) { + } else if (flag instanceof BlockStateListFlag) { + final BlockStateListFlag blockListFlag = (BlockStateListFlag) flag; + Set parsedBlocks = blockListFlag.parseValue(value); + for (final BlockType block : parsedBlocks) { final String permission = Captions.PERMISSION_SET_FLAG_KEY_VALUE - .f(key.toLowerCase(), block.getRawId().toString().toLowerCase()); + .f(key.toLowerCase(), block.toString().toLowerCase()); final boolean result = Permissions.hasPermission(player, permission); if (!result) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java index 7a1d2cddc..92cb8da1a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index 60ecbeab0..289badf46 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index 7949df513..5ffd80e45 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 030ef0f44..9cbdde212 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java index fe42e5dd4..5182f86d4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java index eb36f8e67..5899da372 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index b51993326..a07330424 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 378da26c2..30e84f3bd 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 2b70e48e5..537e4bd1a 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java index 4b0305969..65fc58fc3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 dd060c88e..4ebb48b83 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index 43204b266..c8d9ae379 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java index f3acaf5a0..3a9bd453c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 02c7494cb..4026bb1e3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java index a763a3c51..fb077e811 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; @@ -8,6 +10,7 @@ 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.sk89q.worldedit.world.item.ItemTypes; import java.util.Arrays; import java.util.Collection; @@ -39,11 +42,11 @@ import java.util.Locale; if (item == null) { return true; } - if (item.getPlotBlock().equalsAny(7, "bedrock")) { + if (item.getType() == ItemTypes.BEDROCK) { plot.removeFlag(Flags.MUSIC); Captions.FLAG_REMOVED.send(player); } else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) { - plot.setFlag(Flags.MUSIC, item.getPlotBlock().getRawId()); + plot.setFlag(Flags.MUSIC, item); Captions.FLAG_ADDED.send(player); } else { Captions.FLAG_NOT_ADDED.send(player); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java index d897fb3cf..25e83c4bd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 55dbdbda4..daa0ae30e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index 8e31051fb..f0b0b0fa4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.json.JSONObject; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java index 0825b9610..99d104071 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 f81f02719..884c23f16 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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 e47cb610f..76a641095 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 cc5c8c21a..a84ee8584 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java index db900e91e..777ea37d9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.MemorySection; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java index 038355d83..147405038 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java index 2dc75f919..5329ae2e2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; public enum RequiredType { 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 d000f55e2..a348bf461 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index 130f2ad1d..d389924f4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 582dfb38a..ae25ccaa5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -10,7 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -60,7 +62,7 @@ import java.util.stream.IntStream; Captions.PERMISSION_SET_COMPONENT.f(component)); return false; } - // PlotBlock[] blocks; + // BlockState[] blocks; BlockBucket bucket; try { if (args.length < 2) { @@ -73,7 +75,7 @@ import java.util.stream.IntStream; } catch (final UnknownBlockException unknownBlockException) { final String unknownBlock = unknownBlockException.getUnknownValue(); Captions.NOT_VALID_BLOCK.send(player, unknownBlock); - StringComparison.ComparisonResult match = + StringComparison.ComparisonResult match = WorldUtil.IMP.getClosestBlock(unknownBlock); if (match != null) { final String found = @@ -87,8 +89,8 @@ import java.util.stream.IntStream; } if (!allowUnsafe) { - for (final PlotBlock block : bucket.getBlocks()) { - if (!block.isAir() && !WorldUtil.IMP.isBlockSolid(block)) { + for (final BlockState block : bucket.getBlocks()) { + if (!block.getBlockType().getMaterial().isAir() && !WorldUtil.IMP.isBlockSolid(block)) { Captions.NOT_ALLOWED_BLOCK.send(player, block.toString()); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index 8b746c624..d4b12fa7a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java index 4b742ad94..3359fe060 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; 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 82190f1b2..4ea9f7411 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java index 458442ff2..7c58f0f3d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java index b3ec2ff05..2a9f0529e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java index 4dd37bdb0..03a3cf3d3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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 85a0fe633..14385ff1d 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java index 87411f1c6..8ae7c5e40 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 000aa9b56..4f1740821 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java index c0cd3309e..d357ed435 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java index 66682ccda..8e4bd39b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; 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 e2b7fa382..0f5c5f45b 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java index 36744cc44..add8d4540 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index c319303b6..3a7613dd1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; 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 7234743cf..177715d39 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index 3d636e0dd..ea2f6f538 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -1,7 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import lombok.Getter; @@ -76,11 +78,11 @@ public class Configuration { } else { block = part; } - final StringComparison.ComparisonResult value = + final StringComparison.ComparisonResult value = WorldUtil.IMP.getClosestBlock(block); if (value == null) { throw new UnknownBlockException(block); - } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.isAir() + } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.getBlockType().getMaterial().isAir() && !WorldUtil.IMP.isBlockSolid(value.best)) { throw new UnsafeBlockException(value.best); } @@ -110,11 +112,11 @@ public class Configuration { } else { block = part; } - StringComparison.ComparisonResult value = + StringComparison.ComparisonResult value = WorldUtil.IMP.getClosestBlock(block); if (value == null || value.match > 1) { return false; - } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.isAir() + } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.getBlockType().getMaterial().isAir() && !WorldUtil.IMP.isBlockSolid(value.best)) { throw new UnsafeBlockException(value.best); } @@ -162,9 +164,9 @@ public class Configuration { public static final class UnsafeBlockException extends IllegalArgumentException { - @Getter private final PlotBlock unsafeBlock; + @Getter private final BlockState unsafeBlock; - UnsafeBlockException(@NonNull final PlotBlock unsafeBlock) { + UnsafeBlockException(@NonNull final BlockState unsafeBlock) { super(String.format("%s is not a valid block", unsafeBlock)); this.unsafeBlock = unsafeBlock; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java index 31539d5c2..05127f68d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java @@ -1,7 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.ArrayList; @@ -66,7 +68,7 @@ public class ConfigurationNode { if (this.value instanceof BlockBucket) { return this.value.toString(); } - if (this.value instanceof PlotBlock) { + if (this.value instanceof BlockState) { return this.value.toString(); } return this.value; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index b1e239c78..8b2e4398d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import java.io.File; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java index 962e0468f..59385e623 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.File; import java.util.ArrayList; import java.util.Collections; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java index 5beef2aab..81565c4e2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java index 47a03cf60..38fc283b7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java index 4acecc01f..1126a7d83 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; 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 f8b2cedb0..1a27ff618 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Storage; import com.github.intellectualsites.plotsquared.plot.util.StringMan; 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 a62924e9e..55cb57b57 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; 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 10ceb8784..2bb1d3dd5 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import java.io.File; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java index 837d3a66a..a390960c3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.sql.PreparedStatement; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java new file mode 100644 index 000000000..ee80b560e --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java @@ -0,0 +1,40 @@ +package com.github.intellectualsites.plotsquared.plot.flag; + +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.github.intellectualsites.plotsquared.plot.config.Captions; +import com.sk89q.worldedit.world.block.BlockState; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.sk89q.worldedit.world.block.BlockType; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class BlockStateListFlag extends ListFlag> { + + public BlockStateListFlag(String name) { + super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); + } + + @Override public String valueToString(Object value) { + return StringMan.join((Set) value, ","); + } + + @Override public Set parseValue(final String value) { + return Arrays.stream(BlockUtil.parse(value)).map(BlockState::getBlockType).collect(Collectors.toSet()); + } + + @Override public String getValueDescription() { + return "Flag value must be a block list"; + } + + public boolean contains(Plot plot, BlockState value) { + return contains(plot, value.getBlockType()); + } +} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java index 841df766c..a44168e73 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java index 8cc665471..505f5cab6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; public class DoubleFlag extends Flag { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java index 88119bbaa..c86299a22 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java index 21047d9cd..03269827e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; 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 51391f788..4a4a7d64a 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index b21d6fb25..a84d041bc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -58,9 +60,9 @@ public final class Flags { public static final BooleanFlag BLOCK_IGNITION = new BooleanFlag("block-ignition"); public static final BooleanFlag SOIL_DRY = new BooleanFlag("soil-dry"); public static final StringListFlag BLOCKED_CMDS = new StringListFlag("blocked-cmds"); - public static final PlotBlockListFlag USE = new PlotBlockListFlag("use"); - public static final PlotBlockListFlag BREAK = new PlotBlockListFlag("break"); - public static final PlotBlockListFlag PLACE = new PlotBlockListFlag("place"); + public static final BlockStateListFlag USE = new BlockStateListFlag("use"); + public static final BlockStateListFlag BREAK = new BlockStateListFlag("break"); + public static final BlockStateListFlag PLACE = new BlockStateListFlag("place"); public static final BooleanFlag DEVICE_INTERACT = new BooleanFlag("device-interact"); public static final BooleanFlag VEHICLE_BREAK = new BooleanFlag("vehicle-break"); public static final BooleanFlag VEHICLE_PLACE = new BooleanFlag("vehicle-place"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index 26510b35b..b67ae58ba 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java index ced532cd1..2a83fbac7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java index 1f24cb4a3..55260ec6f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java index 0468c59b2..af2b1345c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java index 3085288b1..7f1fd1aff 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java index 8d57e8865..b5ad2fca2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; public class LongFlag extends Flag { 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 deleted file mode 100644 index d042ecb4d..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.flag; - -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; -import com.github.intellectualsites.plotsquared.plot.util.StringMan; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Objects; -import java.util.stream.Collectors; - -public class PlotBlockListFlag extends ListFlag> { - - public PlotBlockListFlag(String name) { - super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); - } - - @Override public String valueToString(Object value) { - return StringMan.join((HashSet) value, ","); - } - - @Override public HashSet parseValue(final String value) { - final LegacyMappings legacyMappings = PlotSquared.get().IMP.getLegacyMappings(); - return Arrays.stream(value.split(",")).map(legacyMappings::fromAny).filter(Objects::nonNull) - .collect(Collectors.toCollection(HashSet::new)); - } - - @Override public String getValueDescription() { - return "Flag value must be a block list"; - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java index 43544748f..beb3e8836 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; 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 31447847c..504b04a40 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + 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/flag/StringListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java index a1e28aa3d..9717de1d9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java index 6c02516fd..9dfa64dc5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index 2a85581ad..1e2d1df5f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -1,16 +1,19 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue; 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.world.block.BlockTypes; import org.jetbrains.annotations.NotNull; import java.util.Set; @@ -64,7 +67,7 @@ public class AugmentedUtils { txx = Math.min(15, area.getRegion().maxX - blockX); tzz = Math.min(15, area.getRegion().maxZ - blockZ); primaryMask = new DelegateLocalBlockQueue(queue) { - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { if (area.contains(x, z)) { return super.setBlock(x, y, z, id); } @@ -84,7 +87,7 @@ public class AugmentedUtils { primaryMask = queue; } LocalBlockQueue secondaryMask; - PlotBlock air = StringPlotBlock.EVERYTHING; + BlockState air = BlockTypes.AIR.getDefaultState(); if (area.TERRAIN == 2) { PlotManager manager = area.getPlotManager(); final boolean[][] canPlace = new boolean[16][16]; @@ -108,7 +111,7 @@ public class AugmentedUtils { } toReturn = true; secondaryMask = new DelegateLocalBlockQueue(primaryMask) { - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { if (canPlace[x - blockX][z - blockZ]) { return super.setBlock(x, y, z, id); } 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 a15b9ab1b..293303bcf 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,11 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Settings; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -284,9 +286,9 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid( new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz + 1), new Location(classicPlotWorld.worldname, ex, maxY, ez - 1), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 0, sz + 1), - new Location(classicPlotWorld.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7, (byte) 0)); + new Location(classicPlotWorld.worldname, ex, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), @@ -312,9 +314,9 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, sx + 1, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), - ez), PlotBlock.get((short) 0, (byte) 0)); + ez), BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz), - new Location(classicPlotWorld.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0)); + new Location(classicPlotWorld.worldname, ex - 1, 0, ez), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT, sz), classicPlotWorld.WALL_FILLING); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz), @@ -337,10 +339,10 @@ public class ClassicPlotManager extends SquarePlotManager { LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.ROAD_HEIGHT + 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez - 1), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, 0, ez - 1), - PlotBlock.get((short) 7, (byte) 0)); + BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); return queue.enqueue(); @@ -358,7 +360,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), @@ -378,7 +380,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), @@ -395,7 +397,7 @@ public class ClassicPlotManager extends SquarePlotManager { LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT + 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz), 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 ec80b3b84..7048ee8cf 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 @@ -1,12 +1,14 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; 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.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.jetbrains.annotations.NotNull; @@ -18,18 +20,18 @@ import java.util.Locale; public int ROAD_HEIGHT = 62; public int PLOT_HEIGHT = 62; public int WALL_HEIGHT = 62; - public BlockBucket MAIN_BLOCK = BlockBucket.withSingle(PlotBlock.get("stone")); - // new PlotBlock[] {PlotBlock.get("stone")}; - public BlockBucket TOP_BLOCK = BlockBucket.withSingle(PlotBlock.get("grass_block")); - //new PlotBlock[] {PlotBlock.get("grass")}; - public BlockBucket WALL_BLOCK = BlockBucket.withSingle(PlotBlock.get("stone_slab")); - // PlotBlock.get((short) 44, (byte) 0); - public BlockBucket CLAIMED_WALL_BLOCK = BlockBucket.withSingle(PlotBlock.get("sandstone_slab")); - // PlotBlock.get((short) 44, (byte) 1); - public BlockBucket WALL_FILLING = BlockBucket.withSingle(PlotBlock.get("stone")); - //PlotBlock.get((short) 1, (byte) 0); - public BlockBucket ROAD_BLOCK = BlockBucket.withSingle(PlotBlock.get("quartz_block")); - // PlotBlock.get((short) 155, (byte) 0); + public BlockBucket MAIN_BLOCK = BlockBucket.withSingle(BlockUtil.get("stone")); + // new BlockState[] {BlockUtil.get("stone")}; + public BlockBucket TOP_BLOCK = BlockBucket.withSingle(BlockUtil.get("grass_block")); + //new BlockState[] {BlockUtil.get("grass")}; + public BlockBucket WALL_BLOCK = BlockBucket.withSingle(BlockUtil.get("stone_slab")); + // BlockUtil.get((short) 44, (byte) 0); + public BlockBucket CLAIMED_WALL_BLOCK = BlockBucket.withSingle(BlockUtil.get("sandstone_slab")); + // BlockUtil.get((short) 44, (byte) 1); + public BlockBucket WALL_FILLING = BlockBucket.withSingle(BlockUtil.get("stone")); + //BlockUtil.get((short) 1, (byte) 0); + public BlockBucket ROAD_BLOCK = BlockBucket.withSingle(BlockUtil.get("quartz_block")); + // BlockUtil.get((short) 155, (byte) 0); public boolean PLOT_BEDROCK = true; public ClassicPlotWorld(String worldName, String id, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java index ec5f971fc..ffe895f8b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; public interface GeneratorWrapper { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java index a0ed41226..2590fd181 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java index b0cc10323..d91d22f94 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.jetbrains.annotations.NotNull; 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 6cb57ba8f..29b1ee67d 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 @@ -1,11 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; 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.sk89q.worldedit.world.block.BlockState; 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; @@ -43,7 +45,7 @@ public class HybridGen extends IndependentPlotGenerator { for (short x = 0; x < 16; x++) { for (short z = 0; z < 16; z++) { blockBuckets[0][(z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("bedrock")); + BlockBucket.withSingle(BlockUtil.get("bedrock")); } } } @@ -74,7 +76,7 @@ public class HybridGen extends IndependentPlotGenerator { if (hpw.PLOT_BEDROCK) { for (short x = 0; x < 16; x++) { for (short z = 0; z < 16; z++) { - result.setBlock(x, 0, z, PlotBlock.get("bedrock")); + result.setBlock(x, 0, z, BlockUtil.get("bedrock")); } } } 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 528ad57f9..17129cc29 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.Template; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -7,7 +9,7 @@ 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; @@ -174,13 +176,13 @@ public class HybridPlotManager extends ClassicPlotManager { // The component blocks final BlockBucket plotfloor = hybridPlotWorld.TOP_BLOCK; final BlockBucket filling = hybridPlotWorld.MAIN_BLOCK; - final PlotBlock bedrock; + final BlockState bedrock; if (hybridPlotWorld.PLOT_BEDROCK) { - bedrock = PlotBlock.get((short) 7, (byte) 0); + bedrock = BlockUtil.get((short) 7, (byte) 0); } else { - bedrock = PlotBlock.get((short) 0, (byte) 0); + bedrock = BlockUtil.get((short) 0, (byte) 0); } - final PlotBlock air = PlotBlock.get((short) 0, (byte) 0); + final BlockState air = BlockUtil.get((short) 0, (byte) 0); final String biome = hybridPlotWorld.PLOT_BIOME; final LocalBlockQueue queue = hybridPlotWorld.getQueue(false); ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index 2f8c7c823..c53e1c9b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -14,7 +16,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTagBuilder; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.transform.BlockTransformExtent; import com.sk89q.worldedit.internal.helper.MCDirections; import com.sk89q.worldedit.math.BlockVector3; @@ -178,7 +180,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { if (schematic3 != null) { this.PLOT_SCHEMATIC = true; - BlockArrayClipboard blockArrayClipboard3 = schematic3.getClipboard(); + Clipboard blockArrayClipboard3 = schematic3.getClipboard(); BlockVector3 d3 = blockArrayClipboard3.getDimensions(); short w3 = (short) d3.getX(); @@ -252,9 +254,9 @@ public class HybridPlotWorld extends ClassicPlotWorld { } this.ROAD_SCHEMATIC_ENABLED = true; // Do not populate road if using schematic population - // TODO: What? this.ROAD_BLOCK = BlockBucket.empty(); // PlotBlock.getEmptyData(this.ROAD_BLOCK); // PlotBlock.get(this.ROAD_BLOCK.id, (byte) 0); + // TODO: What? this.ROAD_BLOCK = BlockBucket.empty(); // BlockState.getEmptyData(this.ROAD_BLOCK); // BlockUtil.get(this.ROAD_BLOCK.id, (byte) 0); - BlockArrayClipboard blockArrayClipboard1 = schematic1.getClipboard(); + Clipboard blockArrayClipboard1 = schematic1.getClipboard(); BlockVector3 d1 = blockArrayClipboard1.getDimensions(); short w1 = (short) d1.getX(); @@ -277,7 +279,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { } } - BlockArrayClipboard blockArrayClipboard2 = schematic2.getClipboard(); + Clipboard blockArrayClipboard2 = schematic2.getClipboard(); BlockVector3 d2 = blockArrayClipboard2.getDimensions(); short w2 = (short) d2.getX(); short l2 = (short) d2.getZ(); 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 9e09ea977..a638059a1 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; @@ -8,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; @@ -111,12 +113,12 @@ public abstract class HybridUtils { } public int checkModified(LocalBlockQueue queue, int x1, int x2, int y1, int y2, int z1, int z2, - PlotBlock[] blocks) { + BlockState[] blocks) { int count = 0; for (int y = y1; y <= y2; y++) { for (int x = x1; x <= x2; x++) { for (int z = z1; z <= z2; z++) { - PlotBlock block = queue.getBlock(x, y, z); + BlockState block = queue.getBlock(x, y, z); boolean same = Arrays.stream(blocks).anyMatch(p -> WorldUtil.IMP.isBlockSame(block, p)); if (!same) { @@ -307,8 +309,8 @@ public abstract class HybridUtils { for (int z = sz; z <= ez; z++) { for (int y = sy; y <= pm.getWorldHeight(); y++) { if (y > ey) { - PlotBlock block = queue.getBlock(x, y, z); - if (!block.isAir()) { + BlockState block = queue.getBlock(x, y, z); + if (!block.getBlockType().getMaterial().isAir()) { ey = y; } } 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 def532368..bda8a6ccb 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java index 88c7f2557..0880a9e8b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; 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 8ee343b3f..cc3f292cb 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Direction; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java index c2d1ddb31..6ed48568d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotId; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java index 5d0c86858..adfaf450d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java index 815f5ea43..177b92699 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum PlayerBlockEventType { // Non interactive EAT, READ, 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 7aee40de0..ec6051199 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flag; @@ -8,7 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; 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.util.block.ItemUtil; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; @@ -22,6 +25,8 @@ 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 com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import java.util.HashMap; import java.util.Map; @@ -144,21 +149,21 @@ public class PlotListener { Optional musicFlag = plot.getFlag(Flags.MUSIC); if (musicFlag.isPresent()) { final String id = musicFlag.get(); - final PlotBlock block = PlotBlock.get(id); - final String rawId = block.getRawId().toString(); - if (rawId.contains("disc") || PlotBlock.isEverything(block) || block.isAir()) { + final ItemType item = ItemUtil.get(id); + final String rawId = item.getId(); + if (rawId.contains("disc") || item == ItemTypes.AIR) { Location location = player.getLocation(); Location lastLocation = player.getMeta("music"); if (lastLocation != null) { - player.playMusic(lastLocation, PlotBlock.get("air")); - if (PlotBlock.isEverything(block) || block.isAir()) { + player.playMusic(lastLocation, ItemTypes.AIR); + if (item == ItemTypes.AIR) { player.deleteMeta("music"); } } - if (!(PlotBlock.isEverything(block) || block.isAir())) { + if (!(item == ItemTypes.AIR)) { try { player.setMeta("music", location); - player.playMusic(location, block); + player.playMusic(location, item); } catch (Exception ignored) { } } @@ -167,7 +172,7 @@ public class PlotListener { Location lastLoc = player.getMeta("music"); if (lastLoc != null) { player.deleteMeta("music"); - player.playMusic(lastLoc, PlotBlock.get("air")); + player.playMusic(lastLoc, ItemTypes.AIR); } } CommentManager.sendTitle(player, plot); @@ -275,7 +280,7 @@ public class PlotListener { Location lastLoc = player.getMeta("music"); if (lastLoc != null) { player.deleteMeta("music"); - player.playMusic(lastLoc, PlotBlock.get("air")); + player.playMusic(lastLoc, ItemTypes.AIR); } } return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java index 7d2d824b4..8818ed437 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java index 073819fa3..39d30935b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java index 3692efa51..c562f4f9a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java index 78379fd9e..5f9cac7fc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java index ed925a135..ca9b988bb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.logger; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class DelegateLogger implements ILogger { private final ILogger parent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java index 16fb343bf..050f2a365 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.logger; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public interface ILogger { void log(String message); } 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 bd15eddf9..b0ddc9d06 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java @@ -1,9 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.object.collection.RandomCollection; import com.google.common.collect.ImmutableMap; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; @@ -24,23 +28,23 @@ import java.util.Random; * has a specified chance of being randomly picked */ @EqualsAndHashCode @SuppressWarnings({"unused", "WeakerAccess"}) public final class BlockBucket - implements Iterable, ConfigurationSerializable { + implements Iterable, ConfigurationSerializable { private final Random random = new Random(); - private final Map blocks; + private final Map blocks; private final BucketIterator bucketIterator = new BucketIterator(); private boolean compiled, singleItem; - private PlotBlock head; + private BlockState head; - private RandomCollection randomBlocks; - private PlotBlock single; + private RandomCollection randomBlocks; + private BlockState single; public BlockBucket() { this.blocks = new HashMap<>(); } - public static BlockBucket withSingle(@NonNull final PlotBlock block) { + public static BlockBucket withSingle(@NonNull final BlockState block) { final BlockBucket blockBucket = new BlockBucket(); blockBucket.addBlock(block, 100); return blockBucket; @@ -53,15 +57,15 @@ import java.util.Random; return Configuration.BLOCK_BUCKET.parseString(map.get("blocks").toString()); } - public void addBlock(@NonNull final PlotBlock block) { + public void addBlock(@NonNull final BlockState block) { this.addBlock(block, -1); } - public void addBlock(@NonNull final PlotBlock block, final int chance) { + public void addBlock(@NonNull final BlockState block, final int chance) { addBlock(block, (double) chance); } - private void addBlock(@NonNull final PlotBlock block, double chance) { + private void addBlock(@NonNull final BlockState block, double chance) { if (chance == -1) chance = 1; this.blocks.put(block, chance); @@ -81,7 +85,7 @@ import java.util.Random; * @return Immutable collection containing all blocks that can * be found in the bucket */ - public Collection getBlocks() { + public Collection getBlocks() { if (!isCompiled()) { this.compile(); } @@ -94,7 +98,7 @@ import java.util.Random; * @param count Number of blocks * @return Immutable collection containing randomly selected blocks */ - public Collection getBlocks(final int count) { + public Collection getBlocks(final int count) { return Arrays.asList(getBlockArray(count)); } @@ -104,8 +108,8 @@ import java.util.Random; * @param count Number of blocks * @return Immutable collection containing randomly selected blocks */ - public PlotBlock[] getBlockArray(final int count) { - final PlotBlock[] blocks = new PlotBlock[count]; + public BlockState[] getBlockArray(final int count) { + final BlockState[] blocks = new BlockState[count]; if (this.singleItem) { Arrays.fill(blocks, 0, count, getBlock()); } else { @@ -142,7 +146,7 @@ import java.util.Random; } } - @NotNull @Override public Iterator iterator() { + @NotNull @Override public Iterator iterator() { return this.bucketIterator; } @@ -155,7 +159,7 @@ import java.util.Random; * * @return Randomly picked block (cased on specified rates) */ - public PlotBlock getBlock() { + public BlockState getBlock() { if (!isCompiled()) { this.compile(); } @@ -165,19 +169,22 @@ import java.util.Random; if (randomBlocks != null) { return randomBlocks.next(); } - return StringPlotBlock.EVERYTHING; + return BlockTypes.AIR.getDefaultState(); } @Override public String toString() { if (!isCompiled()) { compile(); } + if (blocks.size() == 1) { + return blocks.entrySet().iterator().next().getKey().toString(); + } final StringBuilder builder = new StringBuilder(); - Iterator> iterator = blocks.entrySet().iterator(); + Iterator> iterator = blocks.entrySet().iterator(); while (iterator.hasNext()) { - Entry entry = iterator.next(); - PlotBlock block = entry.getKey(); - builder.append(block.getRawId()); + Entry entry = iterator.next(); + BlockState block = entry.getKey(); + builder.append(block); Double weight = entry.getValue(); if (weight != 1) { builder.append(":").append(weight.intValue()); @@ -213,13 +220,13 @@ import java.util.Random; } - private final class BucketIterator implements Iterator { + private final class BucketIterator implements Iterator { @Override public boolean hasNext() { return true; } - @Override public PlotBlock next() { + @Override public BlockState next() { return getBlock(); } } 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 a4f02a9ef..07094aec5 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class BlockLoc { private final int x; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockRegistry.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockRegistry.java deleted file mode 100644 index e125ca188..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockRegistry.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -import lombok.Getter; -import lombok.NonNull; - -import java.util.HashMap; -import java.util.Map; - -public abstract class BlockRegistry { - - @Getter private final Class type; - private final Map map = new HashMap<>(); - - public BlockRegistry(@NonNull final Class type, final T... preInitializedItems) { - this.type = type; - for (final T preInitializedItem : preInitializedItems) { - this.addMapping(getPlotBlock(preInitializedItem), preInitializedItem); - } - } - - public final void addMapping(@NonNull final PlotBlock plotBlock, @NonNull final T t) { - if (map.containsKey(plotBlock)) { - return; - } - this.map.put(plotBlock, t); - } - - public abstract PlotBlock getPlotBlock(final T item); - - public final T getItem(final PlotBlock plotBlock) { - return this.map.get(plotBlock); - } - -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java index e665ea752..c1bc5c98d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java index 27cb55216..182aa061e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class CmdInstance { public final Runnable command; public final long timestamp; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 490a6e211..8da0f74a3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -1,10 +1,15 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import org.jetbrains.annotations.NotNull; import java.util.UUID; @@ -120,7 +125,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setFlight(boolean fly) { } - @Override public void playMusic(@NotNull Location location, @NotNull PlotBlock id) { + @Override public void playMusic(@NotNull Location location, @NotNull ItemType id) { } @Override public void kick(String message) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java index 3c3900dc1..f54e103a1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum Direction { ALL(-1, "all"), NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java index bb466c082..30c2f88b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.DebugExec; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java index d34521ee9..9c6c63022 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class FileBytes { public final String path; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java index 3413bd235..490c256f5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java @@ -1,10 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.sk89q.worldedit.world.block.BlockState; + public abstract class LazyBlock { - public abstract StringPlotBlock getPlotBlock(); + public abstract BlockState getBlockState(); public String getId() { - return getPlotBlock().getItemId(); + return getBlockState().toString(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java index 8487c44be..a2391a86f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class LazyResult { private T result; 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 deleted file mode 100644 index 0596cd010..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.registry.LegacyMapper; -import lombok.Getter; -import lombok.Setter; - -public class LegacyPlotBlock extends PlotBlock { - - public static final PlotBlock EVERYTHING = new LegacyPlotBlock((short) 0, (byte) 0); - public static final PlotBlock[] CACHE = new PlotBlock[65535]; - - static { - for (int i = 0; i < 65535; i++) { - short id = (short) (i >> 4); - byte data = (byte) (i & 15); - CACHE[i] = new LegacyPlotBlock(id, data); - } - } - - @Setter private BaseBlock baseBlock = null; - @Getter public final short id; - @Getter public final byte data; - - public LegacyPlotBlock(short id, byte data) { - this.id = id; - this.data = data; - } - - @Override public Object getRawId() { - return this.id; - } - - @Override public BaseBlock getBaseBlock() { - if (baseBlock == null) { - baseBlock = LegacyMapper.getInstance().getBlockFromLegacy(id, data).toBaseBlock(); - } - return baseBlock; - } - - @Override public boolean isAir() { - return this.id == 0; - } - - @Override public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LegacyPlotBlock other = (LegacyPlotBlock) obj; - return (this.id == other.id) && ((this.data == other.data) || (this.data == -1) || ( - other.data == -1)); - } - - @Override public int hashCode() { - return this.id; - } - - @Override public String toString() { - if (this.data == -1) { - return this.id + ""; - } - return this.id + ":" + this.data; - } - -} 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 5f2b6bafe..8e7edf51a 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.sk89q.worldedit.math.BlockVector2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java index 85e6e72d8..f2e1a8dab 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.UUID; public interface OfflinePlotPlayer { 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 6708289f3..edb28ba12 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; @@ -1282,7 +1284,7 @@ public class Plot { if (!isLoaded()) { return location; } - if (!WorldUtil.IMP.getBlock(location).isAir()) { + if (!WorldUtil.IMP.getBlock(location).getBlockType().getMaterial().isAir()) { location.setY(Math.max(1 + WorldUtil.IMP .getHighestBlock(this.getWorldName(), location.getX(), location.getZ()), bottom.getY())); @@ -1456,7 +1458,7 @@ public class Plot { } Location location = manager.getSignLoc(this); LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); - queue.setBlock(location.getX(), location.getY(), location.getZ(), PlotBlock.get("air")); + queue.setBlock(location.getX(), location.getY(), location.getZ(), BlockUtil.get("air")); queue.flush(); } 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 b3217297d..99b4709cd 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java deleted file mode 100644 index 5b9de5852..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.Settings; -import com.google.common.collect.ImmutableMap; -import com.sk89q.worldedit.world.block.BaseBlock; -import lombok.NonNull; - -import java.util.Collection; -import java.util.Map; - -public abstract class PlotBlock implements ConfigurationSerializable { - - private static Class conversionType; - private static BlockRegistry blockRegistry; - - protected PlotBlock() { - } - - public static boolean isEverything(@NonNull final PlotBlock block) { - return block.equals(LegacyPlotBlock.EVERYTHING) || block.equals(StringPlotBlock.EVERYTHING); - } - - public static boolean containsEverything(@NonNull final Collection blocks) { - for (final PlotBlock block : blocks) { - if (isEverything(block)) { - return true; - } - } - return false; - } - - public static PlotBlock get(char combinedId) { - switch (combinedId) { - case 0: - return null; - case 1: - return get(0, 0); - default: - return get(combinedId >> 4, combinedId & 15); - } - } - - public static PlotBlock deserialize(@NonNull final Map map) { - if (map.containsKey("material")) { - final Object object = map.get("material"); - return get(object.toString()); - } - return null; - } - - public static StringPlotBlock get(@NonNull final String itemId) { - if (Settings.Enabled_Components.BLOCK_CACHE) { - return StringPlotBlock.getOrAdd(itemId); - } - return new StringPlotBlock(itemId); - } - - public static PlotBlock get(int id, int data) { - return Settings.Enabled_Components.BLOCK_CACHE && data > 0 ? - LegacyPlotBlock.CACHE[(id << 4) + data] : - new LegacyPlotBlock((short) id, (byte) data); - } - - public static PlotBlock getEmptyData(@NonNull final PlotBlock plotBlock) { - if (plotBlock instanceof StringPlotBlock) { - return plotBlock; - } - return get(((LegacyPlotBlock) plotBlock).getId(), (byte) 0); - } - - public static PlotBlock get(@NonNull final BaseBlock baseBlock) { - StringPlotBlock plotBlock = get(baseBlock.getBlockType().getId()); - plotBlock.setBaseBlock(baseBlock); - return plotBlock; - } - - public static PlotBlock get(@NonNull final Object type) { - if (blockRegistry == null) { - blockRegistry = PlotSquared.imp().getBlockRegistry(); - if (blockRegistry == null) { - throw new UnsupportedOperationException( - "The PlotSquared implementation has not registered a custom block registry." - + " This method can't be used."); - } - conversionType = blockRegistry.getType(); - } - if (!type.getClass().equals(conversionType)) { - throw new UnsupportedOperationException( - "The PlotSquared implementation has not registered a block registry for this object type"); - } - return blockRegistry.getPlotBlock(type); - } - - @Override public Map serialize() { - return ImmutableMap.of("material", this.getRawId()); - } - - public T to(@NonNull final Class clazz) { - if (blockRegistry == null) { - blockRegistry = PlotSquared.imp().getBlockRegistry(); - if (blockRegistry == null) { - throw new UnsupportedOperationException( - "The PlotSquared implementation has not registered a custom block registry." - + " This method can't be used."); - } - conversionType = blockRegistry.getType(); - } - if (!clazz.equals(conversionType)) { - throw new UnsupportedOperationException( - "The PlotSquared implementation has not registered a block registry for this object type"); - } - return clazz.cast(blockRegistry.getItem(this)); - } - - public abstract boolean isAir(); - - public final boolean equalsAny(final int id, @NonNull final String stringId) { - if (this instanceof StringPlotBlock) { - final StringPlotBlock stringPlotBlock = (StringPlotBlock) this; - return stringPlotBlock.idEquals(stringId); - } - final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) this; - return legacyPlotBlock.id == id; - } - - @Override public abstract boolean equals(Object obj); - - @Override public abstract int hashCode(); - - @Override public abstract String toString(); - - public abstract Object getRawId(); - - public abstract BaseBlock getBaseBlock(); - -} 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 d5d7c95d3..ef68d8d45 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java index 09759c09d..bd941da6b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class PlotFilter { public boolean allowsArea(final PlotArea area) { return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java index 4faa17b76..62cfeec49 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Set; import java.util.UUID; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 21e7dc777..1076ad443 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java index 4598a2fff..927f80872 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil; import lombok.NonNull; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java index c0a9d93d0..b306ebed9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java @@ -1,7 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; import lombok.Getter; public class PlotItemStack { @@ -9,7 +15,7 @@ public class PlotItemStack { public final int amount; public final String name; public final String[] lore; - @Getter private final PlotBlock plotBlock; + @Getter private final ItemType type; /** * @param id Legacy numerical item ID @@ -21,10 +27,11 @@ public class PlotItemStack { */ @Deprecated public PlotItemStack(final int id, final short data, final int amount, final String name, final String... lore) { + this.amount = amount; this.name = name; this.lore = lore; - this.plotBlock = PlotBlock.get(id, data); + this.type = LegacyMapper.getInstance().getItemFromLegacy(id, data); } /** @@ -35,10 +42,13 @@ public class PlotItemStack { */ public PlotItemStack(final String id, final int amount, final String name, final String... lore) { - StringComparison.ComparisonResult match = WorldUtil.IMP.getClosestBlock(id); - this.plotBlock = match.best; + this.type = ItemTypes.get(id); this.amount = amount; this.name = name; this.lore = lore; } + + public BlockState getBlockState() { + return type.getBlockType().getDefaultState(); + } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java index 33e57f753..e2ca83a64 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.StringMan; import lombok.AllArgsConstructor; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 0b39b2b7d..9120a576f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.commands.Template; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java index 64e6fedb3..f7865a7c6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager; 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 e7ee3d40f..7019d10ce 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; @@ -19,6 +21,8 @@ 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 com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; import lombok.NonNull; import org.jetbrains.annotations.NotNull; @@ -470,7 +474,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @param location where to play the music * @param id the record item id */ - public abstract void playMusic(@NotNull Location location, @NotNull PlotBlock id); + public abstract void playMusic(@NotNull Location location, @NotNull ItemType id); /** * Check if this player is banned. 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 8d7904690..4bc9b159f 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java index 490f8c926..3dfb4c1fa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class PseudoRandom { public static final PseudoRandom random = new PseudoRandom(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java index 911b2e6c5..b00e3cac7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Settings; import java.util.ArrayList; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java index ced127a22..3f4db9a7c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class RegionWrapper { public final int minX; public final int maxX; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java index 90074a63a..3ac0da1a8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class RunnableVal implements Runnable { public T value; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java index ee46a417f..1872b5c1c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class RunnableVal2 implements Runnable { public T value1; public U value2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java index cb6b2a8be..4a4d47663 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class RunnableVal3 implements Runnable { public T value1; public U value2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java index e203fa870..ba7a5f47c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java deleted file mode 100644 index d4119ae92..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockTypes; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -public class StringPlotBlock extends PlotBlock { - - public static final PlotBlock EVERYTHING = new StringPlotBlock("air"); - private static final Map STRING_PLOT_BLOCK_CACHE = new HashMap<>(); - @Getter private final String nameSpace; - @Getter private final String itemId; - @Setter private BaseBlock baseBlock = null; - private boolean isForeign = false; - - public StringPlotBlock(@NonNull final String nameSpace, @NonNull final String itemId) { - this.nameSpace = nameSpace.toLowerCase(Locale.ENGLISH); - this.itemId = itemId.toLowerCase(Locale.ENGLISH); - this.determineForeign(); - } - - public StringPlotBlock(@NonNull final String itemId) { - if (itemId.contains(":")) { - final String[] parts = itemId.split(":"); - if (parts.length < 2) { - throw new IllegalArgumentException(String.format("Cannot parse \"%s\"", itemId)); - } - this.nameSpace = parts[0].toLowerCase(Locale.ENGLISH); - this.itemId = parts[1].toLowerCase(Locale.ENGLISH); - } else { - this.nameSpace = "minecraft"; - if (itemId.isEmpty()) { - this.itemId = "air"; - } else { - this.itemId = itemId.toLowerCase(Locale.ENGLISH); - } - } - this.determineForeign(); - } - - public static StringPlotBlock getOrAdd(@NonNull final String itemId) { - // final String id = itemId.toLowerCase(Locale.ENGLISH); - - StringPlotBlock plotBlock = STRING_PLOT_BLOCK_CACHE.get(itemId); - if (plotBlock == null) { - plotBlock = new StringPlotBlock(itemId); - STRING_PLOT_BLOCK_CACHE.put(itemId, plotBlock); - } - - return plotBlock; - } - - private void determineForeign() { - this.isForeign = !this.nameSpace.equals("minecraft"); - } - - @Override public String toString() { - return this.isForeign ? String.format("%s:%s", nameSpace, itemId) : itemId; - } - - @Override public boolean isAir() { - return this.itemId.isEmpty() || this.itemId.equalsIgnoreCase("air"); - } - - @Override public int hashCode() { - return this.toString().hashCode(); - } - - public boolean idEquals(@NonNull final String id) { - return id.equalsIgnoreCase(this.itemId); - } - - @Override public Object getRawId() { - return this.getItemId(); - } - - @Override public BaseBlock getBaseBlock() { - if (baseBlock == null) { - baseBlock = BlockTypes.get(itemId).getDefaultState().toBaseBlock(); - } - return baseBlock; - } - - @Override public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - StringPlotBlock other = (StringPlotBlock) obj; - return other.nameSpace.equals(this.nameSpace) && other.itemId.equals(this.itemId); - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java index 12d0a11aa..aa1e6e471 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java index 0353eb313..1af1fbf19 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java index 341fbb4f3..ef3cad495 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.MathMan; import java.util.ArrayList; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java index b8dfa0a12..5778883f3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; import java.util.Random; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java index e75b64cb4..143649029 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; import java.util.NavigableMap; import java.util.Random; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java index 30d9b1230..b0b964060 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java index 29cf003cf..bf1f56d25 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java index 598904b0f..80e417801 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java index fa44db6c2..e597fcd02 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java index ada90457f..97579f29e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotId; public class PlotComment { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/ItemType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/ItemType.java deleted file mode 100644 index f558b5243..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/ItemType.java +++ /dev/null @@ -1,307 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object.schematic; - -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; - -public enum ItemType { - AIR("air", 0), STONE("stone", 1), GRANITE("stone", 1, 1), POLISHED_GRANITE("stone", 1, - 2), DIORITE("stone", 1, 3), POLISHED_DIORITE("stone", 1, 4), ANDESITE("stone", 1, - 5), POLISHED_ANDESITE("stone", 1, 6), GRASS("grass", 2), DIRT("dirt", 3), COARSE_DIRT( - "dirt", 3, 1), PODZOL("dirt", 3, 2), COBBLESTONE("cobblestone", 4), OAK_WOOD_PLANK("planks", - 5), SPRUCE_WOOD_PLANK("planks", 5, 1), BIRCH_WOOD_PLANK("planks", 5, 2), JUNGLE_WOOD_PLANK( - "planks", 5, 3), ACACIA_WOOD_PLANK("planks", 5, 4), DARK_OAK_WOOD_PLANK("planks", 5, - 5), OAK_SAPLING("sapling", 6), SPRUCE_SAPLING("sapling", 6, 1), BIRCH_SAPLING("sapling", 6, - 2), JUNGLE_SAPLING("sapling", 6, 3), ACACIA_SAPLING("sapling", 6, 4), DARK_OAK_SAPLING( - "sapling", 6, 5), BEDROCK("bedrock", 7), FLOWING_WATER("flowing_water", 8), STILL_WATER( - "water", 9), FLOWING_LAVA("flowing_lava", 10), STILL_LAVA("lava", 11), SAND("sand", - 12), RED_SAND("sand", 12, 1), GRAVEL("gravel", 13), GOLD_ORE("gold_ore", 14), IRON_ORE( - "iron_ore", 15), COAL_ORE("coal_ore", 16), OAK_WOOD("log", 17), SPRUCE_WOOD("log", 17, - 1), BIRCH_WOOD("log", 17, 2), JUNGLE_WOOD("log", 17, 3), OAK_LEAVES("leaves", - 18), SPRUCE_LEAVES("leaves", 18, 1), BIRCH_LEAVES("leaves", 18, 2), JUNGLE_LEAVES("leaves", - 18, 3), SPONGE("sponge", 19), WET_SPONGE("sponge", 19, 1), GLASS("glass", - 20), LAPIS_LAZULI_ORE("lapis_ore", 21), LAPIS_LAZULI_BLOCK("lapis_block", 22), DISPENSER( - "dispenser", 23), SANDSTONE("sandstone", 24), CHISELED_SANDSTONE("sandstone", 24, - 1), SMOOTH_SANDSTONE("sandstone", 24, 2), NOTE_BLOCK("noteblock", 25), BED("bed", - 26), POWERED_RAIL("golden_rail", 27), DETECTOR_RAIL("detector_rail", 28), STICKY_PISTON( - "sticky_piston", 29), COBWEB("web", 30), DEAD_SHRUB("tallgrass", 31), TALLGRASS("tallgrass", - 31, 1), FERN("tallgrass", 31, 2), DEAD_SHRUB1("deadbush", 32), PISTON("piston", - 33), PISTON_HEAD("piston_head", 34), WHITE_WOOL("wool", 35), ORANGE_WOOL("wool", 35, - 1), MAGENTA_WOOL("wool", 35, 2), LIGHT_BLUE_WOOL("wool", 35, 3), YELLOW_WOOL("wool", 35, - 4), LIME_WOOL("wool", 35, 5), PINK_WOOL("wool", 35, 6), GRAY_WOOL("wool", 35, - 7), LIGHT_GRAY_WOOL("wool", 35, 8), CYAN_WOOL("wool", 35, 9), PURPLE_WOOL("wool", 35, - 10), BLUE_WOOL("wool", 35, 11), BROWN_WOOL("wool", 35, 12), GREEN_WOOL("wool", 35, - 13), RED_WOOL("wool", 35, 14), BLACK_WOOL("wool", 35, 15), DANDELION("yellow_flower", - 37), POPPY("red_flower", 38), BLUE_ORCHID("red_flower", 38, 1), ALLIUM("red_flower", 38, - 2), AZURE_BLUET("red_flower", 38, 3), RED_TULIP("red_flower", 38, 4), ORANGE_TULIP( - "red_flower", 38, 5), WHITE_TULIP("red_flower", 38, 6), PINK_TULIP("red_flower", 38, - 7), OXEYE_DAISY("red_flower", 38, 8), BROWN_MUSHROOM("brown_mushroom", 39), RED_MUSHROOM( - "red_mushroom", 40), GOLD_BLOCK("gold_block", 41), IRON_BLOCK("iron_block", - 42), DOUBLE_STONE_SLAB("double_stone_slab", 43), DOUBLE_SANDSTONE_SLAB("double_stone_slab", - 43, 1), DOUBLE_WOODEN_SLAB("double_stone_slab", 43, 2), DOUBLE_COBBLESTONE_SLAB( - "double_stone_slab", 43, 3), DOUBLE_BRICK_SLAB("double_stone_slab", 43, - 4), DOUBLE_STONE_BRICK_SLAB("double_stone_slab", 43, 5), DOUBLE_NETHER_BRICK_SLAB( - "double_stone_slab", 43, 6), DOUBLE_QUARTZ_SLAB("double_stone_slab", 43, 7), STONE_SLAB( - "stone_slab", 44), SANDSTONE_SLAB("stone_slab", 44, 1), WOODEN_SLAB("stone_slab", 44, - 2), COBBLESTONE_SLAB("stone_slab", 44, 3), BRICK_SLAB("stone_slab", 44, - 4), STONE_BRICK_SLAB("stone_slab", 44, 5), NETHER_BRICK_SLAB("stone_slab", 44, - 6), QUARTZ_SLAB("stone_slab", 44, 7), BRICKS("brick_block", 45), TNT("tnt", 46), BOOKSHELF( - "bookshelf", 47), MOSS_STONE("mossy_cobblestone", 48), OBSIDIAN("obsidian", 49), TORCH( - "torch", 50), FIRE("fire", 51), MONSTER_SPAWNER("mob_spawner", 52), OAK_WOOD_STAIRS( - "oak_stairs", 53), CHEST("chest", 54), REDSTONE_WIRE("redstone_wire", 55), DIAMOND_ORE( - "diamond_ore", 56), DIAMOND_BLOCK("diamond_block", 57), CRAFTING_TABLE("crafting_table", - 58), WHEAT_CROPS("wheat", 59), FARMLAND("farmland", 60), FURNACE("furnace", - 61), BURNING_FURNACE("lit_furnace", 62), STANDING_SIGN_BLOCK("standing_sign", - 63), OAK_DOOR_BLOCK("wooden_door", 64), LADDER("ladder", 65), RAIL("rail", - 66), COBBLESTONE_STAIRS("stone_stairs", 67), WALL_MOUNTED_SIGN_BLOCK("wall_sign", - 68), LEVER("lever", 69), STONE_PRESSURE_PLATE("stone_pressure_plate", 70), IRON_DOOR_BLOCK( - "iron_door", 71), WOODEN_PRESSURE_PLATE("wooden_pressure_plate", 72), REDSTONE_ORE( - "redstone_ore", 73), GLOWING_REDSTONE_ORE("lit_redstone_ore", 74), REDSTONE_TORCH_OFF( - "unlit_redstone_torch", 75), REDSTONE_TORCH_ON("redstone_torch", 76), STONE_BUTTON( - "stone_button", 77), SNOW("snow_layer", 78), ICE("ice", 79), SNOW_BLOCK("snow", 80), CACTUS( - "cactus", 81), CLAY("clay", 82), SUGAR_CANES("reeds", 83), JUKEBOX("jukebox", - 84), OAK_FENCE("fence", 85), PUMPKIN("pumpkin", 86), NETHERRACK("netherrack", - 87), SOUL_SAND("soul_sand", 88), GLOWSTONE("glowstone", 89), NETHER_PORTAL("portal", - 90), JACK_OLANTERN("lit_pumpkin", 91), CAKE_BLOCK("cake", 92), REDSTONE_REPEATER_BLOCK_OFF( - "unpowered_repeater", 93), REDSTONE_REPEATER_BLOCK_ON("powered_repeater", - 94), WHITE_STAINED_GLASS("stained_glass", 95), ORANGE_STAINED_GLASS("stained_glass", 95, - 1), MAGENTA_STAINED_GLASS("stained_glass", 95, 2), LIGHT_BLUE_STAINED_GLASS("stained_glass", - 95, 3), YELLOW_STAINED_GLASS("stained_glass", 95, 4), LIME_STAINED_GLASS("stained_glass", - 95, 5), PINK_STAINED_GLASS("stained_glass", 95, 6), GRAY_STAINED_GLASS("stained_glass", 95, - 7), LIGHT_GRAY_STAINED_GLASS("stained_glass", 95, 8), CYAN_STAINED_GLASS("stained_glass", - 95, 9), PURPLE_STAINED_GLASS("stained_glass", 95, 10), BLUE_STAINED_GLASS("stained_glass", - 95, 11), BROWN_STAINED_GLASS("stained_glass", 95, 12), GREEN_STAINED_GLASS("stained_glass", - 95, 13), RED_STAINED_GLASS("stained_glass", 95, 14), BLACK_STAINED_GLASS("stained_glass", - 95, 15), WOODEN_TRAPDOOR("trapdoor", 96), STONE_MONSTER_EGG("monster_egg", - 97), COBBLESTONE_MONSTER_EGG("monster_egg", 97, 1), STONE_BRICK_MONSTER_EGG("monster_egg", - 97, 2), MOSSY_STONE_BRICK_MONSTER_EGG("monster_egg", 97, - 3), CRACKED_STONE_BRICK_MONSTER_EGG("monster_egg", 97, 4), CHISELED_STONE_BRICK_MONSTER_EGG( - "monster_egg", 97, 5), STONE_BRICKS("stonebrick", 98), MOSSY_STONE_BRICKS("stonebrick", 98, - 1), CRACKED_STONE_BRICKS("stonebrick", 98, 2), CHISELED_STONE_BRICKS("stonebrick", 98, - 3), RED_MUSHROOM_CAP("stonebrick", 99), BROWN_MUSHROOM_CAP("stonebrick", 100), IRON_BARS( - "iron_bars", 101), GLASS_PANE("glass_pane", 102), MELON_BLOCK("melon_block", - 103), PUMPKIN_STEM("pumpkin_stem", 104), MELON_STEM("melon_stem", 105), VINES("vine", - 106), OAK_FENCE_GATE("fence_gate", 107), BRICK_STAIRS("brick_stairs", - 108), STONE_BRICK_STAIRS("stone_brick_stairs", 109), MYCELIUM("mycelium", 110), LILY_PAD( - "waterlily", 111), NETHER_BRICK("nether_brick", 112), NETHER_BRICK_FENCE( - "nether_brick_fence", 113), NETHER_BRICK_STAIRS("nether_brick_stairs", 114), NETHER_WART( - "nether_wart", 115), ENCHANTMENT_TABLE("enchanting_table", 116), BREWING_STAND( - "brewing_stand", 117), CAULDRON("cauldron", 118), END_PORTAL("end_portal", - 119), END_PORTAL_FRAME("end_portal_frame", 120), END_STONE("end_stone", 121), DRAGON_EGG( - "dragon_egg", 122), REDSTONE_LAMP_INACTIVE("redstone_lamp", 123), REDSTONE_LAMP_ACTIVE( - "lit_redstone_lamp", 124), DOUBLE_OAK_WOOD_SLAB("double_wooden_slab", - 125), DOUBLE_SPRUCE_WOOD_SLAB("double_wooden_slab", 125, 1), DOUBLE_BIRCH_WOOD_SLAB( - "double_wooden_slab", 125, 2), DOUBLE_JUNGLE_WOOD_SLAB("double_wooden_slab", 125, - 3), DOUBLE_ACACIA_WOOD_SLAB("double_wooden_slab", 125, 4), DOUBLE_DARK_OAK_WOOD_SLAB( - "double_wooden_slab", 125, 5), OAK_WOOD_SLAB("wooden_slab", 126), SPRUCE_WOOD_SLAB( - "wooden_slab", 126, 1), BIRCH_WOOD_SLAB("wooden_slab", 126, 2), JUNGLE_WOOD_SLAB( - "wooden_slab", 126, 3), ACACIA_WOOD_SLAB("wooden_slab", 126, 4), DARK_OAK_WOOD_SLAB( - "wooden_slab", 126, 5), COCOA("cocoa", 127), SANDSTONE_STAIRS("sandstone_stairs", - 128), EMERALD_ORE("emerald_ore", 129), ENDER_CHEST("ender_chest", 130), TRIPWIRE_HOOK( - "tripwire_hook", 131), TRIPWIRE("tripwire_hook", 132), EMERALD_BLOCK("emerald_block", - 133), SPRUCE_WOOD_STAIRS("spruce_stairs", 134), BIRCH_WOOD_STAIRS("birch_stairs", - 135), JUNGLE_WOOD_STAIRS("jungle_stairs", 136), COMMAND_BLOCK("command_block", 137), BEACON( - "beacon", 138), COBBLESTONE_WALL("cobblestone_wall", 139), MOSSY_COBBLESTONE_WALL( - "cobblestone_wall", 139, 1), FLOWER_POT("flower_pot", 140), CARROTS("carrots", - 141), POTATOES("potatoes", 142), WOODEN_BUTTON("wooden_button", 143), MOB_HEAD("skull", - 144), ANVIL("anvil", 145), TRAPPED_CHEST("trapped_chest", - 146), WEIGHTED_PRESSURE_PLATE_LIGHT("light_weighted_pressure_plate", - 147), WEIGHTED_PRESSURE_PLATE_HEAVY("heavy_weighted_pressure_plate", - 148), REDSTONE_COMPARATOR_INACTIVE("unpowered_comparator", 149), REDSTONE_COMPARATOR_ACTIVE( - "powered_comparator", 150), DAYLIGHT_SENSOR("daylight_detector", 151), REDSTONE_BLOCK( - "redstone_block", 152), NETHER_QUARTZ_ORE("quartz_ore", 153), HOPPER("hopper", - 154), QUARTZ_BLOCK("quartz_block", 155), CHISELED_QUARTZ_BLOCK("quartz_block", 155, - 1), PILLAR_QUARTZ_BLOCK("quartz_block", 155, 2), QUARTZ_STAIRS("quartz_stairs", - 156), ACTIVATOR_RAIL("activator_rail", 157), DROPPER("dropper", 158), WHITE_STAINED_CLAY( - "stained_hardened_clay", 159), ORANGE_STAINED_CLAY("stained_hardened_clay", 159, - 1), MAGENTA_STAINED_CLAY("stained_hardened_clay", 159, 2), LIGHT_BLUE_STAINED_CLAY( - "stained_hardened_clay", 159, 3), YELLOW_STAINED_CLAY("stained_hardened_clay", 159, - 4), LIME_STAINED_CLAY("stained_hardened_clay", 159, 5), PINK_STAINED_CLAY( - "stained_hardened_clay", 159, 6), GRAY_STAINED_CLAY("stained_hardened_clay", 159, - 7), LIGHT_GRAY_STAINED_CLAY("stained_hardened_clay", 159, 8), CYAN_STAINED_CLAY( - "stained_hardened_clay", 159, 9), PURPLE_STAINED_CLAY("stained_hardened_clay", 159, - 10), BLUE_STAINED_CLAY("stained_hardened_clay", 159, 11), BROWN_STAINED_CLAY( - "stained_hardened_clay", 159, 12), GREEN_STAINED_CLAY("stained_hardened_clay", 159, - 13), RED_STAINED_CLAY("stained_hardened_clay", 159, 14), BLACK_STAINED_CLAY( - "stained_hardened_clay", 159, 15), WHITE_STAINED_GLASS_PANE("stained_glass_pane", - 160), ORANGE_STAINED_GLASS_PANE("stained_glass_pane", 160, 1), MAGENTA_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 2), LIGHT_BLUE_STAINED_GLASS_PANE("stained_glass_pane", 160, - 3), YELLOW_STAINED_GLASS_PANE("stained_glass_pane", 160, 4), LIME_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 5), PINK_STAINED_GLASS_PANE("stained_glass_pane", 160, - 6), GRAY_STAINED_GLASS_PANE("stained_glass_pane", 160, 7), LIGHT_GRAY_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 8), CYAN_STAINED_GLASS_PANE("stained_glass_pane", 160, - 9), PURPLE_STAINED_GLASS_PANE("stained_glass_pane", 160, 10), BLUE_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 11), BROWN_STAINED_GLASS_PANE("stained_glass_pane", 160, - 12), GREEN_STAINED_GLASS_PANE("stained_glass_pane", 160, 13), RED_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 14), BLACK_STAINED_GLASS_PANE("stained_glass_pane", 160, - 15), ACACIA_LEAVES("leaves2", 161), DARK_OAK_LEAVES("leaves2", 161, 1), ACACIA_WOOD("log2", - 162), DARK_OAK_WOOD("log2", 162, 1), ACACIA_WOOD_STAIRS("acacia_stairs", - 163), DARK_OAK_WOOD_STAIRS("dark_oak_stairs", 164), SLIME_BLOCK("slime", 165), BARRIER( - "barrier", 166), IRON_TRAPDOOR("iron_trapdoor", 167), PRISMARINE("prismarine", - 168), PRISMARINE_BRICKS("prismarine", 168, 1), DARK_PRISMARINE("prismarine", 168, - 2), SEA_LANTERN("sea_lantern", 169), HAY_BALE("hay_block", 170), WHITE_CARPET("carpet", - 171), ORANGE_CARPET("carpet", 171, 1), MAGENTA_CARPET("carpet", 171, 2), LIGHT_BLUE_CARPET( - "carpet", 171, 3), YELLOW_CARPET("carpet", 171, 4), LIME_CARPET("carpet", 171, - 5), PINK_CARPET("carpet", 171, 6), GRAY_CARPET("carpet", 171, 7), LIGHT_GRAY_CARPET( - "carpet", 171, 8), CYAN_CARPET("carpet", 171, 9), PURPLE_CARPET("carpet", 171, - 10), BLUE_CARPET("carpet", 171, 11), BROWN_CARPET("carpet", 171, 12), GREEN_CARPET("carpet", - 171, 13), RED_CARPET("carpet", 171, 14), BLACK_CARPET("carpet", 171, 15), HARDENED_CLAY( - "hardened_clay", 172), BLOCK_OF_COAL("coal_block", 173), PACKED_ICE("packed_ice", - 174), SUNFLOWER("double_plant", 175), LILAC("double_plant", 175, 1), DOUBLE_TALLGRASS( - "double_plant", 175, 2), LARGE_FERN("double_plant", 175, 3), ROSE_BUSH("double_plant", 175, - 4), PEONY("double_plant", 175, 5), FREE_STANDING_BANNER("standing_banner", - 176), WALL_MOUNTED_BANNER("wall_banner", 177), INVERTED_DAYLIGHT_SENSOR( - "daylight_detector_inverted", 178), RED_SANDSTONE("red_sandstone", - 179), SMOOTH_RED_SANDSTONE("red_sandstone", 179, 1), CHISELED_RED_SANDSTONE("red_sandstone", - 179, 2), RED_SANDSTONE_STAIRS("red_sandstone_stairs", 180), DOUBLE_RED_SANDSTONE_SLAB( - "stone_slab2", 181), RED_SANDSTONE_SLAB("double_stone_slab2", 182), SPRUCE_FENCE_GATE( - "spruce_fence_gate", 183), BIRCH_FENCE_GATE("birch_fence_gate", 184), JUNGLE_FENCE_GATE( - "jungle_fence_gate", 185), DARK_OAK_FENCE_GATE("dark_oak_fence_gate", - 186), ACACIA_FENCE_GATE("acacia_fence_gate", 187), SPRUCE_FENCE("spruce_fence", - 188), BIRCH_FENCE("birch_fence", 189), JUNGLE_FENCE("jungle_fence", 190), DARK_OAK_FENCE( - "dark_oak_fence", 191), ACACIA_FENCE("acacia_fence", 192), SPRUCE_DOOR_BLOCK("spruce_door", - 193), BIRCH_DOOR_BLOCK("birch_door", 194), JUNGLE_DOOR_BLOCK("jungle_door", - 195), ACACIA_DOOR_BLOCK("acacia_door", 196), DARK_OAK_DOOR_BLOCK("dark_oak_door", - 197), IRON_SHOVEL("iron_shovel", 256), IRON_PICKAXE("iron_pickaxe", 257), IRON_AXE( - "iron_axe", 258), FLINT_AND_STEEL("flint_and_steel", 259), APPLE("apple", 260), BOW("bow", - 261), ARROW("arrow", 262), COAL("coal", 263), CHARCOAL("coal", 263, 1), DIAMOND("diamond", - 264), IRON_INGOT("iron_ingot", 265), GOLD_INGOT("gold_ingot", 266), IRON_SWORD("iron_sword", - 267), WOODEN_SWORD("wooden_sword", 268), WOODEN_SHOVEL("wooden_shovel", - 269), WOODEN_PICKAXE("wooden_pickaxe", 270), WOODEN_AXE("wooden_axe", 271), STONE_SWORD( - "stone_sword", 272), STONE_SHOVEL("stone_shovel", 273), STONE_PICKAXE("stone_pickaxe", - 274), STONE_AXE("stone_axe", 275), DIAMOND_SWORD("diamond_sword", 276), DIAMOND_SHOVEL( - "diamond_shovel", 277), DIAMOND_PICKAXE("diamond_pickaxe", 278), DIAMOND_AXE("diamond_axe", - 279), STICK("stick", 280), BOWL("bowl", 281), MUSHROOM_STEW("mushroom_stew", - 282), GOLDEN_SWORD("golden_sword", 283), GOLDEN_SHOVEL("golden_shovel", - 284), GOLDEN_PICKAXE("golden_pickaxe", 285), GOLDEN_AXE("golden_axe", 286), STRING("string", - 287), FEATHER("feather", 288), GUNPOWDER("gunpowder", 289), WOODEN_HOE("wooden_hoe", - 290), STONE_HOE("stone_hoe", 291), IRON_HOE("iron_hoe", 292), DIAMOND_HOE("diamond_hoe", - 293), GOLDEN_HOE("golden_hoe", 294), WHEAT_SEEDS("wheat_seeds", 295), WHEAT("wheat", - 296), BREAD("bread", 297), LEATHER_HELMET("leather_helmet", 298), LEATHER_TUNIC( - "leather_chestplate", 299), LEATHER_PANTS("leather_leggings", 300), LEATHER_BOOTS( - "leather_boots", 301), CHAINMAIL_HELMET("chainmail_helmet", 302), CHAINMAIL_CHESTPLATE( - "chainmail_chestplate", 303), CHAINMAIL_LEGGINGS("chainmail_leggings", - 304), CHAINMAIL_BOOTS("chainmail_boots", 305), IRON_HELMET("iron_helmet", - 306), IRON_CHESTPLATE("iron_chestplate", 307), IRON_LEGGINGS("iron_leggings", - 308), IRON_BOOTS("iron_boots", 309), DIAMOND_HELMET("diamond_helmet", - 310), DIAMOND_CHESTPLATE("diamond_chestplate", 311), DIAMOND_LEGGINGS("diamond_leggings", - 312), DIAMOND_BOOTS("diamond_boots", 313), GOLDEN_HELMET("golden_helmet", - 314), GOLDEN_CHESTPLATE("golden_chestplate", 315), GOLDEN_LEGGINGS("golden_leggings", - 316), GOLDEN_BOOTS("golden_boots", 317), FLINT("flint_and_steel", 318), RAW_PORKCHOP( - "porkchop", 319), COOKED_PORKCHOP("cooked_porkchop", 320), PAINTING("painting", - 321), GOLDEN_APPLE("golden_apple", 322), ENCHANTED_GOLDEN_APPLE("golden_apple", 322, - 1), SIGN("sign", 323), OAK_DOOR("wooden_door", 324), BUCKET("bucket", 325), WATER_BUCKET( - "water_bucket", 326), LAVA_BUCKET("lava_bucket", 327), MINECART("minecart", 328), SADDLE( - "saddle", 329), IRON_DOOR("iron_door", 330), REDSTONE("redstone", 331), SNOWBALL("snowball", - 332), BOAT("boat", 333), LEATHER("leather", 334), MILK_BUCKET("milk_bucket", 335), BRICK( - "brick", 336), CLAY1("clay_ball", 337), SUGAR_CANES1("reeds", 338), PAPER("paper", - 339), BOOK("book", 340), SLIMEBALL("slime_ball", 341), MINECART_WITH_CHEST("chest_minecart", - 342), MINECART_WITH_FURNACE("furnace_minecart", 343), EGG("egg", 344), COMPASS("compass", - 345), FISHING_ROD("fishing_rod", 346), CLOCK("clock", 347), GLOWSTONE_DUST("glowstone_dust", - 348), RAW_FISH("fish", 349), RAW_SALMON("fish", 349, 1), CLOWNFISH("fish", 349, - 2), PUFFERFISH("fish", 349, 3), COOKED_FISH("cooked_fish", 350), COOKED_SALMON( - "cooked_fish", 350, 1), INK_SACK("dye", 351), ROSE_RED("dye", 351, 1), CACTUS_GREEN("dye", - 351, 2), COCO_BEANS("dye", 351, 3), LAPIS_LAZULI("dye", 351, 4), PURPLE_DYE("dye", 351, - 5), CYAN_DYE("dye", 351, 6), LIGHT_GRAY_DYE("dye", 351, 7), GRAY_DYE("dye", 351, - 8), PINK_DYE("dye", 351, 9), LIME_DYE("dye", 351, 10), DANDELION_YELLOW("dye", 351, - 11), LIGHT_BLUE_DYE("dye", 351, 12), MAGENTA_DYE("dye", 351, 13), ORANGE_DYE("dye", 351, - 14), BONE_MEAL("dye", 351, 15), BONE("bone", 352), SUGAR("sugar", 353), CAKE("cake", - 354), BED1("bed", 355), REDSTONE_REPEATER("repeater", 356), COOKIE("cookie", 357), MAP( - "filled_map", 358), SHEARS("shears", 359), MELON("melon", 360), PUMPKIN_SEEDS( - "pumpkin_seeds", 361), MELON_SEEDS("melon_seeds", 362), RAW_BEEF("beef", 363), STEAK( - "cooked_beef", 364), RAW_CHICKEN("chicken", 365), COOKED_CHICKEN("cooked_chicken", - 366), ROTTEN_FLESH("rotten_flesh", 367), ENDER_PEARL("ender_pearl", 368), BLAZE_ROD( - "blaze_rod", 369), GHAST_TEAR("ghast_tear", 370), GOLD_NUGGET("gold_nugget", - 371), NETHER_WART1("nether_wart", 372), POTION("potion", 373), GLASS_BOTTLE("glass_bottle", - 374), SPIDER_EYE("spider_eye", 375), FERMENTED_SPIDER_EYE("fermented_spider_eye", - 376), BLAZE_POWDER("blaze_powder", 377), MAGMA_CREAM("magma_cream", 378), BREWING_STAND1( - "brewing_stand", 379), CAULDRON1("cauldron", 380), EYE_OF_ENDER("ender_eye", - 381), GLISTERING_MELON("speckled_melon", 382), SPAWN_CREEPER("spawn_egg", 383, - 50), SPAWN_SKELETON("spawn_egg", 383, 51), SPAWN_SPIDER("spawn_egg", 383, 52), SPAWN_ZOMBIE( - "spawn_egg", 383, 54), SPAWN_SLIME("spawn_egg", 383, 55), SPAWN_GHAST("spawn_egg", 383, - 56), SPAWN_PIGMAN("spawn_egg", 383, 57), SPAWN_ENDERMAN("spawn_egg", 383, - 58), SPAWN_CAVE_SPIDER("spawn_egg", 383, 59), SPAWN_SILVERFISH("spawn_egg", 383, - 60), SPAWN_BLAZE("spawn_egg", 383, 61), SPAWN_MAGMA_CUBE("spawn_egg", 383, 62), SPAWN_BAT( - "spawn_egg", 383, 65), SPAWN_WITCH("spawn_egg", 383, 66), SPAWN_ENDERMITE("spawn_egg", 383, - 67), SPAWN_GUARDIAN("spawn_egg", 383, 68), SPAWN_PIG("spawn_egg", 383, 90), SPAWN_SHEEP( - "spawn_egg", 383, 91), SPAWN_COW("spawn_egg", 383, 92), SPAWN_CHICKEN("spawn_egg", 383, - 93), SPAWN_SQUID("spawn_egg", 383, 94), SPAWN_WOLF("spawn_egg", 383, 95), SPAWN_MOOSHROOM( - "spawn_egg", 383, 96), SPAWN_OCELOT("spawn_egg", 383, 98), SPAWN_HORSE("spawn_egg", 383, - 100), SPAWN_RABBIT("spawn_egg", 383, 101), SPAWN_VILLAGER("spawn_egg", 383, - 120), BOTTLE_O_ENCHANTING("experience_bottle", 384), FIRE_CHARGE("fire_charge", - 385), BOOK_AND_QUILL("writable_book", 386), WRITTEN_BOOK("written_book", 387), EMERALD( - "emerald", 388), ITEM_FRAME("item_frame", 389), FLOWER_POT1("flower_pot", 390), CARROT( - "carrot", 391), POTATO("potato", 392), BAKED_POTATO("baked_potato", 393), POISONOUS_POTATO( - "poisonous_potato", 394), EMPTY_MAP("map", 395), GOLDEN_CARROT("golden_carrot", - 396), MOB_HEAD_SKELETON("skull", 397), MOB_HEAD_WITHER_SKELETON("skull", 397, - 1), MOB_HEAD_ZOMBIE("skull", 397, 2), MOB_HEAD_HUMAN("skull", 397, 3), MOB_HEAD_CREEPER( - "skull", 397, 4), CARROT_ON_A_STICK("carrot_on_a_stick", 398), NETHER_STAR("nether_star", - 399), PUMPKIN_PIE("pumpkin_pie", 400), FIREWORK_ROCKET("fireworks", 401), FIREWORK_STAR( - "firework_charge", 402), ENCHANTED_BOOK("enchanted_book", 403), REDSTONE_COMPARATOR( - "comparator", 404), NETHER_BRICK1("netherbrick", 405), NETHER_QUARTZ("quartz", - 406), MINECART_WITH_TNT("tnt_minecart", 407), MINECART_WITH_HOPPER("hopper_minecart", - 408), PRISMARINE_SHARD("prismarine_shard", 409), PRISMARINE_CRYSTALS("prismarine_crystals", - 410), RAW_RABBIT("rabbit", 411), COOKED_RABBIT("cooked_rabbit", 412), RABBIT_STEW( - "rabbit_stew", 413), RABBITS_FOOT("rabbit_foot", 414), RABBIT_HIDE("rabbit_hide", - 415), ARMOR_STAND("armor_stand", 416), IRON_HORSE_ARMOR("iron_horse_armor", - 417), GOLDEN_HORSE_ARMOR("golden_horse_armor", 418), DIAMOND_HORSE_ARMOR( - "diamond_horse_armor", 419), LEAD("lead", 420), NAME_TAG("name_tag", - 421), MINECART_WITH_COMMAND_BLOCK("command_block_minecart", 422), RAW_MUTTON("mutton", - 423), COOKED_MUTTON("cooked_mutton", 424), BANNER("banner", 425), SPRUCE_DOOR("spruce_door", - 427), BIRCH_DOOR("birch_door", 428), JUNGLE_DOOR("jungle_door", 429), ACACIA_DOOR( - "acacia_door", 430), DARK_OAK_DOOR("dark_oak_door", 431), DISC_13("record_13", - 2256), CAT_DISC("record_cat", 2257), BLOCKS_DISC("record_blocks", 2258), CHIRP_DISC( - "record_chirp", 2259), FAR_DISC("record_far", 2260), MALL_DISC("record_mall", - 2261), MELLOHI_DISC("record_mellohi", 2262), STAL_DISC("record_stal", 2263), STRAD_DISC( - "record_strad", 2264), WARD_DISC("record_ward", 2265), DISC_11("record_11", - 2266), WAIT_DISC("record_wait", 2267), END_ROD("end_rod", 198), CHORUS_PLANT("chorus_plant", - 199), CHORUS_FLOWER("chorus_flower", 200), PURPUR_BLOCK("purpur_block", 201), PURPUR_PILLAR( - "purpur_pillar", 202), PURPUR_STAIRS("purpur_stairs", 203), PURPUR_DOUBLE_SLAB( - "purpur_double_slab", 204), PURPUR_SLAB("purpur_slab", 205), END_BRICKS("end_bricks", - 206), BEETROOTS("beetroots", 207), GRASS_PATH("grass_path", 208), END_GATEWAY("end_gateway", - 209), REPEATING_COMMAND_BLOCK("repeating_command_block", 210), CHAIN_COMMAND_BLOCK( - "chain_command_block", 211), FROSTED_ICE("frosted_ice", 212), STRUCTURE_BLOCK( - "structure_block", 255); - - private static final Map ids = new HashMap<>(); - private static final Map datas = new HashMap<>(); - - static { - for (ItemType type : EnumSet.allOf(ItemType.class)) { - ids.put(type.name, type.id); - datas.put(type.name, type.data); - } - } - - private final int id; - private final byte data; - private final String name; - - ItemType(String name, int id) { - this.id = id; - this.data = 0; - this.name = name; - } - - ItemType(String name, int id, int data) { - this.id = id; - this.data = (byte) data; - this.name = name; - } - - public static int getId(String name) { - Integer value = ids.get(name); - if (value == null) { - return 0; - } - return value; - } - - public static byte getData(String name) { - Byte value = datas.get(name); - if (value == null) { - return 0; - } - return value; - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java index 2b7e31295..6e3cc6688 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java @@ -1,6 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; public class PlotItem { @@ -9,10 +12,10 @@ public class PlotItem { public final int z; // public final short[] id; // public final byte[] data; - public final PlotBlock[] types; + public final ItemType[] types; public final byte[] amount; - public PlotItem(short x, short y, short z, PlotBlock[] types, byte[] amount) { + public PlotItem(short x, short y, short z, ItemType[] types, byte[] amount) { this.x = x; this.y = y; this.z = z; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java index e2c222df5..5977c1eb3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java @@ -1,9 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicWriter; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; @@ -17,10 +19,10 @@ import java.util.Map; public class Schematic { // Lossy but fast - @Getter private final BlockArrayClipboard clipboard; + @Getter private final Clipboard clipboard; @Getter private Map flags = new HashMap<>(); - public Schematic(BlockArrayClipboard clip) { + public Schematic(Clipboard clip) { this.clipboard = clip; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java index a19404da2..6f31b68ed 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java index 994f6a465..0223c45f6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.stream; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.IOException; import java.io.OutputStream; 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 8d5152a1b..a60d788df 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java index 7a59dab9d..b5156eae9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; 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 7f63e2ed0..cfeba3ff2 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; 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 1f5e70856..a8b2c421f 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java index f2e0b3c03..2dd7399ad 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; 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 49d3788d5..dedeeacdf 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; 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 d50e3d22f..a01bf0e70 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 @@ -1,11 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; @@ -35,7 +37,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { blockBuckets[layer] = new BlockBucket[4096]; } blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("bedrock")); + BlockBucket.withSingle(BlockUtil.get("bedrock")); } } } @@ -47,7 +49,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { blockBuckets[layer] = new BlockBucket[4096]; } blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("dirt")); + BlockBucket.withSingle(BlockUtil.get("dirt")); } } } @@ -59,7 +61,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { blockBuckets[layer] = new BlockBucket[4096]; } blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("grass_block")); + BlockBucket.withSingle(BlockUtil.get("grass_block")); } } } @@ -71,12 +73,12 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { if (area.VOID) { Location min = result.getMin(); if (min.getX() == 0 && min.getZ() == 0) { - result.setBlock(0, 0, 0, PlotBlock.get("bedrock")); + result.setBlock(0, 0, 0, BlockUtil.get("bedrock")); } } else { - result.setCuboid(bedrock1, bedrock2, PlotBlock.get("bedrock")); - result.setCuboid(dirt1, dirt2, PlotBlock.get("dirt")); - result.setCuboid(grass1, grass2, PlotBlock.get("grass_block")); + result.setCuboid(bedrock1, bedrock2, BlockUtil.get("bedrock")); + result.setCuboid(dirt1, dirt2, BlockUtil.get("dirt")); + result.setCuboid(grass1, grass2, BlockUtil.get("grass_block")); } result.fillBiome("PLAINS"); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java index 6052c2a93..9dd004cf1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Arrays; public class ArrayUtil { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java index ace8bb7e4..3b3b9d0c7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class ByteArrayUtilities { public static byte[] integerToBytes(int i) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java index 1177206e6..5ffba6493 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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 206f2b710..e67c11265 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java index e6cdc4134..a502f7538 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.CmdInstance; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java index 4eff629d6..281b2f71b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java index f8860887f..12afc3798 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class ConsoleColors { public static String fromString(String input) { input = input.replaceAll("&0", fromChatColor("&0")).replaceAll("&1", fromChatColor("&1")) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java index 4912b6e83..8554b2d78 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java index 51e093d46..ad8a19479 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.IntegerFlag; 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 5d443a43e..51f055fea 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -10,18 +12,22 @@ 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.sk89q.worldedit.world.block.BlockState; 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 com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import org.jetbrains.annotations.Nullable; import java.util.HashSet; import java.util.List; import java.util.Optional; +import java.util.Set; import java.util.UUID; +import java.util.function.Supplier; public abstract class EventUtil { @@ -101,7 +107,7 @@ public abstract class EventUtil { } public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type, - Location location, LazyBlock block, boolean notifyPerms) { + Location location, Supplier block, boolean notifyPerms) { PlotArea area = location.getPlotArea(); assert area != null; Plot plot = area.getPlot(location); @@ -127,19 +133,19 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } - Optional> use = plot.getFlag(Flags.USE); + Optional> use = plot.getFlag(Flags.USE); if (use.isPresent()) { - HashSet value = use.get(); - if (PlotBlock.containsEverything(value) || value - .contains(block.getPlotBlock())) { + Set value = use.get(); + if (value.contains(BlockTypes.AIR) || value + .contains(block.get())) { return true; } } - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); if (destroy.isPresent()) { - HashSet value = destroy.get(); - if (PlotBlock.containsEverything(value) || value - .contains(block.getPlotBlock())) { + Set value = destroy.get(); + if (value.contains(BlockTypes.AIR) || value + .contains(block.get())) { return true; } } @@ -221,10 +227,10 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } - Optional> flagValue = plot.getFlag(Flags.USE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { return Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil @@ -244,10 +250,10 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_BUILD_UNOWNED.getTranslated(), notifyPerms); } - Optional> flagValue = plot.getFlag(Flags.PLACE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.PLACE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_OTHER.getTranslated(), false)) { return true; @@ -271,10 +277,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.DEVICE_INTERACT).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.USE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -298,10 +304,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.USE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -327,10 +333,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.USE); - HashSet value = flag.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flag = plot.getFlag(Flags.USE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -357,10 +363,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.USE); - HashSet value = flag.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flag = plot.getFlag(Flags.USE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -387,10 +393,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.PLACE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.PLACE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -417,10 +423,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.PLACE); - HashSet value = flag.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flag = plot.getFlag(Flags.PLACE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -448,10 +454,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.PLACE); - HashSet value = flag.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flag = plot.getFlag(Flags.PLACE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java index 761c5aa0a..ff5bfd98c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Settings; import java.io.BufferedReader; 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 b5ebe5d17..300958f55 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.google.common.base.Charsets; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java index 03b87fc2b..3ce6f49cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java index dfbc0b3eb..e9dca64af 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java @@ -1,10 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import lombok.NonNull; import java.util.Collection; @@ -36,7 +38,7 @@ import java.util.Map; } private BlockBucket blockToBucket(@NonNull final String block) { - final PlotBlock plotBlock = WorldUtil.IMP.getClosestBlock(block).best; + final BlockState plotBlock = WorldUtil.IMP.getClosestBlock(block).best; return BlockBucket.withSingle(plotBlock); } @@ -48,9 +50,9 @@ import java.util.Map; section.set(string, blocks.toString()); } - private BlockBucket blockListToBucket(@NonNull final PlotBlock[] blocks) { - final Map counts = new HashMap<>(); - for (final PlotBlock block : blocks) { + private BlockBucket blockListToBucket(@NonNull final BlockState[] blocks) { + final Map counts = new HashMap<>(); + for (final BlockState block : blocks) { counts.putIfAbsent(block, 0); counts.put(block, counts.get(block) + 1); } @@ -63,7 +65,7 @@ import java.util.Map; } final BlockBucket bucket = new BlockBucket(); if (includeRatios) { - for (final Map.Entry count : counts.entrySet()) { + for (final Map.Entry count : counts.entrySet()) { bucket.addBlock(count.getKey(), count.getValue()); } } else { @@ -72,9 +74,9 @@ import java.util.Map; return bucket; } - private PlotBlock[] splitBlockList(@NonNull final List list) { + private BlockState[] splitBlockList(@NonNull final List list) { return list.stream().map(s -> WorldUtil.IMP.getClosestBlock(s).best) - .toArray(PlotBlock[]::new); + .toArray(BlockState[]::new); } private void convertBlock(@NonNull final ConfigurationSection section, @@ -86,14 +88,14 @@ import java.util.Map; private void convertBlockList(@NonNull final ConfigurationSection section, @NonNull final String key, @NonNull final List blockList) { - final PlotBlock[] blocks = this.splitBlockList(blockList); + final BlockState[] blocks = this.splitBlockList(blockList); final BlockBucket bucket = this.blockListToBucket(blocks); this.setString(section, key, bucket); PlotSquared.log( Captions.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString())); } - private String plotBlockArrayString(@NonNull final PlotBlock[] blocks) { + private String plotBlockArrayString(@NonNull final BlockState[] blocks) { final StringBuilder builder = new StringBuilder(); for (int i = 0; i < blocks.length; i++) { builder.append(blocks[i].toString()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyMappings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyMappings.java deleted file mode 100644 index d79ad6653..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyMappings.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.util; - -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; - -public abstract class LegacyMappings { - - public abstract PlotBlock fromAny(final String string); - - public abstract PlotBlock fromLegacyToString(final int id, final int data); - - public abstract PlotBlock fromLegacyToString(final String id); - - public abstract PlotBlock fromStringToLegacy(final String id); - -} 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 af4b21e3c..e998c787d 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.Like; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java index 00ea391ba..c82000adc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class MathMan { private static final int ATAN2_BITS = 7; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java index c9a332bb9..8143a7588 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java index b3b1fd5a7..f881f95e6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum PlotGameMode { NOT_SET(-1, ""), SURVIVAL(0, "survival"), CREATIVE(1, "creative"), ADVENTURE(2, "adventure"), SPECTATOR(3, "spectator"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java index 62ea9cc33..759f423c3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum PlotWeather { RAIN, CLEAR, RESET } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java index 621766c17..64cce0b02 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java index b9fc6ff09..56493658a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; 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 90a9b905f..7fa86c242 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.json.JSONArray; import com.github.intellectualsites.plotsquared.json.JSONException; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -19,7 +21,7 @@ import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; @@ -180,7 +182,7 @@ public abstract class SchematicHandler { return; } // block type and data arrays - final BlockArrayClipboard blockArrayClipboard = schematic.getClipboard(); + final Clipboard blockArrayClipboard = schematic.getClipboard(); // Calculate the optimal height to paste the schematic at final int y_offset_actual; if (autoHeight) { @@ -330,7 +332,7 @@ public abstract class SchematicHandler { ClipboardFormat format = ClipboardFormats.findByFile(file); if (format != null) { ClipboardReader reader = format.getReader(new FileInputStream(file)); - BlockArrayClipboard clip = (BlockArrayClipboard) reader.read(); + Clipboard clip = reader.read(); return new Schematic(clip); } else { throw new UnsupportedFormatException( @@ -357,13 +359,13 @@ public abstract class SchematicHandler { try { SpongeSchematicReader schematicReader = new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is))); - BlockArrayClipboard clip = (BlockArrayClipboard) schematicReader.read(); + Clipboard clip = schematicReader.read(); return new Schematic(clip); } catch (IOException ignored) { try { MCEditSchematicReader schematicReader = new MCEditSchematicReader(new NBTInputStream(new GZIPInputStream(is))); - BlockArrayClipboard clip = (BlockArrayClipboard) schematicReader.read(); + Clipboard clip = schematicReader.read(); return new Schematic(clip); } catch (IOException e) { e.printStackTrace(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java index b77d991fe..670e01798 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.SetupObject; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java index dd6a1f960..f2a6cbde2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java index 047b4a71f..304f55b32 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.jetbrains.annotations.NotNull; import java.lang.reflect.Array; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java index f6e86cd92..a558487c5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; 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 9967e88eb..5fb4bfba7 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; 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 b5e37ed93..927cc646c 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java index 0ad79b41b..d3f35e4b7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import lombok.Getter; import lombok.NonNull; import lombok.RequiredArgsConstructor; 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 a503e1882..a82e50d9e 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,9 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -50,15 +52,15 @@ public abstract class WorldUtil { public abstract void saveWorld(String world); - public abstract String getClosestMatchingName(PlotBlock plotBlock); + public abstract String getClosestMatchingName(BlockState plotBlock); - public abstract boolean isBlockSolid(PlotBlock block); + public abstract boolean isBlockSolid(BlockState block); - public abstract StringComparison.ComparisonResult getClosestBlock(String name); + public abstract StringComparison.ComparisonResult getClosestBlock(String name); public abstract String getBiome(String world, int x, int z); - public abstract PlotBlock getBlock(Location location); + public abstract BlockState getBlock(Location location); public abstract int getHighestBlock(String world, int x, int z); @@ -161,5 +163,5 @@ public abstract class WorldUtil { return null; } - public abstract boolean isBlockSame(PlotBlock block1, PlotBlock block2); + public abstract boolean isBlockSame(BlockState block1, BlockState block2); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java index 133088a2e..212778ccd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.area; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import java.util.HashSet; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index ad20a5b99..d524e2af9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -1,6 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -30,7 +32,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { public abstract LocalChunk getLocalChunk(int x, int z); - @Override public abstract PlotBlock getBlock(int x, int y, int z); + @Override public abstract BlockState getBlock(int x, int y, int z); public abstract void setComponents(LocalChunk lc) throws ExecutionException, InterruptedException; @@ -111,11 +113,11 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return true; } - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { - // Trying to mix PlotBlock and BaseBlock leads to all kinds of issues. - // Since BaseBlock has more features than PlotBlock, simply convert - // all PlotBlocks to BaseBlocks - return setBlock(x, y, z, id.getBaseBlock()); + @Override public boolean setBlock(int x, int y, int z, BlockState id) { + // Trying to mix BlockState and BaseBlock leads to all kinds of issues. + // Since BaseBlock has more features than BlockState, simply convert + // all BlockStates to BaseBlocks + return setBlock(x, y, z, id.toBaseBlock()); } @Override public final boolean setBiome(int x, int z, String biome) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java new file mode 100644 index 000000000..c83375edc --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java @@ -0,0 +1,89 @@ +package com.github.intellectualsites.plotsquared.plot.util.block; + +import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.FuzzyBlockState; +import com.sk89q.worldedit.world.registry.LegacyMapper; +import lombok.NonNull; + +import java.util.Map; + +public final class BlockUtil { + private BlockUtil(){} + + private static final ParserContext PARSER_CONTEXT = new ParserContext(); + + private static final InputParser PARSER; + + static { + PARSER_CONTEXT.setRestricted(false); + PARSER_CONTEXT.setPreferringWildcard(false); + PARSER_CONTEXT.setTryLegacy(true); + PARSER = WorldEdit.getInstance().getBlockFactory().getParsers().get(0); + } + + public static final BlockState get(int id) { + return LegacyMapper.getInstance().getBlockFromLegacy(id); + } + + public static final BlockState get(int id, int data) { + return LegacyMapper.getInstance().getBlockFromLegacy(id, data); + } + + public static final BlockState get(String id) { + if (id.length() == 1 && id.charAt(0) == '*') { + return FuzzyBlockState.builder().type(BlockTypes.AIR).build(); + } + BlockType type = BlockType.REGISTRY.get(id); + if (type != null) { + return type.getDefaultState(); + } + if (Character.isDigit(id.charAt(0))) { + String[] split = id.split(":"); + if (MathMan.isInteger(split[0])) { + if (split.length == 2) { + if (MathMan.isInteger(split[1])) { + return get(Integer.parseInt(split[0]), Integer.parseInt(split[1])); + } + } else { + return get(Integer.parseInt(split[0])); + } + } + } + try { + BaseBlock block = PARSER.parseFromInput(id, PARSER_CONTEXT); + return block.toImmutableState(); + } catch (InputParseException e) { + e.printStackTrace(); + return null; + } + } + + public static final BlockState[] parse(String commaDelimited) { + String[] split = commaDelimited.split(",(?![^\\(\\[]*[\\]\\)])"); + BlockState[] result = new BlockState[split.length]; + for (int i = 0; i < split.length; i++) { + result[i] = get(split[i]); + } + return result; + } + + public static BlockState deserialize(@NonNull final Map map) { + if (map.containsKey("material")) { + final Object object = map.get("material"); + return get(object.toString()); + } + return null; + } + +} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index c5c17b4a4..61e08a208 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -1,6 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BaseBlock; public class DelegateLocalBlockQueue extends LocalBlockQueue { @@ -62,11 +64,11 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { return parent.setBlock(x, y, z, id); } - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { return parent.setBlock(x, y, z, id); } - @Override public PlotBlock getBlock(int x, int y, int z) { + @Override public BlockState getBlock(int x, int y, int z) { return parent.getBlock(x, y, z); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java index 049b13d32..3aadb6ebf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java new file mode 100644 index 000000000..243d098ab --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java @@ -0,0 +1,30 @@ +package com.github.intellectualsites.plotsquared.plot.util.block; + +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; + +import java.util.Locale; + +public final class ItemUtil { + private ItemUtil(){} + + public static ItemType get(String input) { + input = input.toLowerCase(Locale.ROOT); + if (Character.isDigit(input.charAt(0))) { + String[] split = input.split(":"); + if (MathMan.isInteger(split[0])) { + if (split.length == 2) { + if (MathMan.isInteger(split[1])) { + return LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]), Integer.parseInt(split[1])); + } + } else { + return LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0])); + } + } + } + if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input; + return ItemTypes.get(input); + } +} 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 1ce8ccd11..8fc6011e2 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,8 +1,10 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.StringMan; @@ -53,7 +55,7 @@ public abstract class LocalBlockQueue { * @param z the z coordinate from 0 to 15 inclusive * @param id the id to set the block to */ - public abstract boolean setBlock(final int x, final int y, final int z, final PlotBlock id); + public abstract boolean setBlock(final int x, final int y, final int z, final BlockState id); public abstract boolean setBlock(final int x, final int y, final int z, final BaseBlock id); @@ -62,7 +64,7 @@ public abstract class LocalBlockQueue { return true; } - public abstract PlotBlock getBlock(int x, int y, int z); + public abstract BlockState getBlock(int x, int y, int z); public abstract boolean setBiome(int x, int z, String biome); @@ -100,7 +102,7 @@ public abstract class LocalBlockQueue { return GlobalBlockQueue.IMP.enqueue(this); } - public void setCuboid(Location pos1, Location pos2, PlotBlock block) { + public void setCuboid(Location pos1, Location pos2, BlockState block) { int yMin = Math.min(pos1.getY(), pos2.getY()); int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY())); int xMin = Math.min(pos1.getX(), pos2.getX()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java index d0a561111..075865ff5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.sk89q.worldedit.world.block.BaseBlock; public class OffsetLocalBlockQueue extends DelegateLocalBlockQueue { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java index 3c96e0d5f..aebe4707d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class QueueProvider { public static QueueProvider of(final Class primary, final Class fallback) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java index 7e41887ed..0c404c548 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java @@ -1,10 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.sk89q.worldedit.world.block.BaseBlock; @@ -55,7 +57,7 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { .setBlock(x + minX, y + minY, z + minZ, id); } - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super .setBlock(x + minX, y + minY, z + minZ, id); } 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 dbd9773f0..906b15247 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java index ab95068da..95f4067f2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java @@ -1,4 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class ExpirySettings { } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java index e959948b4..3e1c964dd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; 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 484759d66..4f18151cc 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 @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java index c10d9507b..1733d93b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java index 9981dd0f1..01c8e5f29 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java index 5b165d32a..c701b2b9b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java index c2a0af542..58f0ed56b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java index c2b81a729..4b94e58a2 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java @@ -1,20 +1,24 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.AbstractDBTest; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.EventUtilTest; +import com.sk89q.worldedit.world.block.BlockType; import org.junit.Before; import org.junit.Test; import java.util.Collection; import java.util.HashSet; import java.util.Optional; +import java.util.Set; import java.util.UUID; import static org.junit.Assert.assertEquals; @@ -36,13 +40,13 @@ public class FlagTest { Optional flag = plot.getFlag(use); if (flag.isPresent()) { System.out.println(Flags.USE.valueToString(flag.get())); - testBlock = PlotBlock.get((short) 1, (byte) 0); + testBlock = BlockUtil.get((short) 1, (byte) 0); flag.get().add(testBlock); } flag.ifPresent(collection -> System.out.println(Flags.USE.valueToString(collection))); - Optional> flag2 = plot.getFlag(Flags.USE); + Optional> flag2 = plot.getFlag(Flags.USE); if (flag2.isPresent()) { - // assertThat(flag2.get(), (Matcher>) IsCollectionContaining.hasItem(testBlock)); + // assertThat(flag2.get(), (Matcher>) IsCollectionContaining.hasItem(testBlock)); } if (flag.isPresent() && flag2.isPresent()) { assertEquals(flag.get(), flag2.get()); diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java index 069c886da..d5570365f 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.junit.Test; public class PlotVersionTest { diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java index a2cc07d1b..37e7d8ba6 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java index a421137c0..da13420fa 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.junit.Test; import java.util.logging.Logger; 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 fd2a8db15..f5cfba022 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,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java index 58e43ff65..15b6ded37 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.AbstractDBTest; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/build.gradle b/build.gradle index 667ba16f8..99e3b3d1c 100644 --- a/build.gradle +++ b/build.gradle @@ -48,6 +48,14 @@ version = String.format("%s.%s", rootVersion, buildNumber) description = rootProject.name +allprojects { + gradle.projectsEvaluated { + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xmaxerrs" << "1000" + } + } +} + subprojects { apply(plugin: "java") apply(plugin: "maven") From 7e6dc48d697432a26038d972ae5d1d561becaf56 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 4 Nov 2019 19:58:24 +0000 Subject: [PATCH 171/258] imports --- .../plotsquared/bukkit/BukkitMain.java | 4 ---- .../plotsquared/bukkit/chat/ArrayWrapper.java | 2 -- .../plotsquared/bukkit/chat/FancyMessage.java | 2 -- .../bukkit/chat/JsonRepresentedObject.java | 2 -- .../plotsquared/bukkit/chat/JsonString.java | 2 -- .../plotsquared/bukkit/chat/MessagePart.java | 2 -- .../plotsquared/bukkit/chat/Reflection.java | 2 -- .../plotsquared/bukkit/chat/TextualComponent.java | 2 -- .../plotsquared/bukkit/commands/DebugUUID.java | 2 -- .../bukkit/events/PlayerClaimPlotEvent.java | 2 -- .../bukkit/events/PlayerEnterPlotEvent.java | 2 -- .../bukkit/events/PlayerLeavePlotEvent.java | 2 -- .../bukkit/events/PlayerPlotDeniedEvent.java | 2 -- .../bukkit/events/PlayerPlotHelperEvent.java | 2 -- .../bukkit/events/PlayerPlotTrustedEvent.java | 2 -- .../bukkit/events/PlayerTeleportToPlotEvent.java | 2 -- .../plotsquared/bukkit/events/PlotAutoMergeEvent.java | 2 -- .../bukkit/events/PlotChangeOwnerEvent.java | 2 -- .../plotsquared/bukkit/events/PlotClearEvent.java | 2 -- .../bukkit/events/PlotComponentSetEvent.java | 2 -- .../plotsquared/bukkit/events/PlotDeleteEvent.java | 2 -- .../plotsquared/bukkit/events/PlotEvent.java | 2 -- .../plotsquared/bukkit/events/PlotFlagAddEvent.java | 2 -- .../bukkit/events/PlotFlagRemoveEvent.java | 2 -- .../plotsquared/bukkit/events/PlotMergeEvent.java | 2 -- .../plotsquared/bukkit/events/PlotRateEvent.java | 2 -- .../plotsquared/bukkit/events/PlotUnlinkEvent.java | 2 -- .../bukkit/generator/BukkitAugmentedGenerator.java | 2 -- .../bukkit/generator/BukkitPlotGenerator.java | 2 -- .../bukkit/generator/DelegatePlotGenerator.java | 5 +---- .../bukkit/generator/PlotBlockPopulator.java | 2 -- .../plotsquared/bukkit/listeners/ChunkListener.java | 2 -- .../bukkit/listeners/EntitySpawnListener.java | 2 -- .../bukkit/listeners/ForceFieldListener.java | 2 -- .../plotsquared/bukkit/listeners/PlayerEvents.java | 8 +++----- .../bukkit/listeners/PlotPlusListener.java | 2 -- .../bukkit/listeners/SingleWorldListener.java | 2 -- .../plotsquared/bukkit/listeners/WorldEvents.java | 2 -- .../plotsquared/bukkit/object/BukkitBlockUtil.java | 4 ---- .../bukkit/object/BukkitOfflinePlayer.java | 2 -- .../plotsquared/bukkit/object/BukkitPlayer.java | 6 +----- .../bukkit/object/entity/AgeableStats.java | 2 -- .../bukkit/object/entity/ArmorStandStats.java | 2 -- .../bukkit/object/entity/EntityBaseStats.java | 2 -- .../bukkit/object/entity/EntityWrapper.java | 2 -- .../plotsquared/bukkit/object/entity/HorseStats.java | 2 -- .../bukkit/object/entity/LivingEntityStats.java | 2 -- .../object/entity/ReplicatingEntityWrapper.java | 2 -- .../bukkit/object/entity/TameableStats.java | 2 -- .../bukkit/object/entity/TeleportEntityWrapper.java | 2 -- .../bukkit/object/schematic/StateWrapper.java | 2 -- .../plotsquared/bukkit/util/BukkitChatManager.java | 2 -- .../plotsquared/bukkit/util/BukkitChunkManager.java | 4 +--- .../plotsquared/bukkit/util/BukkitCommand.java | 2 -- .../plotsquared/bukkit/util/BukkitEconHandler.java | 2 -- .../plotsquared/bukkit/util/BukkitEventUtil.java | 2 -- .../plotsquared/bukkit/util/BukkitHybridUtils.java | 7 ++----- .../plotsquared/bukkit/util/BukkitInventoryUtil.java | 2 -- .../bukkit/util/BukkitSchematicHandler.java | 2 -- .../plotsquared/bukkit/util/BukkitSetupUtils.java | 2 -- .../plotsquared/bukkit/util/BukkitTaskManager.java | 2 -- .../plotsquared/bukkit/util/BukkitUtil.java | 8 +++----- .../plotsquared/bukkit/util/BukkitVersion.java | 2 -- .../plotsquared/bukkit/util/Metrics.java | 2 -- .../plotsquared/bukkit/util/NbtFactory.java | 2 -- .../plotsquared/bukkit/util/OfflinePlayerUtil.java | 2 -- .../plotsquared/bukkit/util/SendChunk.java | 2 -- .../plotsquared/bukkit/util/SetGenCB.java | 2 -- .../bukkit/util/block/BukkitLocalQueue.java | 5 ++--- .../plotsquared/bukkit/util/block/GenChunk.java | 6 ++---- .../plotsquared/bukkit/uuid/DatFileFilter.java | 2 -- .../plotsquared/bukkit/uuid/DefaultUUIDWrapper.java | 2 -- .../plotsquared/bukkit/uuid/FileUUIDHandler.java | 2 -- .../bukkit/uuid/LowerOfflineUUIDWrapper.java | 2 -- .../plotsquared/bukkit/uuid/OfflineUUIDWrapper.java | 2 -- .../plotsquared/bukkit/uuid/SQLUUIDHandler.java | 2 -- .../intellectualsites/plotsquared/api/PlotAPI.java | 2 -- .../plotsquared/commands/Argument.java | 2 -- .../plotsquared/commands/Command.java | 2 -- .../plotsquared/commands/CommandCaller.java | 2 -- .../plotsquared/commands/CommandDeclaration.java | 2 -- .../plotsquared/configuration/Configuration.java | 2 -- .../configuration/ConfigurationOptions.java | 2 -- .../configuration/ConfigurationSection.java | 2 -- .../configuration/InvalidConfigurationException.java | 2 -- .../configuration/MemoryConfiguration.java | 2 -- .../configuration/MemoryConfigurationOptions.java | 2 -- .../plotsquared/configuration/MemorySection.java | 2 -- .../configuration/file/FileConfiguration.java | 2 -- .../configuration/file/FileConfigurationOptions.java | 2 -- .../configuration/file/YamlConfiguration.java | 2 -- .../configuration/file/YamlConfigurationOptions.java | 2 -- .../configuration/file/YamlConstructor.java | 2 -- .../configuration/file/YamlRepresenter.java | 2 -- .../serialization/ConfigurationSerializable.java | 2 -- .../serialization/ConfigurationSerialization.java | 2 -- .../serialization/DelegateDeserialization.java | 2 -- .../configuration/serialization/SerializableAs.java | 2 -- .../intellectualsites/plotsquared/json/JSONArray.java | 2 -- .../plotsquared/json/JSONException.java | 2 -- .../plotsquared/json/JSONObject.java | 2 -- .../plotsquared/json/JSONString.java | 2 -- .../plotsquared/json/JSONTokener.java | 2 -- .../intellectualsites/plotsquared/json/Property.java | 2 -- .../intellectualsites/plotsquared/json/XML.java | 2 -- .../plotsquared/json/XMLTokener.java | 2 -- .../intellectualsites/plotsquared/plot/Platform.java | 2 -- .../plotsquared/plot/PlotSquared.java | 3 --- .../plotsquared/plot/PlotVersion.java | 2 -- .../plotsquared/plot/commands/Add.java | 2 -- .../plotsquared/plot/commands/Alias.java | 2 -- .../plotsquared/plot/commands/Area.java | 2 -- .../plotsquared/plot/commands/Auto.java | 2 -- .../plotsquared/plot/commands/Biome.java | 2 -- .../plotsquared/plot/commands/Buy.java | 2 -- .../plotsquared/plot/commands/Chat.java | 2 -- .../plotsquared/plot/commands/Claim.java | 2 -- .../plotsquared/plot/commands/Clear.java | 2 -- .../plotsquared/plot/commands/Cluster.java | 2 -- .../plotsquared/plot/commands/CommandCategory.java | 2 -- .../plotsquared/plot/commands/Comment.java | 2 -- .../plotsquared/plot/commands/Condense.java | 2 -- .../plotsquared/plot/commands/Confirm.java | 2 -- .../plotsquared/plot/commands/Continue.java | 2 -- .../plotsquared/plot/commands/Copy.java | 2 -- .../plot/commands/CreateRoadSchematic.java | 2 -- .../plotsquared/plot/commands/Database.java | 2 -- .../plotsquared/plot/commands/Debug.java | 2 -- .../plotsquared/plot/commands/DebugAllowUnsafe.java | 2 -- .../plotsquared/plot/commands/DebugClaimTest.java | 2 -- .../plotsquared/plot/commands/DebugExec.java | 4 +--- .../plotsquared/plot/commands/DebugFixFlags.java | 2 -- .../plotsquared/plot/commands/DebugImportWorlds.java | 2 -- .../plotsquared/plot/commands/DebugLoadTest.java | 2 -- .../plotsquared/plot/commands/DebugPaste.java | 2 -- .../plotsquared/plot/commands/DebugRoadRegen.java | 2 -- .../plotsquared/plot/commands/DebugSaveTest.java | 2 -- .../plotsquared/plot/commands/Delete.java | 2 -- .../plotsquared/plot/commands/Deny.java | 2 -- .../plotsquared/plot/commands/Desc.java | 2 -- .../plotsquared/plot/commands/Dislike.java | 2 -- .../plotsquared/plot/commands/Done.java | 2 -- .../plotsquared/plot/commands/Download.java | 2 -- .../plotsquared/plot/commands/FlagCmd.java | 6 +----- .../plotsquared/plot/commands/GenerateDocs.java | 2 -- .../plotsquared/plot/commands/Grant.java | 2 -- .../plotsquared/plot/commands/Help.java | 2 -- .../plotsquared/plot/commands/Inbox.java | 2 -- .../plotsquared/plot/commands/Info.java | 2 -- .../plotsquared/plot/commands/Kick.java | 2 -- .../plotsquared/plot/commands/Leave.java | 2 -- .../plotsquared/plot/commands/Like.java | 2 -- .../plotsquared/plot/commands/ListCmd.java | 2 -- .../plotsquared/plot/commands/Load.java | 2 -- .../plotsquared/plot/commands/MainCommand.java | 2 -- .../plotsquared/plot/commands/Merge.java | 2 -- .../plotsquared/plot/commands/Middle.java | 2 -- .../plotsquared/plot/commands/Move.java | 2 -- .../plotsquared/plot/commands/Music.java | 2 -- .../plotsquared/plot/commands/Near.java | 2 -- .../plotsquared/plot/commands/Owner.java | 2 -- .../plotsquared/plot/commands/PluginCmd.java | 2 -- .../plotsquared/plot/commands/Purge.java | 2 -- .../plotsquared/plot/commands/Rate.java | 2 -- .../plotsquared/plot/commands/RegenAllRoads.java | 2 -- .../plotsquared/plot/commands/Relight.java | 2 -- .../plotsquared/plot/commands/Reload.java | 2 -- .../plotsquared/plot/commands/Remove.java | 2 -- .../plotsquared/plot/commands/RequiredType.java | 2 -- .../plotsquared/plot/commands/Save.java | 2 -- .../plotsquared/plot/commands/SchematicCmd.java | 2 -- .../plotsquared/plot/commands/Set.java | 4 +--- .../plotsquared/plot/commands/SetCommand.java | 2 -- .../plotsquared/plot/commands/SetHome.java | 2 -- .../plotsquared/plot/commands/Setup.java | 2 -- .../plotsquared/plot/commands/SubCommand.java | 2 -- .../plotsquared/plot/commands/Swap.java | 2 -- .../plotsquared/plot/commands/Target.java | 2 -- .../plotsquared/plot/commands/Template.java | 2 -- .../plotsquared/plot/commands/Toggle.java | 2 -- .../plotsquared/plot/commands/Trim.java | 2 -- .../plotsquared/plot/commands/Trust.java | 2 -- .../plotsquared/plot/commands/Unlink.java | 2 -- .../plotsquared/plot/commands/Visit.java | 2 -- .../plotsquared/plot/commands/WE_Anywhere.java | 2 -- .../plotsquared/plot/config/Captions.java | 2 -- .../plotsquared/plot/config/Config.java | 2 -- .../plotsquared/plot/config/Configuration.java | 4 +--- .../plotsquared/plot/config/ConfigurationNode.java | 4 +--- .../plotsquared/plot/config/Settings.java | 2 -- .../plotsquared/plot/config/Storage.java | 2 -- .../plotsquared/plot/database/AbstractDB.java | 2 -- .../plotsquared/plot/database/DBFunc.java | 2 -- .../plotsquared/plot/database/Database.java | 2 -- .../plotsquared/plot/database/MySQL.java | 2 -- .../plotsquared/plot/database/SQLManager.java | 2 -- .../plotsquared/plot/database/SQLite.java | 2 -- .../plotsquared/plot/database/StmtMod.java | 2 -- .../plotsquared/plot/flag/BlockStateListFlag.java | 11 +++-------- .../plotsquared/plot/flag/BooleanFlag.java | 2 -- .../plotsquared/plot/flag/DoubleFlag.java | 2 -- .../plotsquared/plot/flag/EnumFlag.java | 2 -- .../intellectualsites/plotsquared/plot/flag/Flag.java | 2 -- .../plotsquared/plot/flag/FlagManager.java | 2 -- .../plotsquared/plot/flag/Flags.java | 2 -- .../plotsquared/plot/flag/GameModeFlag.java | 2 -- .../plotsquared/plot/flag/IntegerFlag.java | 2 -- .../plotsquared/plot/flag/IntegerListFlag.java | 2 -- .../plotsquared/plot/flag/IntervalFlag.java | 2 -- .../plotsquared/plot/flag/ListFlag.java | 2 -- .../plotsquared/plot/flag/LongFlag.java | 2 -- .../plotsquared/plot/flag/PlotWeatherFlag.java | 2 -- .../plotsquared/plot/flag/StringFlag.java | 2 -- .../plotsquared/plot/flag/StringListFlag.java | 2 -- .../plotsquared/plot/flag/TeleportDenyFlag.java | 2 -- .../plotsquared/plot/generator/AugmentedUtils.java | 5 +---- .../plot/generator/ClassicPlotManager.java | 4 +--- .../plotsquared/plot/generator/ClassicPlotWorld.java | 4 +--- .../plotsquared/plot/generator/GeneratorWrapper.java | 2 -- .../plotsquared/plot/generator/GridPlotManager.java | 2 -- .../plotsquared/plot/generator/GridPlotWorld.java | 2 -- .../plotsquared/plot/generator/HybridGen.java | 4 +--- .../plotsquared/plot/generator/HybridPlotManager.java | 5 ++--- .../plotsquared/plot/generator/HybridPlotWorld.java | 2 -- .../plotsquared/plot/generator/HybridUtils.java | 4 +--- .../plot/generator/IndependentPlotGenerator.java | 2 -- .../plotsquared/plot/generator/PlotGenerator.java | 2 -- .../plotsquared/plot/generator/SquarePlotManager.java | 2 -- .../plotsquared/plot/generator/SquarePlotWorld.java | 2 -- .../plotsquared/plot/listener/ExtentWrapper.java | 2 -- .../plot/listener/PlayerBlockEventType.java | 2 -- .../plotsquared/plot/listener/PlotListener.java | 5 +---- .../plotsquared/plot/listener/ProcessedWEExtent.java | 2 -- .../plotsquared/plot/listener/WEExtent.java | 2 -- .../plotsquared/plot/listener/WEManager.java | 2 -- .../plotsquared/plot/listener/WESubscriber.java | 2 -- .../plotsquared/plot/logger/DelegateLogger.java | 2 -- .../plotsquared/plot/logger/ILogger.java | 2 -- .../plotsquared/plot/object/BlockBucket.java | 2 -- .../plotsquared/plot/object/BlockLoc.java | 2 -- .../plotsquared/plot/object/ChunkWrapper.java | 2 -- .../plotsquared/plot/object/CmdInstance.java | 2 -- .../plotsquared/plot/object/ConsolePlayer.java | 4 ---- .../plotsquared/plot/object/Direction.java | 2 -- .../plotsquared/plot/object/Expression.java | 2 -- .../plotsquared/plot/object/FileBytes.java | 2 -- .../plotsquared/plot/object/LazyBlock.java | 1 - .../plotsquared/plot/object/LazyResult.java | 2 -- .../plotsquared/plot/object/Location.java | 2 -- .../plotsquared/plot/object/OfflinePlotPlayer.java | 2 -- .../plotsquared/plot/object/Plot.java | 3 +-- .../plotsquared/plot/object/PlotArea.java | 2 -- .../plotsquared/plot/object/PlotCluster.java | 2 -- .../plotsquared/plot/object/PlotFilter.java | 2 -- .../plotsquared/plot/object/PlotHandler.java | 2 -- .../plotsquared/plot/object/PlotId.java | 2 -- .../plotsquared/plot/object/PlotInventory.java | 2 -- .../plotsquared/plot/object/PlotItemStack.java | 4 ---- .../plotsquared/plot/object/PlotLoc.java | 2 -- .../plotsquared/plot/object/PlotManager.java | 2 -- .../plotsquared/plot/object/PlotMessage.java | 2 -- .../plotsquared/plot/object/PlotPlayer.java | 3 --- .../plotsquared/plot/object/PlotSettings.java | 2 -- .../plotsquared/plot/object/PseudoRandom.java | 2 -- .../plotsquared/plot/object/Rating.java | 2 -- .../plotsquared/plot/object/RegionWrapper.java | 2 -- .../plotsquared/plot/object/RunnableVal.java | 2 -- .../plotsquared/plot/object/RunnableVal2.java | 2 -- .../plotsquared/plot/object/RunnableVal3.java | 2 -- .../plotsquared/plot/object/SetupObject.java | 2 -- .../plotsquared/plot/object/StringWrapper.java | 2 -- .../plot/object/chat/PlainChatManager.java | 2 -- .../plot/object/collection/FlatRandomCollection.java | 2 -- .../plot/object/collection/RandomCollection.java | 2 -- .../object/collection/SimpleRandomCollection.java | 2 -- .../plotsquared/plot/object/comment/CommentInbox.java | 2 -- .../plotsquared/plot/object/comment/InboxOwner.java | 2 -- .../plotsquared/plot/object/comment/InboxPublic.java | 2 -- .../plotsquared/plot/object/comment/InboxReport.java | 2 -- .../plotsquared/plot/object/comment/PlotComment.java | 2 -- .../plotsquared/plot/object/schematic/PlotItem.java | 3 --- .../plotsquared/plot/object/schematic/Schematic.java | 2 -- .../plot/object/schematic/StoredEntity.java | 2 -- .../object/stream/AbstractDelegateOutputStream.java | 2 -- .../plot/object/worlds/DefaultPlotAreaManager.java | 2 -- .../plot/object/worlds/PlotAreaManager.java | 2 -- .../plotsquared/plot/object/worlds/SinglePlot.java | 2 -- .../plot/object/worlds/SinglePlotArea.java | 2 -- .../plot/object/worlds/SinglePlotAreaManager.java | 2 -- .../plot/object/worlds/SinglePlotManager.java | 2 -- .../plot/object/worlds/SingleWorldGenerator.java | 4 +--- .../plotsquared/plot/util/ArrayUtil.java | 2 -- .../plotsquared/plot/util/ByteArrayUtilities.java | 2 -- .../plotsquared/plot/util/ChatManager.java | 2 -- .../plotsquared/plot/util/ChunkManager.java | 2 -- .../plotsquared/plot/util/CmdConfirm.java | 2 -- .../plotsquared/plot/util/CommentManager.java | 2 -- .../plotsquared/plot/util/ConsoleColors.java | 2 -- .../plotsquared/plot/util/EconHandler.java | 2 -- .../plotsquared/plot/util/EntityUtil.java | 2 -- .../plotsquared/plot/util/EventUtil.java | 6 +----- .../plotsquared/plot/util/HttpUtil.java | 2 -- .../plotsquared/plot/util/IncendoPaster.java | 2 -- .../plotsquared/plot/util/InventoryUtil.java | 2 -- .../plotsquared/plot/util/LegacyConverter.java | 2 -- .../plotsquared/plot/util/MainUtil.java | 2 -- .../plotsquared/plot/util/MathMan.java | 2 -- .../plotsquared/plot/util/Permissions.java | 2 -- .../plotsquared/plot/util/PlotGameMode.java | 2 -- .../plotsquared/plot/util/PlotWeather.java | 2 -- .../plotsquared/plot/util/ReflectionUtils.java | 2 -- .../plotsquared/plot/util/RegExUtil.java | 2 -- .../plotsquared/plot/util/SchematicHandler.java | 2 -- .../plotsquared/plot/util/SetupUtils.java | 2 -- .../plotsquared/plot/util/StringComparison.java | 2 -- .../plotsquared/plot/util/StringMan.java | 2 -- .../plotsquared/plot/util/TaskManager.java | 2 -- .../plotsquared/plot/util/UUIDHandler.java | 2 -- .../plot/util/UUIDHandlerImplementation.java | 2 -- .../plotsquared/plot/util/UpdateUtility.java | 2 -- .../plotsquared/plot/util/WorldUtil.java | 4 +--- .../plotsquared/plot/util/area/QuadMap.java | 2 -- .../plot/util/block/BasicLocalBlockQueue.java | 4 +--- .../plotsquared/plot/util/block/BlockUtil.java | 3 --- .../plot/util/block/DelegateLocalBlockQueue.java | 4 +--- .../plotsquared/plot/util/block/GlobalBlockQueue.java | 2 -- .../plotsquared/plot/util/block/LocalBlockQueue.java | 4 +--- .../plot/util/block/OffsetLocalBlockQueue.java | 2 -- .../plotsquared/plot/util/block/QueueProvider.java | 2 -- .../plot/util/block/ScopedLocalBlockQueue.java | 4 +--- .../plotsquared/plot/util/expiry/ExpireManager.java | 2 -- .../plotsquared/plot/util/expiry/ExpirySettings.java | 2 -- .../plotsquared/plot/util/expiry/ExpiryTask.java | 2 -- .../plotsquared/plot/util/expiry/PlotAnalysis.java | 2 -- .../plotsquared/plot/util/helpmenu/HelpMenu.java | 2 -- .../plotsquared/plot/util/helpmenu/HelpObject.java | 2 -- .../plotsquared/plot/util/helpmenu/HelpPage.java | 2 -- .../plotsquared/plot/uuid/UUIDWrapper.java | 2 -- .../intellectualsites/plotsquared/plot/FlagTest.java | 5 +---- .../plotsquared/plot/PlotVersionTest.java | 2 -- .../plotsquared/plot/database/AbstractDBTest.java | 2 -- .../plotsquared/plot/object/LocationTest.java | 2 -- .../plotsquared/plot/util/EventUtilTest.java | 2 -- .../plot/util/UUIDHandlerImplementationTest.java | 2 -- 344 files changed, 40 insertions(+), 750 deletions(-) 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 08a8dc4be..79579010b 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.bukkit.listeners.ChunkListener; import com.github.intellectualsites.plotsquared.bukkit.listeners.EntitySpawnListener; @@ -67,7 +65,6 @@ 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 com.sk89q.worldedit.bukkit.BukkitBlockRegistry; import io.papermc.lib.PaperLib; import lombok.Getter; import lombok.NonNull; @@ -75,7 +72,6 @@ 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; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java index 2b61b3d53..064d77d86 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.apache.commons.lang.Validate; import java.lang.reflect.Array; 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 911ca6b3c..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java index 32c365171..04f036526 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.google.gson.stream.JsonWriter; import java.io.IOException; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java index 9d9d7ab9c..7f8dd4d29 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.google.gson.stream.JsonWriter; import org.bukkit.configuration.serialization.ConfigurationSerializable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java index deeeea0b3..64bdda48d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; import com.google.gson.stream.JsonWriter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java index 3d9e731c1..717e164ee 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.bukkit.Bukkit; import java.lang.reflect.Field; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java index c292f7d5f..14e3d2305 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.gson.stream.JsonWriter; 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 9765d38b9..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.uuid.DatFileFilter; import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper; import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java index c8fbc78a4..269b64296 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java index c0b0702e0..a40365b40 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java index 04ea1a344..36482d44c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java index 23c011e8f..c9c4d56b9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java index 174bd1673..573d53ea8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java index 4ee2d9ca0..f2f9efe71 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java index 6a4c4bccd..79d43391e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java index 8722d86b4..059b296cf 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import lombok.Getter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java index 4c71093b3..3fba03284 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.entity.Player; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java index e4354d4fe..b4ab469a2 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java index 4c347657e..6911ccdd4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java index 4720a0353..5199496ff 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java index d8ea39fc3..ae4b0c1d7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Event; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java index e55b33920..e8c4ac63c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java index b8617e361..3e3e48b55 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java index 9e1822960..55488011e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import lombok.Getter; import lombok.Setter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java index 9e494ba1c..b6ca46593 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.Rating; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java index 00a4d39dc..5db7d04d4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.events; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import lombok.Getter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java index 85872ca9c..03b0c8123 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; import org.bukkit.Chunk; import org.bukkit.World; 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 4fc0618cd..beafb2dc8 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.bukkit.util.block.GenChunk; import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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 0ffcad59c..c410a3e0b 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; @@ -9,10 +7,9 @@ import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGe 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.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import lombok.RequiredArgsConstructor; import org.bukkit.World; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java index 3e24f900f..de06df5a3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; 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 aa13e9dc5..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,5 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index 2e5c8fcc8..a982f39fd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java index 86136afeb..d2d588970 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 d622d6d71..721121ba0 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 @@ -1,9 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; +import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -15,8 +13,6 @@ import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; 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.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotHandler; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; @@ -32,6 +28,8 @@ 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 com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java index a3a82441d..b103ed7de 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java index 47274c696..a53527fc9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java index 243e72dcb..afa821975 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java index 9c6672a49..1730ebd51 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java @@ -1,11 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - -import com.github.intellectualsites.plotsquared.plot.object.LazyBlock; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockState; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java index b26182f3f..7c52a25de 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 80b4fb9c5..35fa0d20b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -1,13 +1,9 @@ package com.github.intellectualsites.plotsquared.bukkit.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - 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.github.intellectualsites.plotsquared.plot.object.Location; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -15,10 +11,10 @@ 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.UUIDHandler; +import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.item.ItemType; import io.papermc.lib.PaperLib; import org.bukkit.GameMode; -import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.WeatherType; import org.bukkit.entity.Player; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java index b53edc5ea..5769f0e46 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - class AgeableStats { int age; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java index 44ebdb8b6..56b36e2bb 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - class ArmorStandStats { final float[] head = new float[3]; 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 94c93f1fb..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,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - class EntityBaseStats { EntityWrapper passenger; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java index b0e34a99c..d0b6f28b5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import lombok.Getter; import lombok.NonNull; import org.bukkit.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java index 86c10e868..7fd976258 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.bukkit.entity.Horse; class HorseStats { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java index e6f8411f2..c702ffaa7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; 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 5e7b8f2d2..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import org.bukkit.Art; import org.bukkit.DyeColor; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java index 4dfa1939b..f9e8ded36 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.bukkit.entity.AnimalTamer; class TameableStats { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java index fcfbce2b8..7456ae10e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import org.bukkit.Chunk; import org.bukkit.Location; 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 8f05a41f7..1d2d80198 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.schematic; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java index 5f5f50ddd..ef3af32d9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.chat.FancyMessage; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 c92bf2452..e6731d6ce 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.entity.EntityWrapper; import com.github.intellectualsites.plotsquared.bukkit.object.entity.ReplicatingEntityWrapper; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -10,12 +8,12 @@ import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; 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.sk89q.worldedit.world.block.BlockState; 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.BlockUtil; 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; 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 49f6bf87a..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.commands.DebugUUID; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java index 9dfb2c725..a9978b76c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; 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 8fb7a41db..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,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.events.PlayerClaimPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent; 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 063c1363b..29c4c63b7 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -10,11 +8,8 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; 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.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -22,7 +17,9 @@ 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.expiry.PlotAnalysis; +import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import org.bukkit.Bukkit; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java index 60408171b..a5a64b307 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; 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 ad2233ed2..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java index 44c2e13d5..59be5f5e7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java index aaf9c787f..56448ff34 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import org.bukkit.Bukkit; 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 d264cdc05..38c7e069d 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 @@ -1,14 +1,10 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - 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.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.world.block.BlockState; 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; @@ -17,7 +13,10 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.world.block.BlockState; import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -41,7 +40,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Set; @SuppressWarnings({"unused", "WeakerAccess"}) public class BukkitUtil extends WorldUtil { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java index a073aa23d..8bfa3da59 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class BukkitVersion { public static int[] v1_13_2 = {1, 13, 2}; public static int[] v1_13_1 = {1, 13, 1}; 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 45b6568d9..edc2f9669 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; 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 35030fa6a..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.google.common.base.Splitter; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; 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 7a2d53b27..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Entity; 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 0b8683cc8..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java index 17b046ec9..45814d639 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitAugmentedGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 687626ad0..54e153845 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -1,16 +1,15 @@ package com.github.intellectualsites.plotsquared.bukkit.util.block; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQueue; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import io.papermc.lib.PaperLib; import lombok.NonNull; import org.bukkit.Bukkit; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index 41d04222c..50dd042ad 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -1,20 +1,18 @@ package com.github.intellectualsites.plotsquared.bukkit.util.block; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; import lombok.Setter; import org.bukkit.Chunk; -import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.generator.ChunkGenerator.BiomeGrid; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java index 2be775fb3..2fb0892a7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.io.File; import java.io.FilenameFilter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java index 04cdea922..40d902f8e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 351668cb5..440aca318 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java index 41129644e..3f33387b9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.google.common.base.Charsets; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java index 74f067cc9..306f67e4e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 434bd8760..4c74be5b6 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java index adb7235cf..610362953 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.api; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java index f50397294..7ae1985ce 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotId; public abstract class Argument { 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 6472310fd..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java index eca768ecc..3b5ee295e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; public interface CommandCaller { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java index 6377796fc..851a03174 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java index be132d9d3..c2b4b4d95 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java index 808f942c9..81c96196d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - /** * Various settings for controlling the input and output of a {@link * Configuration}. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java index 6579332c8..0752dfb57 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.List; import java.util.Map; import java.util.Set; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java index 81377a83e..e9c099ed1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - /** * Exception thrown when attempting to load an invalid {@link Configuration}. */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java index 0dbb112a6..20131cbe1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java index 89b99ffb3..22f9d751b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - /** * Various settings for controlling the input and output of a {@link * MemoryConfiguration}. 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 68ef0f660..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,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.LinkedHashSet; 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 686347a17..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.file; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; import com.github.intellectualsites.plotsquared.configuration.MemoryConfiguration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java index fe1e19ce2..6eb99bb6e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.file; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.MemoryConfiguration; import com.github.intellectualsites.plotsquared.configuration.MemoryConfigurationOptions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java index 7388ecd53..d8c41c3da 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.file; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java index b0dfae09d..a7e71cdaf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.file; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - /** * Various settings for controlling the input and output of a {@link * YamlConfiguration}. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java index b0e288250..1f52f7abb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.file; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization; import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.error.YAMLException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java index 99263c761..ebe1aebee 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.file; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java index 415f162d9..f83e7a468 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java index 9f0374354..cb1abd54a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.Configuration; import java.lang.reflect.Constructor; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java index 7267d5c2d..8a071cb2e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java index c88a9c277..79b50998c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java index cb4d5f99f..62ee01329 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.json; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.io.IOException; import java.io.StringWriter; import java.io.Writer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java index 690dd78b2..67de10815 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.json; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - /** * The JSONException is thrown by the JSON.org classes when things are amiss. * 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 dc4d37bac..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.json; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.io.IOException; import java.io.StringWriter; import java.io.Writer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java index 116091822..019776e58 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.json; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - /** * The JSONString interface allows a toJSONString() method so that a class can change the * behavior of JSONObject.toString(), JSONArray.toString(), and 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 673202d3b..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,7 +1,5 @@ package com.github.intellectualsites.plotsquared.json; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java index 50faeb1c6..7ace1989b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.json; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Enumeration; import java.util.Iterator; import java.util.Properties; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java index 65ce81e65..51a0cdb10 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.json; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Iterator; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java index 84ee565f4..96d65541f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.json; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.HashMap; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java index 0278e90b6..1736edf6f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public enum Platform { Bukkit, Sponge, Spigot, Paper 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 88c9009a8..31f06f9d0 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; @@ -26,7 +24,6 @@ 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotCluster; import com.github.intellectualsites.plotsquared.plot.object.PlotFilter; import com.github.intellectualsites.plotsquared.plot.object.PlotId; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java index 13cd48798..4646a787a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class PlotVersion { public final int year, month, day, hash, build; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java index c51dbb1e7..d92dd4ea3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 8250c4d20..401446243 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 a01145e72..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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 45a6fae1c..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java index 1a18c5150..8b9ecb790 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java index 343c7d96b..dbfd37768 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java index b8fca9445..c2a3daf84 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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 a691ff4b3..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java index fe3a45a8c..9dcd475a1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 d0bc4127f..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java index fc910e50a..3958f2d39 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import lombok.RequiredArgsConstructor; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java index 4ddd2b302..171a5bfe5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index c00065f20..a9341f373 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java index 4d9473387..75a4709b8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java index 9261ef796..961742c1b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index 9ca4816f9..de77513bc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java index 52d00568d..14fa6347e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index 13e957a08..abbddc9ca 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index fe86acaaa..c1970f969 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java index f827a5ffa..8413eae22 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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 7876177b5..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 82dc57b24..8bafa55b7 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -17,7 +15,6 @@ 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -39,6 +36,7 @@ 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; import com.google.common.io.Files; +import com.sk89q.worldedit.world.block.BlockState; import javax.script.Bindings; import javax.script.ScriptContext; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java index 946abaf82..ca848a6bb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index 1d72d34a6..978c95e34 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java index adfd640b9..f12ce8d1e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 522f11b8f..9ea6d7bdd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index 33559079c..a268f8903 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java index 698e7099a..0c544d096 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java index adf8491e5..72c6da126 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index dc9dec874..5ddfde305 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java index 2ef572d73..d3b261ba8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java index 315a9fea8..372231481 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java index 282ab8331..055cfabd9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java index fbbffdf2d..776cff0f8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 a0d1598b3..8ec105c88 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 @@ -1,21 +1,18 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - 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.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; +import com.github.intellectualsites.plotsquared.plot.flag.BlockStateListFlag; 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.flag.IntegerFlag; import com.github.intellectualsites.plotsquared.plot.flag.ListFlag; -import com.github.intellectualsites.plotsquared.plot.flag.BlockStateListFlag; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -30,7 +27,6 @@ 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; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java index 92cb8da1a..7a1d2cddc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index 289badf46..60ecbeab0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index 5ffd80e45..7949df513 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 9cbdde212..030ef0f44 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java index 5182f86d4..fe42e5dd4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java index 5899da372..eb36f8e67 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index a07330424..b51993326 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 30e84f3bd..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 537e4bd1a..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java index 65fc58fc3..4b0305969 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 4ebb48b83..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index c8d9ae379..43204b266 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java index 3a9bd453c..f3acaf5a0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 4026bb1e3..02c7494cb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java index fb077e811..e60ee9ba1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java index 25e83c4bd..d897fb3cf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index daa0ae30e..55dbdbda4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index f0b0b0fa4..8e31051fb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.json.JSONObject; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java index 99d104071..0825b9610 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 884c23f16..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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 76a641095..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 a84ee8584..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java index 777ea37d9..db900e91e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.MemorySection; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java index 147405038..038355d83 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java index 5329ae2e2..2dc75f919 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandCaller; public enum RequiredType { 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 a348bf461..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index d389924f4..130f2ad1d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index ae25ccaa5..771063217 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -12,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -21,6 +18,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; +import com.sk89q.worldedit.world.block.BlockState; import java.util.ArrayList; import java.util.Arrays; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index d4b12fa7a..8b746c624 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java index 3359fe060..4b742ad94 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; 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 4ea9f7411..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java index 7c58f0f3d..458442ff2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java index 2a9f0529e..b3ec2ff05 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java index 03a3cf3d3..4dd37bdb0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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 14385ff1d..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java index 8ae7c5e40..87411f1c6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 4f1740821..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java index d357ed435..c0cd3309e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java index 8e4bd39b3..66682ccda 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; 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 0f5c5f45b..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java index add8d4540..36744cc44 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 3a7613dd1..c319303b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.config; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; 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 177715d39..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.config; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index ea2f6f538..d8e141069 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -1,11 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.config; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; import lombok.NonNull; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java index 05127f68d..2b6167e97 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java @@ -1,10 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.config; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.sk89q.worldedit.world.block.BlockState; import java.util.ArrayList; import java.util.Arrays; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index 8b2e4398d..b1e239c78 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.config; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import java.io.File; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java index 59385e623..962e0468f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.config; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.io.File; import java.util.ArrayList; import java.util.Collections; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java index 81565c4e2..5beef2aab 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.database; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java index 38fc283b7..47a03cf60 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.database; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java index 1126a7d83..4acecc01f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.database; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; 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 1a27ff618..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.database; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Storage; import com.github.intellectualsites.plotsquared.plot.util.StringMan; 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 55cb57b57..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.database; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; 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 2bb1d3dd5..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.database; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import java.io.File; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java index a390960c3..837d3a66a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.database; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.sql.PreparedStatement; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java index ee80b560e..61a5a25a1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java @@ -1,19 +1,14 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.sk89q.worldedit.world.block.BlockState; +import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; import java.util.Set; -import java.util.function.Function; import java.util.stream.Collectors; public class BlockStateListFlag extends ListFlag> { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java index a44168e73..841df766c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java index 505f5cab6..8cc665471 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; public class DoubleFlag extends Flag { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java index c86299a22..88119bbaa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java index 03269827e..21047d9cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; 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 4a4a7d64a..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index a84d041bc..bf04cd3fd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index b67ae58ba..26510b35b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java index 2a83fbac7..ced532cd1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java index 55260ec6f..1f24cb4a3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java index af2b1345c..0468c59b2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java index 7f1fd1aff..3085288b1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java index b5ad2fca2..8d57e8865 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; public class LongFlag extends Flag { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java index beb3e8836..43544748f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; 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 504b04a40..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,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - 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/flag/StringListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java index 9717de1d9..a1e28aa3d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java index 9dfa64dc5..6c02516fd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.flag; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index 1e2d1df5f..73a9e75d0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -1,18 +1,15 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue; 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.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import org.jetbrains.annotations.NotNull; 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 293303bcf..d3eee1165 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,16 +1,14 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Settings; 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.sk89q.worldedit.world.block.BlockState; 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.BlockUtil; 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 7048ee8cf..249df910c 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 @@ -1,15 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; 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.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java index ffe895f8b..ec5f971fc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotArea; public interface GeneratorWrapper { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java index 2590fd181..a0ed41226 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java index d91d22f94..b0cc10323 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.jetbrains.annotations.NotNull; 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 29b1ee67d..aae8b3643 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 @@ -1,15 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; 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 17129cc29..e87860190 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.Template; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -9,16 +7,17 @@ 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.sk89q.worldedit.world.block.BlockState; 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; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.Sets; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import java.io.File; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index c53e1c9b6..6b44487ce 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 a638059a1..cc3a5ba02 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; @@ -10,7 +8,6 @@ import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; @@ -26,6 +23,7 @@ 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 com.sk89q.worldedit.world.block.BlockState; import java.io.File; import java.util.ArrayDeque; 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 bda8a6ccb..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,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java index 0880a9e8b..88c7f2557 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; 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 cc3f292cb..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,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Direction; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java index 6ed48568d..c2d1ddb31 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.generator; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotId; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java index adfaf450d..5d0c86858 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java index 177b92699..815f5ea43 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public enum PlayerBlockEventType { // Non interactive EAT, READ, 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 ec6051199..a91a97f90 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flag; @@ -10,8 +8,6 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; 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.util.block.ItemUtil; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; @@ -24,6 +20,7 @@ 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.block.ItemUtil; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java index 8818ed437..7d2d824b4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java index 39d30935b..073819fa3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java index c562f4f9a..3692efa51 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java index 5f9cac7fc..78379fd9e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java index ca9b988bb..ed925a135 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.logger; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class DelegateLogger implements ILogger { private final ILogger parent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java index 050f2a365..16fb343bf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.logger; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public interface ILogger { void log(String message); } 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 b0ddc9d06..cc8e9cd72 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.object.collection.RandomCollection; 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 07094aec5..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class BlockLoc { private final int x; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java index c1bc5c98d..e665ea752 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java index 182aa061e..27cb55216 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class CmdInstance { public final Runnable command; public final long timestamp; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 8da0f74a3..4d9f23e5f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -1,15 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemType; -import com.sk89q.worldedit.world.item.ItemTypes; import org.jetbrains.annotations.NotNull; import java.util.UUID; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java index f54e103a1..3c3900dc1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public enum Direction { ALL(-1, "all"), NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java index 30c2f88b3..bb466c082 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.DebugExec; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java index 9c6c63022..d34521ee9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class FileBytes { public final String path; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java index 490c256f5..9f3345a83 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java @@ -1,6 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; import com.sk89q.worldedit.world.block.BlockState; public abstract class LazyBlock { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java index a2391a86f..8487c44be 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public abstract class LazyResult { private T result; 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 8e7edf51a..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.sk89q.worldedit.math.BlockVector2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java index f2e1a8dab..85e6e72d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.UUID; public interface OfflinePlotPlayer { 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 edb28ba12..c753cefe7 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; @@ -24,6 +22,7 @@ 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.BlockUtil; 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; 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 99b4709cd..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; 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 ef68d8d45..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java index bd941da6b..09759c09d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public abstract class PlotFilter { public boolean allowsArea(final PlotArea area) { return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java index 62cfeec49..4faa17b76 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Set; import java.util.UUID; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 1076ad443..21e7dc777 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java index 927f80872..4598a2fff 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil; import lombok.NonNull; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java index b306ebed9..b142eda79 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java @@ -1,9 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - -import com.github.intellectualsites.plotsquared.plot.util.StringComparison; -import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java index e2ca83a64..33e57f753 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.util.StringMan; import lombok.AllArgsConstructor; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 9120a576f..0b39b2b7d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.commands.Template; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java index f7865a7c6..64e6fedb3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager; 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 7019d10ce..5eddb6364 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; @@ -21,7 +19,6 @@ 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 com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemType; import lombok.NonNull; import org.jetbrains.annotations.NotNull; 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 4bc9b159f..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java index 3dfb4c1fa..490f8c926 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class PseudoRandom { public static final PseudoRandom random = new PseudoRandom(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java index b00e3cac7..911b2e6c5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Settings; import java.util.ArrayList; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java index 3f4db9a7c..ced127a22 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class RegionWrapper { public final int minX; public final int maxX; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java index 3ac0da1a8..90074a63a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public abstract class RunnableVal implements Runnable { public T value; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java index 1872b5c1c..ee46a417f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public abstract class RunnableVal2 implements Runnable { public T value1; public U value2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java index 4a4d47663..cb6b2a8be 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public abstract class RunnableVal3 implements Runnable { public T value1; public U value2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java index ba7a5f47c..e203fa870 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java index aa1e6e471..12d0a11aa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - /** * */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java index 1af1fbf19..0353eb313 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.chat; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java index ef3cad495..341fbb4f3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.util.MathMan; import java.util.ArrayList; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java index 5778883f3..b8dfa0a12 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Map; import java.util.Random; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java index 143649029..e75b64cb4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Map; import java.util.NavigableMap; import java.util.Random; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java index b0b964060..30d9b1230 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java index bf1f56d25..29cf003cf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java index 80e417801..598904b0f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java index e597fcd02..fa44db6c2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java index 97579f29e..ada90457f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotId; public class PlotComment { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java index 6e3cc6688..16397d0da 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java @@ -1,8 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemType; public class PlotItem { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java index 5977c1eb3..cdd1f25f1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.WorldEditException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java index 6f31b68ed..a19404da2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java index 0223c45f6..994f6a465 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.stream; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.io.IOException; import java.io.OutputStream; 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 a60d788df..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java index b5156eae9..7a59dab9d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; 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 cfeba3ff2..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; 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 a8b2c421f..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java index 2dd7399ad..f2e0b3c03 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; 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 dedeeacdf..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,5 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; 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 a01bf0e70..a7f3e2b62 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 @@ -1,14 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; 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/ArrayUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java index 9dd004cf1..6052c2a93 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.Arrays; public class ArrayUtil { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java index 3b3b9d0c7..ace8bb7e4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class ByteArrayUtilities { public static byte[] integerToBytes(int i) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java index 5ffba6493..1177206e6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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 e67c11265..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,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java index a502f7538..e6cdc4134 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.CmdInstance; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java index 281b2f71b..4eff629d6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java index 12afc3798..f8860887f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class ConsoleColors { public static String fromString(String input) { input = input.replaceAll("&0", fromChatColor("&0")).replaceAll("&1", fromChatColor("&1")) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java index 8554b2d78..4912b6e83 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java index ad8a19479..51e093d46 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.IntegerFlag; 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 51f055fea..dc8830769 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 @@ -1,28 +1,24 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - 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.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; -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.sk89q.worldedit.world.block.BlockState; 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 com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import org.jetbrains.annotations.Nullable; -import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java index ff5bfd98c..761c5aa0a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.config.Settings; import java.io.BufferedReader; 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 300958f55..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.google.common.base.Charsets; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java index 3ce6f49cd..03b87fc2b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java index e9dca64af..93faabe87 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; 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 e998c787d..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.Like; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java index c82000adc..00ea391ba 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class MathMan { private static final int ATAN2_BITS = 7; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java index 8143a7588..c9a332bb9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java index f881f95e6..b3b1fd5a7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public enum PlotGameMode { NOT_SET(-1, ""), SURVIVAL(0, "survival"), CREATIVE(1, "creative"), ADVENTURE(2, "adventure"), SPECTATOR(3, "spectator"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java index 759f423c3..62ea9cc33 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public enum PlotWeather { RAIN, CLEAR, RESET } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java index 64cce0b02..621766c17 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java index 56493658a..b9fc6ff09 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; 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 7fa86c242..a1c920d9e 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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.json.JSONArray; import com.github.intellectualsites.plotsquared.json.JSONException; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java index 670e01798..b77d991fe 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.SetupObject; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java index f2a6cbde2..dd6a1f960 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java index 304f55b32..047b4a71f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.jetbrains.annotations.NotNull; import java.lang.reflect.Array; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java index a558487c5..f6e86cd92 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; 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 5fb4bfba7..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; 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 927cc646c..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java index d3f35e4b7..0ad79b41b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import lombok.Getter; import lombok.NonNull; import lombok.RequiredArgsConstructor; 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 a82e50d9e..9d60a80ba 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,11 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -16,6 +13,7 @@ import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.world.block.BlockState; import java.io.ByteArrayOutputStream; import java.io.File; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java index 212778ccd..133088a2e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.area; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import java.util.HashSet; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index d524e2af9..08bfab890 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -1,13 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import org.jetbrains.annotations.NotNull; import java.util.concurrent.ConcurrentHashMap; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java index c83375edc..f377de6e4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java @@ -1,8 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index 61e08a208..cf695f3d6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -1,9 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; public class DelegateLocalBlockQueue extends LocalBlockQueue { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java index 3aadb6ebf..049b13d32 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; 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 8fc6011e2..572f70228 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,10 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.StringMan; @@ -13,6 +10,7 @@ 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 com.sk89q.worldedit.world.block.BlockState; import java.util.Map; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java index 075865ff5..d0a561111 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.sk89q.worldedit.world.block.BaseBlock; public class OffsetLocalBlockQueue extends DelegateLocalBlockQueue { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java index aebe4707d..3c96e0d5f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public abstract class QueueProvider { public static QueueProvider of(final Class primary, final Class fallback) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java index 0c404c548..416a2c36e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java @@ -1,15 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { private final int minX; 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 906b15247..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java index 95f4067f2..ab95068da 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java @@ -1,6 +1,4 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - public class ExpirySettings { } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java index 3e1c964dd..e959948b4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; 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 4f18151cc..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 @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java index 1733d93b3..c10d9507b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java index 01c8e5f29..9981dd0f1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java index c701b2b9b..5b165d32a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java index 58f0ed56b..c2a0af542 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.uuid; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java index 4b94e58a2..6c322864b 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java @@ -1,22 +1,19 @@ package com.github.intellectualsites.plotsquared.plot; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.database.AbstractDBTest; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.EventUtilTest; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; import com.sk89q.worldedit.world.block.BlockType; import org.junit.Before; import org.junit.Test; import java.util.Collection; -import java.util.HashSet; import java.util.Optional; import java.util.Set; import java.util.UUID; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java index d5570365f..069c886da 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.junit.Test; public class PlotVersionTest { diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java index 37e7d8ba6..a2cc07d1b 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.database; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java index da13420fa..a421137c0 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.object; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import org.junit.Test; import java.util.logging.Logger; 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 f5cfba022..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,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java index 15b6ded37..58e43ff65 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java @@ -1,7 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.util; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; - import com.github.intellectualsites.plotsquared.plot.database.AbstractDBTest; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; From ba3ff08d6c1ed4d4479cb7bda22756debcb1b3b3 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 4 Nov 2019 20:17:29 +0000 Subject: [PATCH 172/258] Update BlockStateListFlag.java --- .../plotsquared/plot/flag/BlockStateListFlag.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java index 61a5a25a1..1ca476618 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java @@ -26,7 +26,7 @@ public class BlockStateListFlag extends ListFlag> { } @Override public String getValueDescription() { - return "Flag value must be a block list"; + return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated(); } public boolean contains(Plot plot, BlockState value) { From 88732bb88cd2f066654fdc17786cf9e9fe4f0c4a Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 4 Nov 2019 21:08:33 +0000 Subject: [PATCH 173/258] Use CuboidRegion instead of RegionWrapper --- .../plotsquared/bukkit/chat/Reflection.java | 8 +- .../generator/DelegatePlotGenerator.java | 2 +- .../bukkit/util/BukkitChunkManager.java | 41 +++--- .../bukkit/util/BukkitHybridUtils.java | 8 +- .../bukkit/util/BukkitSchematicHandler.java | 12 +- .../plotsquared/bukkit/util/BukkitUtil.java | 10 +- .../bukkit/util/block/BukkitLocalQueue.java | 2 +- .../bukkit/util/block/GenChunk.java | 2 +- .../plotsquared/plot/IPlotMain.java | 4 +- .../plotsquared/plot/PlotSquared.java | 4 +- .../plotsquared/plot/commands/Area.java | 11 +- .../plotsquared/plot/commands/Trim.java | 15 ++- .../plot/flag/BlockStateListFlag.java | 2 +- .../plot/generator/AugmentedUtils.java | 13 +- .../plot/generator/ClassicPlotManager.java | 34 ++--- .../plot/generator/ClassicPlotWorld.java | 2 +- .../plotsquared/plot/generator/HybridGen.java | 2 +- .../plot/generator/HybridPlotManager.java | 2 +- .../plot/generator/HybridUtils.java | 17 +-- .../plot/generator/SquarePlotManager.java | 13 +- .../plot/listener/PlotListener.java | 2 +- .../plot/listener/ProcessedWEExtent.java | 7 +- .../plotsquared/plot/listener/WEExtent.java | 7 +- .../plotsquared/plot/listener/WEManager.java | 51 ++++---- .../plot/listener/WESubscriber.java | 5 +- .../plot/object/ConsolePlayer.java | 7 +- .../plotsquared/plot/object/Location.java | 4 - .../plotsquared/plot/object/Plot.java | 121 +++++++++--------- .../plotsquared/plot/object/PlotArea.java | 36 +++--- .../plotsquared/plot/object/PlotCluster.java | 8 +- .../plot/object/RegionWrapper.java | 71 ---------- .../object/worlds/DefaultPlotAreaManager.java | 6 +- .../plot/object/worlds/PlotAreaManager.java | 4 +- .../plot/object/worlds/SinglePlot.java | 13 +- .../object/worlds/SinglePlotAreaManager.java | 4 +- .../object/worlds/SingleWorldGenerator.java | 2 +- .../plotsquared/plot/util/ChunkManager.java | 20 +-- .../plotsquared/plot/util/MainUtil.java | 22 +++- .../plot/util/SchematicHandler.java | 20 +-- .../plotsquared/plot/util/WorldUtil.java | 4 +- .../plotsquared/plot/util/area/QuadMap.java | 41 +++--- .../plot/util/{block => world}/BlockUtil.java | 2 +- .../plot/util/{block => world}/ItemUtil.java | 2 +- .../plot/util/world/RegionUtil.java | 40 ++++++ .../plotsquared/plot/FlagTest.java | 2 +- 45 files changed, 357 insertions(+), 348 deletions(-) delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java rename Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/{block => world}/BlockUtil.java (97%) rename Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/{block => world}/ItemUtil.java (94%) create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/RegionUtil.java diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java index 717e164ee..ebe7e81b3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java @@ -22,7 +22,7 @@ public final class Reflection { /** * Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages). -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; */ private static final Map> _loadedOBCClasses = new HashMap<>(); private static final Map, Map> _loadedFields = new HashMap<>(); @@ -40,10 +40,10 @@ import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; /** * Gets the version string from the package name of the CraftBukkit server implementation. -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * This is needed to bypass the JAR package name changing on each update. -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * * @return The version string of the OBC and NMS packages, including the trailing dot. */ @@ -86,7 +86,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * * @param className The name of the class, excluding the package, within OBC. This name may contain a subpackage name, such as {@code inventory.CraftItemStack}. -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * @return The class instance representing the specified OBC class, or {@code null} if it could not be loaded. */ public synchronized static Class getOBCClass(String className) { 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 c410a3e0b..aab23d804 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,7 @@ 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.util.MathMan; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import lombok.RequiredArgsConstructor; import org.bukkit.World; 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 e6731d6ce..44bad9589 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 @@ -9,11 +9,12 @@ 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.PlotLoc; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; +import com.sk89q.worldedit.regions.CuboidRegion; 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.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; 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; @@ -44,15 +45,15 @@ import java.util.concurrent.CompletableFuture; public class BukkitChunkManager extends ChunkManager { - public static boolean isIn(RegionWrapper region, int x, int z) { - return x >= region.minX && x <= region.maxX && z >= region.minZ && z <= region.maxZ; + public static boolean isIn(CuboidRegion region, int x, int z) { + return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX() && z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ(); } public static ContentMap swapChunk(World world1, World world2, Chunk pos1, Chunk pos2, - RegionWrapper r1, RegionWrapper r2) { + CuboidRegion r1, CuboidRegion r2) { ContentMap map = new ContentMap(); - int relX = r2.minX - r1.minX; - int relZ = r2.minZ - r1.minZ; + int relX = r2.getMinimumPoint().getX() - r1.getMinimumPoint().getX(); + int relZ = r2.getMinimumPoint().getZ() - r1.getMinimumPoint().getZ(); map.saveEntitiesIn(pos1, r1, relX, relZ, true); map.saveEntitiesIn(pos2, r2, -relX, -relZ, true); @@ -69,8 +70,8 @@ public class BukkitChunkManager extends ChunkManager { LocalBlockQueue queue1 = GlobalBlockQueue.IMP.getNewQueue(worldName1, false); LocalBlockQueue queue2 = GlobalBlockQueue.IMP.getNewQueue(worldName2, false); - for (int x = Math.max(r1.minX, sx); x <= Math.min(r1.maxX, sx + 15); x++) { - for (int z = Math.max(r1.minZ, sz); z <= Math.min(r1.maxZ, sz + 15); z++) { + for (int x = Math.max(r1.getMinimumPoint().getX(), sx); x <= Math.min(r1.getMaximumPoint().getX(), sx + 15); x++) { + for (int z = Math.max(r1.getMinimumPoint().getZ(), sz); z <= Math.min(r1.getMaximumPoint().getZ(), sz + 15); z++) { for (int y = 0; y < 256; y++) { Block block1 = world1.getBlockAt(x, y, z); BaseBlock baseBlock1 = bukkitWorld1.getFullBlock(BlockVector3.at(x, y, z)); @@ -198,8 +199,8 @@ public class BukkitChunkManager extends ChunkManager { final int relX = newPos.getX() - pos1.getX(); final int relZ = newPos.getZ() - pos1.getZ(); - final RegionWrapper region = - new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); + final CuboidRegion region = + RegionUtil.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); final World oldWorld = Bukkit.getWorld(pos1.getWorld()); final BukkitWorld oldBukkitWorld = new BukkitWorld(oldWorld); final World newWorld = Bukkit.getWorld(newPos.getWorld()); @@ -350,8 +351,8 @@ public class BukkitChunkManager extends ChunkManager { if (checkX2 && checkZ2) { map.saveRegion(bukkitWorldObj, xxt2, xxt, zzt2, zzt); // } - RegionWrapper currentPlotClear = - new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); + CuboidRegion currentPlotClear = + RegionUtil.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); map.saveEntitiesOut(chunkObj, currentPlotClear); AugmentedUtils.bypass(ignoreAugment, () -> setChunkInPlotArea(null, new RunnableVal() { @@ -434,10 +435,10 @@ public class BukkitChunkManager extends ChunkManager { @Override public void swap(Location bot1, Location top1, Location bot2, Location top2, final Runnable whenDone) { - RegionWrapper region1 = - new RegionWrapper(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ()); - RegionWrapper region2 = - new RegionWrapper(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ()); + CuboidRegion region1 = + RegionUtil.createRegion(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ()); + CuboidRegion region2 = + RegionUtil.createRegion(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ()); final World world1 = Bukkit.getWorld(bot1.getWorld()); World world2 = Bukkit.getWorld(bot2.getWorld()); @@ -622,7 +623,7 @@ public class BukkitChunkManager extends ChunkManager { } } - void saveEntitiesOut(Chunk chunk, RegionWrapper region) { + void saveEntitiesOut(Chunk chunk, CuboidRegion region) { for (Entity entity : chunk.getEntities()) { Location location = BukkitUtil.getLocation(entity); int x = location.getX(); @@ -639,11 +640,11 @@ public class BukkitChunkManager extends ChunkManager { } } - void saveEntitiesIn(Chunk chunk, RegionWrapper region) { + void saveEntitiesIn(Chunk chunk, CuboidRegion region) { saveEntitiesIn(chunk, region, 0, 0, false); } - void saveEntitiesIn(Chunk chunk, RegionWrapper region, int offsetX, int offsetZ, + void saveEntitiesIn(Chunk chunk, CuboidRegion region, int offsetX, int offsetZ, boolean delete) { for (Entity entity : chunk.getEntities()) { Location location = BukkitUtil.getLocation(entity); 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 29c4c63b7..95f4b2ebc 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 @@ -8,7 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; 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.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -34,7 +34,7 @@ import java.util.Set; public class BukkitHybridUtils extends HybridUtils { - @Override public void analyzeRegion(final String world, final RegionWrapper region, + @Override public void analyzeRegion(final String world, final CuboidRegion region, final RunnableVal whenDone) { // int diff, int variety, int vertices, int rotation, int height_sd /* @@ -56,8 +56,8 @@ public class BukkitHybridUtils extends HybridUtils { return; } - final Location bot = new Location(world, region.minX, region.minY, region.minZ); - final Location top = new Location(world, region.maxX, region.maxY, region.maxZ); + final Location bot = new Location(world, region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); + final Location top = new Location(world, region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); final int bx = bot.getX(); final int bz = bot.getZ(); 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 3f980d37c..ed0a8cfcc 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; @@ -35,7 +35,7 @@ import java.util.stream.IntStream; */ public class BukkitSchematicHandler extends SchematicHandler { - @Override public void getCompoundTag(final String world, final Set regions, + @Override public void getCompoundTag(final String world, final Set regions, final RunnableVal whenDone) { // async TaskManager.runTaskAsync(new Runnable() { @@ -74,7 +74,7 @@ public class BukkitSchematicHandler extends SchematicHandler { List tileEntities = new ArrayList<>(); ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length); // Queue - final ArrayDeque queue = new ArrayDeque<>(regions); + final ArrayDeque queue = new ArrayDeque<>(regions); TaskManager.runTask(new Runnable() { @Override public void run() { if (queue.isEmpty()) { @@ -95,9 +95,9 @@ public class BukkitSchematicHandler extends SchematicHandler { return; } final Runnable regionTask = this; - RegionWrapper region = queue.poll(); - Location pos1 = new Location(world, region.minX, region.minY, region.minZ); - Location pos2 = new Location(world, region.maxX, region.maxY, region.maxZ); + CuboidRegion region = queue.poll(); + Location pos1 = new Location(world, region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); + Location pos2 = new Location(world, region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); final int p1x = pos1.getX(); final int sy = pos1.getY(); final int p1z = pos1.getZ(); 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 38c7e069d..a73872bee 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 @@ -6,14 +6,14 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; 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.sk89q.worldedit.regions.CuboidRegion; 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; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.world.block.BlockState; @@ -428,12 +428,12 @@ import java.util.Set; } @Override - public void setBiomes(@NonNull final String worldName, @NonNull final RegionWrapper region, + public void setBiomes(@NonNull final String worldName, @NonNull final CuboidRegion region, @NonNull final String biomeString) { final World world = getWorld(worldName); final Biome biome = Biome.valueOf(biomeString.toUpperCase()); - for (int x = region.minX; x <= region.maxX; x++) { - for (int z = region.minZ; z <= region.maxZ; z++) { + for (int x = region.getMinimumPoint().getX(); x <= region.getMaximumPoint().getX(); x++) { + for (int z = region.getMinimumPoint().getZ(); z <= region.getMaximumPoint().getZ(); z++) { world.setBiome(x, z, biome); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 54e153845..9f5dc4e7f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWra import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQueue; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index 50dd042ad..a93c22679 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; 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 77f36bb41..3a47773b7 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 @@ -88,11 +88,11 @@ public interface IPlotMain extends ILogger { /** * Gets the NMS package prefix. -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * * @return The NMS package prefix -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; */ String getNMSPackage(); 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 31f06f9d0..a08a8b1c2 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 @@ -29,7 +29,7 @@ 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.sk89q.worldedit.regions.CuboidRegion; 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; @@ -2008,7 +2008,7 @@ import java.util.zip.ZipInputStream; return Collections.unmodifiableSet(result); } - public Set getPlotAreas(final String world, final RegionWrapper region) { + public Set getPlotAreas(final String world, final CuboidRegion region) { final PlotArea[] areas = plotAreaManager.getPlotAreas(world, region); final Set set = new HashSet<>(); Collections.addAll(set, areas); 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 0f39ebe94..f773c1e1c 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 @@ -12,7 +12,8 @@ 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.util.world.RegionUtil; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.object.SetupObject; @@ -99,7 +100,7 @@ import java.util.Set; area.ROAD_WIDTH / 2; final int offsetX = bx - (area.ROAD_WIDTH == 0 ? 0 : lower); final int offsetZ = bz - (area.ROAD_WIDTH == 0 ? 0 : lower); - final RegionWrapper region = new RegionWrapper(bx, tx, bz, tz); + final CuboidRegion region = RegionUtil.createRegion(bx, tx, bz, tz); Set areas = PlotSquared.get().getPlotAreas(area.worldname, region); if (!areas.isEmpty()) { @@ -460,10 +461,10 @@ import java.util.Set; if (area.TYPE != 2) { center = WorldUtil.IMP.getSpawn(area.worldname); } else { - RegionWrapper region = area.getRegion(); + CuboidRegion region = area.getRegion(); center = - new Location(area.worldname, region.minX + (region.maxX - region.minX) / 2, - 0, region.minZ + (region.maxZ - region.minZ) / 2); + new Location(area.worldname, region.getMinimumPoint().getX() + (region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) / 2, + 0, region.getMinimumPoint().getZ() + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) / 2); center.setY(1 + WorldUtil.IMP .getHighestBlock(area.worldname, center.getX(), center.getZ())); } 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 000aa9b56..66a024ec4 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 @@ -6,7 +6,8 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; 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.util.world.RegionUtil; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; @@ -176,18 +177,18 @@ import java.util.Set; } int bx = cbx << 4; int bz = cbz << 4; - RegionWrapper region = new RegionWrapper(bx, bx + 511, bz, bz + 511); + CuboidRegion region = RegionUtil.createRegion(bx, bx + 511, bz, bz + 511); for (Plot plot : PlotSquared.get().getPlots(world)) { Location bot = plot.getBottomAbs(); Location top = plot.getExtendedTopAbs(); - RegionWrapper plotReg = - new RegionWrapper(bot.getX(), top.getX(), bot.getZ(), + CuboidRegion plotReg = + RegionUtil.createRegion(bot.getX(), top.getX(), bot.getZ(), top.getZ()); - if (!region.intersects(plotReg)) { + if (!RegionUtil.intersects(region, plotReg)) { continue; } - for (int x = plotReg.minX >> 4; x <= plotReg.maxX >> 4; x++) { - for (int z = plotReg.minZ >> 4; z <= plotReg.maxZ >> 4; z++) { + for (int x = plotReg.getMinimumPoint().getX() >> 4; x <= plotReg.getMaximumPoint().getX() >> 4; x++) { + for (int z = plotReg.getMinimumPoint().getZ() >> 4; z <= plotReg.getMaximumPoint().getZ() >> 4; z++) { BlockVector2 loc = BlockVector2.at(x, z); chunks.remove(loc); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java index 1ca476618..b9f3367d0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.StringMan; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index 73a9e75d0..f5aa2e440 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -4,7 +4,8 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; @@ -33,7 +34,7 @@ public class AugmentedUtils { final int blockX = chunkX << 4; final int blockZ = chunkZ << 4; - RegionWrapper region = new RegionWrapper(blockX, blockX + 15, blockZ, blockZ + 15); + CuboidRegion region = RegionUtil.createRegion(blockX, blockX + 15, blockZ, blockZ + 15); Set areas = PlotSquared.get().getPlotAreas(world, region); if (areas.isEmpty()) { return false; @@ -59,10 +60,10 @@ public class AugmentedUtils { int tzz; // gen if (area.TYPE == 2) { - bxx = Math.max(0, area.getRegion().minX - blockX); - bzz = Math.max(0, area.getRegion().minZ - blockZ); - txx = Math.min(15, area.getRegion().maxX - blockX); - tzz = Math.min(15, area.getRegion().maxZ - blockZ); + bxx = Math.max(0, area.getRegion().getMinimumPoint().getX() - blockX); + bzz = Math.max(0, area.getRegion().getMinimumPoint().getZ() - blockZ); + txx = Math.min(15, area.getRegion().getMaximumPoint().getX() - blockX); + tzz = Math.min(15, area.getRegion().getMaximumPoint().getZ() - blockZ); primaryMask = new DelegateLocalBlockQueue(queue) { @Override public boolean setBlock(int x, int y, int z, BlockState id) { if (area.contains(x, z)) { 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 d3eee1165..b0ef7e138 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 @@ -6,9 +6,9 @@ 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.PlotId; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.MathMan; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; @@ -59,11 +59,11 @@ public class ClassicPlotManager extends SquarePlotManager { Plot plot = classicPlotWorld.getPlotAbs(plotId); LocalBlockQueue queue = classicPlotWorld.getQueue(false); if (plot.isBasePlot()) { - for (RegionWrapper region : plot.getRegions()) { + for (CuboidRegion region : plot.getRegions()) { Location pos1 = - new Location(classicPlotWorld.worldname, region.minX, classicPlotWorld.PLOT_HEIGHT, region.minZ); + new Location(classicPlotWorld.worldname, region.getMinimumPoint().getX(), classicPlotWorld.PLOT_HEIGHT, region.getMinimumPoint().getZ()); Location pos2 = - new Location(classicPlotWorld.worldname, region.maxX, classicPlotWorld.PLOT_HEIGHT, region.maxZ); + new Location(classicPlotWorld.worldname, region.getMaximumPoint().getX(), classicPlotWorld.PLOT_HEIGHT, region.getMaximumPoint().getZ()); queue.setCuboid(pos1, pos2, blocks); } } @@ -77,9 +77,9 @@ public class ClassicPlotManager extends SquarePlotManager { } LocalBlockQueue queue = classicPlotWorld.getQueue(false); int maxY = getWorldHeight(); - for (RegionWrapper region : plot.getRegions()) { - Location pos1 = new Location(classicPlotWorld.worldname, region.minX, 1, region.minZ); - Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); + for (CuboidRegion region : plot.getRegions()) { + Location pos1 = new Location(classicPlotWorld.worldname, region.getMinimumPoint().getX(), 1, region.getMinimumPoint().getZ()); + Location pos2 = new Location(classicPlotWorld.worldname, region.getMaximumPoint().getX(), maxY, region.getMaximumPoint().getZ()); queue.setCuboid(pos1, pos2, blocks); } return queue.enqueue(); @@ -92,10 +92,10 @@ public class ClassicPlotManager extends SquarePlotManager { } LocalBlockQueue queue = classicPlotWorld.getQueue(false); int maxY = getWorldHeight(); - for (RegionWrapper region : plot.getRegions()) { + for (CuboidRegion region : plot.getRegions()) { Location pos1 = - new Location(classicPlotWorld.worldname, region.minX, classicPlotWorld.PLOT_HEIGHT + 1, region.minZ); - Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); + new Location(classicPlotWorld.worldname, region.getMinimumPoint().getX(), classicPlotWorld.PLOT_HEIGHT + 1, region.getMinimumPoint().getZ()); + Location pos2 = new Location(classicPlotWorld.worldname, region.getMaximumPoint().getX(), maxY, region.getMaximumPoint().getZ()); queue.setCuboid(pos1, pos2, blocks); } return queue.enqueue(); @@ -107,10 +107,10 @@ public class ClassicPlotManager extends SquarePlotManager { return false; } LocalBlockQueue queue = classicPlotWorld.getQueue(false); - for (RegionWrapper region : plot.getRegions()) { - Location pos1 = new Location(classicPlotWorld.worldname, region.minX, 1, region.minZ); + for (CuboidRegion region : plot.getRegions()) { + Location pos1 = new Location(classicPlotWorld.worldname, region.getMinimumPoint().getX(), 1, region.getMinimumPoint().getZ()); Location pos2 = - new Location(classicPlotWorld.worldname, region.maxX, classicPlotWorld.PLOT_HEIGHT - 1, region.maxZ); + new Location(classicPlotWorld.worldname, region.getMaximumPoint().getX(), classicPlotWorld.PLOT_HEIGHT - 1, region.getMaximumPoint().getZ()); queue.setCuboid(pos1, pos2, blocks); } return queue.enqueue(); @@ -173,9 +173,9 @@ public class ClassicPlotManager extends SquarePlotManager { } } if (plot.isBasePlot()) { - for (RegionWrapper region : plot.getRegions()) { - Location pos1 = new Location(classicPlotWorld.worldname, region.minX, maxY, region.minZ); - Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); + for (CuboidRegion region : plot.getRegions()) { + Location pos1 = new Location(classicPlotWorld.worldname, region.getMinimumPoint().getX(), maxY, region.getMinimumPoint().getZ()); + Location pos2 = new Location(classicPlotWorld.worldname, region.getMaximumPoint().getX(), maxY, region.getMaximumPoint().getZ()); queue.setCuboid(pos1, pos2, blocks); } } 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 249df910c..4d1ad357c 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 @@ -7,7 +7,7 @@ import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.PlotId; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; 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 aae8b3643..7df870508 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 @@ -7,7 +7,7 @@ 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.util.MathMan; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; 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 e87860190..0ab0947a4 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 @@ -12,7 +12,7 @@ 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; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.google.common.collect.Sets; 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 cc3a5ba02..f397c3fc2 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 @@ -10,7 +10,8 @@ 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.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -45,11 +46,11 @@ public abstract class HybridUtils { public static PlotArea area; public static boolean UPDATE = false; - public abstract void analyzeRegion(String world, RegionWrapper region, + public abstract void analyzeRegion(String world, CuboidRegion region, RunnableVal whenDone); public void analyzePlot(final Plot origin, final RunnableVal whenDone) { - final ArrayDeque zones = new ArrayDeque<>(origin.getRegions()); + final ArrayDeque zones = new ArrayDeque<>(origin.getRegions()); final ArrayList analysis = new ArrayList<>(); Runnable run = new Runnable() { @Override public void run() { @@ -97,7 +98,7 @@ public abstract class HybridUtils { TaskManager.runTask(whenDone); return; } - RegionWrapper region = zones.poll(); + CuboidRegion region = zones.poll(); final Runnable task = this; analyzeRegion(origin.getWorldName(), region, new RunnableVal() { @Override public void run(PlotAnalysis value) { @@ -271,10 +272,10 @@ public abstract class HybridUtils { int tz = sz - 1; int ty = get_ey(plotManager, queue, sx, ex, bz, tz, sy); - Set sideRoad = - new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez))); - final Set intersection = - new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz))); + Set sideRoad = + new HashSet<>(Collections.singletonList(RegionUtil.createRegion(sx, ex, sy, ey, sz, ez))); + final Set intersection = + new HashSet<>(Collections.singletonList(RegionUtil.createRegion(sx, ex, sy, ty, bz, tz))); final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.getArea() 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 8ee343b3f..b05249d39 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 @@ -6,13 +6,14 @@ 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; +import java.util.Set; /** * A plot manager with a square grid layout, with square shaped plots. @@ -28,20 +29,20 @@ public abstract class SquarePlotManager extends GridPlotManager { @Override public boolean clearPlot(final Plot plot, final Runnable whenDone) { - final HashSet regions = plot.getRegions(); + final Set regions = plot.getRegions(); Runnable run = new Runnable() { @Override public void run() { if (regions.isEmpty()) { whenDone.run(); return; } - Iterator iterator = regions.iterator(); - RegionWrapper region = iterator.next(); + Iterator iterator = regions.iterator(); + CuboidRegion region = iterator.next(); iterator.remove(); Location pos1 = - new Location(plot.getWorldName(), region.minX, region.minY, region.minZ); + new Location(plot.getWorldName(), region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); Location pos2 = - new Location(plot.getWorldName(), region.maxX, region.maxY, region.maxZ); + new Location(plot.getWorldName(), region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); ChunkManager.manager.regenerateRegion(pos1, pos2, false, this); } }; 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 a91a97f90..7426b99c8 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 @@ -20,7 +20,7 @@ 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.block.ItemUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java index 7d2d824b4..f72fb0520 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; 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.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; @@ -20,10 +20,11 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import java.lang.reflect.Field; import java.util.HashSet; +import java.util.Set; public class ProcessedWEExtent extends AbstractDelegateExtent { - private final HashSet mask; + private final Set mask; private final String world; private final int max; int BScount = 0; @@ -33,7 +34,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { private int count; private Extent parent; - public ProcessedWEExtent(String world, HashSet mask, int max, Extent child, + public ProcessedWEExtent(String world, Set mask, int max, Extent child, Extent parent) { super(child); this.mask = mask; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java index 073819fa3..ea9f404b8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; @@ -16,14 +16,15 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; import java.util.HashSet; +import java.util.Set; public class WEExtent extends AbstractDelegateExtent { public static BlockState AIRSTATE = BlockTypes.AIR.getDefaultState(); public static BaseBlock AIRBASE = BlockTypes.AIR.getDefaultState().toBaseBlock(); - private final HashSet mask; + private final Set mask; - public WEExtent(HashSet mask, Extent extent) { + public WEExtent(Set mask, Extent extent) { super(extent); this.mask = mask; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java index 3692efa51..8d0081273 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java @@ -7,62 +7,65 @@ 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.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import java.util.HashSet; +import java.util.Set; import java.util.UUID; public class WEManager { - public static boolean maskContains(HashSet mask, int x, int y, int z) { - for (RegionWrapper region : mask) { - if (region.isIn(x, y, z)) { + public static boolean maskContains(Set mask, int x, int y, int z) { + for (CuboidRegion region : mask) { + if (RegionUtil.contains(region, x, y, z)) { return true; } } return false; } - public static boolean maskContains(HashSet mask, int x, int z) { - for (RegionWrapper region : mask) { - if (region.isIn(x, z)) { + public static boolean maskContains(Set mask, int x, int z) { + for (CuboidRegion region : mask) { + if (RegionUtil.contains(region, x, z)) { return true; } } return false; } - public static boolean maskContains(HashSet mask, double dx, double dy, + public static boolean maskContains(Set mask, double dx, double dy, double dz) { int x = Math.toIntExact(Math.round(dx >= 0 ? dx - 0.5 : dx + 0.5)); int y = Math.toIntExact(Math.round(dy - 0.5)); int z = Math.toIntExact(Math.round(dz >= 0 ? dz - 0.5 : dz + 0.5)); - for (RegionWrapper region : mask) { - if (region.isIn(x, y, z)) { + for (CuboidRegion region : mask) { + if (RegionUtil.contains(region, x, y, z)) { return true; } } return false; } - public static boolean maskContains(HashSet mask, double dx, double dz) { + public static boolean maskContains(Set mask, double dx, double dz) { int x = Math.toIntExact(Math.round(dx >= 0 ? dx - 0.5 : dx + 0.5)); int z = Math.toIntExact(Math.round(dz >= 0 ? dz - 0.5 : dz + 0.5)); - for (RegionWrapper region : mask) { - if (region.isIn(x, z)) { + for (CuboidRegion region : mask) { + if (RegionUtil.contains(region, x, z)) { return true; } } return false; } - public static HashSet getMask(PlotPlayer player) { - HashSet regions = new HashSet<>(); + public static HashSet getMask(PlotPlayer player) { + HashSet regions = new HashSet<>(); UUID uuid = player.getUUID(); Location location = player.getLocation(); String world = location.getWorld(); if (!PlotSquared.get().hasPlotArea(world)) { - regions.add(new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, + regions.add(RegionUtil.createRegion(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE)); return regions; } @@ -78,10 +81,10 @@ public class WEManager { if (plot != null && (!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot)) && ( (allowMember && plot.isAdded(uuid)) || (!allowMember && (plot.isOwner(uuid)) || plot .getTrusted().contains(uuid))) && !(Flags.NO_WORLDEDIT.isTrue(plot))) { - for (RegionWrapper region : plot.getRegions()) { - RegionWrapper copy = - new RegionWrapper(region.minX, region.maxX, area.MIN_BUILD_HEIGHT, - area.MAX_BUILD_HEIGHT, region.minZ, region.maxZ); + for (CuboidRegion region : plot.getRegions()) { + BlockVector3 pos1 = region.getMinimumPoint().withY(area.MIN_BUILD_HEIGHT); + BlockVector3 pos2 = region.getMaximumPoint().withY(area.MAX_BUILD_HEIGHT); + CuboidRegion copy = new CuboidRegion(pos1, pos2); regions.add(copy); } player.setMeta("WorldEditRegionPlot", plot); @@ -89,12 +92,12 @@ public class WEManager { return regions; } - public static boolean intersects(RegionWrapper region1, RegionWrapper region2) { - return region1.intersects(region2); + public static boolean intersects(CuboidRegion region1, CuboidRegion region2) { + return RegionUtil.intersects(region1, region2); } - public static boolean regionContains(RegionWrapper selection, HashSet mask) { - for (RegionWrapper region : mask) { + public static boolean regionContains(CuboidRegion selection, HashSet mask) { + for (CuboidRegion region : mask) { if (intersects(region, selection)) { return true; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java index 78379fd9e..a56063d08 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.sk89q.worldedit.WorldEdit; @@ -19,6 +19,7 @@ import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.world.World; import java.util.HashSet; +import java.util.Set; public class WESubscriber { @@ -37,7 +38,7 @@ public class WESubscriber { if (actor != null && actor.isPlayer()) { String name = actor.getName(); PlotPlayer plotPlayer = PlotPlayer.wrap(name); - HashSet mask; + Set mask; if (plotPlayer == null) { Player player = (Player) actor; Location location = player.getLocation(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 4d9f23e5f..28ad5669b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.item.ItemType; import org.jetbrains.annotations.NotNull; @@ -18,9 +19,9 @@ public class ConsolePlayer extends PlotPlayer { PlotArea area = PlotSquared.get().getFirstPlotArea(); Location location; if (area != null) { - RegionWrapper region = area.getRegion(); - location = new Location(area.worldname, region.minX + region.maxX / 2, 0, - region.minZ + region.maxZ / 2); + CuboidRegion region = area.getRegion(); + location = new Location(area.worldname, region.getMinimumPoint().getX() + region.getMaximumPoint().getX() / 2, 0, + region.getMinimumPoint().getZ() + region.getMaximumPoint().getZ() / 2); } else { location = new Location("world", 0, 0, 0); } 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 5f2b6bafe..30c8b19c8 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 @@ -27,10 +27,6 @@ public class Location implements Cloneable, Comparable { this.blockVector3 = BlockVector3.at(x, y, z); } - public Location() { - this.world = ""; - } - public Location(String world, int x, int y, int z) { this(world, x, y, z, 0f, 0f); } 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 c753cefe7..9718eb198 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 @@ -22,7 +22,7 @@ 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.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; 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; @@ -32,6 +32,8 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -66,13 +68,13 @@ import java.util.stream.Collectors; */ public class Plot { - private static final int MAX_HEIGHT = 256; + public static final int MAX_HEIGHT = 256; /** * @deprecated raw access is deprecated */ - @Deprecated private static HashSet connected_cache; - private static HashSet regions_cache; + @Deprecated private static Set connected_cache; + private static Set regions_cache; @NotNull private final PlotId id; @@ -865,7 +867,7 @@ public class Plot { return false; } } - final HashSet regions = this.getRegions(); + final Set regions = this.getRegions(); final Set plots = this.getConnectedPlots(); final ArrayDeque queue = new ArrayDeque<>(plots); if (isDelete) { @@ -877,10 +879,10 @@ public class Plot { @Override public void run() { if (queue.isEmpty()) { Runnable run = () -> { - for (RegionWrapper region : regions) { - Location[] corners = region.getCorners(getWorldName()); - ChunkManager.manager.clearAllEntities(corners[0], corners[1]); - } +// for (CuboidRegion region : regions) { +// Location[] corners = MainUtil.getCorners(getWorldName(), region); +// ChunkManager.manager.clearAllEntities(corners[0], corners[1]); +// } TaskManager.runTask(whenDone); }; for (Plot current : plots) { @@ -920,7 +922,7 @@ public class Plot { * @param whenDone The task to run when finished, or null */ public void setBiome(final String biome, final Runnable whenDone) { - final ArrayDeque regions = new ArrayDeque<>(this.getRegions()); + final ArrayDeque regions = new ArrayDeque<>(this.getRegions()); final int extendBiome; if (area instanceof SquarePlotWorld) { extendBiome = (((SquarePlotWorld) area).ROAD_WIDTH > 0) ? 1 : 0; @@ -934,11 +936,11 @@ public class Plot { TaskManager.runTask(whenDone); return; } - RegionWrapper region = regions.poll(); - Location pos1 = new Location(getWorldName(), region.minX - extendBiome, region.minY, - region.minZ - extendBiome); - Location pos2 = new Location(getWorldName(), region.maxX + extendBiome, region.maxY, - region.maxZ + extendBiome); + CuboidRegion region = regions.poll(); + Location pos1 = new Location(getWorldName(), region.getMinimumPoint().getX() - extendBiome, region.getMinimumPoint().getY(), + region.getMinimumPoint().getZ() - extendBiome); + Location pos2 = new Location(getWorldName(), region.getMaximumPoint().getX() + extendBiome, region.getMaximumPoint().getY(), + region.getMaximumPoint().getZ() + extendBiome); ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run(int[] value) { BlockVector2 loc = BlockVector2.at(value[0], value[1]); @@ -1254,9 +1256,9 @@ public class Plot { } public Location getSide() { - RegionWrapper largest = getLargestRegion(); - int x = (largest.maxX >> 1) - (largest.minX >> 1) + largest.minX; - int z = largest.minZ - 1; + CuboidRegion largest = getLargestRegion(); + int x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest.getMinimumPoint().getX(); + int z = largest.getMinimumPoint().getZ() - 1; PlotManager manager = getManager(); int y = isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), x, z) : 62; if (area.ALLOW_SIGNS && (y <= 0 || y >= 255)) { @@ -1328,9 +1330,9 @@ public class Plot { int z; if (loc.getX() == Integer.MAX_VALUE && loc.getZ() == Integer.MAX_VALUE) { // center - RegionWrapper largest = plot.getLargestRegion(); - x = (largest.maxX >> 1) - (largest.minX >> 1) + largest.minX; - z = (largest.maxZ >> 1) - (largest.minZ >> 1) + largest.minZ; + CuboidRegion largest = plot.getLargestRegion(); + x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest.getMinimumPoint().getX(); + z = (largest.getMaximumPoint().getZ() >> 1) - (largest.getMinimumPoint().getZ() >> 1) + largest.getMinimumPoint().getZ(); } else { // specific Location bot = plot.getBottomAbs(); @@ -1348,9 +1350,9 @@ public class Plot { public double getVolume() { double count = 0; - for (RegionWrapper region : getRegions()) { + for (CuboidRegion region : getRegions()) { count += - (region.maxX - (double) region.minX + 1) * (region.maxZ - (double) region.minZ + 1) + (region.getMaximumPoint().getX() - (double) region.getMinimumPoint().getX() + 1) * (region.getMaximumPoint().getZ() - (double) region.getMinimumPoint().getZ() + 1) * MAX_HEIGHT; } return count; @@ -1436,9 +1438,9 @@ public class Plot { public void refreshChunks() { LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); 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++) { + for (CuboidRegion region : Plot.this.getRegions()) { + for (int x = region.getMinimumPoint().getX() >> 4; x <= region.getMaximumPoint().getX() >> 4; x++) { + for (int z = region.getMinimumPoint().getZ() >> 4; z <= region.getMaximumPoint().getZ() >> 4; z++) { if (chunks.add(BlockVector2.at(x, z))) { queue.refreshChunk(x, z); } @@ -2593,7 +2595,7 @@ public class Plot { * * @return */ - @NotNull public HashSet getRegions() { + @NotNull public Set getRegions() { if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) { return regions_cache; } @@ -2601,14 +2603,13 @@ public class Plot { Location pos1 = this.getBottomAbs(); Location pos2 = this.getTopAbs(); connected_cache = Sets.newHashSet(this); - regions_cache = Sets.newHashSet( - new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getY(), pos2.getY(), pos1.getZ(), - pos2.getZ())); + CuboidRegion rg = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()); + regions_cache = Collections.singleton(rg); return regions_cache; } Set plots = this.getConnectedPlots(); - HashSet regions = regions_cache = new HashSet<>(); - HashSet visited = new HashSet<>(); + Set regions = regions_cache = new HashSet<>(); + Set visited = new HashSet<>(); for (Plot current : plots) { if (visited.contains(current.getId())) { continue; @@ -2685,12 +2686,14 @@ public class Plot { Location toploc = plot.getExtendedTopAbs(); Location botabs = plot.getBottomAbs(); Location topabs = plot.getTopAbs(); - regions.add(new RegionWrapper(botabs.getX(), topabs.getX(), topabs.getZ() + 1, - toploc.getZ())); + BlockVector3 pos1 = BlockVector3.at(botabs.getX(), 0, topabs.getZ() + 1); + BlockVector3 pos2 = BlockVector3.at(topabs.getX(), Plot.MAX_HEIGHT - 1, toploc.getZ()); + regions.add(new CuboidRegion(pos1, pos2)); if (plot.getMerged(Direction.SOUTHEAST)) { + pos1 = BlockVector3.at(topabs.getX() + 1, 0, topabs.getZ() + 1); + pos2 = BlockVector3.at(toploc.getX(), Plot.MAX_HEIGHT - 1, toploc.getZ()); regions.add( - new RegionWrapper(topabs.getX() + 1, toploc.getX(), topabs.getZ() + 1, - toploc.getZ())); + new CuboidRegion(pos1, pos2)); // intersection } } @@ -2703,18 +2706,22 @@ public class Plot { Location toploc = plot.getExtendedTopAbs(); Location botabs = plot.getBottomAbs(); Location topabs = plot.getTopAbs(); - regions.add(new RegionWrapper(topabs.getX() + 1, toploc.getX(), botabs.getZ(), - topabs.getZ())); + BlockVector3 pos1 = BlockVector3.at(topabs.getX() + 1, 0, botabs.getZ()); + BlockVector3 pos2 = BlockVector3.at(toploc.getX(), Plot.MAX_HEIGHT - 1, topabs.getZ()); + regions.add(new CuboidRegion(pos1, pos2)); if (plot.getMerged(Direction.SOUTHEAST)) { + pos1 = BlockVector3.at(topabs.getX() + 1, 0, topabs.getZ()); + pos2 = BlockVector3.at(toploc.getX(), Plot.MAX_HEIGHT - 1, toploc.getZ()); regions.add( - new RegionWrapper(topabs.getX() + 1, toploc.getX(), topabs.getZ() + 1, - toploc.getZ())); + new CuboidRegion(pos1, pos2)); // intersection } } } + BlockVector3 pos1 = BlockVector3.at(gbotabs.getX() + 1, 0, gbotabs.getZ()); + BlockVector3 pos2 = BlockVector3.at(gtopabs.getX(), Plot.MAX_HEIGHT - 1, gtopabs.getZ()); regions.add( - new RegionWrapper(gbotabs.getX(), gtopabs.getX(), gbotabs.getZ(), gtopabs.getZ())); + new CuboidRegion(pos1, pos2)); } return regions; } @@ -2724,13 +2731,13 @@ public class Plot { * * @return */ - public RegionWrapper getLargestRegion() { - HashSet regions = this.getRegions(); - RegionWrapper max = null; + public CuboidRegion getLargestRegion() { + Set regions = this.getRegions(); + CuboidRegion max = null; double area = Double.NEGATIVE_INFINITY; - for (RegionWrapper region : regions) { + for (CuboidRegion region : regions) { double current = - (region.maxX - (double) region.minX + 1) * (region.maxZ - (double) region.minZ + 1); + (region.getMaximumPoint().getX() - (double) region.getMinimumPoint().getX() + 1) * (region.getMaximumPoint().getZ() - (double) region.getMinimumPoint().getZ() + 1); if (current > area) { max = region; area = current; @@ -2759,9 +2766,9 @@ public class Plot { */ public List getAllCorners() { Area area = new Area(); - for (RegionWrapper region : this.getRegions()) { - Rectangle2D rect = new Rectangle2D.Double(region.minX - 0.6, region.minZ - 0.6, - region.maxX - region.minX + 1.2, region.maxZ - region.minZ + 1.2); + for (CuboidRegion region : this.getRegions()) { + Rectangle2D rect = new Rectangle2D.Double(region.getMinimumPoint().getX() - 0.6, region.getMinimumPoint().getZ() - 0.6, + region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + 1.2, region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + 1.2); Area rectArea = new Area(rect); area.add(rectArea); } @@ -2976,7 +2983,7 @@ public class Plot { } // world border destination.updateWorldBorder(); - final ArrayDeque regions = new ArrayDeque<>(this.getRegions()); + final ArrayDeque regions = new ArrayDeque<>(this.getRegions()); // move / swap data final PlotArea originArea = getArea(); for (Plot plot : plots) { @@ -2991,8 +2998,8 @@ public class Plot { TaskManager.runTask(whenDone); return; } - RegionWrapper region = regions.poll(); - Location[] corners = region.getCorners(getWorldName()); + CuboidRegion region = regions.poll(); + Location[] corners = MainUtil.getCorners(getWorldName(), region); Location pos1 = corners[0]; Location pos2 = corners[1]; Location pos3 = pos1.clone().add(offsetX, 0, offsetZ); @@ -3019,8 +3026,8 @@ public class Plot { return; } final Runnable task = this; - RegionWrapper region = regions.poll(); - Location[] corners = region.getCorners(getWorldName()); + CuboidRegion region = regions.poll(); + Location[] corners = MainUtil.getCorners(getWorldName(), region); final Location pos1 = corners[0]; final Location pos2 = corners[1]; Location newPos = pos1.clone().add(offsetX, 0, offsetZ); @@ -3093,7 +3100,7 @@ public class Plot { } } // copy terrain - final ArrayDeque regions = new ArrayDeque<>(this.getRegions()); + final ArrayDeque regions = new ArrayDeque<>(this.getRegions()); Runnable run = new Runnable() { @Override public void run() { if (regions.isEmpty()) { @@ -3104,8 +3111,8 @@ public class Plot { TaskManager.runTask(whenDone); return; } - RegionWrapper region = regions.poll(); - Location[] corners = region.getCorners(getWorldName()); + CuboidRegion region = regions.poll(); + Location[] corners = MainUtil.getCorners(getWorldName(), region); Location pos1 = corners[0]; Location pos2 = corners[1]; Location newPos = pos1.clone().add(offsetX, 0, offsetZ); 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 b3217297d..970c427b8 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 @@ -19,8 +19,12 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap; 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.world.RegionUtil; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -79,7 +83,7 @@ public abstract class PlotArea { public int MIN_BUILD_HEIGHT = 1; public PlotGameMode GAMEMODE = PlotGameMode.CREATIVE; private int hash; - private RegionWrapper region; + private CuboidRegion region; private ConcurrentHashMap meta; private QuadMap clusters; @@ -128,16 +132,16 @@ public abstract class PlotArea { } /** - * Returns the region for this PlotArea or a RegionWrapper encompassing + * Returns the region for this PlotArea or a CuboidRegion encompassing * the whole world if none exists. * - * @return RegionWrapper + * @return CuboidRegion */ - public RegionWrapper getRegion() { + public CuboidRegion getRegion() { this.region = getRegionAbs(); if (this.region == null) { - return new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, - Integer.MAX_VALUE); + return new CuboidRegion(BlockVector3.at(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE), + BlockVector3.at(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE)); } return this.region; } @@ -145,15 +149,16 @@ public abstract class PlotArea { /** * Returns the region for this PlotArea. * - * @return RegionWrapper or null if no applicable region + * @return CuboidRegion or null if no applicable region */ - private RegionWrapper getRegionAbs() { + private CuboidRegion getRegionAbs() { if (this.region == null) { if (this.min != null) { Location bot = getPlotManager().getPlotBottomLocAbs(this.min); Location top = getPlotManager().getPlotTopLocAbs(this.max); - this.region = new RegionWrapper(bot.getX() - 1, top.getX() + 1, bot.getZ() - 1, - top.getZ() + 1); + BlockVector3 pos1 = bot.getBlockVector3().subtract(BlockVector3.ONE); + BlockVector3 pos2 = top.getBlockVector3().add(BlockVector3.ONE); + this.region = new CuboidRegion(pos1, pos2); } } return this.region; @@ -497,7 +502,7 @@ public abstract class PlotArea { } public boolean contains(final int x, final int z) { - return this.TYPE != 2 || getRegionAbs().isIn(x, z); + return this.TYPE != 2 || RegionUtil.contains(getRegionAbs(), x, z); } public boolean contains(@NotNull final PlotId id) { @@ -507,7 +512,7 @@ public abstract class PlotArea { public boolean contains(@NotNull final Location location) { return StringMan.isEqual(location.getWorld(), this.worldname) && (getRegionAbs() == null - || this.region.isIn(location.getX(), location.getZ())); + || this.region.contains(location.getBlockVector3())); } @NotNull Set getPlotsAbs(final UUID uuid) { @@ -940,9 +945,10 @@ public abstract class PlotArea { public void addCluster(@Nullable final PlotCluster plotCluster) { if (this.clusters == null) { this.clusters = new QuadMap(Integer.MAX_VALUE, 0, 0, 62) { - @Override public RegionWrapper getRegion(PlotCluster value) { - return new RegionWrapper(value.getP1().x, value.getP2().x, value.getP1().y, - value.getP2().y); + @Override public CuboidRegion getRegion(PlotCluster value) { + BlockVector2 pos1 = BlockVector2.at(value.getP1().x, value.getP1().y); + BlockVector2 pos2 = BlockVector2.at(value.getP2().x, value.getP2().y); + return new CuboidRegion(pos1.toBlockVector3(), pos2.toBlockVector3(Plot.MAX_HEIGHT - 1)); } }; } 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 d5d7c95d3..4a653d8dd 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 @@ -2,6 +2,8 @@ package com.github.intellectualsites.plotsquared.plot.object; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; +import com.sk89q.worldedit.regions.CuboidRegion; import java.util.HashSet; import java.util.UUID; @@ -15,7 +17,7 @@ public class PlotCluster { public int temp; private PlotId pos1; private PlotId pos2; - private RegionWrapper region; + private CuboidRegion region; public PlotCluster(PlotArea area, PlotId pos1, PlotId pos2, UUID owner) { this.area = area; @@ -56,10 +58,10 @@ public class PlotCluster { } private void setRegion() { - this.region = new RegionWrapper(this.pos1.x, this.pos2.x, this.pos1.y, this.pos2.y); + this.region = RegionUtil.createRegion(this.pos1.x, this.pos2.x, this.pos1.y, this.pos2.y); } - public RegionWrapper getRegion() { + public CuboidRegion getRegion() { return this.region; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java deleted file mode 100644 index ced127a22..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -public class RegionWrapper { - public final int minX; - public final int maxX; - public final int minY; - public final int maxY; - public final int minZ; - public final int maxZ; - - public RegionWrapper(int minX, int maxX, int minZ, int maxZ) { - this.maxX = maxX; - this.minX = minX; - this.maxZ = maxZ; - this.minZ = minZ; - this.minY = 0; - this.maxY = 256; - } - - public RegionWrapper(int minX, int maxX, int minY, int maxY, int minZ, int maxZ) { - this.maxX = maxX; - this.minX = minX; - this.maxZ = maxZ; - this.minZ = minZ; - this.minY = minY; - this.maxY = maxY; - } - - public boolean isIn(int x, int y, int z) { - return x >= this.minX && x <= this.maxX && z >= this.minZ && z <= this.maxZ - && y >= this.minY && y <= this.maxY; - } - - public boolean isIn(int x, int z) { - return x >= this.minX && x <= this.maxX && z >= this.minZ && z <= this.maxZ; - } - - public boolean intersects(RegionWrapper other) { - return other.minX <= this.maxX && other.maxX >= this.minX && other.minY <= this.maxY - && other.maxY >= this.minY; - } - - @Override public int hashCode() { - return this.minX + 13 * this.maxX + 23 * this.minZ + 39 * this.maxZ; - } - - @Override public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (obj == this) { - return true; - } - if (obj instanceof RegionWrapper) { - RegionWrapper other = (RegionWrapper) obj; - return this.minX == other.minX && this.minZ == other.minZ && this.minY == other.minY - && this.maxX == other.maxX && this.maxZ == other.maxZ && this.maxY == other.maxY; - } - return false; - } - - @Override public String toString() { - return this.minX + "->" + this.maxX + "," + this.minZ + "->" + this.maxZ; - } - - public Location[] getCorners(String world) { - Location pos1 = new Location(world, this.minX, this.minY, this.minZ); - Location pos2 = new Location(world, this.maxX, this.maxY, this.maxZ); - return new Location[] {pos1, pos2}; - } -} 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 8d5152a1b..0191b53df 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap; @@ -99,7 +99,7 @@ public class DefaultPlotAreaManager implements PlotAreaManager { QuadMap map = this.plotAreaGrid.get(plotArea.worldname); if (map == null) { map = new QuadMap(Integer.MAX_VALUE, 0, 0) { - @Override public RegionWrapper getRegion(PlotArea value) { + @Override public CuboidRegion getRegion(PlotArea value) { return value.getRegion(); } }; @@ -201,7 +201,7 @@ public class DefaultPlotAreaManager implements PlotAreaManager { } } - @Override public PlotArea[] getPlotAreas(String world, RegionWrapper region) { + @Override public PlotArea[] getPlotAreas(String world, CuboidRegion region) { if (region == null) { PlotArea[] areas = this.plotAreaMap.get(world); if (areas == null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java index 7a59dab9d..b34ad2787 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; public interface PlotAreaManager { PlotArea getApplicablePlotArea(Location location); @@ -11,7 +11,7 @@ public interface PlotAreaManager { PlotArea getPlotArea(String world, String id); - PlotArea[] getPlotAreas(String world, RegionWrapper region); + PlotArea[] getPlotAreas(String world, CuboidRegion region); PlotArea[] getAllPlotAreas(); 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 7f63e2ed0..a9a620daa 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 @@ -8,18 +8,21 @@ 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.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import com.google.common.collect.Sets; import org.jetbrains.annotations.NotNull; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; +import java.util.Set; import java.util.UUID; public class SinglePlot extends Plot { - private HashSet regions = Sets.newHashSet( - new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, - Integer.MAX_VALUE)); + private Set regions = Collections.singleton( + new CuboidRegion(BlockVector3.at(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE), + BlockVector3.at(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE))); public SinglePlot(PlotArea area, PlotId id, UUID owner) { super(area, id, owner); @@ -66,7 +69,7 @@ public class SinglePlot extends Plot { return super.isLoaded(); } - @NotNull @Override public HashSet getRegions() { + @NotNull @Override public Set getRegions() { return regions; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java index f2e0b3c03..620a689b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.ArrayUtil; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; @@ -90,7 +90,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager { return isWorld(location.getWorld()) || location.getWorld().equals("*") ? area : null; } - @Override public PlotArea[] getPlotAreas(String world, RegionWrapper region) { + @Override public PlotArea[] getPlotAreas(String world, CuboidRegion region) { PlotArea[] found = super.getPlotAreas(world, region); if (found != null && found.length != 0) { return found; 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 a7f3e2b62..0042ca222 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 @@ -6,7 +6,7 @@ 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.PlotId; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; 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 206f2b710..be8a79207 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.util; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; 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; @@ -80,7 +80,7 @@ public abstract class ChunkManager { return false; } - public static void largeRegionTask(final String world, final RegionWrapper region, + public static void largeRegionTask(final String world, final CuboidRegion region, final RunnableVal task, final Runnable whenDone) { TaskManager.runTaskAsync(() -> { HashSet chunks = new HashSet<>(); @@ -90,16 +90,16 @@ public abstract class ChunkManager { int bz = mcr.getZ() << 9; int tx = bx + 511; int tz = bz + 511; - if (bx <= region.maxX && tx >= region.minX && bz <= region.maxZ - && tz >= region.minZ) { + if (bx <= region.getMaximumPoint().getX() && tx >= region.getMinimumPoint().getX() && bz <= region.getMaximumPoint().getZ() + && tz >= region.getMinimumPoint().getZ()) { for (int x = bx >> 4; x <= (tx >> 4); x++) { int cbx = x << 4; int ctx = cbx + 15; - if (cbx <= region.maxX && ctx >= region.minX) { + if (cbx <= region.getMaximumPoint().getX() && ctx >= region.getMinimumPoint().getX()) { for (int z = bz >> 4; z <= (tz >> 4); z++) { int cbz = z << 4; int ctz = cbz + 15; - if (cbz <= region.maxZ && ctz >= region.minZ) { + if (cbz <= region.getMaximumPoint().getZ() && ctz >= region.getMinimumPoint().getZ()) { chunks.add(BlockVector2.at(x, z)); } } @@ -118,16 +118,16 @@ public abstract class ChunkManager { public static void chunkTask(final Plot plot, final RunnableVal task, final Runnable whenDone, final int allocate) { - final ArrayList regions = new ArrayList<>(plot.getRegions()); + final ArrayList regions = new ArrayList<>(plot.getRegions()); Runnable smallTask = new Runnable() { @Override public void run() { if (regions.isEmpty()) { TaskManager.runTask(whenDone); return; } - RegionWrapper value = regions.remove(0); - Location pos1 = new Location(plot.getWorldName(), value.minX, 0, value.minZ); - Location pos2 = new Location(plot.getWorldName(), value.maxX, 0, value.maxZ); + CuboidRegion value = regions.remove(0); + Location pos1 = new Location(plot.getWorldName(), value.getMinimumPoint().getX(), 0, value.getMinimumPoint().getZ()); + Location pos2 = new Location(plot.getWorldName(), value.getMaximumPoint().getX(), 0, value.getMaximumPoint().getZ()); chunkTask(pos1, pos2, task, this, allocate); } }; 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 af4b21e3c..d06beab3f 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 @@ -16,7 +16,9 @@ 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.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; 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; @@ -372,6 +374,14 @@ public class MainUtil { return plot.getFlag(Flags.SERVER_PLOT).orElse(false); } + @NotNull public static Location[] getCorners(String world, CuboidRegion region) { + BlockVector3 min = region.getMinimumPoint(); + BlockVector3 max = region.getMaximumPoint(); + Location pos1 = new Location(world, min.getX(), min.getY(), min.getZ()); + Location pos2 = new Location(world, max.getX(), max.getY(), max.getZ()); + return new Location[] {pos1, pos2}; + } + /** * Get the corner locations for a list of regions. * @@ -380,11 +390,11 @@ public class MainUtil { * @return * @see Plot#getCorners() */ - @NotNull public static Location[] getCorners(String world, Collection regions) { + @NotNull public static Location[] getCorners(String world, Collection regions) { Location min = null; Location max = null; - for (RegionWrapper region : regions) { - Location[] corners = region.getCorners(world); + for (CuboidRegion region : regions) { + Location[] corners = getCorners(world, region); if (min == null) { min = corners[0]; max = corners[1]; @@ -558,7 +568,9 @@ public class MainUtil { * @param biome */ public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, String biome) { - RegionWrapper region = new RegionWrapper(p1x, p2x, p1z, p2z); + BlockVector3 pos1 = BlockVector2.at(p1x, p1z).toBlockVector3(); + BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(Plot.MAX_HEIGHT - 1); + CuboidRegion region = new CuboidRegion(pos1, pos2); WorldUtil.IMP.setBiomes(world, region, biome); } 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 a1c920d9e..75f8d79f0 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 @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld; 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.RegionWrapper; +import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; @@ -168,13 +168,13 @@ public abstract class SchematicHandler { final int LENGTH = dimension.getZ(); final int HEIGHT = dimension.getY(); // Validate dimensions - RegionWrapper region = plot.getLargestRegion(); - if (((region.maxX - region.minX + xOffset + 1) < WIDTH) || ( - (region.maxZ - region.minZ + zOffset + 1) < LENGTH) || (HEIGHT > 256)) { + CuboidRegion region = plot.getLargestRegion(); + if (((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || ( + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT > 256)) { PlotSquared.debug("Schematic is too large"); PlotSquared.debug( "(" + WIDTH + ',' + LENGTH + ',' + HEIGHT + ") is bigger than (" + ( - region.maxX - region.minX) + ',' + (region.maxZ - region.minZ) + region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) + ',' + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) + ",256)"); TaskManager.runTask(whenDone); return; @@ -192,16 +192,16 @@ public abstract class SchematicHandler { y_offset_actual = yOffset + ((ClassicPlotWorld) pw).PLOT_HEIGHT; } else { y_offset_actual = yOffset + 1 + MainUtil - .getHeighestBlock(plot.getWorldName(), region.minX + 1, - region.minZ + 1); + .getHeighestBlock(plot.getWorldName(), region.getMinimumPoint().getX() + 1, + region.getMinimumPoint().getZ() + 1); } } } else { y_offset_actual = yOffset; } Location pos1 = - new Location(plot.getWorldName(), region.minX + xOffset, y_offset_actual, - region.minZ + zOffset); + new Location(plot.getWorldName(), region.getMinimumPoint().getX() + xOffset, y_offset_actual, + region.getMinimumPoint().getZ() + zOffset); Location pos2 = pos1.clone().add(WIDTH - 1, HEIGHT - 1, LENGTH - 1); final int p1x = pos1.getX(); final int p1z = pos1.getZ(); @@ -445,7 +445,7 @@ public abstract class SchematicHandler { return true; } - public abstract void getCompoundTag(String world, Set regions, + public abstract void getCompoundTag(String world, Set regions, RunnableVal whenDone); public void getCompoundTag(final Plot plot, final RunnableVal whenDone) { 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 9d60a80ba..52be1a312 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 @@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.sk89q.jnbt.CompoundTag; @@ -66,7 +66,7 @@ public abstract class WorldUtil { public abstract void setSign(String world, int x, int y, int z, String[] lines); - public abstract void setBiomes(String world, RegionWrapper region, String biome); + public abstract void setBiomes(String world, CuboidRegion region, String biome); public abstract com.sk89q.worldedit.world.World getWeWorld(String world); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java index 133088a2e..e016cfeea 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java @@ -1,6 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.area; -import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; +import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; +import com.sk89q.worldedit.regions.CuboidRegion; import java.util.HashSet; import java.util.Set; @@ -96,9 +97,9 @@ public class QuadMap { this.objects.add(area); return; } - RegionWrapper region = getRegion(area); - if (region.minX >= this.x) { - if (region.minZ >= this.z) { + CuboidRegion region = getRegion(area); + if (region.getMinimumPoint().getX() >= this.x) { + if (region.getMinimumPoint().getZ() >= this.z) { if (this.one == null) { this.one = newInstance(this.newsize, this.x + this.newsize, this.z + this.newsize, @@ -107,7 +108,7 @@ public class QuadMap { this.one.add(area); recalculateSkip(); return; - } else if (region.maxZ < this.z) { + } else if (region.getMaximumPoint().getZ() < this.z) { if (this.two == null) { this.two = newInstance(this.newsize, this.x + this.newsize, this.z - this.newsize, @@ -117,8 +118,8 @@ public class QuadMap { recalculateSkip(); return; } - } else if (region.maxX < this.x) { - if (region.minZ >= this.z) { + } else if (region.getMaximumPoint().getX() < this.x) { + if (region.getMinimumPoint().getZ() >= this.z) { if (this.four == null) { this.four = newInstance(this.newsize, this.x - this.newsize, this.z + this.newsize, @@ -127,7 +128,7 @@ public class QuadMap { this.four.add(area); recalculateSkip(); return; - } else if (region.maxZ < this.z) { + } else if (region.getMaximumPoint().getZ() < this.z) { if (this.three == null) { this.three = newInstance(this.newsize, this.x - this.newsize, this.z - this.newsize, @@ -144,14 +145,14 @@ public class QuadMap { this.objects.add(area); } - public RegionWrapper getRegion(T value) { + public CuboidRegion getRegion(T value) { return null; } public QuadMap newInstance(int newsize, int x, int z, int min) { try { return new QuadMap(newsize, x, z, min) { - @Override public RegionWrapper getRegion(T value) { + @Override public CuboidRegion getRegion(T value) { return QuadMap.this.getRegion(value); } }; @@ -172,9 +173,9 @@ public class QuadMap { this.skip = null; } } else { - RegionWrapper region = getRegion(area); - if (region.minX >= this.x) { - if (region.minZ >= this.z) { + CuboidRegion region = getRegion(area); + if (region.getMinimumPoint().getX() >= this.x) { + if (region.getMinimumPoint().getZ() >= this.z) { if (this.one != null) { if (this.one.remove(area)) { this.one = null; @@ -190,7 +191,7 @@ public class QuadMap { } } } else { - if (region.minZ >= this.z) { + if (region.getMinimumPoint().getZ() >= this.z) { if (this.four != null) { if (this.four.remove(area)) { this.four = null; @@ -224,11 +225,11 @@ public class QuadMap { this.skip = map.skip == null ? map : map.skip; } - public Set get(RegionWrapper region) { + public Set get(CuboidRegion region) { HashSet set = new HashSet<>(); if (this.objects != null) { for (T obj : this.objects) { - if (getRegion(obj).intersects(region)) { + if (RegionUtil.intersects(getRegion(obj), region)) { set.add(obj); } } @@ -254,15 +255,15 @@ public class QuadMap { return set; } - public boolean intersects(RegionWrapper other) { - return (other.minX <= this.x + this.size) && (other.maxX >= this.x - this.size) && ( - other.minZ <= this.z + this.size) && (other.maxZ >= this.z - this.size); + public boolean intersects(CuboidRegion other) { + return (other.getMinimumPoint().getX() <= this.x + this.size) && (other.getMaximumPoint().getX() >= this.x - this.size) && ( + other.getMinimumPoint().getZ() <= this.z + this.size) && (other.getMaximumPoint().getZ() >= this.z - this.size); } public T get(int x, int z) { if (this.objects != null) { for (T obj : this.objects) { - if (getRegion(obj).isIn(x, z)) { + if (RegionUtil.contains(getRegion(obj), x, z)) { return obj; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java similarity index 97% rename from Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java rename to Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java index f377de6e4..6ea6d1c6c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java @@ -1,4 +1,4 @@ -package com.github.intellectualsites.plotsquared.plot.util.block; +package com.github.intellectualsites.plotsquared.plot.util.world; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.sk89q.worldedit.WorldEdit; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/ItemUtil.java similarity index 94% rename from Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java rename to Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/ItemUtil.java index 243d098ab..415df8fe1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/ItemUtil.java @@ -1,4 +1,4 @@ -package com.github.intellectualsites.plotsquared.plot.util.block; +package com.github.intellectualsites.plotsquared.plot.util.world; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.sk89q.worldedit.world.item.ItemType; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/RegionUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/RegionUtil.java new file mode 100644 index 000000000..271f76dac --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/RegionUtil.java @@ -0,0 +1,40 @@ +package com.github.intellectualsites.plotsquared.plot.util.world; + +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; + +public class RegionUtil { + public static CuboidRegion createRegion(int pos1x, int pos2x, int pos1z, int pos2z) { + return createRegion(pos1x, pos2x, 0, Plot.MAX_HEIGHT - 1, pos1z, pos2z); + } + + public static CuboidRegion createRegion(int pos1x, int pos2x, int pos1y, int pos2y, int pos1z, int pos2z) { + BlockVector3 pos1 = BlockVector3.at(pos1x, pos1y, pos1z); + BlockVector3 pos2 = BlockVector3.at(pos2x, pos2y, pos2z); + return new CuboidRegion(pos1, pos2); + } + + public static boolean contains(CuboidRegion region, int x, int z) { + BlockVector3 min = region.getMinimumPoint(); + BlockVector3 max = region.getMaximumPoint(); + return x >= min.getX() && x <= max.getX() && z >= min.getZ() && z <= max.getZ(); + } + + public static boolean contains(CuboidRegion region, int x, int y, int z) { + BlockVector3 min = region.getMinimumPoint(); + BlockVector3 max = region.getMaximumPoint(); + return x >= min.getX() && x <= max.getX() && z >= min.getZ() && z <= max.getZ() && y >= min.getY() && y <= max.getY(); + } + + // Because WE (not fawe) lack this for CuboidRegion + public static boolean intersects(CuboidRegion region, CuboidRegion other) { + BlockVector3 regionMin = region.getMinimumPoint(); + BlockVector3 regionMax = region.getMaximumPoint(); + + BlockVector3 otherMin = other.getMinimumPoint(); + BlockVector3 otherMax = other.getMaximumPoint(); + + return otherMin.getX() <= regionMax.getX() && otherMax.getX() >= regionMin.getX() && otherMin.getZ() <= regionMax.getZ() && otherMax.getZ() >= regionMin.getZ(); + } +} diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java index 6c322864b..8bbc1193f 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java @@ -8,7 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.EventUtilTest; -import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.worldedit.world.block.BlockType; import org.junit.Before; import org.junit.Test; From 2cb734bba2955ef55b16042f145736e13f327a28 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 4 Nov 2019 21:55:40 +0000 Subject: [PATCH 174/258] editsession util --- .../plotsquared/bukkit/BukkitMain.java | 11 ++ .../bukkit/object/BukkitPlayer.java | 6 + .../bukkit/util/BukkitTaskManager.java | 6 +- .../plotsquared/api/PlotAPI.java | 1 + .../plotsquared/plot/IPlotMain.java | 3 + .../plot/object/ConsolePlayer.java | 6 + .../plotsquared/plot/object/Plot.java | 2 +- .../plotsquared/plot/object/PlotPlayer.java | 3 + .../plot/util/world/OperationUtil.java | 116 ++++++++++++++++++ 9 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/OperationUtil.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 25ad69723..7d4c8bf4b 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 @@ -65,6 +65,10 @@ 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 com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.bukkit.BukkitCommandSender; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.extension.platform.Actor; import io.papermc.lib.PaperLib; import lombok.Getter; import lombok.NonNull; @@ -74,6 +78,7 @@ import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.OfflinePlayer; import org.bukkit.World; +import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -823,4 +828,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } return names; } + + @Override public Actor getConsole() { + @NotNull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); + WorldEditPlugin wePlugin = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit")); + return wePlugin.wrapCommandSender(console); + } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 35fa0d20b..9ca1bbbae 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -12,6 +12,8 @@ import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.world.item.ItemType; import io.papermc.lib.PaperLib; import org.bukkit.GameMode; @@ -55,6 +57,10 @@ public class BukkitPlayer extends PlotPlayer { super.populatePersistentMetaMap(); } + @Override public Actor toActor() { + return BukkitAdapter.adapt(player); + } + @NotNull @Override public Location getLocation() { final Location location = super.getLocation(); return location == null ? BukkitUtil.getLocation(this.player) : location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java index 56448ff34..cbe09142c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java @@ -3,6 +3,8 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import org.bukkit.Bukkit; +import org.bukkit.scheduler.BukkitTask; +import org.jetbrains.annotations.NotNull; public class BukkitTaskManager extends TaskManager { @@ -24,8 +26,8 @@ public class BukkitTaskManager extends TaskManager { } @Override public void taskAsync(Runnable runnable) { - this.bukkitMain.getServer().getScheduler().runTaskAsynchronously(this.bukkitMain, runnable) - .getTaskId(); + @NotNull BukkitTask task = this.bukkitMain.getServer().getScheduler() + .runTaskAsynchronously(this.bukkitMain, runnable); } @Override public void task(Runnable runnable) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java index 610362953..740db8fca 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; +import com.sk89q.worldedit.extension.platform.Actor; import lombok.NoArgsConstructor; import java.util.Collections; 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 3a47773b7..b532cb4ce 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 @@ -16,6 +16,7 @@ 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 com.sk89q.worldedit.extension.platform.Actor; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -248,4 +249,6 @@ import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; @NotNull IndependentPlotGenerator getDefaultGenerator(); List getPluginIds(); + + Actor getConsole(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 28ad5669b..ae9fffb89 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -5,6 +5,8 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.item.ItemType; import org.jetbrains.annotations.NotNull; @@ -36,6 +38,10 @@ public class ConsolePlayer extends PlotPlayer { return instance; } + @Override public Actor toActor() { + return PlotSquared.get().IMP.getConsole(); + } + @Override public boolean canTeleport(@NotNull Location location) { return true; } 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 9718eb198..33e482428 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 @@ -1116,7 +1116,7 @@ public class Plot { * Delete a plot (use null for the runnable if you don't need to be notified on completion) * * @see PlotSquared#removePlot(Plot, boolean) - * @see #clear(Runnable) to simply clear a plot + * @see #clear(boolean, boolean, Runnable) to simply clear a plot */ public boolean deletePlot(final Runnable whenDone) { if (!this.hasOwner()) { 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 5eddb6364..f48cbc981 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 @@ -19,6 +19,7 @@ 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 com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.world.item.ItemType; import lombok.NonNull; import org.jetbrains.annotations.NotNull; @@ -86,6 +87,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { return UUIDHandler.getPlayer(name); } + public abstract Actor toActor(); + /** * Set some session only metadata for this player. * diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/OperationUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/OperationUtil.java new file mode 100644 index 000000000..05b969065 --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/OperationUtil.java @@ -0,0 +1,116 @@ +package com.github.intellectualsites.plotsquared.plot.util.world; + +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.util.TaskManager; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.world.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.concurrent.Future; +import java.util.function.Consumer; + +public class OperationUtil { + private static final boolean ASYNC; + + static { + boolean hasFawe = true; + try { + Class.forName("com.boydti.fawe.Fawe"); + } catch (ClassNotFoundException ignore) { + hasFawe = false; + } + ASYNC = hasFawe; + } + + public Future withEditSession(@NotNull PlotPlayer plotPlayer, @NotNull Consumer consumer, @Nullable Consumer exceptionHandler) { + if (ASYNC) { + ListeningExecutorService exec = WorldEdit.getInstance().getExecutorService(); + return exec.submit( + () -> withEditSessionOnThread(plotPlayer, consumer, exceptionHandler)); + } else { + withEditSessionOnThread(plotPlayer, consumer, exceptionHandler); + } + return Futures.immediateFuture(true); + } + + private void withEditSessionOnThread(PlotPlayer plotPlayer, Consumer consumer, Consumer exceptionHandler) { + Actor actor = plotPlayer.toActor(); + World weWorld = getWorld(plotPlayer, actor); + LocalSession session = getSession(actor); + try (EditSession ess = createEditSession(weWorld, actor, session)) { + try { + consumer.accept(ess); + } finally { + ess.close(); + session.remember(ess); + } + } catch (Throwable e) { + if (exceptionHandler != null) { + exceptionHandler.accept(e); + } else { + e.printStackTrace(); + } + } + } + + private static World getWorld(String worldName) { + Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING); + List worlds = platform.getWorlds(); + for (World current : worlds) { + if (current.getName().equals(worldName)) { + return current; + } + } + return null; + } + + private static World getWorld(PlotPlayer plotPlayer, Actor actor) { + World weWorld; + if (actor instanceof Player) { + weWorld = ((Player) actor).getWorld(); + } else { + @NotNull Location loc = plotPlayer.getLocation(); + String world = loc.getWorld(); + weWorld = getWorld(world); + } + return weWorld; + } + + private static EditSession createEditSession(PlotPlayer plotPlayer) { + Actor actor = plotPlayer.toActor(); + World weWorld = getWorld(plotPlayer, actor); + return createEditSession(weWorld, actor); + } + + private static LocalSession getSession(Actor actor) { + return WorldEdit.getInstance().getSessionManager().get(actor); + } + + private static EditSession createEditSession(World world, Actor actor) { + return createEditSession(world, actor, getSession(actor)); + } + + private static EditSession createEditSession(World world, Actor actor, LocalSession session) { + EditSession editSession; + Player player = actor.isPlayer() ? (Player) actor : null; + editSession = WorldEdit.getInstance().getEditSessionFactory() + .getEditSession(world, -1, null, player); + + editSession.setFastMode(!actor.isPlayer()); + editSession.setReorderMode(EditSession.ReorderMode.FAST); + return editSession; + } +} From fed516972485be7fed34af2e1292d27041a49d30 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 5 Nov 2019 15:23:48 +0000 Subject: [PATCH 175/258] Get sign lines sync --- .../plotsquared/bukkit/util/BukkitUtil.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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..bf7ed114a 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 @@ -8,6 +8,7 @@ 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; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; +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.sk89q.worldedit.bukkit.BukkitWorld; @@ -312,13 +313,15 @@ import java.util.Set; } @Override @Nullable public String[] getSign(@NonNull final Location location) { - Block block = getWorld(location.getWorld()) - .getBlockAt(location.getX(), location.getY(), location.getZ()); - if (block.getState() instanceof Sign) { - Sign sign = (Sign) block.getState(); - return sign.getLines(); - } - return null; + Block block = getWorld(location.getWorld()).getBlockAt(location.getX(), location.getY(), location.getZ()); + return TaskManager.IMP.sync(new RunnableVal() { + @Override public void run(String[] value) { + if (block.getState() instanceof Sign) { + Sign sign = (Sign) block.getState(); + this.value = sign.getLines(); + } + } + }); } @Override public Location getSpawn(@NonNull final PlotPlayer player) { From 252fdefef3d11d945c6f9d701fdd15de30130210 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 6 Nov 2019 11:39:55 +0000 Subject: [PATCH 176/258] bad regex replace --- .../plotsquared/bukkit/chat/Reflection.java | 8 -------- .../intellectualsites/plotsquared/plot/IPlotMain.java | 4 ---- 2 files changed, 12 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java index ebe7e81b3..f3f004284 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java @@ -21,8 +21,6 @@ public final class Reflection { private static final Map> _loadedNMSClasses = new HashMap<>(); /** * Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages). - -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; */ private static final Map> _loadedOBCClasses = new HashMap<>(); private static final Map, Map> _loadedFields = new HashMap<>(); @@ -39,11 +37,7 @@ import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; /** * Gets the version string from the package name of the CraftBukkit server implementation. - -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * This is needed to bypass the JAR package name changing on each update. - -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * * @return The version string of the OBC and NMS packages, including the trailing dot. */ @@ -85,8 +79,6 @@ import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously). * * @param className The name of the class, excluding the package, within OBC. This name may contain a subpackage name, such as {@code inventory.CraftItemStack}. - -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * @return The class instance representing the specified OBC class, or {@code null} if it could not be loaded. */ public synchronized static Class getOBCClass(String className) { 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 b532cb4ce..bf4bf888a 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 @@ -88,12 +88,8 @@ public interface IPlotMain extends ILogger { /** * Gets the NMS package prefix. - -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; * * @return The NMS package prefix - -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; */ String getNMSPackage(); From 1570c4d08a4b14bf6255be722cf048a0dcea6d46 Mon Sep 17 00:00:00 2001 From: Matt <4009945+MattBDev@users.noreply.github.com> Date: Wed, 6 Nov 2019 14:20:32 -0500 Subject: [PATCH 177/258] Add missing import --- .../intellectualsites/plotsquared/bukkit/util/BukkitUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a73872bee..b2ceb0e4b 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,9 +3,9 @@ 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.Location; 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; From 72c6f1165a363a2510d614045d14170571374348 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 7 Nov 2019 17:02:08 +0100 Subject: [PATCH 178/258] Fix okio --- Core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/build.gradle b/Core/build.gradle index 0329af1fe..865e18257 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -16,7 +16,7 @@ dependencies { testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") implementation("com.squareup.okhttp3:okhttp:3.12.0") - implementation("com.squareup.okio:okio:1.14.0") + implementation("com.squareup.okio:okio:2.2.2") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50") } From 834d78603740ceef74d2a23d424303c30f66cc40 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 7 Nov 2019 17:02:34 +0100 Subject: [PATCH 179/258] Fix okio --- Bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 10e61bb8d..4dd1d8f48 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -83,7 +83,7 @@ shadowJar { include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) include(dependency("com.squareup.okhttp3:okhttp:3.12.0")) - include(dependency("com.squareup.okio:okio:1.14.0")) + include(dependency("com.squareup.okio:okio:2.2.2")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) include(dependency("io.papermc:paperlib:1.0.2")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) From 07fcd53bf86bdec7810cdd7d9887c2b5d2a04123 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 8 Nov 2019 05:17:51 +0000 Subject: [PATCH 180/258] Fixes IntellectualSites/PlotSquaredSuggestions#58 --- .../plot/generator/ClassicPlotManager.java | 48 ++++++++----------- .../plotsquared/plot/object/BlockBucket.java | 8 +++- .../plotsquared/plot/object/PlotManager.java | 17 ++++++- 3 files changed, 41 insertions(+), 32 deletions(-) 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 b0ef7e138..640ee389c 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 @@ -51,7 +51,9 @@ public class ClassicPlotManager extends SquarePlotManager { @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING); - setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); + if (!classicPlotWorld.WALL_BLOCK.isAir() || !classicPlotWorld.WALL_BLOCK.equals(classicPlotWorld.CLAIMED_WALL_BLOCK)) { + setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); + } return GlobalBlockQueue.IMP.addEmptyTask(whenDone); } @@ -409,44 +411,29 @@ public class ClassicPlotManager extends SquarePlotManager { * @return false if part of the merge failed, otherwise true if successful. */ @Override public boolean finishPlotMerge(List plotIds) { - final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; - boolean success = true; - for (PlotId plotId : plotIds) { - success &= setWall(plotId, block); + final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + for (PlotId plotId : plotIds) { + setWall(plotId, claim); + } } if (Settings.General.MERGE_REPLACE_WALL) { final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING; for (PlotId id : plotIds) { - success &= setWallFilling(id, wallBlock); + setWallFilling(id, wallBlock); } } - return success; + return true; } @Override public boolean finishPlotUnlink(List plotIds) { - final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; - boolean success = true; - for (PlotId id : plotIds) { - success &= setWall(id, block); - } - return success; - } - - /** - * Sets all the blocks along all the plot walls to their correct state (claimed or unclaimed). - * - * @return true if the wall blocks were successfully set - */ - @Override public boolean regenerateAllPlotWalls() { - boolean success = true; - for (Plot plot : classicPlotWorld.getPlots()) { - if (plot.hasOwner()) { - success &= setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK); - } else { - success &= setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); + final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + for (PlotId id : plotIds) { + setWall(id, claim); } } - return success; + return true; // return false if unlink has been denied } @Override public boolean startPlotMerge(List plotIds) { @@ -459,7 +446,10 @@ public class ClassicPlotManager extends SquarePlotManager { @Override public boolean claimPlot(Plot plot) { final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - return setWall(plot.getId(), claim); + if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + return setWall(plot.getId(), claim); + } + return true; } @Override public String[] getPlotComponents(PlotId plotId) { 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 cc8e9cd72..43b519fc3 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 @@ -25,7 +25,7 @@ import java.util.Random; * A block bucket is a container of block types, where each block * has a specified chance of being randomly picked */ -@EqualsAndHashCode @SuppressWarnings({"unused", "WeakerAccess"}) public final class BlockBucket +@EqualsAndHashCode(of={"blocks"}) @SuppressWarnings({"unused", "WeakerAccess"}) public final class BlockBucket implements Iterable, ConfigurationSerializable { private final Random random = new Random(); @@ -194,6 +194,11 @@ import java.util.Random; return builder.toString(); } + public boolean isAir() { + compile(); + return blocks.isEmpty() || (single != null && single.getBlockType().getMaterial().isAir()); + } + @Override public Map serialize() { if (!isCompiled()) { compile(); @@ -201,7 +206,6 @@ import java.util.Random; return ImmutableMap.of("blocks", this.toString()); } - @Getter @EqualsAndHashCode @RequiredArgsConstructor private final static class Range { private final int min; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 0b39b2b7d..8f50f3504 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -90,6 +90,21 @@ public abstract class PlotManager { return 255; } - public abstract boolean regenerateAllPlotWalls(); + /** + * Sets all the blocks along all the plot walls to their correct state (claimed or unclaimed). + * + * @return true if the wall blocks were successfully set + */ + public boolean regenerateAllPlotWalls() { + boolean success = true; + for (Plot plot : plotArea.getPlots()) { + if (plot.hasOwner()) { + success &= claimPlot(plot); + } else { + success &= unClaimPlot(plot, null); + } + } + return success; + } } From ed588476e00f4627f94a1bedae18d74611f91023 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 8 Nov 2019 22:31:01 +0000 Subject: [PATCH 181/258] Fix single plot areas --- .../plotsquared/plot/object/PlotId.java | 10 +++++++++- .../plot/object/worlds/SinglePlot.java | 2 +- .../plot/object/worlds/SinglePlotArea.java | 17 ++++++++++++----- .../object/worlds/SinglePlotAreaManager.java | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 21e7dc777..a777a6b6f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -25,6 +25,14 @@ public class PlotId { this.y = y; } + public int getX() { + return x; + } + + public int getY() { + return y; + } + /** * Get a Plot Id based on a string * @@ -40,7 +48,7 @@ public class PlotId { } @Nullable public static PlotId fromStringOrNull(@NotNull String string) { - String[] parts = string.split("[;|,]"); + String[] parts = string.split("[;,.]"); if (parts.length < 2) { return null; } 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 a9a620daa..788e7a99a 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 @@ -44,7 +44,7 @@ public class SinglePlot extends Plot { } @Override public String getWorldName() { - return getId().toCommaSeparatedString(); + return getId().getX() + "." + getId().getY(); } @Override public SinglePlotArea getArea() { 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 1f5e70856..f04d340eb 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 @@ -47,7 +47,7 @@ public class SinglePlotArea extends GridPlotWorld { } public void loadWorld(final PlotId id) { - String worldName = id.toCommaSeparatedString(); + String worldName = id.getX() + "." + id.getY(); if (WorldUtil.IMP.isWorld(worldName)) { return; } @@ -59,12 +59,19 @@ public class SinglePlotArea extends GridPlotWorld { setup.step = new ConfigurationNode[0]; setup.world = worldName; + File container = PlotSquared.imp().getWorldContainer(); + File destination = new File(container, worldName); + + {// convert old + File oldFile = new File(container, id.toCommaSeparatedString()); + if (oldFile.exists()) { + oldFile.renameTo(destination); + } + } // Duplicate 0;0 if (setup.type != 0) { - File container = PlotSquared.imp().getWorldContainer(); - File destination = new File(container, worldName); if (!destination.exists()) { - File src = new File(container, "0,0"); + File src = new File(container, "0.0"); if (src.exists()) { if (!destination.exists()) { destination.mkdirs(); @@ -93,7 +100,7 @@ public class SinglePlotArea extends GridPlotWorld { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { - String worldName = id.toCommaSeparatedString(); + String worldName = id.getX() + "." + id.getY(); if (WorldUtil.IMP.isWorld(worldName)) { return; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java index 620a689b3..d35257b9b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java @@ -44,7 +44,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager { } case 1: if ((c <= '/') || (c >= ':')) { - if (c == ';' || c == ',') { + if (c == '.') { mode = 2; continue; } From 37280779b076c7a2ce4e783c5e2d2683b1d85d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 10 Nov 2019 12:06:33 +0100 Subject: [PATCH 182/258] Make `/plot setowner` require an argument. Fixes #2501. --- .../plotsquared/plot/commands/Owner.java | 28 ++++++++++--------- .../plotsquared/plot/config/Captions.java | 1 + 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 55dbdbda4..82ec9f652 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -20,6 +20,10 @@ import java.util.UUID; requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, String value) { + if (value == null || value.isEmpty()) { + Captions.SET_OWNER_MISSING_PLAYER.send(player); + return false; + } Set plots = plot.getConnectedPlots(); UUID uuid = null; String name = null; @@ -75,20 +79,18 @@ import java.util.UUID; final String finalName = name; final UUID finalUUID = uuid; final boolean removeDenied = plot.isDenied(finalUUID); - Runnable run = new Runnable() { - @Override public void run() { - if (plot.setOwner(finalUUID, player)) { - if (removeDenied) - plot.removeDenied(finalUUID); - plot.setSign(finalName); - MainUtil.sendMessage(player, Captions.SET_OWNER); - if (other != null) { - MainUtil.sendMessage(other, Captions.NOW_OWNER, - plot.getArea() + ";" + plot.getId()); - } - } else { - MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED); + Runnable run = () -> { + if (plot.setOwner(finalUUID, player)) { + if (removeDenied) + plot.removeDenied(finalUUID); + plot.setSign(finalName); + MainUtil.sendMessage(player, Captions.SET_OWNER); + if (other != null) { + MainUtil.sendMessage(other, Captions.NOW_OWNER, + plot.getArea() + ";" + plot.getId()); } + } else { + MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED); } }; if (hasConfirmation(player)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 68783e02e..16c9ac3d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -578,6 +578,7 @@ public enum Captions { // SET_OWNER("$4You successfully set the plot owner", "Owner"), SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"), + SET_OWNER_MISSING_PLAYER("$1You need to specify a new owner. Correct usage is: $2/plot setowner ", "Owner"), NOW_OWNER("$4You are now owner of plot %s", "Owner"), // // From a221d6fd07848b807dd82a3c7f3fe1a3a16ba063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 10 Nov 2019 12:10:38 +0100 Subject: [PATCH 183/258] Run tasks synchronously on Bukkit when the plugin is disabled. Previously, the tasks would fail to run, as the scheduler prevents disabled plugins from running tasks. This would cause problems on server shutdown, especially when the SQLManager attempts to perform database queries. This fixes #2446. --- .../plotsquared/bukkit/util/BukkitTaskManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java index 56448ff34..0d00f7741 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java @@ -24,8 +24,12 @@ public class BukkitTaskManager extends TaskManager { } @Override public void taskAsync(Runnable runnable) { - this.bukkitMain.getServer().getScheduler().runTaskAsynchronously(this.bukkitMain, runnable) - .getTaskId(); + if (this.bukkitMain.isEnabled()) { + this.bukkitMain.getServer().getScheduler() + .runTaskAsynchronously(this.bukkitMain, runnable).getTaskId(); + } else { + runnable.run(); + } } @Override public void task(Runnable runnable) { From c155c65a8fe58ab8dece2975b469fd505ab68c92 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 11:23:25 +0000 Subject: [PATCH 184/258] Remove modifier reflection Fixes #2484 --- .../intellectualsites/plotsquared/plot/config/Config.java | 6 +----- .../intellectualsites/plotsquared/plot/config/Settings.java | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) 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 7234743cf..f7bd5118e 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 @@ -365,12 +365,8 @@ public class Config { * @throws NoSuchFieldException * @throws IllegalAccessException */ - private static void setAccessible(Field field) - throws NoSuchFieldException, IllegalAccessException { + private static void setAccessible(Field field) { field.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); } /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index b1e239c78..8dd1be8a8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -16,10 +16,10 @@ public class Settings extends Config { @Comment("These first 7 aren't configurable") // This is a comment @Final // Indicates that this value isn't configurable - public static final String ISSUES = "https://github.com/IntellectualSites/PlotSquared/issues"; - @Final public static final String SUGGESTION = + public static String ISSUES = "https://github.com/IntellectualSites/PlotSquared/issues"; + @Final public static String SUGGESTION = "https://github.com/IntellectualSites/PlotSquaredSuggestions"; - @Final public static final String WIKI = + @Final public static String WIKI = "https://github.com/IntellectualSites/PlotSquared/wiki"; @Final public static String DATE; // These values are set from P2 before loading @Final public static String BUILD; // These values are set from P2 before loading From c5121894789f3ff9c3ef0fdfd298172e1c6d561d Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 11:31:47 +0000 Subject: [PATCH 185/258] fix import --- .../intellectualsites/plotsquared/bukkit/util/BukkitUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b2ceb0e4b..a73872bee 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,9 +3,9 @@ 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.Location; 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; From baca8808ee50fc38f23772223954db1c4a4e9b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 10 Nov 2019 13:26:15 +0100 Subject: [PATCH 186/258] Add missing Location import. --- .../intellectualsites/plotsquared/bukkit/util/BukkitUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b2ceb0e4b..a73872bee 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,9 +3,9 @@ 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.Location; 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; From 3e30e9554f0f19e86b3c184212ff29134cd1065f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 10 Nov 2019 13:26:59 +0100 Subject: [PATCH 187/258] Add missing RunnableVal import. --- .../intellectualsites/plotsquared/bukkit/util/BukkitUtil.java | 1 + 1 file changed, 1 insertion(+) 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 0e640db8c..026689c2d 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 @@ -6,6 +6,7 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; 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.RunnableVal; import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; From 729452038bd3701762d7880218616246ca6dc1a6 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 12:43:47 +0000 Subject: [PATCH 188/258] Check if integer --- .../plot/config/Configuration.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index d8e141069..a4fe5a8b5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -1,12 +1,16 @@ package com.github.intellectualsites.plotsquared.plot.config; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; import lombok.NonNull; +import java.util.Arrays; + /** * Main Configuration Utility */ @@ -64,15 +68,15 @@ public class Configuration { final BlockBucket blockBucket = new BlockBucket(); final String[] parts = string.split(","); for (final String part : parts) { - String block; + String block = part; int chance = -1; - if (part.contains(":")) { final String[] innerParts = part.split(":"); - if (innerParts.length > 1) { - chance = Integer.parseInt(innerParts[1]); + String chanceStr = innerParts[innerParts.length - 1]; + if (innerParts.length > 1 && MathMan.isInteger(chanceStr)) { + chance = Integer.parseInt(chanceStr); + block = StringMan.join(Arrays.copyOf(innerParts, innerParts.length - 1), ":"); } - block = innerParts[0]; } else { block = part; } @@ -97,16 +101,17 @@ public class Configuration { } final String[] parts = string.split(","); for (final String part : parts) { - String block; + String block = part; if (part.contains(":")) { final String[] innerParts = part.split(":"); - if (innerParts.length > 1) { - final int chance = Integer.parseInt(innerParts[1]); + String chanceStr = innerParts[innerParts.length - 1]; + if (innerParts.length > 1 && MathMan.isInteger(chanceStr)) { + final int chance = Integer.parseInt(chanceStr); if (chance < 1 || chance > 100) { return false; } + block = StringMan.join(Arrays.copyOf(innerParts, innerParts.length - 1), ":"); } - block = innerParts[0]; } else { block = part; } From 34eb7d05dcf52972b447b6d0cab1226a2ff7cabb Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 12:45:51 +0000 Subject: [PATCH 189/258] Print actual value for setup? --- .../intellectualsites/plotsquared/plot/commands/Setup.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 82190f1b2..eb7826ee5 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 @@ -276,8 +276,9 @@ import java.util.UUID; Captions.NOT_ALLOWED_BLOCK.send(player, e.getUnsafeBlock().toString()); } if (valid) { - sendMessage(player, Captions.SETUP_VALID_ARG, step.getConstant(), args[0]); step.setValue(args[0]); + Object value = step.getValue(); + sendMessage(player, Captions.SETUP_VALID_ARG, step.getConstant(), value); object.setup_index++; if (object.setup_index == object.step.length) { onCommand(player, args); From 8c1985f9c036edc123b3fc124216b40752dd37f0 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 13:08:34 +0000 Subject: [PATCH 190/258] Split by regex --- .../intellectualsites/plotsquared/plot/PlotSquared.java | 2 +- .../plotsquared/plot/config/Configuration.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 a08a8b1c2..fd57be3d8 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 @@ -1320,7 +1320,7 @@ import java.util.zip.ZipInputStream; .filter(validArgument -> args.toLowerCase(Locale.ENGLISH).contains(validArgument)) .count(); - String[] split = args.toLowerCase(Locale.ENGLISH).split(","); + String[] split = args.toLowerCase(Locale.ENGLISH).split(",(?![^\\(\\[]*[\\]\\)])"); if (split.length > expected) { // This means we have multi-block block buckets diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index a4fe5a8b5..dc143f1e4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -66,7 +66,7 @@ public class Configuration { return new BlockBucket(); } final BlockBucket blockBucket = new BlockBucket(); - final String[] parts = string.split(","); + final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); for (final String part : parts) { String block = part; int chance = -1; @@ -99,7 +99,7 @@ public class Configuration { if (string == null || string.isEmpty()) { return false; } - final String[] parts = string.split(","); + final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); for (final String part : parts) { String block = part; if (part.contains(":")) { From 7dcecf486dcde089751876ee0dadcd28916e64d3 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 13:18:15 +0000 Subject: [PATCH 191/258] Use regex for block bucket, yay --- .../plot/config/Configuration.java | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index dc143f1e4..ec2e1dd34 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -10,6 +10,8 @@ import lombok.Getter; import lombok.NonNull; import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Main Configuration Utility @@ -61,6 +63,9 @@ public class Configuration { public static final SettingValue BLOCK_BUCKET = new SettingValue("BLOCK_BUCKET") { + + private Pattern pattern = Pattern.compile("((?[A-Za-z_]+):)?(?([A-Za-z_]+(\\[?[\\S\\s]+\\])?))(:(?[0-9]{1,3}))?"); + @Override public BlockBucket parseString(final String string) { if (string == null || string.isEmpty()) { return new BlockBucket(); @@ -68,18 +73,12 @@ public class Configuration { final BlockBucket blockBucket = new BlockBucket(); final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); for (final String part : parts) { - String block = part; - int chance = -1; - if (part.contains(":")) { - final String[] innerParts = part.split(":"); - String chanceStr = innerParts[innerParts.length - 1]; - if (innerParts.length > 1 && MathMan.isInteger(chanceStr)) { - chance = Integer.parseInt(chanceStr); - block = StringMan.join(Arrays.copyOf(innerParts, innerParts.length - 1), ":"); - } - } else { - block = part; - } + Matcher matcher = pattern.matcher(part); + String namespace = matcher.group("namespace"); + String block = matcher.group("block"); + String chanceStr = matcher.group("chance"); + if (namespace == null) namespace = "minecraft"; + int chance = chanceStr == null ? -1 : Integer.parseInt(chanceStr); final StringComparison.ComparisonResult value = WorldUtil.IMP.getClosestBlock(block); if (value == null) { @@ -101,19 +100,15 @@ public class Configuration { } final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); for (final String part : parts) { - String block = part; - if (part.contains(":")) { - final String[] innerParts = part.split(":"); - String chanceStr = innerParts[innerParts.length - 1]; - if (innerParts.length > 1 && MathMan.isInteger(chanceStr)) { - final int chance = Integer.parseInt(chanceStr); - if (chance < 1 || chance > 100) { - return false; - } - block = StringMan.join(Arrays.copyOf(innerParts, innerParts.length - 1), ":"); - } - } else { - block = part; + Matcher matcher = pattern.matcher(part); + String namespace = matcher.group("namespace"); + String block = matcher.group("block"); + String chanceStr = matcher.group("chance"); + if (namespace == null) namespace = "minecraft"; + int chance = chanceStr == null ? -1 : Integer.parseInt(chanceStr); + + if ((chance != -1 && (chance < 1 || chance > 100)) || block == null) { + return false; } StringComparison.ComparisonResult value = WorldUtil.IMP.getClosestBlock(block); From f1b8510708bf86260f9ae9eff9e630c3c8c2d9a5 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 13:24:04 +0000 Subject: [PATCH 192/258] forgot to find --- .../plotsquared/plot/config/Configuration.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index ec2e1dd34..94188b35b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -74,6 +74,7 @@ public class Configuration { final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); for (final String part : parts) { Matcher matcher = pattern.matcher(part); + matcher.find(); String namespace = matcher.group("namespace"); String block = matcher.group("block"); String chanceStr = matcher.group("chance"); @@ -101,6 +102,7 @@ public class Configuration { final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); for (final String part : parts) { Matcher matcher = pattern.matcher(part); + matcher.find(); String namespace = matcher.group("namespace"); String block = matcher.group("block"); String chanceStr = matcher.group("chance"); From 93894aca963473936b63812e16e8ee6d6aad1ba1 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 13:27:37 +0000 Subject: [PATCH 193/258] Force lowercase --- .../intellectualsites/plotsquared/plot/util/world/BlockUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java index 6ea6d1c6c..7f57e80c2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java @@ -41,6 +41,7 @@ public final class BlockUtil { if (id.length() == 1 && id.charAt(0) == '*') { return FuzzyBlockState.builder().type(BlockTypes.AIR).build(); } + id = id.toLowerCase(); BlockType type = BlockType.REGISTRY.get(id); if (type != null) { return type.getDefaultState(); From fe438fd62afb936e398e3ecebacac6f38a257c94 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 13:29:58 +0000 Subject: [PATCH 194/258] swallow stacktrace --- .../intellectualsites/plotsquared/plot/util/world/BlockUtil.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java index 7f57e80c2..14ff2652c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java @@ -62,7 +62,6 @@ public final class BlockUtil { BaseBlock block = PARSER.parseFromInput(id, PARSER_CONTEXT); return block.toImmutableState(); } catch (InputParseException e) { - e.printStackTrace(); return null; } } From 1d9ad9482264d263782c62d61f8a09a414bdaa40 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 14:01:12 +0000 Subject: [PATCH 195/258] Fix plot getRegions off by 1 --- .../plotsquared/plot/object/Plot.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 33e482428..67fe23387 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 @@ -879,10 +879,10 @@ public class Plot { @Override public void run() { if (queue.isEmpty()) { Runnable run = () -> { -// for (CuboidRegion region : regions) { -// Location[] corners = MainUtil.getCorners(getWorldName(), region); -// ChunkManager.manager.clearAllEntities(corners[0], corners[1]); -// } + for (CuboidRegion region : regions) { + Location[] corners = MainUtil.getCorners(getWorldName(), region); + ChunkManager.manager.clearAllEntities(corners[0], corners[1]); + } TaskManager.runTask(whenDone); }; for (Plot current : plots) { @@ -2710,7 +2710,7 @@ public class Plot { BlockVector3 pos2 = BlockVector3.at(toploc.getX(), Plot.MAX_HEIGHT - 1, topabs.getZ()); regions.add(new CuboidRegion(pos1, pos2)); if (plot.getMerged(Direction.SOUTHEAST)) { - pos1 = BlockVector3.at(topabs.getX() + 1, 0, topabs.getZ()); + pos1 = BlockVector3.at(topabs.getX() + 1, 0, topabs.getZ() + 1); pos2 = BlockVector3.at(toploc.getX(), Plot.MAX_HEIGHT - 1, toploc.getZ()); regions.add( new CuboidRegion(pos1, pos2)); From d254633b77cf9cb04b87cdf35579d43fefd33606 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 17:47:37 +0000 Subject: [PATCH 196/258] Use patterns instead of BlockBucket Still use BlockBucket for loading/saving from config --- .../plotsquared/bukkit/BukkitMain.java | 2 - .../generator/DelegatePlotGenerator.java | 30 +- .../bukkit/object/BukkitPlayer.java | 1 - .../bukkit/util/BukkitChunkManager.java | 8 +- .../bukkit/util/BukkitHybridUtils.java | 313 ------------------ .../bukkit/util/BukkitSchematicHandler.java | 1 - .../bukkit/util/BukkitTaskManager.java | 2 - .../plotsquared/bukkit/util/BukkitUtil.java | 28 +- .../bukkit/util/block/BukkitLocalQueue.java | 7 +- .../bukkit/util/block/GenChunk.java | 21 +- .../plotsquared/api/PlotAPI.java | 1 - .../plotsquared/plot/PlotSquared.java | 2 +- .../plotsquared/plot/commands/Area.java | 12 +- .../plotsquared/plot/commands/Biome.java | 32 +- .../plotsquared/plot/commands/Info.java | 2 +- .../plotsquared/plot/commands/Set.java | 52 +-- .../plotsquared/plot/commands/Trim.java | 4 +- .../plotsquared/plot/config/Config.java | 1 - .../plot/config/Configuration.java | 16 +- .../plot/generator/AugmentedUtils.java | 9 +- .../plot/generator/ClassicPlotManager.java | 68 ++-- .../plot/generator/ClassicPlotWorld.java | 28 +- .../plotsquared/plot/generator/HybridGen.java | 54 +-- .../plot/generator/HybridPlotManager.java | 11 +- .../plot/generator/HybridUtils.java | 195 ++++++++++- .../generator/IndependentPlotGenerator.java | 9 - .../plot/generator/SquarePlotManager.java | 3 +- .../plot/listener/PlotListener.java | 2 +- .../plot/listener/ProcessedWEExtent.java | 3 +- .../plotsquared/plot/listener/WEExtent.java | 3 +- .../plot/listener/WESubscriber.java | 3 +- .../plotsquared/plot/object/BlockBucket.java | 37 ++- .../plot/object/ConsolePlayer.java | 1 - .../plotsquared/plot/object/Plot.java | 19 +- .../plotsquared/plot/object/PlotArea.java | 22 +- .../plotsquared/plot/object/PlotManager.java | 3 +- .../object/worlds/DefaultPlotAreaManager.java | 2 +- .../plot/object/worlds/SinglePlot.java | 1 - .../object/worlds/SinglePlotAreaManager.java | 2 +- .../plot/object/worlds/SinglePlotManager.java | 4 +- .../object/worlds/SingleWorldGenerator.java | 59 +--- .../plotsquared/plot/util/ChunkManager.java | 2 +- .../plotsquared/plot/util/MainUtil.java | 21 +- .../plot/util/SchematicHandler.java | 2 +- .../plotsquared/plot/util/WorldUtil.java | 11 +- .../plot/util/block/BasicLocalBlockQueue.java | 23 +- .../plot/util/block/ChunkBlockQueue.java | 95 ++++++ .../util/block/DelegateLocalBlockQueue.java | 8 +- .../plot/util/block/LocalBlockQueue.java | 14 +- .../util/block/OffsetLocalBlockQueue.java | 3 +- .../util/block/ScopedLocalBlockQueue.java | 5 +- .../plot/util/world/OperationUtil.java | 3 - .../plot/util/world/PatternUtil.java | 66 ++++ 53 files changed, 618 insertions(+), 708 deletions(-) create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ChunkBlockQueue.java create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.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 7d4c8bf4b..8474d5c8a 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 @@ -65,8 +65,6 @@ 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 com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.BukkitCommandSender; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.extension.platform.Actor; import io.papermc.lib.PaperLib; 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 aab23d804..ed4df3714 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 @@ -2,15 +2,13 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -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.PlotId; import com.github.intellectualsites.plotsquared.plot.util.MathMan; -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; +import com.sk89q.worldedit.bukkit.BukkitAdapter; import lombok.RequiredArgsConstructor; import org.bukkit.World; import org.bukkit.block.Biome; @@ -37,30 +35,6 @@ import java.util.Random; return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max); } - @Override public BlockBucket[][] generateBlockBucketChunk(PlotArea settings) { - BlockBucket[][] blockBuckets = new BlockBucket[16][]; - HybridPlotWorld hpw = (HybridPlotWorld) settings; - // Bedrock - if (hpw.PLOT_BEDROCK) { - for (short x = 0; x < 16; x++) { - for (short z = 0; z < 16; z++) { - blockBuckets[0][(z << 4) | x] = - BlockBucket.withSingle(BlockUtil.get("bedrock")); - } - } - } - for (short x = 0; x < 16; x++) { - for (short z = 0; z < 16; z++) { - for (int y = 1; y < hpw.PLOT_HEIGHT; y++) { - blockBuckets[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = hpw.MAIN_BLOCK; - } - blockBuckets[hpw.PLOT_HEIGHT >> 4][((hpw.PLOT_HEIGHT & 0xF) << 8) | (z << 4) | x] = - hpw.MAIN_BLOCK; - } - } - return blockBuckets; - } - @Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) { World world = BukkitUtil.getWorld(this.world); Location min = result.getMin(); @@ -71,7 +45,7 @@ import java.util.Random; ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() { @Override public void setBiome(@Range(from = 0, to = 15) int x, @Range(from = 0, to = 15) int z, Biome biome) { - result.setBiome(x, z, biome.name()); + result.setBiome(x, z, BukkitAdapter.adapt(biome)); } @Override @NotNull public Biome getBiome(int x, int z) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 9ca1bbbae..f09ecb968 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -12,7 +12,6 @@ import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.world.item.ItemType; import io.papermc.lib.PaperLib; 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 44bad9589..0209058c5 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 @@ -9,19 +9,19 @@ 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.PlotLoc; -import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; -import com.sk89q.worldedit.regions.CuboidRegion; 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.world.BlockUtil; 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.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockTypes; import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -370,7 +370,7 @@ public class BukkitChunkManager extends ChunkManager { if (id != null) { value.setBlock(x1, y, z1, id); } else { - value.setBlock(x1, y, z1, BlockUtil.get("air")); + value.setBlock(x1, y, z1, BlockTypes.AIR.getDefaultState()); } } for (int y = Math.min(128, ids.length); 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 95f4b2ebc..c13a656f8 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 @@ -1,321 +1,8 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; -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.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.sk89q.worldedit.regions.CuboidRegion; -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; -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.expiry.PlotAnalysis; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.data.BlockData; -import org.bukkit.block.data.Directional; -import org.bukkit.generator.ChunkGenerator; - -import java.util.HashSet; -import java.util.Set; public class BukkitHybridUtils extends HybridUtils { - @Override public void analyzeRegion(final String world, final CuboidRegion region, - final RunnableVal whenDone) { - // int diff, int variety, int vertices, int rotation, int height_sd - /* - * diff: compare to base by looping through all blocks - * variety: add to HashSet for each BlockState - * height_sd: loop over all blocks and get top block - * - * vertices: store air map and compare with neighbours - * for each block check the adjacent - * - Store all blocks then go through in second loop - * - recheck each block - * - */ - TaskManager.runTaskAsync(() -> { - final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); - final World worldObj = Bukkit.getWorld(world); - final ChunkGenerator chunkGenerator = worldObj.getGenerator(); - if (!(chunkGenerator instanceof BukkitPlotGenerator)) { - return; - } - final Location bot = new Location(world, region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); - final Location top = new Location(world, region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); - - final int bx = bot.getX(); - final int bz = bot.getZ(); - final int tx = top.getX(); - final int tz = top.getZ(); - final int cbx = bx >> 4; - final int cbz = bz >> 4; - final int ctx = tx >> 4; - final int ctz = tz >> 4; - MainUtil.initCache(); - final int width = tx - bx + 1; - final int length = tz - bz + 1; - - System.gc(); - System.gc(); - final BlockBucket[][][] oldBlocks = new BlockBucket[256][width][length]; - final BlockState[][][] newBlocks = new BlockState[256][width][length]; - final BlockBucket airBucket = BlockBucket.withSingle(BlockTypes.AIR.getDefaultState()); - - PlotArea area = PlotSquared.get().getPlotArea(world, null); - - if (!(area instanceof HybridPlotWorld)) { - return; - } - - HybridPlotWorld hpw = (HybridPlotWorld) area; - final BlockBucket[][] result = hpw.getBlockBucketChunk(); - - if (result == null) { - return; - } - - if (hpw.PLOT_SCHEMATIC) { - short[] rx = new short[16]; - short[] rz = new short[16]; - short rbx; - short rbz; - if (bx < 0) { - rbx = (short) (hpw.SIZE + (bx % hpw.SIZE)); - } else { - rbx = (short) (bx % hpw.SIZE); - } - if (bz < 0) { - rbz = (short) (hpw.SIZE + (bz % hpw.SIZE)); - } else { - rbz = (short) (bz % hpw.SIZE); - } - for (short i = 0; i < 16; i++) { - short v = (short) (rbx + i); - if (v >= hpw.SIZE) { - v -= hpw.SIZE; - } - rx[i] = v; - } - for (short i = 0; i < 16; i++) { - short v = (short) (rbz + i); - if (v >= hpw.SIZE) { - v -= hpw.SIZE; - } - rz[i] = v; - } - int minY; - if (Settings.Schematics.PASTE_ON_TOP) { - minY = hpw.SCHEM_Y; - } else { - minY = 1; - } - for (short x = 0; x < 16; x++) { - for (short z = 0; z < 16; z++) { - BaseBlock[] blocks = hpw.G_SCH.get(MathMan.pair(rx[x], rz[z])); - for (int y = 0; y < blocks.length; y++) { - if (blocks[y] != null) { - result[(minY + y) >> 4][(((minY + y) & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(blocks[y].toImmutableState()); - } - } - } - } - } - - final Runnable run = () -> ChunkManager.chunkTask(bot, top, new RunnableVal() { - @Override public void run(int[] value) { - // [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] - int X = value[0]; - int Z = value[1]; - int xb = (X << 4) - bx; - int zb = (Z << 4) - bz; - for (int i = 0; i < result.length; i++) { - if (result[i] == null) { - for (int j = 0; j < 4096; j++) { - int x = MainUtil.x_loc[i][j] + xb; - if (x < 0 || x >= width) { - continue; - } - int z = MainUtil.z_loc[i][j] + zb; - if (z < 0 || z >= length) { - continue; - } - int y = MainUtil.y_loc[i][j]; - oldBlocks[y][x][z] = airBucket; - } - continue; - } - for (int j = 0; j < result[i].length; j++) { - int x = MainUtil.x_loc[i][j] + xb; - if (x < 0 || x >= width) { - continue; - } - int z = MainUtil.z_loc[i][j] + zb; - if (z < 0 || z >= length) { - continue; - } - int y = MainUtil.y_loc[i][j]; - oldBlocks[y][x][z] = result[i][j] != null ? result[i][j] : airBucket; - } - } - - } - }, () -> TaskManager.runTaskAsync(() -> { - int size = width * length; - int[] changes = new int[size]; - int[] faces = new int[size]; - int[] data = new int[size]; - int[] air = new int[size]; - int[] variety = new int[size]; - int i = 0; - for (int x = 0; x < width; x++) { - for (int z = 0; z < length; z++) { - Set types = new HashSet<>(); - for (int y = 0; y < 256; y++) { - BlockBucket old = oldBlocks[y][x][z]; - try { - if (old == null) { - old = airBucket; - } - BlockState now = newBlocks[y][x][z]; - if (!old.getBlocks().contains(now)) { - changes[i]++; - } - if (now.getBlockType().getMaterial().isAir()) { - air[i]++; - } else { - // check vertices - // modifications_adjacent - if (x > 0 && z > 0 && y > 0 && x < width - 1 && z < length - 1 - && y < 255) { - if (newBlocks[y - 1][x][z].getBlockType().getMaterial().isAir()) { - faces[i]++; - } - if (newBlocks[y][x - 1][z].getBlockType().getMaterial().isAir()) { - faces[i]++; - } - if (newBlocks[y][x][z - 1].getBlockType().getMaterial().isAir()) { - faces[i]++; - } - if (newBlocks[y + 1][x][z].getBlockType().getMaterial().isAir()) { - faces[i]++; - } - if (newBlocks[y][x + 1][z].getBlockType().getMaterial().isAir()) { - faces[i]++; - } - if (newBlocks[y][x][z + 1].getBlockType().getMaterial().isAir()) { - faces[i]++; - } - } - - Material material = BukkitAdapter.adapt(now.getBlockType()); - if (material != null) { - BlockData blockData = material.createBlockData(); - if (blockData instanceof Directional) { - data[i] += 8; - } else if (!blockData.getClass().equals(BlockData.class)) { - data[i]++; - } - } - types.add(now.getBlockType()); - } - } catch (NullPointerException e) { - e.printStackTrace(); - } - } - variety[i] = types.size(); - i++; - } - } - // analyze plot - // put in analysis obj - - // run whenDone - PlotAnalysis analysis = new PlotAnalysis(); - analysis.changes = (int) (MathMan.getMean(changes) * 100); - analysis.faces = (int) (MathMan.getMean(faces) * 100); - analysis.data = (int) (MathMan.getMean(data) * 100); - analysis.air = (int) (MathMan.getMean(air) * 100); - analysis.variety = (int) (MathMan.getMean(variety) * 100); - - analysis.changes_sd = (int) (MathMan.getSD(changes, analysis.changes) * 100); - analysis.faces_sd = (int) (MathMan.getSD(faces, analysis.faces) * 100); - analysis.data_sd = (int) (MathMan.getSD(data, analysis.data) * 100); - analysis.air_sd = (int) (MathMan.getSD(air, analysis.air) * 100); - analysis.variety_sd = (int) (MathMan.getSD(variety, analysis.variety) * 100); - System.gc(); - System.gc(); - whenDone.value = analysis; - whenDone.run(); - }), 5); - System.gc(); - MainUtil.initCache(); - ChunkManager.chunkTask(bot, top, new RunnableVal() { - @Override public void run(int[] value) { - int X = value[0]; - int Z = value[1]; - worldObj.loadChunk(X, Z); - int minX; - if (X == cbx) { - minX = bx & 15; - } else { - minX = 0; - } - int minZ; - if (Z == cbz) { - minZ = bz & 15; - } else { - minZ = 0; - } - int maxX; - if (X == ctx) { - maxX = tx & 15; - } else { - maxX = 16; - } - int maxZ; - if (Z == ctz) { - maxZ = tz & 15; - } else { - maxZ = 16; - } - - int cbx = X << 4; - int cbz = Z << 4; - - int xb = cbx - bx; - int zb = cbz - bz; - for (int x = minX; x <= maxX; x++) { - int xx = cbx + x; - for (int z = minZ; z <= maxZ; z++) { - int zz = cbz + z; - for (int y = 0; y < 256; y++) { - BlockState block = queue.getBlock(xx, y, zz); - int xr = xb + x; - int zr = zb + z; - newBlocks[y][xr][zr] = block; - } - } - } - worldObj.unloadChunkRequest(X, Z); - } - }, () -> TaskManager.runTaskAsync(run), 5); - }); - } } 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 ed0a8cfcc..4139d2191 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 @@ -2,7 +2,6 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java index dcb562166..0989ccf1a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java @@ -3,8 +3,6 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import org.bukkit.Bukkit; -import org.bukkit.scheduler.BukkitTask; -import org.jetbrains.annotations.NotNull; public class BukkitTaskManager extends TaskManager { 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 026689c2d..b4e74b74d 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 @@ -7,7 +7,6 @@ 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.RunnableVal; -import com.sk89q.worldedit.regions.CuboidRegion; 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; @@ -18,6 +17,8 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockState; import lombok.NonNull; import org.bukkit.Bukkit; @@ -39,7 +40,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -279,8 +279,8 @@ import java.util.Set; return getWorld(worldName) != null; } - @Override public String getBiome(String world, int x, int z) { - return getWorld(world).getBiome(x, z).name(); + @Override public BiomeType getBiome(String world, int x, int z) { + return BukkitAdapter.adapt(getWorld(world).getBiome(x, z)); } @Override public int getHighestBlock(@NonNull final String world, final int x, final int z) { @@ -380,20 +380,6 @@ import java.util.Set; } } - @Override public int getBiomeFromString(@NonNull final String biomeString) { - try { - final Biome biome = Biome.valueOf(biomeString.toUpperCase()); - return Arrays.asList(Biome.values()).indexOf(biome); - } catch (IllegalArgumentException ignored) { - return -1; - } - } - - @Override public String[] getBiomeList() { - final Biome[] biomes = Biome.values(); - return Arrays.stream(biomes).map(Enum::name).toArray(String[]::new); - } - @Override public boolean addItems(@NonNull final String worldName, @NonNull final PlotItem items) { final World world = getWorld(worldName); @@ -433,9 +419,9 @@ import java.util.Set; @Override public void setBiomes(@NonNull final String worldName, @NonNull final CuboidRegion region, - @NonNull final String biomeString) { + @NonNull final BiomeType biomeType) { final World world = getWorld(worldName); - final Biome biome = Biome.valueOf(biomeString.toUpperCase()); + final Biome biome = BukkitAdapter.adapt(biomeType); for (int x = region.getMinimumPoint().getX(); x <= region.getMaximumPoint().getX(); x++) { for (int z = region.getMinimumPoint().getZ(); z <= region.getMaximumPoint().getZ(); z++) { world.setBiome(x, z, biome); @@ -450,7 +436,7 @@ import java.util.Set; @Override public BlockState getBlock(@NonNull final Location location) { final World world = getWorld(location.getWorld()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); - return BlockUtil.get(block.getType().name()); + return BukkitAdapter.asBlockType(block.getType()).getDefaultState(); } @Override public String getMainWorld() { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 9f5dc4e7f..82f5c4282 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -8,6 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQ import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import io.papermc.lib.PaperLib; @@ -130,11 +131,11 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { int bx = lc.getX() << 4; int bz = lc.getX() << 4; for (int x = 0; x < lc.biomes.length; x++) { - String[] biomes2 = lc.biomes[x]; + BiomeType[] biomes2 = lc.biomes[x]; if (biomes2 != null) { - for (String biomeStr : biomes2) { + for (BiomeType biomeStr : biomes2) { if (biomeStr != null) { - Biome biome = Biome.valueOf(biomeStr.toUpperCase()); + Biome biome = BukkitAdapter.adapt(biomeStr); worldObj.setBiome(bx, bz, biome); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index a93c22679..72c570df5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -5,11 +5,14 @@ import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; +import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil; import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; import lombok.Getter; import lombok.Setter; import org.bukkit.Chunk; @@ -57,11 +60,11 @@ public class GenChunk extends ScopedLocalBlockQueue { chunkZ = wrap.z; } - @Override public void fillBiome(String biomeName) { + @Override public void fillBiome(BiomeType biomeType) { if (biomeGrid == null) { return; } - Biome biome = Biome.valueOf(biomeName.toUpperCase()); + Biome biome = BukkitAdapter.adapt(biomeType); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { this.biomeGrid.setBiome(x, z, biome); @@ -92,8 +95,8 @@ public class GenChunk extends ScopedLocalBlockQueue { chunkData.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, BukkitAdapter.adapt(block)); } - @Override public boolean setBiome(int x, int z, String biome) { - return setBiome(x, z, Biome.valueOf(biome.toUpperCase())); + @Override public boolean setBiome(int x, int z, BiomeType biomeType) { + return setBiome(x, z, BukkitAdapter.adapt(biomeType)); } public boolean setBiome(int x, int z, Biome biome) { @@ -104,6 +107,10 @@ public class GenChunk extends ScopedLocalBlockQueue { return false; } + @Override public boolean setBlock(int x, int y, int z, Pattern pattern) { + return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z)); + } + @Override public boolean setBlock(int x, int y, int z, BlockState id) { if (this.result == null) { this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); @@ -130,7 +137,7 @@ public class GenChunk extends ScopedLocalBlockQueue { return true; } this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); - this.storeCache(x, y, z, BlockUtil.get(id.getBlockType().getId())); + this.storeCache(x, y, z, id.toImmutableState()); return true; } @@ -141,7 +148,7 @@ public class GenChunk extends ScopedLocalBlockQueue { } BlockState[] array = result[i]; if (array == null) { - return BlockUtil.get(""); + return BlockTypes.AIR.getDefaultState(); } int j = MainUtil.CACHE_J[y][x][z]; return array[j]; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java index 740db8fca..610362953 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java @@ -14,7 +14,6 @@ import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; -import com.sk89q.worldedit.extension.platform.Actor; import lombok.NoArgsConstructor; import java.util.Collections; 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 fd57be3d8..86b8c7a92 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 @@ -29,7 +29,6 @@ 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.sk89q.worldedit.regions.CuboidRegion; 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; @@ -56,6 +55,7 @@ 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; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.regions.CuboidRegion; import lombok.Getter; import lombok.NonNull; import lombok.Setter; 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 f773c1e1c..11134d2ca 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 @@ -12,8 +12,6 @@ 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.util.world.RegionUtil; -import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.object.SetupObject; @@ -25,7 +23,9 @@ 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.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.regions.CuboidRegion; import java.io.IOException; import java.util.ArrayList; @@ -209,20 +209,20 @@ import java.util.Set; break; case "f": case "floor": - pa.TOP_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]); + pa.TOP_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]).getPattern(); break; case "m": case "main": - pa.MAIN_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]); + pa.MAIN_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]).getPattern(); break; case "w": case "wall": pa.WALL_FILLING = - Configuration.BLOCK_BUCKET.parseString(pair[1]); + Configuration.BLOCK_BUCKET.parseString(pair[1]).getPattern(); break; case "b": case "border": - pa.WALL_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]); + pa.WALL_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]).getPattern(); break; case "terrain": pa.TERRAIN = Integer.parseInt(pair[1]); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java index 8b9ecb790..d377acd15 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java @@ -6,7 +6,8 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.StringMan; -import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; @CommandDeclaration(command = "setbiome", permission = "plots.set.biome", description = "Set the plot biome", usage = "/plot biome [biome]", @@ -14,25 +15,26 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; requiredType = RequiredType.NONE) public class Biome extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, final String value) { - int biome = WorldUtil.IMP.getBiomeFromString(value); - if (biome == -1) { + try { + BiomeType biome = BiomeTypes.get(value); + if (plot.getRunning() > 0) { + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); + return false; + } + plot.addRunning(); + plot.setBiome(biome, () -> { + plot.removeRunning(); + MainUtil + .sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase()); + }); + return true; + } catch (IllegalStateException ignore) { String biomes = StringMan - .join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATOR.getTranslated()); + .join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated()); Captions.NEED_BIOME.send(player); MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes); return false; } - if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); - return false; - } - plot.addRunning(); - plot.setBiome(value.toUpperCase(), () -> { - plot.removeRunning(); - MainUtil - .sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase()); - }); - return true; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java index fe42e5dd4..b4e46daea 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java @@ -102,7 +102,7 @@ public class Info extends SubCommand { inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info", "&cID: &6" + plot.getId().toString(), "&cOwner: &6" + name, "&cAlias: &6" + plot.getAlias(), - "&cBiome: &6" + plot.getBiome().replaceAll("_", "").toLowerCase(), + "&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + plot.isAdded(uuid), "&cSeen: &6" + MainUtil.secToTime((int) (ExpireManager.IMP.getAge(plot) / 1000)), "&cIs Denied: &6" + plot.isDenied(uuid))); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 771063217..8106b81b9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -3,22 +3,18 @@ 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.config.Configuration; -import com.github.intellectualsites.plotsquared.plot.config.Configuration.UnknownBlockException; 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.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; 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.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.StringMan; -import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; -import com.sk89q.worldedit.world.block.BlockState; +import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil; +import com.sk89q.worldedit.function.pattern.Pattern; import java.util.ArrayList; import java.util.Arrays; @@ -60,51 +56,19 @@ import java.util.stream.IntStream; Captions.PERMISSION_SET_COMPONENT.f(component)); return false; } - // BlockState[] blocks; - BlockBucket bucket; - try { - if (args.length < 2) { - MainUtil.sendMessage(player, Captions.NEED_BLOCK); - return true; - } - - try { - bucket = Configuration.BLOCK_BUCKET.parseString(material); - } catch (final UnknownBlockException unknownBlockException) { - final String unknownBlock = unknownBlockException.getUnknownValue(); - Captions.NOT_VALID_BLOCK.send(player, unknownBlock); - StringComparison.ComparisonResult match = - WorldUtil.IMP.getClosestBlock(unknownBlock); - if (match != null) { - final String found = - WorldUtil.IMP.getClosestMatchingName(match.best); - if (found != null) { - MainUtil.sendMessage(player, Captions.DID_YOU_MEAN, - found.toLowerCase()); - } - } - return false; - } - - if (!allowUnsafe) { - for (final BlockState block : bucket.getBlocks()) { - if (!block.getBlockType().getMaterial().isAir() && !WorldUtil.IMP.isBlockSolid(block)) { - Captions.NOT_ALLOWED_BLOCK.send(player, block.toString()); - return false; - } - } - } - } catch (Exception ignored) { - MainUtil.sendMessage(player, Captions.NOT_VALID_BLOCK, material); - return false; + if (args.length < 2) { + MainUtil.sendMessage(player, Captions.NEED_BLOCK); + return true; } + + Pattern pattern = PatternUtil.parse(player, material); if (plot.getRunning() > 0) { MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return false; } plot.addRunning(); for (Plot current : plot.getConnectedPlots()) { - current.setComponent(component, bucket); + current.setComponent(component, pattern); } MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); GlobalBlockQueue.IMP.addEmptyTask(plot::removeRunning); 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 66a024ec4..fcdce4898 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 @@ -6,8 +6,6 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; 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.util.world.RegionUtil; -import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; @@ -17,7 +15,9 @@ 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.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.regions.CuboidRegion; import java.io.File; import java.io.IOException; 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 f7bd5118e..26c5050ce 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 @@ -13,7 +13,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index 94188b35b..a1aedc478 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -1,15 +1,14 @@ package com.github.intellectualsites.plotsquared.plot.config; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; -import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; import lombok.NonNull; -import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -43,21 +42,20 @@ public class Configuration { return Boolean.parseBoolean(string); } }; - public static final SettingValue BIOME = new SettingValue("BIOME") { + public static final SettingValue BIOME = new SettingValue("BIOME") { @Override public boolean validateValue(String string) { try { - int biome = WorldUtil.IMP.getBiomeFromString(string.toUpperCase()); - return biome != -1; + return BiomeTypes.get(string) != null; } catch (Exception ignored) { return false; } } - @Override public String parseString(String string) { + @Override public BiomeType parseString(String string) { if (validateValue(string)) { - return string.toUpperCase(); + return BiomeTypes.get(string.toUpperCase()); } - return "FOREST"; + return BiomeTypes.FOREST; } }; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index f5aa2e440..f1bf833b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -4,12 +4,13 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; -import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; -import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue; 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.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import org.jetbrains.annotations.NotNull; @@ -72,7 +73,7 @@ public class AugmentedUtils { return false; } - @Override public boolean setBiome(int x, int z, String biome) { + @Override public boolean setBiome(int x, int z, BiomeType biome) { if (area.contains(x, z)) { return super.setBiome(x, z, biome); } @@ -116,7 +117,7 @@ public class AugmentedUtils { return false; } - @Override public boolean setBiome(int x, int y, String biome) { + @Override public boolean setBiome(int x, int y, BiomeType biome) { return super.setBiome(x, y, biome); } }; 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 640ee389c..a06fbceca 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,19 +1,21 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.config.Settings; -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.PlotId; -import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.MathMan; -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; 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.world.BlockUtil; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.regions.CuboidRegion; import java.util.List; +import static com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil.isAir; + /** * A plot manager with square plots which tessellate on a square grid with the following sections: ROAD, WALL, BORDER (wall), PLOT, FLOOR (plot). */ @@ -27,7 +29,7 @@ public class ClassicPlotManager extends SquarePlotManager { } @Override public boolean setComponent(PlotId plotId, String component, - BlockBucket blocks) { + Pattern blocks) { switch (component) { case "floor": return setFloor(plotId, blocks); @@ -51,13 +53,13 @@ public class ClassicPlotManager extends SquarePlotManager { @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING); - if (!classicPlotWorld.WALL_BLOCK.isAir() || !classicPlotWorld.WALL_BLOCK.equals(classicPlotWorld.CLAIMED_WALL_BLOCK)) { + if (!isAir(classicPlotWorld.WALL_BLOCK) || !classicPlotWorld.WALL_BLOCK.equals(classicPlotWorld.CLAIMED_WALL_BLOCK)) { setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); } return GlobalBlockQueue.IMP.addEmptyTask(whenDone); } - public boolean setFloor(PlotId plotId, BlockBucket blocks) { + public boolean setFloor(PlotId plotId, Pattern blocks) { Plot plot = classicPlotWorld.getPlotAbs(plotId); LocalBlockQueue queue = classicPlotWorld.getQueue(false); if (plot.isBasePlot()) { @@ -72,7 +74,7 @@ public class ClassicPlotManager extends SquarePlotManager { return queue.enqueue(); } - public boolean setAll(PlotId plotId, BlockBucket blocks) { + public boolean setAll(PlotId plotId, Pattern blocks) { Plot plot = classicPlotWorld.getPlotAbs(plotId); if (!plot.isBasePlot()) { return false; @@ -87,7 +89,7 @@ public class ClassicPlotManager extends SquarePlotManager { return queue.enqueue(); } - public boolean setAir(PlotId plotId, BlockBucket blocks) { + public boolean setAir(PlotId plotId, Pattern blocks) { Plot plot = classicPlotWorld.getPlotAbs(plotId); if (!plot.isBasePlot()) { return false; @@ -103,7 +105,7 @@ public class ClassicPlotManager extends SquarePlotManager { return queue.enqueue(); } - public boolean setMain(PlotId plotId, BlockBucket blocks) { + public boolean setMain(PlotId plotId, Pattern blocks) { Plot plot = classicPlotWorld.getPlotAbs(plotId); if (!plot.isBasePlot()) { return false; @@ -118,7 +120,7 @@ public class ClassicPlotManager extends SquarePlotManager { return queue.enqueue(); } - public boolean setMiddle(PlotId plotId, BlockBucket blocks) { + public boolean setMiddle(PlotId plotId, Pattern blocks) { Plot plot = classicPlotWorld.getPlotAbs(plotId); if (!plot.isBasePlot()) { return false; @@ -128,11 +130,11 @@ public class ClassicPlotManager extends SquarePlotManager { int x = MathMan.average(corners[0].getX(), corners[1].getX()); int z = MathMan.average(corners[0].getZ(), corners[1].getZ()); - queue.setBlock(x, classicPlotWorld.PLOT_HEIGHT, z, blocks.getBlock()); + queue.setBlock(x, classicPlotWorld.PLOT_HEIGHT, z, blocks); return queue.enqueue(); } - public boolean setOutline(PlotId plotId, BlockBucket blocks) { + public boolean setOutline(PlotId plotId, Pattern blocks) { if (classicPlotWorld.ROAD_WIDTH == 0) { return false; } @@ -145,7 +147,7 @@ public class ClassicPlotManager extends SquarePlotManager { int z = bottom.getZ(); for (int x = bottom.getX(); x <= top.getX(); x++) { for (int y = classicPlotWorld.PLOT_HEIGHT; y <= maxY; y++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } } @@ -153,7 +155,7 @@ public class ClassicPlotManager extends SquarePlotManager { int x = bottom.getX(); for (int z = bottom.getZ(); z <= top.getZ(); z++) { for (int y = classicPlotWorld.PLOT_HEIGHT; y <= maxY; y++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } } @@ -162,7 +164,7 @@ public class ClassicPlotManager extends SquarePlotManager { int z = top.getZ(); for (int x = bottom.getX(); x <= top.getX(); x++) { for (int y = classicPlotWorld.PLOT_HEIGHT; y <= maxY; y++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } } @@ -170,7 +172,7 @@ public class ClassicPlotManager extends SquarePlotManager { int x = top.getX(); for (int z = bottom.getZ(); z <= top.getZ(); z++) { for (int y = classicPlotWorld.PLOT_HEIGHT; y <= maxY; y++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } } @@ -184,7 +186,7 @@ public class ClassicPlotManager extends SquarePlotManager { return queue.enqueue(); } - public boolean setWallFilling(PlotId plotId, BlockBucket blocks) { + public boolean setWallFilling(PlotId plotId, Pattern blocks) { if (classicPlotWorld.ROAD_WIDTH == 0) { return false; } @@ -198,7 +200,7 @@ public class ClassicPlotManager extends SquarePlotManager { int z = bot.getZ(); for (int x = bot.getX(); x < top.getX(); x++) { for (int y = 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } } @@ -206,7 +208,7 @@ public class ClassicPlotManager extends SquarePlotManager { int x = bot.getX(); for (int z = bot.getZ(); z < top.getZ(); z++) { for (int y = 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } } @@ -215,7 +217,7 @@ public class ClassicPlotManager extends SquarePlotManager { for (int x = bot.getX(); x < top.getX() + (plot.getMerged(Direction.EAST) ? 0 : 1); x++) { for (int y = 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } } @@ -224,14 +226,14 @@ public class ClassicPlotManager extends SquarePlotManager { for (int z = bot.getZ(); z < top.getZ() + (plot.getMerged(Direction.SOUTH) ? 0 : 1); z++) { for (int y = 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } } return queue.enqueue(); } - public boolean setWall(PlotId plotId, BlockBucket blocks) { + public boolean setWall(PlotId plotId, Pattern blocks) { if (classicPlotWorld.ROAD_WIDTH == 0) { return false; } @@ -245,27 +247,27 @@ public class ClassicPlotManager extends SquarePlotManager { if (!plot.getMerged(Direction.NORTH)) { int z = bot.getZ(); for (int x = bot.getX(); x < top.getX(); x++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } if (!plot.getMerged(Direction.WEST)) { int x = bot.getX(); for (int z = bot.getZ(); z < top.getZ(); z++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } if (!plot.getMerged(Direction.SOUTH)) { int z = top.getZ(); for (int x = bot.getX(); x < top.getX() + (plot.getMerged(Direction.EAST) ? 0 : 1); x++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } if (!plot.getMerged(Direction.EAST)) { int x = top.getX(); for (int z = bot.getZ(); z < top.getZ() + (plot.getMerged(Direction.SOUTH) ? 0 : 1); z++) { - queue.setBlock(x, y, z, blocks.getBlock()); + queue.setBlock(x, y, z, blocks); } } return queue.enqueue(); @@ -411,14 +413,14 @@ public class ClassicPlotManager extends SquarePlotManager { * @return false if part of the merge failed, otherwise true if successful. */ @Override public boolean finishPlotMerge(List plotIds) { - final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + final Pattern claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + if (!isAir(claim) || !claim.equals(classicPlotWorld.WALL_BLOCK)) { for (PlotId plotId : plotIds) { setWall(plotId, claim); } } if (Settings.General.MERGE_REPLACE_WALL) { - final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING; + final Pattern wallBlock = classicPlotWorld.WALL_FILLING; for (PlotId id : plotIds) { setWallFilling(id, wallBlock); } @@ -427,8 +429,8 @@ public class ClassicPlotManager extends SquarePlotManager { } @Override public boolean finishPlotUnlink(List plotIds) { - final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + final Pattern claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + if (!isAir(claim) || !claim.equals(classicPlotWorld.WALL_BLOCK)) { for (PlotId id : plotIds) { setWall(id, claim); } @@ -445,8 +447,8 @@ public class ClassicPlotManager extends SquarePlotManager { } @Override public boolean claimPlot(Plot plot) { - final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + final Pattern claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + if (!isAir(claim) || !claim.equals(classicPlotWorld.WALL_BLOCK)) { return setWall(plot.getId(), claim); } return true; 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 4d1ad357c..46af0e43c 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 @@ -5,9 +5,11 @@ 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.config.Settings; -import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.world.block.BlockTypes; import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; @@ -18,17 +20,17 @@ import java.util.Locale; public int ROAD_HEIGHT = 62; public int PLOT_HEIGHT = 62; public int WALL_HEIGHT = 62; - public BlockBucket MAIN_BLOCK = BlockBucket.withSingle(BlockUtil.get("stone")); + public Pattern MAIN_BLOCK = new BlockPattern(BlockTypes.STONE.getDefaultState()); // new BlockState[] {BlockUtil.get("stone")}; - public BlockBucket TOP_BLOCK = BlockBucket.withSingle(BlockUtil.get("grass_block")); + public Pattern TOP_BLOCK = new BlockPattern(BlockTypes.GRASS_BLOCK.getDefaultState()); //new BlockState[] {BlockUtil.get("grass")}; - public BlockBucket WALL_BLOCK = BlockBucket.withSingle(BlockUtil.get("stone_slab")); + public Pattern WALL_BLOCK = new BlockPattern(BlockTypes.STONE_SLAB.getDefaultState()); // BlockUtil.get((short) 44, (byte) 0); - public BlockBucket CLAIMED_WALL_BLOCK = BlockBucket.withSingle(BlockUtil.get("sandstone_slab")); + public Pattern CLAIMED_WALL_BLOCK = new BlockPattern(BlockTypes.SANDSTONE_SLAB.getDefaultState()); // BlockUtil.get((short) 44, (byte) 1); - public BlockBucket WALL_FILLING = BlockBucket.withSingle(BlockUtil.get("stone")); + public Pattern WALL_FILLING = new BlockPattern(BlockTypes.STONE.getDefaultState()); //BlockUtil.get((short) 1, (byte) 0); - public BlockBucket ROAD_BLOCK = BlockBucket.withSingle(BlockUtil.get("quartz_block")); + public Pattern ROAD_BLOCK = new BlockPattern(BlockTypes.QUARTZ_BLOCK.getDefaultState()); // BlockUtil.get((short) 155, (byte) 0); public boolean PLOT_BEDROCK = true; @@ -81,16 +83,16 @@ import java.util.Locale; super.loadConfiguration(config); this.PLOT_BEDROCK = config.getBoolean("plot.bedrock"); this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height")); - this.MAIN_BLOCK = Configuration.BLOCK_BUCKET.parseString(config.getString("plot.filling")); - this.TOP_BLOCK = Configuration.BLOCK_BUCKET.parseString(config.getString("plot.floor")); - this.WALL_BLOCK = Configuration.BLOCK_BUCKET.parseString(config.getString("wall.block")); + this.MAIN_BLOCK = new BlockPattern(BlockUtil.get(config.getString("plot.filling"))); + this.TOP_BLOCK = new BlockPattern(BlockUtil.get(config.getString("plot.floor"))); + this.WALL_BLOCK = new BlockPattern(BlockUtil.get(config.getString("wall.block"))); this.ROAD_HEIGHT = Math.min(255, config.getInt("road.height")); - this.ROAD_BLOCK = Configuration.BLOCK_BUCKET.parseString(config.getString("road.block")); + this.ROAD_BLOCK = new BlockPattern(BlockUtil.get(config.getString("road.block"))); this.WALL_FILLING = - Configuration.BLOCK_BUCKET.parseString(config.getString("wall.filling")); + new BlockPattern(BlockUtil.get(config.getString("wall.filling"))); this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height")); this.CLAIMED_WALL_BLOCK = - Configuration.BLOCK_BUCKET.parseString(config.getString("wall.block_claimed")); + new BlockPattern(BlockUtil.get(config.getString("wall.block_claimed"))); // Dump world settings if (Settings.DEBUG) { 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 7df870508..1910fc07e 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,14 +2,13 @@ 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.BlockBucket; 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.util.MathMan; -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockTypes; public class HybridGen extends IndependentPlotGenerator { @@ -35,37 +34,6 @@ public class HybridGen extends IndependentPlotGenerator { } } - @Override public BlockBucket[][] generateBlockBucketChunk(PlotArea settings) { - BlockBucket[][] blockBuckets = new BlockBucket[16][]; - HybridPlotWorld hpw = (HybridPlotWorld) settings; - // Bedrock - if (hpw.PLOT_BEDROCK) { - for (short x = 0; x < 16; x++) { - for (short z = 0; z < 16; z++) { - blockBuckets[0][(z << 4) | x] = - BlockBucket.withSingle(BlockUtil.get("bedrock")); - } - } - } - for (short x = 0; x < 16; x++) { - for (short z = 0; z < 16; z++) { - for (int y = 1; y < hpw.PLOT_HEIGHT; y++) { - int layer = y >> 4; - if (blockBuckets[layer] == null) { - blockBuckets[layer] = new BlockBucket[4096]; - } - blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = hpw.MAIN_BLOCK; - } - int layer = hpw.PLOT_HEIGHT >> 4; - if (blockBuckets[layer] == null) { - blockBuckets[layer] = new BlockBucket[4096]; - } - blockBuckets[layer][((hpw.PLOT_HEIGHT & 0xF) << 8) | (z << 4) | x] = hpw.MAIN_BLOCK; - } - } - return blockBuckets; - } - @Override public void generateChunk(ScopedLocalBlockQueue result, PlotArea settings) { HybridPlotWorld hpw = (HybridPlotWorld) settings; // Biome @@ -74,7 +42,7 @@ public class HybridGen extends IndependentPlotGenerator { if (hpw.PLOT_BEDROCK) { for (short x = 0; x < 16; x++) { for (short z = 0; z < 16; z++) { - result.setBlock(x, 0, z, BlockUtil.get("bedrock")); + result.setBlock(x, 0, z, BlockTypes.BEDROCK.getDefaultState()); } } } @@ -128,7 +96,7 @@ public class HybridGen extends IndependentPlotGenerator { for (short z = 0; z < 16; z++) { // Road for (int y = 1; y <= hpw.ROAD_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.ROAD_BLOCK.getBlock()); + result.setBlock(x, y, z, hpw.ROAD_BLOCK); } if (hpw.ROAD_SCHEMATIC_ENABLED) { placeSchem(hpw, result, rx[x], rz[z], x, z, true); @@ -139,7 +107,7 @@ public class HybridGen extends IndependentPlotGenerator { if (gz[z]) { // road for (int y = 1; y <= hpw.ROAD_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.ROAD_BLOCK.getBlock()); + result.setBlock(x, y, z, hpw.ROAD_BLOCK); } if (hpw.ROAD_SCHEMATIC_ENABLED) { placeSchem(hpw, result, rx[x], rz[z], x, z, true); @@ -147,10 +115,10 @@ public class HybridGen extends IndependentPlotGenerator { } else { // wall for (int y = 1; y <= hpw.WALL_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.WALL_FILLING.getBlock()); + result.setBlock(x, y, z, hpw.WALL_FILLING); } if (!hpw.ROAD_SCHEMATIC_ENABLED) { - result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK.getBlock()); + result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK); } else { placeSchem(hpw, result, rx[x], rz[z], x, z, true); } @@ -161,7 +129,7 @@ public class HybridGen extends IndependentPlotGenerator { if (gz[z]) { // road for (int y = 1; y <= hpw.ROAD_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.ROAD_BLOCK.getBlock()); + result.setBlock(x, y, z, hpw.ROAD_BLOCK); } if (hpw.ROAD_SCHEMATIC_ENABLED) { placeSchem(hpw, result, rx[x], rz[z], x, z, true); @@ -169,19 +137,19 @@ public class HybridGen extends IndependentPlotGenerator { } else if (wz[z]) { // wall for (int y = 1; y <= hpw.WALL_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.WALL_FILLING.getBlock()); + result.setBlock(x, y, z, hpw.WALL_FILLING); } if (!hpw.ROAD_SCHEMATIC_ENABLED) { - result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK.getBlock()); + result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK); } else { placeSchem(hpw, result, rx[x], rz[z], x, z, true); } } else { // plot for (int y = 1; y < hpw.PLOT_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.MAIN_BLOCK.getBlock()); + result.setBlock(x, y, z, hpw.MAIN_BLOCK); } - result.setBlock(x, hpw.PLOT_HEIGHT, z, hpw.TOP_BLOCK.getBlock()); + result.setBlock(x, hpw.PLOT_HEIGHT, z, hpw.TOP_BLOCK); if (hpw.PLOT_SCHEMATIC) { placeSchem(hpw, result, rx[x], rz[z], x, z, false); } 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 0ab0947a4..06550a3cb 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,6 @@ 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.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; @@ -12,10 +11,12 @@ 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; -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; 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.world.BlockUtil; import com.google.common.collect.Sets; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; @@ -173,8 +174,8 @@ public class HybridPlotManager extends ClassicPlotManager { final boolean canRegen = (hybridPlotWorld.TYPE == 0) && (hybridPlotWorld.TERRAIN == 0) && REGENERATIVE_CLEAR; // The component blocks - final BlockBucket plotfloor = hybridPlotWorld.TOP_BLOCK; - final BlockBucket filling = hybridPlotWorld.MAIN_BLOCK; + final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK; + final Pattern filling = hybridPlotWorld.MAIN_BLOCK; final BlockState bedrock; if (hybridPlotWorld.PLOT_BEDROCK) { bedrock = BlockUtil.get((short) 7, (byte) 0); @@ -182,7 +183,7 @@ public class HybridPlotManager extends ClassicPlotManager { bedrock = BlockUtil.get((short) 0, (byte) 0); } final BlockState air = BlockUtil.get((short) 0, (byte) 0); - final String biome = hybridPlotWorld.PLOT_BIOME; + final BiomeType biome = hybridPlotWorld.PLOT_BIOME; final LocalBlockQueue queue = hybridPlotWorld.getQueue(false); ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run(int[] value) { 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 f397c3fc2..db3df521a 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 @@ -10,21 +10,26 @@ 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.world.RegionUtil; -import com.sk89q.worldedit.regions.CuboidRegion; 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; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.ChunkBlockQueue; 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.github.intellectualsites.plotsquared.plot.util.world.RegionUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import java.io.File; import java.util.ArrayDeque; @@ -46,8 +51,190 @@ public abstract class HybridUtils { public static PlotArea area; public static boolean UPDATE = false; - public abstract void analyzeRegion(String world, CuboidRegion region, - RunnableVal whenDone); + public void analyzeRegion(final String world, final CuboidRegion region, final RunnableVal whenDone) { + // int diff, int variety, int vertices, int rotation, int height_sd + /* + * diff: compare to base by looping through all blocks + * variety: add to HashSet for each BlockState + * height_sd: loop over all blocks and get top block + * + * vertices: store air map and compare with neighbours + * for each block check the adjacent + * - Store all blocks then go through in second loop + * - recheck each block + * + */ + TaskManager.runTaskAsync(() -> { + final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); + + final BlockVector3 bot = region.getMinimumPoint(); + final BlockVector3 top = region.getMaximumPoint(); + + final int bx = bot.getX(); + final int bz = bot.getZ(); + final int tx = top.getX(); + final int tz = top.getZ(); + final int cbx = bx >> 4; + final int cbz = bz >> 4; + final int ctx = tx >> 4; + final int ctz = tz >> 4; + MainUtil.initCache(); + final int width = tx - bx + 1; + final int length = tz - bz + 1; + + PlotArea area = PlotSquared.get().getPlotArea(world, null); + + if (!(area instanceof HybridPlotWorld)) { + return; + } + + HybridPlotWorld hpw = (HybridPlotWorld) area; + ChunkBlockQueue chunk = new ChunkBlockQueue(bot, top, false); + hpw.getGenerator().generateChunk(chunk, hpw); + + final BlockState[][][] oldBlocks = chunk.getBlocks(); + final BlockState[][][] newBlocks = new BlockState[256][width][length]; + final BlockState airBlock = BlockTypes.AIR.getDefaultState(); + + System.gc(); + System.gc(); + + final Runnable run = () -> TaskManager.runTaskAsync(() -> { + int size = width * length; + int[] changes = new int[size]; + int[] faces = new int[size]; + int[] data = new int[size]; + int[] air = new int[size]; + int[] variety = new int[size]; + int i = 0; + for (int x = 0; x < width; x++) { + for (int z = 0; z < length; z++) { + Set types = new HashSet<>(); + for (int y = 0; y < 256; y++) { + BlockState old = oldBlocks[y][x][z]; + try { + if (old == null) { + old = airBlock; + } + BlockState now = newBlocks[y][x][z]; + if (!old.equals(now)) { + changes[i]++; + } + if (now.getBlockType().getMaterial().isAir()) { + air[i]++; + } else { + // check vertices + // modifications_adjacent + if (x > 0 && z > 0 && y > 0 && x < width - 1 && z < length - 1 + && y < 255) { + if (newBlocks[y - 1][x][z].getBlockType().getMaterial().isAir()) { + faces[i]++; + } + if (newBlocks[y][x - 1][z].getBlockType().getMaterial().isAir()) { + faces[i]++; + } + if (newBlocks[y][x][z - 1].getBlockType().getMaterial().isAir()) { + faces[i]++; + } + if (newBlocks[y + 1][x][z].getBlockType().getMaterial().isAir()) { + faces[i]++; + } + if (newBlocks[y][x + 1][z].getBlockType().getMaterial().isAir()) { + faces[i]++; + } + if (newBlocks[y][x][z + 1].getBlockType().getMaterial().isAir()) { + faces[i]++; + } + } + + if (!now.equals(now.getBlockType().getDefaultState())) { + data[i]++; + } + types.add(now.getBlockType()); + } + } catch (NullPointerException e) { + e.printStackTrace(); + } + } + variety[i] = types.size(); + i++; + } + } + // analyze plot + // put in analysis obj + + // run whenDone + PlotAnalysis analysis = new PlotAnalysis(); + analysis.changes = (int) (MathMan.getMean(changes) * 100); + analysis.faces = (int) (MathMan.getMean(faces) * 100); + analysis.data = (int) (MathMan.getMean(data) * 100); + analysis.air = (int) (MathMan.getMean(air) * 100); + analysis.variety = (int) (MathMan.getMean(variety) * 100); + + analysis.changes_sd = (int) (MathMan.getSD(changes, analysis.changes) * 100); + analysis.faces_sd = (int) (MathMan.getSD(faces, analysis.faces) * 100); + analysis.data_sd = (int) (MathMan.getSD(data, analysis.data) * 100); + analysis.air_sd = (int) (MathMan.getSD(air, analysis.air) * 100); + analysis.variety_sd = (int) (MathMan.getSD(variety, analysis.variety) * 100); + System.gc(); + System.gc(); + whenDone.value = analysis; + whenDone.run(); + }); + System.gc(); + MainUtil.initCache(); + Location botLoc = new Location(world, bot.getX(), bot.getY(), bot.getZ()); + Location topLoc = new Location(world, top.getX(), top.getY(), top.getZ()); + ChunkManager.chunkTask(botLoc, topLoc, new RunnableVal() { + @Override public void run(int[] value) { + int X = value[0]; + int Z = value[1]; + int minX; + if (X == cbx) { + minX = bx & 15; + } else { + minX = 0; + } + int minZ; + if (Z == cbz) { + minZ = bz & 15; + } else { + minZ = 0; + } + int maxX; + if (X == ctx) { + maxX = tx & 15; + } else { + maxX = 16; + } + int maxZ; + if (Z == ctz) { + maxZ = tz & 15; + } else { + maxZ = 16; + } + + int cbx = X << 4; + int cbz = Z << 4; + + int xb = cbx - bx; + int zb = cbz - bz; + for (int x = minX; x <= maxX; x++) { + int xx = cbx + x; + for (int z = minZ; z <= maxZ; z++) { + int zz = cbz + z; + for (int y = 0; y < 256; y++) { + BlockState block = queue.getBlock(xx, y, zz); + int xr = xb + x; + int zr = zb + z; + newBlocks[y][xr][zr] = block; + } + } + } + } + }, () -> TaskManager.runTaskAsync(run), 5); + }); + } public void analyzePlot(final Plot origin, final RunnableVal whenDone) { final ArrayDeque zones = new ArrayDeque<>(origin.getRegions()); 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 def532368..1467dc1dd 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,6 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -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; @@ -19,14 +18,6 @@ public abstract class IndependentPlotGenerator { */ public abstract String getName(); - /** - * Generates a 16x4096 array of BlockBuckets corresponding to the area settings to allow for plot analysis - * - * @param settings - * @return - */ - public abstract BlockBucket[][] generateBlockBucketChunk(PlotArea settings); - /** * Use the setBlock or setBiome method of the PlotChunk result parameter to make changes. * The PlotArea settings is the same one this was initialized with. 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 b05249d39..eeda6d06e 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 @@ -6,12 +6,11 @@ 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.sk89q.worldedit.regions.CuboidRegion; import java.util.Arrays; -import java.util.HashSet; import java.util.Iterator; import java.util.Set; 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 7426b99c8..ef9b25406 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 @@ -20,8 +20,8 @@ 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.world.ItemUtil; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; +import com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java index f72fb0520..fc7f95d11 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java @@ -3,7 +3,6 @@ package com.github.intellectualsites.plotsquared.plot.listener; 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.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; @@ -12,6 +11,7 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; @@ -19,7 +19,6 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import java.lang.reflect.Field; -import java.util.HashSet; import java.util.Set; public class ProcessedWEExtent extends AbstractDelegateExtent { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java index ea9f404b8..c9a414ed0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java @@ -1,6 +1,5 @@ package com.github.intellectualsites.plotsquared.plot.listener; -import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; @@ -8,6 +7,7 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; @@ -15,7 +15,6 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; -import java.util.HashSet; import java.util.Set; public class WEExtent extends AbstractDelegateExtent { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java index a56063d08..9991e8286 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java @@ -5,7 +5,6 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.sk89q.worldedit.WorldEdit; @@ -13,12 +12,12 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.extent.EditSessionEvent; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.NullExtent; +import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.EventHandler.Priority; import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.world.World; -import java.util.HashSet; import java.util.Set; public class WESubscriber { 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 43b519fc3..8a4e784b3 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 @@ -4,6 +4,12 @@ import com.github.intellectualsites.plotsquared.configuration.serialization.Conf import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.object.collection.RandomCollection; import com.google.common.collect.ImmutableMap; +import com.sk89q.worldedit.extent.NullExtent; +import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.RandomPattern; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import lombok.EqualsAndHashCode; @@ -17,9 +23,11 @@ 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.Map.Entry; import java.util.Random; +import java.util.stream.Collectors; /** * A block bucket is a container of block types, where each block @@ -37,6 +45,8 @@ import java.util.Random; private RandomCollection randomBlocks; private BlockState single; + private Pattern pattern; + private BlockMask mask; public BlockBucket() { this.blocks = new HashMap<>(); @@ -84,9 +94,7 @@ import java.util.Random; * be found in the bucket */ public Collection getBlocks() { - if (!isCompiled()) { - this.compile(); - } + this.compile(); return Collections.unmodifiableCollection(this.blocks.keySet()); } @@ -126,20 +134,31 @@ import java.util.Random; if (isCompiled()) { return; } - this.compiled = true; switch (blocks.size()) { case 0: single = null; this.randomBlocks = null; + this.pattern = null; + this.mask = new BlockMask(new NullExtent()); break; case 1: single = blocks.keySet().iterator().next(); this.randomBlocks = null; + this.pattern = new BlockPattern(single); + this.mask = new BlockMask(new NullExtent(), single.toBaseBlock()); break; default: single = null; this.randomBlocks = RandomCollection.of(blocks, random); + RandomPattern randomPattern = new RandomPattern(); + for (Entry entry : this.blocks.entrySet()) { + randomPattern.add(new BlockPattern(entry.getKey()), entry.getValue()); + } + this.pattern = randomPattern; + List baseBlocks = getBlocks().stream().map(BlockState::toBaseBlock) + .collect(Collectors.toList()); + this.mask = new BlockMask(new NullExtent(), baseBlocks); break; } } @@ -170,6 +189,16 @@ import java.util.Random; return BlockTypes.AIR.getDefaultState(); } + public Pattern getPattern() { + this.compile(); + return this.pattern; + } + + public BlockMask getMask() { + this.compile(); + return this.mask; + } + @Override public String toString() { if (!isCompiled()) { compile(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index ae9fffb89..c9b7ab5e7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -5,7 +5,6 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; -import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.item.ItemType; 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 67fe23387..65bb23809 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 @@ -22,18 +22,21 @@ 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.world.BlockUtil; 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.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; +import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil; import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BlockTypes; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -921,7 +924,7 @@ public class Plot { * @param biome The biome e.g. "forest" * @param whenDone The task to run when finished, or null */ - public void setBiome(final String biome, final Runnable whenDone) { + public void setBiome(final BiomeType biome, final Runnable whenDone) { final ArrayDeque regions = new ArrayDeque<>(this.getRegions()); final int extendBiome; if (area instanceof SquarePlotWorld) { @@ -1459,7 +1462,7 @@ public class Plot { } Location location = manager.getSignLoc(this); LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); - queue.setBlock(location.getX(), location.getY(), location.getZ(), BlockUtil.get("air")); + queue.setBlock(location.getX(), location.getY(), location.getZ(), BlockTypes.AIR.getDefaultState()); queue.flush(); } @@ -1588,9 +1591,13 @@ public class Plot { * Sets components such as border, wall, floor. * (components are generator specific) */ + @Deprecated public boolean setComponent(String component, String blocks) { BlockBucket parsed = Configuration.BLOCK_BUCKET.parseString(blocks); - return !(parsed == null || parsed.isEmpty()) && this.setComponent(component, parsed); + if (parsed != null && parsed.isEmpty()) { + return false; + } + return this.setComponent(component, parsed.getPattern()); } /** @@ -1598,7 +1605,7 @@ public class Plot { * * @return the name of the biome */ - public String getBiome() { + public BiomeType getBiome() { Location location = this.getCenter(); return WorldUtil.IMP.getBiome(location.getWorld(), location.getX(), location.getZ()); } @@ -2856,7 +2863,7 @@ public class Plot { * @param blocks * @return */ - public boolean setComponent(String component, BlockBucket blocks) { + public boolean setComponent(String component, Pattern blocks) { if (StringMan .isEqualToAny(component, getManager().getPlotComponents(this.getId()))) { EventUtil.manager.callComponentSet(this, component); 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 970c427b8..0cefe8283 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 @@ -25,6 +25,8 @@ import com.google.common.collect.ImmutableSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -54,14 +56,13 @@ public abstract class PlotArea { private final PlotId min; private final PlotId max; @NotNull private final IndependentPlotGenerator generator; - private final BlockBucket[][] blockBucketChunk; public int MAX_PLOT_MEMBERS = 128; public boolean AUTO_MERGE = false; public boolean ALLOW_SIGNS = true; public boolean MISC_SPAWN_UNOWNED = false; public boolean MOB_SPAWNING = false; public boolean MOB_SPAWNER_SPAWNING = false; - public String PLOT_BIOME = "FOREST"; + public BiomeType PLOT_BIOME = BiomeTypes.FOREST; public boolean PLOT_CHAT = false; public boolean SCHEMATIC_CLAIM_SPECIFY = false; public boolean SCHEMATIC_ON_CLAIM = false; @@ -106,11 +107,6 @@ public abstract class PlotArea { this.max = max; } this.worldhash = worldName.hashCode(); - if (Settings.Enabled_Components.PLOT_EXPIRY) { - blockBucketChunk = generator.generateBlockBucketChunk(this); - } else { - blockBucketChunk = null; - } } @NotNull protected abstract PlotManager createManager(); @@ -119,18 +115,6 @@ public abstract class PlotArea { return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue); } - /** - * Get an array of BlockBuckets corresponding to a chunk of a plot - * - * @return BlockBucket[][] - */ - public BlockBucket[][] getBlockBucketChunk() { - if (blockBucketChunk != null) { - return blockBucketChunk; - } - return generator.generateBlockBucketChunk(this); - } - /** * Returns the region for this PlotArea or a CuboidRegion encompassing * the whole world if none exists. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 8f50f3504..e0fc16ddb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -2,6 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.object; import com.github.intellectualsites.plotsquared.plot.commands.Template; import com.github.intellectualsites.plotsquared.plot.config.Settings; +import com.sk89q.worldedit.function.pattern.Pattern; import java.io.IOException; import java.util.Collections; @@ -53,7 +54,7 @@ public abstract class PlotManager { */ public abstract String[] getPlotComponents(PlotId plotId); - public abstract boolean setComponent(PlotId plotId, String component, BlockBucket blocks); + public abstract boolean setComponent(PlotId plotId, String component, Pattern blocks); /* * PLOT MERGING (return false if your generator does not support plot 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 0191b53df..c504af4fb 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 @@ -2,9 +2,9 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap; +import com.sk89q.worldedit.regions.CuboidRegion; import java.util.ArrayList; import java.util.Arrays; 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 788e7a99a..1a8c88b9f 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 @@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; -import com.google.common.collect.Sets; import org.jetbrains.annotations.NotNull; import java.util.Collection; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java index d35257b9b..e54ab6964 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java @@ -2,9 +2,9 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.util.ArrayUtil; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; +import com.sk89q.worldedit.regions.CuboidRegion; public class SinglePlotAreaManager extends DefaultPlotAreaManager { private final SinglePlotArea[] array; 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 49d3788d5..d2aa10499 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,6 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -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; @@ -10,6 +9,7 @@ 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; +import com.sk89q.worldedit.function.pattern.Pattern; import java.io.File; import java.util.List; @@ -69,7 +69,7 @@ public class SinglePlotManager extends PlotManager { } @Override public boolean setComponent(PlotId plotId, String component, - BlockBucket blocks) { + Pattern blocks) { return false; } 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 0042ca222..89069173f 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,12 +2,12 @@ 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.BlockBucket; 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.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; +import com.sk89q.worldedit.world.biome.BiomeTypes; +import com.sk89q.worldedit.world.block.BlockTypes; public class SingleWorldGenerator extends IndependentPlotGenerator { private Location bedrock1 = new Location(null, 0, 0, 0); @@ -21,64 +21,19 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { return "PlotSquared:single"; } - @Override public BlockBucket[][] generateBlockBucketChunk(PlotArea settings) { - BlockBucket[][] blockBuckets = new BlockBucket[16][]; - SinglePlotArea area = (SinglePlotArea) settings; - if (area.VOID) { - return blockBuckets; - } - for (int x = bedrock1.getX(); x <= bedrock2.getX(); x++) { - for (int z = bedrock1.getZ(); z <= bedrock2.getZ(); z++) { - for (int y = bedrock1.getY(); y <= bedrock2.getY(); y++) { - int layer = y >> 4; - if (blockBuckets[layer] == null) { - blockBuckets[layer] = new BlockBucket[4096]; - } - blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(BlockUtil.get("bedrock")); - } - } - } - for (int x = dirt1.getX(); x <= dirt2.getX(); x++) { - for (int z = dirt1.getZ(); z <= dirt2.getZ(); z++) { - for (int y = dirt1.getY(); y <= dirt2.getY(); y++) { - int layer = y >> 4; - if (blockBuckets[layer] == null) { - blockBuckets[layer] = new BlockBucket[4096]; - } - blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(BlockUtil.get("dirt")); - } - } - } - for (int x = grass1.getX(); x <= grass2.getX(); x++) { - for (int z = grass1.getZ(); z <= grass2.getZ(); z++) { - for (int y = grass1.getY(); y <= grass2.getY(); y++) { - int layer = y >> 4; - if (blockBuckets[layer] == null) { - blockBuckets[layer] = new BlockBucket[4096]; - } - blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(BlockUtil.get("grass_block")); - } - } - } - return blockBuckets; - } - @Override public void generateChunk(ScopedLocalBlockQueue result, PlotArea settings) { SinglePlotArea area = (SinglePlotArea) settings; if (area.VOID) { Location min = result.getMin(); if (min.getX() == 0 && min.getZ() == 0) { - result.setBlock(0, 0, 0, BlockUtil.get("bedrock")); + result.setBlock(0, 0, 0, BlockTypes.BEDROCK.getDefaultState()); } } else { - result.setCuboid(bedrock1, bedrock2, BlockUtil.get("bedrock")); - result.setCuboid(dirt1, dirt2, BlockUtil.get("dirt")); - result.setCuboid(grass1, grass2, BlockUtil.get("grass_block")); + result.setCuboid(bedrock1, bedrock2, BlockTypes.BEDROCK.getDefaultState()); + result.setCuboid(dirt1, dirt2, BlockTypes.DIRT.getDefaultState()); + result.setCuboid(grass1, grass2, BlockTypes.GRASS_BLOCK.getDefaultState()); } - result.fillBiome("PLAINS"); + result.fillBiome(BiomeTypes.PLAINS); } @Override public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) { 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 be8a79207..c4df0f04b 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 @@ -3,12 +3,12 @@ package com.github.intellectualsites.plotsquared.plot.util; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.sk89q.worldedit.regions.CuboidRegion; 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 com.sk89q.worldedit.regions.CuboidRegion; import java.io.File; import java.util.ArrayList; 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 d06beab3f..b224e201a 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 @@ -16,12 +16,13 @@ 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.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.CuboidRegion; 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 com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.world.biome.BiomeType; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -46,6 +47,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -217,10 +219,9 @@ public class MainUtil { * @return true if any changes were made */ public static boolean resetBiome(PlotArea area, Location pos1, Location pos2) { - String biome = area.PLOT_BIOME; - if (!StringMan.isEqual(WorldUtil.IMP - .getBiome(area.worldname, (pos1.getX() + pos2.getX()) / 2, - (pos1.getZ() + pos2.getZ()) / 2), biome)) { + BiomeType biome = area.PLOT_BIOME; + if (!Objects.equals(WorldUtil.IMP.getBiome(area.worldname, (pos1.getX() + pos2.getX()) / 2, + (pos1.getZ() + pos2.getZ()) / 2), biome)) { MainUtil.setBiome(area.worldname, pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(), biome); return true; @@ -567,7 +568,7 @@ public class MainUtil { * @param p2z * @param biome */ - public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, String biome) { + public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, BiomeType biome) { BlockVector3 pos1 = BlockVector2.at(p1x, p1z).toBlockVector3(); BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(Plot.MAX_HEIGHT - 1); CuboidRegion region = new CuboidRegion(pos1, pos2); @@ -750,7 +751,7 @@ public class MainUtil { int num = plot.getConnectedPlots().size(); String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : Captions.NONE.getTranslated(); Location bot = plot.getCorners()[0]; - String biome = WorldUtil.IMP.getBiome(plot.getWorldName(), bot.getX(), bot.getZ()); + BiomeType biome = WorldUtil.IMP.getBiome(plot.getWorldName(), bot.getX(), bot.getZ()); String trusted = getPlayerList(plot.getTrusted()); String members = getPlayerList(plot.getMembers()); String denied = getPlayerList(plot.getDenied()); @@ -798,7 +799,7 @@ public class MainUtil { info = info.replace("%alias%", alias); info = info.replace("%num%", String.valueOf(num)); info = info.replace("%desc%", description); - info = info.replace("%biome%", biome); + info = info.replace("%biome%", biome.toString().toLowerCase()); info = info.replace("%owner%", owner); info = info.replace("%members%", members); info = info.replace("%player%", player.getName()); 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 75f8d79f0..64477915b 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 @@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld; 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; @@ -27,6 +26,7 @@ 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.regions.CuboidRegion; import com.sk89q.worldedit.world.block.BaseBlock; import org.jetbrains.annotations.NotNull; 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 52be1a312..099b9ea34 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 @@ -4,7 +4,6 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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.sk89q.worldedit.regions.CuboidRegion; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.sk89q.jnbt.CompoundTag; @@ -13,6 +12,8 @@ import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockState; import java.io.ByteArrayOutputStream; @@ -32,10 +33,6 @@ import java.util.zip.ZipOutputStream; public abstract class WorldUtil { public static WorldUtil IMP; - public abstract int getBiomeFromString(String value); - - public abstract String[] getBiomeList(); - public abstract String getMainWorld(); public abstract boolean isWorld(String worldName); @@ -56,7 +53,7 @@ public abstract class WorldUtil { public abstract StringComparison.ComparisonResult getClosestBlock(String name); - public abstract String getBiome(String world, int x, int z); + public abstract BiomeType getBiome(String world, int x, int z); public abstract BlockState getBlock(Location location); @@ -66,7 +63,7 @@ public abstract class WorldUtil { public abstract void setSign(String world, int x, int y, int z, String[] lines); - public abstract void setBiomes(String world, CuboidRegion region, String biome); + public abstract void setBiomes(String world, CuboidRegion region, BiomeType biome); public abstract com.sk89q.worldedit.world.World getWeWorld(String world); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 08bfab890..72b6252a3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -4,6 +4,9 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import org.jetbrains.annotations.NotNull; @@ -85,6 +88,10 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { this.modified = modified; } + @Override public boolean setBlock(int x, int y, int z, Pattern pattern) { + return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z)); + } + @Override public boolean setBlock(int x, int y, int z, BaseBlock id) { if ((y > 255) || (y < 0)) { return false; @@ -118,7 +125,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return setBlock(x, y, z, id.toBaseBlock()); } - @Override public final boolean setBiome(int x, int z, String biome) { + @Override public final boolean setBiome(int x, int z, BiomeType biomeType) { long pair = (long) (x >> 4) << 32 | (z >> 4) & 0xFFFFFFFFL; LocalChunk result = this.blockChunks.get(pair); if (result == null) { @@ -131,7 +138,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { chunks.add(result); } } - result.setBiome(x & 15, z & 15, biome); + result.setBiome(x & 15, z & 15, biomeType); return true; } @@ -160,7 +167,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { public final int x; public BaseBlock[][] baseblocks; - public String[][] biomes; + public BiomeType[][] biomes; public LocalChunk(BasicLocalBlockQueue parent, int x, int z) { this.parent = parent; @@ -187,15 +194,15 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { public abstract void setBlock(final int x, final int y, final int z, final BaseBlock block); - public void setBiome(int x, int z, String biome) { + public void setBiome(int x, int z, BiomeType biomeType) { if (this.biomes == null) { - this.biomes = new String[16][]; + this.biomes = new BiomeType[16][]; } - String[] index = this.biomes[x]; + BiomeType[] index = this.biomes[x]; if (index == null) { - index = this.biomes[x] = new String[16]; + index = this.biomes[x] = new BiomeType[16]; } - index[z] = biome; + index[z] = biomeType; } public long longHash() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ChunkBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ChunkBlockQueue.java new file mode 100644 index 000000000..47e2c8756 --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ChunkBlockQueue.java @@ -0,0 +1,95 @@ +package com.github.intellectualsites.plotsquared.plot.util.block; + +import com.github.intellectualsites.plotsquared.plot.object.Location; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; + +import java.util.Arrays; + +public class ChunkBlockQueue extends ScopedLocalBlockQueue { + + public final BiomeType[] biomeGrid; + public final BlockState[][][] result; + private final int width; + private final int length; + private final int area; + private final BlockVector3 bot; + private final BlockVector3 top; + + public ChunkBlockQueue(BlockVector3 bot, BlockVector3 top, boolean biomes) { + super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15)); + this.width = top.getX() - bot.getX()+ 1; + this.length = top.getZ() - bot.getZ() + 1; + this.area = width * length; + this.result = new BlockState[256][][]; + this.biomeGrid = biomes ? new BiomeType[width * length] : null; + this.bot = bot; + this.top = top; + } + + public BlockState[][][] getBlocks() { + return result; + } + + @Override public void fillBiome(BiomeType biomeType) { + if (biomeGrid == null) { + return; + } + Arrays.fill(biomeGrid, biomeType); + } + + @Override public boolean setBiome(int x, int z, BiomeType biomeType) { + if (this.biomeGrid != null) { + biomeGrid[(z * width) + x] = biomeType; + return true; + } + return false; + } + + @Override public boolean setBlock(int x, int y, int z, BlockState id) { + this.storeCache(x, y, z, id); + return true; + } + + private void storeCache(final int x, final int y, final int z, final BlockState id) { + BlockState[][] resultY = result[y]; + if (resultY == null) { + result[y] = resultY = new BlockState[length][]; + } + BlockState[] resultYZ = resultY[z]; + if (resultYZ == null) { + resultY[z] = resultYZ = new BlockState[width]; + } + resultYZ[x] = id; + } + + @Override public boolean setBlock(int x, int y, int z, BaseBlock id) { + this.storeCache(x, y, z, id.toImmutableState()); + return true; + } + + @Override public BlockState getBlock(int x, int y, int z) { + BlockState[][] blocksY = result[y]; + if (blocksY != null) { + BlockState[] blocksYZ = blocksY[z]; + if (blocksYZ != null) { + return blocksYZ[x]; + } + } + return null; + } + + @Override public String getWorld() { + return null; + } + + @Override public Location getMax() { + return new Location(getWorld(), top.getX(), top.getY(), top.getZ()); + } + + @Override public Location getMin() { + return new Location(getWorld(), bot.getX(), bot.getY(), bot.getZ()); + } +} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index cf695f3d6..78e706b6b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -58,6 +60,10 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { } } + @Override public boolean setBlock(int x, int y, int z, Pattern pattern) { + return parent.setBlock(x, y, z, pattern); + } + @Override public boolean setBlock(int x, int y, int z, BaseBlock id) { return parent.setBlock(x, y, z, id); } @@ -70,7 +76,7 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { return parent.getBlock(x, y, z); } - @Override public boolean setBiome(int x, int z, String biome) { + @Override public boolean setBiome(int x, int z, BiomeType biome) { return parent.setBiome(x, z, biome); } 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 572f70228..4778a1cae 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,14 +1,16 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; 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.github.intellectualsites.plotsquared.plot.util.world.PatternUtil; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -57,6 +59,10 @@ public abstract class LocalBlockQueue { public abstract boolean setBlock(final int x, final int y, final int z, final BaseBlock id); + public boolean setBlock(final int x, final int y, final int z, final Pattern pattern) { + return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z)); + } + public boolean setTile(int x, int y, int z, CompoundTag tag) { SchematicHandler.manager.restoreTile(this, tag, x, y, z); return true; @@ -64,7 +70,7 @@ public abstract class LocalBlockQueue { public abstract BlockState getBlock(int x, int y, int z); - public abstract boolean setBiome(int x, int z, String biome); + public abstract boolean setBiome(int x, int z, BiomeType biome); public abstract String getWorld(); @@ -116,7 +122,7 @@ public abstract class LocalBlockQueue { } } - public void setCuboid(Location pos1, Location pos2, BlockBucket blocks) { + public void setCuboid(Location pos1, Location pos2, Pattern blocks) { int yMin = Math.min(pos1.getY(), pos2.getY()); int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY())); int xMin = Math.min(pos1.getX(), pos2.getX()); @@ -126,7 +132,7 @@ public abstract class LocalBlockQueue { for (int y = yMin; y <= yMax; y++) { for (int x = xMin; x <= xMax; x++) { for (int z = zMin; z <= zMax; z++) { - setBlock(x, y, z, blocks.getBlock()); + setBlock(x, y, z, blocks); } } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java index d0a561111..37ac7fe5c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java @@ -1,5 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; public class OffsetLocalBlockQueue extends DelegateLocalBlockQueue { @@ -14,7 +15,7 @@ public class OffsetLocalBlockQueue extends DelegateLocalBlockQueue { this.oz = oz; } - @Override public boolean setBiome(int x, int y, String biome) { + @Override public boolean setBiome(int x, int y, BiomeType biome) { return super.setBiome(ox + x, oy + y, biome); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java index 416a2c36e..6a0e375c5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java @@ -6,6 +6,7 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -38,11 +39,11 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { } - @Override public boolean setBiome(int x, int z, String biome) { + @Override public boolean setBiome(int x, int z, BiomeType biome) { return x >= 0 && x <= dx && z >= 0 && z <= dz && super.setBiome(x + minX, z + minZ, biome); } - public void fillBiome(String biome) { + public void fillBiome(BiomeType biome) { for (int x = 0; x <= dx; x++) { for (int z = 0; z < dz; z++) { setBiome(x, z, biome); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/OperationUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/OperationUtil.java index 05b969065..2cb336f52 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/OperationUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/OperationUtil.java @@ -1,11 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.util.world; 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.util.TaskManager; import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java new file mode 100644 index 000000000..381cfc7f1 --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java @@ -0,0 +1,66 @@ +package com.github.intellectualsites.plotsquared.plot.util.world; + +import com.github.intellectualsites.plotsquared.commands.Command; +import com.github.intellectualsites.plotsquared.plot.config.Captions; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.RandomPattern; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; + +public class PatternUtil { + public static BaseBlock apply(Pattern pattern, int x, int y, int z) { + if (pattern instanceof BlockPattern + || pattern instanceof RandomPattern + || pattern instanceof BlockState + || pattern instanceof BlockType + || pattern instanceof BaseBlock) { + return pattern.apply(BlockVector3.ZERO); + } + return pattern.apply(BlockVector3.at(x, y, z)); + } + + public static Pattern parse(PlotPlayer plotPlayer, String input) { + Actor actor = plotPlayer.toActor(); + ParserContext context = new ParserContext(); + context.setActor(actor); + if (actor instanceof Player) { + context.setWorld(((Player) actor).getWorld()); + } + context.setSession(WorldEdit.getInstance().getSessionManager().get(actor)); + context.setRestricted(true); + context.setPreferringWildcard(false); + context.setTryLegacy(true); + try { + Pattern pattern = + WorldEdit.getInstance().getPatternFactory().parseFromInput(input, context); + return pattern; + } catch (InputParseException e) { + throw new Command.CommandException(Captions.NOT_VALID_BLOCK, e.getMessage()); + } + } + + public static boolean isAir(Pattern pattern) { + if (pattern instanceof BlockPattern) { + return ((BlockPattern) pattern).getBlock().getBlockType().getMaterial().isAir(); + } + if (pattern instanceof BlockState) { + return ((BlockState) pattern).getBlockType().getMaterial().isAir(); + } + if (pattern instanceof BlockType) { + return ((BlockType) pattern).getMaterial().isAir(); + } + if (pattern instanceof BaseBlock) { + return ((BaseBlock) pattern).getBlockType().getMaterial().isAir(); + } + return false; + } +} From d34f5cc97eede3e172d21d21b3e65fd49584b9a1 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 18:32:32 +0000 Subject: [PATCH 197/258] Config reading/writing --- .../plotsquared/plot/commands/Area.java | 8 +- .../plot/config/Configuration.java | 62 +---- .../plot/generator/ClassicPlotManager.java | 63 ++--- .../plot/generator/ClassicPlotWorld.java | 25 +- .../plotsquared/plot/generator/HybridGen.java | 18 +- .../plot/generator/HybridPlotManager.java | 4 +- .../plotsquared/plot/object/BlockBucket.java | 233 ++++++------------ .../plotsquared/plot/object/Plot.java | 3 +- .../plot/util/world/PatternUtil.java | 16 +- 9 files changed, 148 insertions(+), 284 deletions(-) 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 11134d2ca..e21c82f7f 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 @@ -209,20 +209,20 @@ import java.util.Set; break; case "f": case "floor": - pa.TOP_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]).getPattern(); + pa.TOP_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]); break; case "m": case "main": - pa.MAIN_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]).getPattern(); + pa.MAIN_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]); break; case "w": case "wall": pa.WALL_FILLING = - Configuration.BLOCK_BUCKET.parseString(pair[1]).getPattern(); + Configuration.BLOCK_BUCKET.parseString(pair[1]); break; case "b": case "border": - pa.WALL_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]).getPattern(); + pa.WALL_BLOCK = Configuration.BLOCK_BUCKET.parseString(pair[1]); break; case "terrain": pa.TERRAIN = Integer.parseInt(pair[1]); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index a1aedc478..aba85f3f8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.config; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockState; @@ -10,7 +11,6 @@ import lombok.Getter; import lombok.NonNull; import java.util.regex.Matcher; -import java.util.regex.Pattern; /** * Main Configuration Utility @@ -62,67 +62,19 @@ public class Configuration { public static final SettingValue BLOCK_BUCKET = new SettingValue("BLOCK_BUCKET") { - private Pattern pattern = Pattern.compile("((?[A-Za-z_]+):)?(?([A-Za-z_]+(\\[?[\\S\\s]+\\])?))(:(?[0-9]{1,3}))?"); - @Override public BlockBucket parseString(final String string) { - if (string == null || string.isEmpty()) { - return new BlockBucket(); - } - final BlockBucket blockBucket = new BlockBucket(); - final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); - for (final String part : parts) { - Matcher matcher = pattern.matcher(part); - matcher.find(); - String namespace = matcher.group("namespace"); - String block = matcher.group("block"); - String chanceStr = matcher.group("chance"); - if (namespace == null) namespace = "minecraft"; - int chance = chanceStr == null ? -1 : Integer.parseInt(chanceStr); - final StringComparison.ComparisonResult value = - WorldUtil.IMP.getClosestBlock(block); - if (value == null) { - throw new UnknownBlockException(block); - } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.getBlockType().getMaterial().isAir() - && !WorldUtil.IMP.isBlockSolid(value.best)) { - throw new UnsafeBlockException(value.best); - } - blockBucket.addBlock(value.best, chance); - } - blockBucket.compile(); // Pre-compile :D - return blockBucket; + BlockBucket bucket = new BlockBucket(string); + bucket.compile(); + Pattern pattern = bucket.toPattern(); + return pattern != null ? bucket : null; } @Override public boolean validateValue(final String string) { try { - if (string == null || string.isEmpty()) { - return false; - } - final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); - for (final String part : parts) { - Matcher matcher = pattern.matcher(part); - matcher.find(); - String namespace = matcher.group("namespace"); - String block = matcher.group("block"); - String chanceStr = matcher.group("chance"); - if (namespace == null) namespace = "minecraft"; - int chance = chanceStr == null ? -1 : Integer.parseInt(chanceStr); - - if ((chance != -1 && (chance < 1 || chance > 100)) || block == null) { - return false; - } - StringComparison.ComparisonResult value = - WorldUtil.IMP.getClosestBlock(block); - if (value == null || value.match > 1) { - return false; - } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.getBlockType().getMaterial().isAir() - && !WorldUtil.IMP.isBlockSolid(value.best)) { - throw new UnsafeBlockException(value.best); - } - } - } catch (final Throwable exception) { + return parseString(string) != null; + } catch (Exception e) { return false; } - return true; } }; 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 a06fbceca..42ebd5c3d 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,6 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.config.Settings; +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; @@ -52,9 +53,9 @@ public class ClassicPlotManager extends SquarePlotManager { } @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { - setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING); - if (!isAir(classicPlotWorld.WALL_BLOCK) || !classicPlotWorld.WALL_BLOCK.equals(classicPlotWorld.CLAIMED_WALL_BLOCK)) { - setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); + setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING.toPattern()); + if (!classicPlotWorld.WALL_BLOCK.isAir() || !classicPlotWorld.WALL_BLOCK.equals(classicPlotWorld.CLAIMED_WALL_BLOCK)) { + setWall(plot.getId(), classicPlotWorld.WALL_BLOCK.toPattern()); } return GlobalBlockQueue.IMP.addEmptyTask(whenDone); } @@ -292,15 +293,15 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 0, sz + 1), new Location(classicPlotWorld.worldname, ex, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), - new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING); + new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), - new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK); + new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, ex, 1, sz + 1), - new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING); + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), - new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK); + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern()); return queue.enqueue(); } @@ -320,15 +321,15 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz), new Location(classicPlotWorld.worldname, ex - 1, 0, ez), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT, sz), classicPlotWorld.WALL_FILLING); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT, sz), classicPlotWorld.WALL_FILLING.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, sz), classicPlotWorld.WALL_BLOCK); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, sz), classicPlotWorld.WALL_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, ez), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT, ez), classicPlotWorld.WALL_FILLING); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT, ez), classicPlotWorld.WALL_FILLING.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.WALL_HEIGHT + 1, ez), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern()); return queue.enqueue(); } @@ -346,7 +347,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex - 1, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern()); return queue.enqueue(); } @@ -364,9 +365,9 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), - new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK); + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), - new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), classicPlotWorld.TOP_BLOCK); + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), classicPlotWorld.TOP_BLOCK.toPattern()); return queue.enqueue(); } @@ -384,9 +385,9 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), - new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); + new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK.toPattern()); return queue.enqueue(); } @@ -401,9 +402,9 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz), - new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz), - new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT, ez), classicPlotWorld.TOP_BLOCK.toPattern()); return queue.enqueue(); } @@ -413,26 +414,26 @@ public class ClassicPlotManager extends SquarePlotManager { * @return false if part of the merge failed, otherwise true if successful. */ @Override public boolean finishPlotMerge(List plotIds) { - final Pattern claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - if (!isAir(claim) || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { for (PlotId plotId : plotIds) { - setWall(plotId, claim); + setWall(plotId, claim.toPattern()); } } if (Settings.General.MERGE_REPLACE_WALL) { - final Pattern wallBlock = classicPlotWorld.WALL_FILLING; + final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING; for (PlotId id : plotIds) { - setWallFilling(id, wallBlock); + setWallFilling(id, wallBlock.toPattern()); } } return true; } @Override public boolean finishPlotUnlink(List plotIds) { - final Pattern claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - if (!isAir(claim) || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { for (PlotId id : plotIds) { - setWall(id, claim); + setWall(id, claim.toPattern()); } } return true; // return false if unlink has been denied @@ -447,9 +448,9 @@ public class ClassicPlotManager extends SquarePlotManager { } @Override public boolean claimPlot(Plot plot) { - final Pattern claim = classicPlotWorld.CLAIMED_WALL_BLOCK; - if (!isAir(claim) || !claim.equals(classicPlotWorld.WALL_BLOCK)) { - return setWall(plot.getId(), claim); + final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; + if (!claim.isAir() || !claim.equals(classicPlotWorld.WALL_BLOCK)) { + return setWall(plot.getId(), claim.toPattern()); } return true; } 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 46af0e43c..abb95d99a 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 @@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; +import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.worldedit.function.pattern.BlockPattern; @@ -20,17 +21,17 @@ import java.util.Locale; public int ROAD_HEIGHT = 62; public int PLOT_HEIGHT = 62; public int WALL_HEIGHT = 62; - public Pattern MAIN_BLOCK = new BlockPattern(BlockTypes.STONE.getDefaultState()); + public BlockBucket MAIN_BLOCK = new BlockBucket(BlockTypes.STONE); // new BlockState[] {BlockUtil.get("stone")}; - public Pattern TOP_BLOCK = new BlockPattern(BlockTypes.GRASS_BLOCK.getDefaultState()); + public BlockBucket TOP_BLOCK = new BlockBucket(BlockTypes.GRASS_BLOCK); //new BlockState[] {BlockUtil.get("grass")}; - public Pattern WALL_BLOCK = new BlockPattern(BlockTypes.STONE_SLAB.getDefaultState()); + public BlockBucket WALL_BLOCK = new BlockBucket(BlockTypes.STONE_SLAB); // BlockUtil.get((short) 44, (byte) 0); - public Pattern CLAIMED_WALL_BLOCK = new BlockPattern(BlockTypes.SANDSTONE_SLAB.getDefaultState()); + public BlockBucket CLAIMED_WALL_BLOCK = new BlockBucket(BlockTypes.SANDSTONE_SLAB); // BlockUtil.get((short) 44, (byte) 1); - public Pattern WALL_FILLING = new BlockPattern(BlockTypes.STONE.getDefaultState()); + public BlockBucket WALL_FILLING = new BlockBucket(BlockTypes.STONE); //BlockUtil.get((short) 1, (byte) 0); - public Pattern ROAD_BLOCK = new BlockPattern(BlockTypes.QUARTZ_BLOCK.getDefaultState()); + public BlockBucket ROAD_BLOCK = new BlockBucket(BlockTypes.QUARTZ_BLOCK); // BlockUtil.get((short) 155, (byte) 0); public boolean PLOT_BEDROCK = true; @@ -83,16 +84,16 @@ import java.util.Locale; super.loadConfiguration(config); this.PLOT_BEDROCK = config.getBoolean("plot.bedrock"); this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height")); - this.MAIN_BLOCK = new BlockPattern(BlockUtil.get(config.getString("plot.filling"))); - this.TOP_BLOCK = new BlockPattern(BlockUtil.get(config.getString("plot.floor"))); - this.WALL_BLOCK = new BlockPattern(BlockUtil.get(config.getString("wall.block"))); + this.MAIN_BLOCK = new BlockBucket(BlockUtil.get(config.getString("plot.filling"))); + this.TOP_BLOCK = new BlockBucket(BlockUtil.get(config.getString("plot.floor"))); + this.WALL_BLOCK = new BlockBucket(BlockUtil.get(config.getString("wall.block"))); this.ROAD_HEIGHT = Math.min(255, config.getInt("road.height")); - this.ROAD_BLOCK = new BlockPattern(BlockUtil.get(config.getString("road.block"))); + this.ROAD_BLOCK = new BlockBucket(BlockUtil.get(config.getString("road.block"))); this.WALL_FILLING = - new BlockPattern(BlockUtil.get(config.getString("wall.filling"))); + new BlockBucket(BlockUtil.get(config.getString("wall.filling"))); this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height")); this.CLAIMED_WALL_BLOCK = - new BlockPattern(BlockUtil.get(config.getString("wall.block_claimed"))); + new BlockBucket(BlockUtil.get(config.getString("wall.block_claimed"))); // Dump world settings if (Settings.DEBUG) { 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 1910fc07e..7fbf5c0ae 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 @@ -96,7 +96,7 @@ public class HybridGen extends IndependentPlotGenerator { for (short z = 0; z < 16; z++) { // Road for (int y = 1; y <= hpw.ROAD_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.ROAD_BLOCK); + result.setBlock(x, y, z, hpw.ROAD_BLOCK.toPattern()); } if (hpw.ROAD_SCHEMATIC_ENABLED) { placeSchem(hpw, result, rx[x], rz[z], x, z, true); @@ -107,7 +107,7 @@ public class HybridGen extends IndependentPlotGenerator { if (gz[z]) { // road for (int y = 1; y <= hpw.ROAD_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.ROAD_BLOCK); + result.setBlock(x, y, z, hpw.ROAD_BLOCK.toPattern()); } if (hpw.ROAD_SCHEMATIC_ENABLED) { placeSchem(hpw, result, rx[x], rz[z], x, z, true); @@ -115,10 +115,10 @@ public class HybridGen extends IndependentPlotGenerator { } else { // wall for (int y = 1; y <= hpw.WALL_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.WALL_FILLING); + result.setBlock(x, y, z, hpw.WALL_FILLING.toPattern()); } if (!hpw.ROAD_SCHEMATIC_ENABLED) { - result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK); + result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK.toPattern()); } else { placeSchem(hpw, result, rx[x], rz[z], x, z, true); } @@ -129,7 +129,7 @@ public class HybridGen extends IndependentPlotGenerator { if (gz[z]) { // road for (int y = 1; y <= hpw.ROAD_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.ROAD_BLOCK); + result.setBlock(x, y, z, hpw.ROAD_BLOCK.toPattern()); } if (hpw.ROAD_SCHEMATIC_ENABLED) { placeSchem(hpw, result, rx[x], rz[z], x, z, true); @@ -137,19 +137,19 @@ public class HybridGen extends IndependentPlotGenerator { } else if (wz[z]) { // wall for (int y = 1; y <= hpw.WALL_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.WALL_FILLING); + result.setBlock(x, y, z, hpw.WALL_FILLING.toPattern()); } if (!hpw.ROAD_SCHEMATIC_ENABLED) { - result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK); + result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK.toPattern()); } else { placeSchem(hpw, result, rx[x], rz[z], x, z, true); } } else { // plot for (int y = 1; y < hpw.PLOT_HEIGHT; y++) { - result.setBlock(x, y, z, hpw.MAIN_BLOCK); + result.setBlock(x, y, z, hpw.MAIN_BLOCK.toPattern()); } - result.setBlock(x, hpw.PLOT_HEIGHT, z, hpw.TOP_BLOCK); + result.setBlock(x, hpw.PLOT_HEIGHT, z, hpw.TOP_BLOCK.toPattern()); if (hpw.PLOT_SCHEMATIC) { placeSchem(hpw, result, rx[x], rz[z], x, z, false); } 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 06550a3cb..e6c165029 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 @@ -174,8 +174,8 @@ public class HybridPlotManager extends ClassicPlotManager { final boolean canRegen = (hybridPlotWorld.TYPE == 0) && (hybridPlotWorld.TERRAIN == 0) && REGENERATIVE_CLEAR; // The component blocks - final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK; - final Pattern filling = hybridPlotWorld.MAIN_BLOCK; + final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern(); + final Pattern filling = hybridPlotWorld.MAIN_BLOCK.toPattern(); final BlockState bedrock; if (hybridPlotWorld.PLOT_BEDROCK) { bedrock = BlockUtil.get((short) 7, (byte) 0); 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 8a4e784b3..a74c66317 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 @@ -2,54 +2,56 @@ package com.github.intellectualsites.plotsquared.plot.object; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; import com.github.intellectualsites.plotsquared.plot.config.Configuration; -import com.github.intellectualsites.plotsquared.plot.object.collection.RandomCollection; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil; import com.google.common.collect.ImmutableMap; -import com.sk89q.worldedit.extent.NullExtent; -import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.RandomPattern; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.BlockType; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.RequiredArgsConstructor; -import org.jetbrains.annotations.NotNull; 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.Map.Entry; -import java.util.Random; -import java.util.stream.Collectors; +import java.util.regex.Matcher; /** * A block bucket is a container of block types, where each block * has a specified chance of being randomly picked */ -@EqualsAndHashCode(of={"blocks"}) @SuppressWarnings({"unused", "WeakerAccess"}) public final class BlockBucket - implements Iterable, ConfigurationSerializable { +@EqualsAndHashCode(of={"input"}) @SuppressWarnings({"unused", "WeakerAccess"}) +public final class BlockBucket implements ConfigurationSerializable { + private boolean compiled; - private final Random random = new Random(); - private final Map blocks; - - private final BucketIterator bucketIterator = new BucketIterator(); - private boolean compiled, singleItem; - private BlockState head; - - private RandomCollection randomBlocks; + private StringBuilder input; private BlockState single; private Pattern pattern; - private BlockMask mask; + + public BlockBucket(BlockType type) { + this(type.getId()); + this.single = type.getDefaultState(); + this.pattern = new BlockPattern(this.single); + this.compiled = true; + } + + public BlockBucket(BlockState state) { + this(state.getAsString()); + this.single = state; + this.pattern = new BlockPattern(this.single); + this.compiled = true; + } + + public BlockBucket(String input) { + this.input = new StringBuilder(input); + } public BlockBucket() { - this.blocks = new HashMap<>(); + this.input = new StringBuilder(); } public static BlockBucket withSingle(@NonNull final BlockState block) { @@ -74,158 +76,75 @@ import java.util.stream.Collectors; } private void addBlock(@NonNull final BlockState block, double chance) { - if (chance == -1) - chance = 1; - this.blocks.put(block, chance); + if (chance == -1) chance = 1; + String prefix = input.length() == 0 ? "" : ","; + input.append(prefix).append(chance + "%" + prefix); this.compiled = false; - if (head == null) { - head = block; - } } public boolean isEmpty() { - return blocks.isEmpty(); + return input == null || input.length() == 0; } - /** - * Get all blocks that are configured in the bucket - * - * @return Immutable collection containing all blocks that can - * be found in the bucket - */ - public Collection getBlocks() { - this.compile(); - return Collections.unmodifiableCollection(this.blocks.keySet()); - } - - /** - * Get a collection containing a specified amount of randomly selected blocks - * - * @param count Number of blocks - * @return Immutable collection containing randomly selected blocks - */ - public Collection getBlocks(final int count) { - return Arrays.asList(getBlockArray(count)); - } - - /** - * Get an array containing a specified amount of randomly selected blocks - * - * @param count Number of blocks - * @return Immutable collection containing randomly selected blocks - */ - public BlockState[] getBlockArray(final int count) { - final BlockState[] blocks = new BlockState[count]; - if (this.singleItem) { - Arrays.fill(blocks, 0, count, getBlock()); - } else { - for (int i = 0; i < count; i++) { - blocks[i] = getBlock(); - } - } - return blocks; - } - - public boolean hasSingleItem() { - return this.singleItem; - } + private static java.util.regex.Pattern regex = java.util.regex.Pattern.compile("((?[A-Za-z_]+):)?(?([A-Za-z_]+(\\[?[\\S\\s]+\\])?))(:(?[0-9]{1,3}))?"); public void compile() { if (isCompiled()) { return; } this.compiled = true; - switch (blocks.size()) { - case 0: - single = null; - this.randomBlocks = null; - this.pattern = null; - this.mask = new BlockMask(new NullExtent()); - break; - case 1: - single = blocks.keySet().iterator().next(); - this.randomBlocks = null; - this.pattern = new BlockPattern(single); - this.mask = new BlockMask(new NullExtent(), single.toBaseBlock()); - break; - default: - single = null; - this.randomBlocks = RandomCollection.of(blocks, random); - RandomPattern randomPattern = new RandomPattern(); - for (Entry entry : this.blocks.entrySet()) { - randomPattern.add(new BlockPattern(entry.getKey()), entry.getValue()); - } - this.pattern = randomPattern; - List baseBlocks = getBlocks().stream().map(BlockState::toBaseBlock) - .collect(Collectors.toList()); - this.mask = new BlockMask(new NullExtent(), baseBlocks); - break; + String string = this.input.toString(); + if (string.isEmpty()) { + this.single = null; + this.pattern = null; + return; } - } - - @NotNull @Override public Iterator iterator() { - return this.bucketIterator; + // Convert legacy format + boolean legacy = false; + String[] blocksStr = string.split(",(?![^\\(\\[]*[\\]\\)])"); + if (blocksStr.length == 1) { + try { + this.single = BlockUtil.get(string); + this.pattern = new BlockPattern(single); + return; + } catch (Exception ignore) {} + } + for (int i = 0; i < blocksStr.length; i++) { + String entry = blocksStr[i]; + Matcher matcher = regex.matcher(entry); + if (matcher.find()) { + String chanceStr = matcher.group("chance"); + if (chanceStr != null && MathMan.isInteger(chanceStr)) { + String[] parts = entry.split(":"); + parts = Arrays.copyOf(parts, parts.length - 1); + entry = chanceStr + "%" + StringMan.join(parts, ":"); + blocksStr[i] = entry; + legacy = true; + } + } + } + if (legacy) { + string = StringMan.join(blocksStr, ","); + } + pattern = PatternUtil.parse(null, string); } public boolean isCompiled() { return this.compiled; } - /** - * Get a random block out of the bucket - * - * @return Randomly picked block (cased on specified rates) - */ - public BlockState getBlock() { - if (!isCompiled()) { - this.compile(); - } - if (single != null) { - return single; - } - if (randomBlocks != null) { - return randomBlocks.next(); - } - return BlockTypes.AIR.getDefaultState(); - } - - public Pattern getPattern() { + public Pattern toPattern() { this.compile(); return this.pattern; } - public BlockMask getMask() { - this.compile(); - return this.mask; - } - @Override public String toString() { - if (!isCompiled()) { - compile(); - } - if (blocks.size() == 1) { - return blocks.entrySet().iterator().next().getKey().toString(); - } - final StringBuilder builder = new StringBuilder(); - Iterator> iterator = blocks.entrySet().iterator(); - while (iterator.hasNext()) { - Entry entry = iterator.next(); - BlockState block = entry.getKey(); - builder.append(block); - Double weight = entry.getValue(); - if (weight != 1) { - builder.append(":").append(weight.intValue()); - } - if (iterator.hasNext()) { - builder.append(","); - } - } - return builder.toString(); + return input.toString(); } public boolean isAir() { compile(); - return blocks.isEmpty() || (single != null && single.getBlockType().getMaterial().isAir()); + return isEmpty() || (single != null && single.getBlockType().getMaterial().isAir()); } @Override public Map serialize() { @@ -249,16 +168,4 @@ import java.util.stream.Collectors; return num <= max && num >= min; } } - - - private final class BucketIterator implements Iterator { - - @Override public boolean hasNext() { - return true; - } - - @Override public BlockState next() { - return getBlock(); - } - } } 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 65bb23809..f14c21609 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 @@ -26,7 +26,6 @@ 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.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; -import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil; import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; @@ -1597,7 +1596,7 @@ public class Plot { if (parsed != null && parsed.isEmpty()) { return false; } - return this.setComponent(component, parsed.getPattern()); + return this.setComponent(component, parsed.toPattern()); } /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java index 381cfc7f1..4d3107eb0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java @@ -29,14 +29,18 @@ public class PatternUtil { } public static Pattern parse(PlotPlayer plotPlayer, String input) { - Actor actor = plotPlayer.toActor(); ParserContext context = new ParserContext(); - context.setActor(actor); - if (actor instanceof Player) { - context.setWorld(((Player) actor).getWorld()); + if (plotPlayer != null) { + Actor actor = plotPlayer.toActor(); + context.setActor(actor); + if (actor instanceof Player) { + context.setWorld(((Player) actor).getWorld()); + } + context.setSession(WorldEdit.getInstance().getSessionManager().get(actor)); + context.setRestricted(true); + } else { + context.setRestricted(false); } - context.setSession(WorldEdit.getInstance().getSessionManager().get(actor)); - context.setRestricted(true); context.setPreferringWildcard(false); context.setTryLegacy(true); try { From bf4d953f3c7b9cc6e285572140145a77831fb5f9 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 18:49:31 +0000 Subject: [PATCH 198/258] No need to convert to a BlockState here --- .../plotsquared/plot/generator/ClassicPlotWorld.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 abb95d99a..00ec5dd7f 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 @@ -84,16 +84,16 @@ import java.util.Locale; super.loadConfiguration(config); this.PLOT_BEDROCK = config.getBoolean("plot.bedrock"); this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height")); - this.MAIN_BLOCK = new BlockBucket(BlockUtil.get(config.getString("plot.filling"))); - this.TOP_BLOCK = new BlockBucket(BlockUtil.get(config.getString("plot.floor"))); - this.WALL_BLOCK = new BlockBucket(BlockUtil.get(config.getString("wall.block"))); + this.MAIN_BLOCK = new BlockBucket(config.getString("plot.filling")); + this.TOP_BLOCK = new BlockBucket(config.getString("plot.floor")); + this.WALL_BLOCK = new BlockBucket(config.getString("wall.block")); this.ROAD_HEIGHT = Math.min(255, config.getInt("road.height")); - this.ROAD_BLOCK = new BlockBucket(BlockUtil.get(config.getString("road.block"))); + this.ROAD_BLOCK = new BlockBucket(config.getString("road.block")); this.WALL_FILLING = - new BlockBucket(BlockUtil.get(config.getString("wall.filling"))); + new BlockBucket(config.getString("wall.filling")); this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height")); this.CLAIMED_WALL_BLOCK = - new BlockBucket(BlockUtil.get(config.getString("wall.block_claimed"))); + new BlockBucket(config.getString("wall.block_claimed")); // Dump world settings if (Settings.DEBUG) { From 968c23113cc2681a26fad13336af8ecb6519c8ce Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 21:51:29 +0000 Subject: [PATCH 199/258] Fixes #2412 --- .../bukkit/listeners/PlayerEvents.java | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) 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 721121ba0..c66d9fa1a 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 @@ -768,38 +768,32 @@ import java.util.regex.Pattern; @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onTeleport(PlayerTeleportEvent event) { - final Object lastLoc = - BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION); - final Object lastPlot = - BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT); + Player player = event.getPlayer(); + PlotPlayer pp = BukkitUtil.getPlayer(player); + Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); org.bukkit.Location to = event.getTo(); if (to != null) { - Player player = event.getPlayer(); - PlotPlayer plotPlayer = PlotPlayer.wrap(player); Location location = BukkitUtil.getLocation(to); PlotArea area = location.getPlotArea(); if (area == null) { + if (lastPlot != null) { + plotExit(pp, lastPlot); + pp.deleteMeta(PlotPlayer.META_LAST_PLOT); + } + pp.deleteMeta(PlotPlayer.META_LOCATION); return; } Plot plot = area.getPlot(location); if (plot != null) { - final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); + final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot); // there is one possibility to still allow teleportation: // to is identical to the plot's home location, and untrusted-visit is true // i.e. untrusted-visit can override deny-teleport // this is acceptable, because otherwise it wouldn't make sense to have both flags set if (!result && !(Flags.UNTRUSTED_VISIT.isTrue(plot) && plot.getHome().equals(BukkitUtil.getLocationFull(to)))) { - MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_ENTRY_DENIED); event.setCancelled(true); - if (lastLoc != null) { - plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc); - } - if (lastPlot != null) { - plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); - } - } else { - plotEntry(plotPlayer, plot); } } } @@ -1198,8 +1192,8 @@ import java.util.regex.Pattern; Player player = event.getPlayer(); PlotPlayer pp = BukkitUtil.getPlayer(player); // Delete last location - pp.deleteMeta(PlotPlayer.META_LOCATION); Plot plot = (Plot) pp.deleteMeta(PlotPlayer.META_LAST_PLOT); + pp.deleteMeta(PlotPlayer.META_LOCATION); if (plot != null) { plotExit(pp, plot); } From f797141a298dc38b129976bcd072e32277acd220 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 22:08:03 +0000 Subject: [PATCH 200/258] Update Plot.java --- .../github/intellectualsites/plotsquared/plot/object/Plot.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f14c21609..e6d2a4dd6 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 @@ -2724,7 +2724,7 @@ public class Plot { } } } - BlockVector3 pos1 = BlockVector3.at(gbotabs.getX() + 1, 0, gbotabs.getZ()); + BlockVector3 pos1 = BlockVector3.at(gbotabs.getX(), 0, gbotabs.getZ()); BlockVector3 pos2 = BlockVector3.at(gtopabs.getX(), Plot.MAX_HEIGHT - 1, gtopabs.getZ()); regions.add( new CuboidRegion(pos1, pos2)); From 55d6217c3222aa579f7d0d408ecdcf4647069c28 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 11 Nov 2019 19:44:51 +0000 Subject: [PATCH 201/258] Check if WORLDEDIT_RESTRICTIONS is enabled Unregister if disabled. --- .../plotsquared/plot/listener/WESubscriber.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java index 9991e8286..753ec2a20 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java @@ -23,8 +23,7 @@ import java.util.Set; public class WESubscriber { @Subscribe(priority = Priority.VERY_EARLY) public void onEditSession(EditSessionEvent event) { - WorldEdit worldedit = PlotSquared.get().worldedit; - if (worldedit == null) { + if (!Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { WorldEdit.getInstance().getEventBus().unregister(this); return; } From 7d7414ebb9f8dd159db5acd4f60a10a6bf0d52ed Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 11 Nov 2019 19:47:26 +0000 Subject: [PATCH 202/258] Fix for single chance parsing --- .../plotsquared/plot/object/BlockBucket.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 a74c66317..c50fddbc3 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 @@ -104,6 +104,15 @@ public final class BlockBucket implements ConfigurationSerializable { String[] blocksStr = string.split(",(?![^\\(\\[]*[\\]\\)])"); if (blocksStr.length == 1) { try { + Matcher matcher = regex.matcher(string); + if (matcher.find()) { + String chanceStr = matcher.group("chance"); + String block = matcher.group("block"); + if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan.isInteger(chanceStr)) { + String namespace = matcher.group("namespace"); + string = (namespace == null ? "" : namespace + ":") + block; + } + } this.single = BlockUtil.get(string); this.pattern = new BlockPattern(single); return; From b02565532f1f5f198288d24f6805b4600f350006 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 11 Nov 2019 21:38:44 +0100 Subject: [PATCH 203/258] Update template checkbox --- .../bug-issue-report-for-plotsquared.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md index a3399ecdb..f2ea869d3 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -41,17 +41,17 @@ assignees: '' ### Server type: **select one** -- [ ] Spigot / Paper *(CraftBukkit should not be used, re-test with Spigot first!)* -- [ ] Sponge *- NOTE: NOT ACTIVELY MAINTAINED* -- [ ] NukkitX *- NOTE: NOT ACTIVELY MAINTAINED* +- [] Spigot / Paper *(CraftBukkit should not be used, re-test with Spigot first!)* +- [] Sponge *- NOTE: NOT ACTIVELY MAINTAINED* +- [] NukkitX *- NOTE: NOT ACTIVELY MAINTAINED* ### Minecraft Version: **select one** -- [ ] Minecraft 1.14.4 ***This is the ONLY actively maintained target for PlotSquared*** -- [ ] Minecraft 1.13.2 -- [ ] Minecraft Java Edition *other versions, please specify*: -- [ ] Minecraft Bedrock Edition *speicify version*: +- [] Minecraft 1.14.4 ***This is the ONLY actively maintained target for PlotSquared*** +- [] Minecraft 1.13.2 +- [] Minecraft Java Edition *other versions, please specify*: +- [] Minecraft Bedrock Edition *speicify version*: ### Server build info: @@ -59,8 +59,8 @@ assignees: '' ### WorldEdit/FAWE versions: -- [ ] FAWE *version*: -- [ ] WorldEdit *version*: +- [] FAWE *version*: +- [] WorldEdit *version*: ### Description of the problem: @@ -83,8 +83,8 @@ assignees: '' # AFFIRMATION OF COMPLETION: -- [ ] I included all information required in the sections above -- [ ] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) -- [ ] I made sure I am using an up-to-date version of PlotSquared -- [ ] I made sure the bug/error is not caused by any other plugin +- [] I included all information required in the sections above +- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) +- [] I made sure I am using an up-to-date version of PlotSquared +- [] I made sure the bug/error is not caused by any other plugin - [x] I didn't read but checked everything above. From 1a2c15684e61df100e98e5ec679e12a46e7f1959 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 11 Nov 2019 21:39:27 +0100 Subject: [PATCH 204/258] Fixed typo --- .github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md index f2ea869d3..aa5349430 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -51,7 +51,7 @@ assignees: '' - [] Minecraft 1.14.4 ***This is the ONLY actively maintained target for PlotSquared*** - [] Minecraft 1.13.2 - [] Minecraft Java Edition *other versions, please specify*: -- [] Minecraft Bedrock Edition *speicify version*: +- [] Minecraft Bedrock Edition *specify version*: ### Server build info: From 5bb7069c7f7776922756f33865c82fae3cf3e67b Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 11 Nov 2019 20:39:28 +0000 Subject: [PATCH 205/258] Fixes #2571 --- .../plotsquared/bukkit/util/BukkitInventoryUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java index a5a64b307..303b180e5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -5,6 +5,7 @@ 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.util.InventoryUtil; +import com.sk89q.worldedit.bukkit.BukkitAdapter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -56,7 +57,7 @@ public class BukkitInventoryUtil extends InventoryUtil { if (item == null) { return null; } - ItemStack stack = new ItemStack(BukkitUtil.getMaterial(item.getBlockState()), item.amount); + ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.amount); ItemMeta meta = null; if (item.name != null) { meta = stack.getItemMeta(); From 322e186c4bfad2b499bc2db200d2a3f260af8fe7 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 12 Nov 2019 07:32:05 +0000 Subject: [PATCH 206/258] Ignore invalid blocks --- .../plotsquared/plot/flag/BlockStateListFlag.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java index b9f3367d0..117551488 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java @@ -8,6 +8,7 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import java.util.Arrays; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -22,7 +23,7 @@ public class BlockStateListFlag extends ListFlag> { } @Override public Set parseValue(final String value) { - return Arrays.stream(BlockUtil.parse(value)).map(BlockState::getBlockType).collect(Collectors.toSet()); + return Arrays.stream(BlockUtil.parse(value)).filter(Objects::nonNull).map(BlockState::getBlockType).collect(Collectors.toSet()); } @Override public String getValueDescription() { From 7e211071209ecc07040dfba6259b57fc2ec42332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Tue, 12 Nov 2019 10:20:46 +0100 Subject: [PATCH 207/258] Update README.md Include information about what the project is. The previous README assumed that the reader would already be familiar with the concept, which isn't really ideal for a project description. The added text is taken from the Spigot resource page. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5a23753a2..417f05ab7 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ --- +PlotSquared is a land and world management plugin for Minecraft. +It includes several highly configurable world generators. +You can create plots of land in existing worlds using plot clusters, or you can have a full world of plots. + For the end user, PlotSquared is packed with a tonne of cool features. It allows you to merge plots, and build together with your friends. You can also change a lot of plot specific settings in the form of From 765a021ecdbf86ad3996546ec9d5a67a04d8550d Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 12 Nov 2019 20:38:18 +0000 Subject: [PATCH 208/258] Some flag fixes Use ItemType for the flags, since they accept items, not blocks. Fixes #2571 --- .../bukkit/listeners/PlayerEvents.java | 35 +++---- .../bukkit/object/BukkitBlockUtil.java | 9 +- .../bukkit/object/BukkitPlayer.java | 3 +- .../plotsquared/plot/commands/Music.java | 2 +- .../plotsquared/plot/flag/Flags.java | 6 +- .../plot/flag/ItemTypeListFlag.java | 39 ++++++++ .../plot/listener/PlotListener.java | 4 +- .../plotsquared/plot/util/EventUtil.java | 92 ++++++++++--------- .../plot/util/world/BlockUtil.java | 2 +- .../plotsquared/plot/util/world/ItemUtil.java | 10 ++ .../plotsquared/plot/FlagTest.java | 8 +- 11 files changed, 133 insertions(+), 77 deletions(-) create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java 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 c66d9fa1a..29db0c471 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 @@ -31,6 +31,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.item.ItemType; import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -1099,10 +1100,10 @@ import java.util.regex.Pattern; return; } if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() - .contains(BukkitAdapter.asBlockType(block.getType()))) { + .contains(BukkitAdapter.asItemType(block.getType()))) { return; } if (Permissions @@ -1384,10 +1385,10 @@ import java.util.regex.Pattern; } PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() - .contains(BukkitBlockUtil.get(block)) || Permissions + .contains(BukkitAdapter.asItemType(block.getType())) || Permissions .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { return; } @@ -1914,8 +1915,8 @@ import java.util.regex.Pattern; Location location = BukkitUtil.getLocation(block.getLocation()); Material finalType = type; if (!EventUtil.manager - .checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, () -> BukkitAdapter.asBlockType( - finalType).getDefaultState(), true)) { + .checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, () -> BukkitAdapter.asItemType( + finalType), true)) { event.setCancelled(true); event.setUseItemInHand(Event.Result.DENY); } @@ -1933,14 +1934,14 @@ import java.util.regex.Pattern; return; } PlayerBlockEventType eventType = null; - Supplier lb; + Supplier lazyItem; Location location; Action action = event.getAction(); switch (action) { case PHYSICAL: { eventType = PlayerBlockEventType.TRIGGER_PHYSICAL; Block block = event.getClickedBlock(); - lb = BukkitBlockUtil.supply(block); + lazyItem = BukkitBlockUtil.supplyItem(block); location = BukkitUtil.getLocation(block.getLocation()); break; } @@ -2109,7 +2110,7 @@ import java.util.regex.Pattern; eventType = PlayerBlockEventType.INTERACT_BLOCK; } } - lb = BukkitBlockUtil.supply(block); + lazyItem = BukkitBlockUtil.supplyItem(block); if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK || !player.isSneaking())) { break; @@ -2128,7 +2129,7 @@ import java.util.regex.Pattern; type = offType; } // in the following, lb needs to have the material of the item in hand i.e. type - lb = BukkitBlockUtil.supply(type); + lazyItem = BukkitBlockUtil.supplyItem(type); if (type.isBlock()) { location = BukkitUtil .getLocation(block.getRelative(event.getBlockFace()).getLocation()); @@ -2211,7 +2212,7 @@ import java.util.regex.Pattern; Block block = event.getClickedBlock(); location = BukkitUtil.getLocation(block.getLocation()); eventType = PlayerBlockEventType.BREAK_BLOCK; - lb = BukkitBlockUtil.supply(block); + lazyItem = BukkitBlockUtil.supplyItem(block); break; default: return; @@ -2222,7 +2223,7 @@ import java.util.regex.Pattern; return; } } - if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, lb, true)) { + if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, lazyItem, true)) { event.setCancelled(true); } } @@ -2470,7 +2471,7 @@ import java.util.regex.Pattern; Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(pp.getUUID())) { - if (Flags.USE.contains(plot, BukkitBlockUtil.get(block))) { + if (Flags.USE.contains(plot, BukkitAdapter.asItemType(block.getType()))) { return; } if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -2530,9 +2531,9 @@ import java.util.regex.Pattern; Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> use = plot.getFlag(Flags.USE); + Optional> use = plot.getFlag(Flags.USE); Block block = event.getBlockClicked(); - if (use.isPresent() && use.get().contains(BukkitBlockUtil.get(block))) { + if (use.isPresent() && use.get().contains(BukkitAdapter.asItemType(block.getType()))) { return; } if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -3088,10 +3089,10 @@ import java.util.regex.Pattern; return; } } else if (!plot.isAdded(pp.getUUID())) { - Set place = plot.getFlag(Flags.PLACE, null); + Set place = plot.getFlag(Flags.PLACE, null); if (place != null) { Block block = event.getBlock(); - if (place.contains(BukkitBlockUtil.get(block))) { + if (place.contains(BukkitAdapter.asItemType(block.getType()))) { return; } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java index 1730ebd51..bd86b5068 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java @@ -2,18 +2,19 @@ package com.github.intellectualsites.plotsquared.bukkit.object; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; import org.bukkit.Material; import org.bukkit.block.Block; import java.util.function.Supplier; public class BukkitBlockUtil { - public static Supplier supply(Block block) { - return () -> BukkitAdapter.asBlockType(block.getType()).getDefaultState(); + public static Supplier supplyItem(Block block) { + return () -> BukkitAdapter.asItemType(block.getType()); } - public static Supplier supply(Material type) { - return () -> BukkitAdapter.asBlockType(type).getDefaultState(); + public static Supplier supplyItem(Material type) { + return () -> BukkitAdapter.asItemType(type); } public static BlockState get(Block block) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index f09ecb968..5ee2960ca 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import io.papermc.lib.PaperLib; import org.bukkit.GameMode; import org.bukkit.Sound; @@ -283,7 +284,7 @@ public class BukkitPlayer extends PlotPlayer { } @Override public void playMusic(@NotNull final Location location, @NotNull final ItemType id) { - if (id.getBlockType().getMaterial().isAir()) { + if (id == ItemTypes.AIR) { // Let's just stop all the discs because why not? for (final Sound sound : Arrays.stream(Sound.values()) .filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java index e60ee9ba1..482a1f050 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java @@ -44,7 +44,7 @@ import java.util.Locale; plot.removeFlag(Flags.MUSIC); Captions.FLAG_REMOVED.send(player); } else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) { - plot.setFlag(Flags.MUSIC, item); + plot.setFlag(Flags.MUSIC, item.getType().getId()); Captions.FLAG_ADDED.send(player); } else { Captions.FLAG_NOT_ADDED.send(player); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index 6df44dca7..3347fad8b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -58,9 +58,9 @@ public final class Flags { public static final BooleanFlag BLOCK_IGNITION = new BooleanFlag("block-ignition"); public static final BooleanFlag SOIL_DRY = new BooleanFlag("soil-dry"); public static final StringListFlag BLOCKED_CMDS = new StringListFlag("blocked-cmds"); - public static final BlockStateListFlag USE = new BlockStateListFlag("use"); - public static final BlockStateListFlag BREAK = new BlockStateListFlag("break"); - public static final BlockStateListFlag PLACE = new BlockStateListFlag("place"); + public static final ItemTypeListFlag USE = new ItemTypeListFlag("use"); + public static final ItemTypeListFlag BREAK = new ItemTypeListFlag("break"); + public static final ItemTypeListFlag PLACE = new ItemTypeListFlag("place"); public static final BooleanFlag DEVICE_INTERACT = new BooleanFlag("device-interact"); public static final BooleanFlag VEHICLE_BREAK = new BooleanFlag("vehicle-break"); public static final BooleanFlag VEHICLE_PLACE = new BooleanFlag("vehicle-place"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java new file mode 100644 index 000000000..2e9d80a38 --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java @@ -0,0 +1,39 @@ +package com.github.intellectualsites.plotsquared.plot.flag; + +import com.github.intellectualsites.plotsquared.plot.config.Captions; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; + +import java.util.Arrays; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +public class ItemTypeListFlag extends ListFlag> { + + public ItemTypeListFlag(String name) { + super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); + } + + @Override public String valueToString(Object value) { + return StringMan.join((Set) value, ","); + } + + @Override public Set parseValue(final String value) { + return Arrays.stream(ItemUtil.parse(value)).filter(Objects::nonNull).collect(Collectors.toSet()); + } + + @Override public String getValueDescription() { + return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated(); + } + + public boolean contains(Plot plot, BlockState value) { + return contains(plot, value.getBlockType().getItemType()); + } +} 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 ef9b25406..1422821dd 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 @@ -152,12 +152,12 @@ public class PlotListener { Location location = player.getLocation(); Location lastLocation = player.getMeta("music"); if (lastLocation != null) { - player.playMusic(lastLocation, ItemTypes.AIR); + player.playMusic(lastLocation, item); if (item == ItemTypes.AIR) { player.deleteMeta("music"); } } - if (!(item == ItemTypes.AIR)) { + if (item != ItemTypes.AIR) { try { player.setMeta("music", location); player.playMusic(location, item); 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 dc8830769..7af028759 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 @@ -17,6 +17,8 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -103,7 +105,7 @@ public abstract class EventUtil { } public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type, - Location location, Supplier block, boolean notifyPerms) { + Location location, Supplier item, boolean notifyPerms) { PlotArea area = location.getPlotArea(); assert area != null; Plot plot = area.getPlot(location); @@ -129,19 +131,19 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } - Optional> use = plot.getFlag(Flags.USE); + Optional> use = plot.getFlag(Flags.USE); if (use.isPresent()) { - Set value = use.get(); - if (value.contains(BlockTypes.AIR) || value - .contains(block.get())) { + Set value = use.get(); + if (value.contains(ItemTypes.AIR) || value + .contains(item.get())) { return true; } } - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); if (destroy.isPresent()) { - Set value = destroy.get(); - if (value.contains(BlockTypes.AIR) || value - .contains(block.get())) { + Set value = destroy.get(); + if (value.contains(ItemTypes.AIR) || value + .contains(item.get())) { return true; } } @@ -223,10 +225,10 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } - Optional> flagValue = plot.getFlag(Flags.USE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { return Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil @@ -246,10 +248,10 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_BUILD_UNOWNED.getTranslated(), notifyPerms); } - Optional> flagValue = plot.getFlag(Flags.PLACE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flagValue = plot.getFlag(Flags.PLACE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_OTHER.getTranslated(), false)) { return true; @@ -273,10 +275,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.DEVICE_INTERACT).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.USE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -300,10 +302,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.USE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -329,10 +331,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.USE); - Set value = flag.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flag = plot.getFlag(Flags.USE); + Set value = flag.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -359,10 +361,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.USE); - Set value = flag.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flag = plot.getFlag(Flags.USE); + Set value = flag.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -389,10 +391,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.PLACE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flagValue = plot.getFlag(Flags.PLACE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -419,10 +421,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.PLACE); - Set value = flag.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flag = plot.getFlag(Flags.PLACE); + Set value = flag.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -450,10 +452,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.PLACE); - Set value = flag.orElse(null); - if (value == null || !value.contains(BlockTypes.AIR) && !value - .contains(block.get())) { + Optional> flag = plot.getFlag(Flags.PLACE); + Set value = flag.orElse(null); + if (value == null || !value.contains(ItemTypes.AIR) && !value + .contains(item.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java index 14ff2652c..ca5b8f777 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/BlockUtil.java @@ -42,7 +42,7 @@ public final class BlockUtil { return FuzzyBlockState.builder().type(BlockTypes.AIR).build(); } id = id.toLowerCase(); - BlockType type = BlockType.REGISTRY.get(id); + BlockType type = BlockTypes.get(id); if (type != null) { return type.getDefaultState(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/ItemUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/ItemUtil.java index 415df8fe1..2d906a73a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/ItemUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/ItemUtil.java @@ -1,6 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.world; import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; @@ -27,4 +28,13 @@ public final class ItemUtil { if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input; return ItemTypes.get(input); } + + public static final ItemType[] parse(String commaDelimited) { + String[] split = commaDelimited.split(",(?![^\\(\\[]*[\\]\\)])"); + ItemType[] result = new ItemType[split.length]; + for (int i = 0; i < split.length; i++) { + result[i] = get(split[i]); + } + return result; + } } diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java index 8bbc1193f..f5748b644 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java @@ -10,6 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.EventUtilTest; import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import org.junit.Before; import org.junit.Test; @@ -22,7 +24,7 @@ import static org.junit.Assert.assertEquals; public class FlagTest { - private Object testBlock; + private ItemType testBlock; private Flag> use = Flags.USE; @Before public void setUp() throws Exception { @@ -37,11 +39,11 @@ public class FlagTest { Optional flag = plot.getFlag(use); if (flag.isPresent()) { System.out.println(Flags.USE.valueToString(flag.get())); - testBlock = BlockUtil.get((short) 1, (byte) 0); + testBlock = ItemTypes.BONE_BLOCK; flag.get().add(testBlock); } flag.ifPresent(collection -> System.out.println(Flags.USE.valueToString(collection))); - Optional> flag2 = plot.getFlag(Flags.USE); + Optional> flag2 = plot.getFlag(Flags.USE); if (flag2.isPresent()) { // assertThat(flag2.get(), (Matcher>) IsCollectionContaining.hasItem(testBlock)); } From c23086259dbb800f8cfb6bd8a1c76762e33e3418 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 12 Nov 2019 20:48:33 +0000 Subject: [PATCH 209/258] Potentially fixes rename issues #2450 --- .../plot/util/UUIDHandlerImplementation.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) 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 b5e37ed93..57b70d263 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 @@ -161,19 +161,19 @@ public abstract class UUIDHandlerImplementation { }); } try { - UUID offline = this.uuidMap.put(name, uuid); - if (offline != null) { - if (!offline.equals(uuid)) { - Set plots = PlotSquared.get().getPlots(offline); + UUID existing = this.uuidMap.put(name, uuid); + if (existing != null) { + if (!existing.equals(uuid)) { + Set plots = PlotSquared.get().getPlots(existing); if (!plots.isEmpty()) { for (Plot plot : plots) { plot.owner = uuid; } - replace(offline, uuid, name.value); + replace(existing, uuid, name.value); } return true; } else { - StringWrapper oName = this.uuidMap.inverse().get(offline); + StringWrapper oName = this.uuidMap.inverse().get(existing); if (!oName.equals(name)) { this.uuidMap.remove(name); this.uuidMap.put(name, uuid); @@ -191,6 +191,13 @@ public abstract class UUIDHandlerImplementation { PlotPlayer player = getPlayer(uuid); if (player == null || player.getName().equalsIgnoreCase(name.value)) { rename(uuid, name); + return false; + } + StringWrapper newName = new StringWrapper(player.getName()); + UUID newUUID = player.getUUID(); + if (newUUID.equals(uuid) && !newName.equals(oldName)) { + inverse.remove(uuid); + this.uuidMap.put(newName, newUUID); } return false; } From f518c47e0924ec444325252fec11764a45ff921f Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 12 Nov 2019 20:52:14 +0000 Subject: [PATCH 210/258] Fixes #1922 Banned people can still "talk" in plot --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 3 +++ 1 file changed, 3 insertions(+) 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 29db0c471..c10a4f8a9 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 @@ -1024,6 +1024,9 @@ import java.util.regex.Pattern; if (plot == null) { return; } + if (plot.isDenied(plotPlayer.getUUID())) { + return; + } event.setCancelled(true); String message = event.getMessage(); String format = Captions.PLOT_CHAT_FORMAT.getTranslated(); From 7623698a005a727dc0e3ed6911092498731500d9 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 12 Nov 2019 22:31:02 +0000 Subject: [PATCH 211/258] don't use legacy ids here --- .../plot/generator/ClassicPlotManager.java | 14 +++++++------- .../plotsquared/plot/object/Plot.java | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) 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 42ebd5c3d..b26e40c46 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 @@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.List; @@ -289,7 +290,7 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid( new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz + 1), new Location(classicPlotWorld.worldname, ex, maxY, ez - 1), - BlockUtil.get((short) 0, (byte) 0)); + BlockTypes.AIR.getDefaultState()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 0, sz + 1), new Location(classicPlotWorld.worldname, ex, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), @@ -317,7 +318,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, sx + 1, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), - ez), BlockUtil.get((short) 0, (byte) 0)); + ez), BlockTypes.AIR.getDefaultState()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz), new Location(classicPlotWorld.worldname, ex - 1, 0, ez), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), @@ -342,7 +343,7 @@ public class ClassicPlotManager extends SquarePlotManager { LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.ROAD_HEIGHT + 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez - 1), - BlockUtil.get((short) 0, (byte) 0)); + BlockTypes.AIR.getDefaultState()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)); @@ -362,8 +363,7 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid( new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), - new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - BlockUtil.get((short) 0, (byte) 0)); + new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockTypes.AIR.getDefaultState()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), @@ -383,7 +383,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - BlockUtil.get((short) 0, (byte) 0)); + BlockTypes.AIR.getDefaultState()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), @@ -400,7 +400,7 @@ public class ClassicPlotManager extends SquarePlotManager { LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT + 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - BlockUtil.get((short) 0, (byte) 0)); + BlockTypes.AIR.getDefaultState()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK.toPattern()); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz), 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 e6d2a4dd6..0441c2baa 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 @@ -997,7 +997,8 @@ public class Plot { manager.createRoadSouthEast(current); } } - } else if (current.getMerged(Direction.SOUTH)) { + } + if (current.getMerged(Direction.SOUTH)) { manager.createRoadSouth(current); } } From 7591770c40413cbd0d29c6bcf2296432fa2ceae1 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 14 Nov 2019 12:48:41 -0800 Subject: [PATCH 212/258] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 417f05ab7..5812f21f8 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,6 @@ Welcome to the Builders's Refuge.


    The AJGaming Network is a modded and vanilla network. Either delve into magic on our magic servers, fight your enemies on our hardcore PvP modpacks or have a good time on our vanilla servers. The mods for our modpacks are handpicked by suggestions from our community making sure we can crate packs you love to play.

    +


    +The Pixel² is an indie games studio started out of Northern Ireland in 2017 and growing worldwide. We are partnered with Microsoft to provide you with thrilling adventure maps, stunning texture packs, and stylish skins, which can all be found on the official Minecraft Marketplace. +

    From a26ede4daeae466e352e904169898c754eda41f4 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 14 Nov 2019 12:54:02 -0800 Subject: [PATCH 213/258] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5812f21f8..bc6564b84 100644 --- a/README.md +++ b/README.md @@ -67,5 +67,5 @@ Welcome to the Builders's Refuge. The AJGaming Network is a modded and vanilla network. Either delve into magic on our magic servers, fight your enemies on our hardcore PvP modpacks or have a good time on our vanilla servers. The mods for our modpacks are handpicked by suggestions from our community making sure we can crate packs you love to play.


    -The Pixel² is an indie games studio started out of Northern Ireland in 2017 and growing worldwide. We are partnered with Microsoft to provide you with thrilling adventure maps, stunning texture packs, and stylish skins, which can all be found on the official Minecraft Marketplace. +Pixel² is an indie games studio started out of Northern Ireland in 2017 and growing worldwide. We are partnered with Microsoft to provide you with thrilling adventure maps, stunning texture packs, and stylish skins, which can all be found on the official Minecraft Marketplace.

    From 8b7414770fe843bef63e7e224fb602f347fdaa28 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 18 Nov 2019 11:09:32 -0500 Subject: [PATCH 214/258] Fix some flag issues --- .../plot/flag/BlockStateListFlag.java | 4 +-- .../plotsquared/plot/flag/BooleanFlag.java | 4 +-- .../plotsquared/plot/flag/DoubleFlag.java | 2 +- .../plotsquared/plot/flag/EnumFlag.java | 4 +-- .../plotsquared/plot/flag/Flag.java | 2 +- .../plotsquared/plot/flag/GameModeFlag.java | 25 ++++++++++--------- .../plotsquared/plot/flag/IntegerFlag.java | 2 +- .../plot/flag/IntegerListFlag.java | 4 +-- .../plotsquared/plot/flag/IntervalFlag.java | 2 +- .../plot/flag/ItemTypeListFlag.java | 8 ++---- .../plotsquared/plot/flag/LongFlag.java | 2 +- .../plot/flag/PlotWeatherFlag.java | 2 +- .../plotsquared/plot/flag/StringFlag.java | 2 +- .../plotsquared/plot/flag/StringListFlag.java | 4 +-- .../plotsquared/plot/util/EventUtil.java | 3 --- 15 files changed, 32 insertions(+), 38 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java index 117551488..4cfd33258 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java @@ -18,8 +18,8 @@ public class BlockStateListFlag extends ListFlag> { super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); } - @Override public String valueToString(Object value) { - return StringMan.join((Set) value, ","); + @Override public String valueToString(Set value) { + return StringMan.join(value, ","); } @Override public Set parseValue(final String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java index 692c0b501..5556ad1fd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java @@ -9,8 +9,8 @@ public class BooleanFlag extends Flag { super(Captions.FLAG_CATEGORY_BOOLEAN, name); } - @Override public String valueToString(Object value) { - return value + ""; + @Override public String valueToString(Boolean value) { + return value.toString(); } @Override public Boolean parseValue(String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java index ab2c86c45..1b24d4813 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java @@ -8,7 +8,7 @@ public class DoubleFlag extends Flag { super(Captions.FLAG_CATEGORY_DECIMAL, name); } - @Override public String valueToString(Object value) { + @Override public String valueToString(Double value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java index 06936d4df..2e1d65820 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java @@ -15,8 +15,8 @@ public class EnumFlag extends Flag { this.values = new HashSet<>(Arrays.asList(values)); } - @Override public String valueToString(Object value) { - return value.toString(); + @Override public String valueToString(String value) { + return value; } @Override public String parseValue(String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java index 21047d9cd..0d01b9e7e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java @@ -44,7 +44,7 @@ public abstract class Flag implements StringComparison.StringComparable { Flags.registerFlag(this); } - public abstract String valueToString(Object value); + public abstract String valueToString(V value); @Override public final String toString() { return "Flag { name='" + getName() + "'}"; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index 023bf804a..12901fb1c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -2,37 +2,38 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; -public class GameModeFlag extends Flag { +public class GameModeFlag extends Flag { public GameModeFlag(String name) { super(Captions.FLAG_CATEGORY_GAMEMODE, name); } - @Override public String valueToString(Object value) { - return ((PlotGameMode) value).getName(); + @Override public String valueToString(GameMode value) { + return value.getName(); } - @Override public PlotGameMode parseValue(String value) { + @Override public GameMode parseValue(String value) { switch (value.toLowerCase()) { - case "survival": - case "s": - case "0": - return PlotGameMode.SURVIVAL; case "creative": case "c": case "1": - return PlotGameMode.CREATIVE; + return GameModes.CREATIVE; case "adventure": case "a": case "2": - return PlotGameMode.ADVENTURE; + return GameModes.ADVENTURE; case "spectator": case "sp": case "3": - return PlotGameMode.SPECTATOR; + return GameModes.SPECTATOR; + case "survival": + case "s": + case "0": default: - return PlotGameMode.NOT_SET; + return GameModes.SURVIVAL; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java index 8b527c46a..93bf57610 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java @@ -13,7 +13,7 @@ public class IntegerFlag extends Flag { return Captions.FLAG_ERROR_INTEGER.getTranslated(); } - @Override public String valueToString(Object value) { + @Override public String valueToString(Integer value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java index e9162000b..bfd2aa730 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java @@ -13,8 +13,8 @@ public class IntegerListFlag extends ListFlag> { super(Captions.FLAG_CATEGORY_INTEGER_LIST, name); } - @Override public String valueToString(Object value) { - return StringMan.join((List) value, ","); + @Override public String valueToString(List value) { + return StringMan.join(value, ","); } @Override public List parseValue(String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java index 7b6b64d47..470b8ed56 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java @@ -11,7 +11,7 @@ public class IntervalFlag extends Flag { super(Captions.FLAG_CATEGORY_INTERVALS, name); } - @Override public String valueToString(Object value) { + @Override public String valueToString(IntervalFlag.Interval value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java index 2e9d80a38..fd37a65d5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java @@ -21,8 +21,8 @@ public class ItemTypeListFlag extends ListFlag> { super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); } - @Override public String valueToString(Object value) { - return StringMan.join((Set) value, ","); + @Override public String valueToString(Set value) { + return StringMan.join(value, ","); } @Override public Set parseValue(final String value) { @@ -32,8 +32,4 @@ public class ItemTypeListFlag extends ListFlag> { @Override public String getValueDescription() { return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated(); } - - public boolean contains(Plot plot, BlockState value) { - return contains(plot, value.getBlockType().getItemType()); - } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java index 1d8846701..538870642 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java @@ -16,7 +16,7 @@ public class LongFlag extends Flag { } } - @Override public String valueToString(Object value) { + @Override public String valueToString(Long value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java index 1893d5370..0d5eb7481 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java @@ -9,7 +9,7 @@ public class PlotWeatherFlag extends Flag { super(Captions.FLAG_CATEGORY_WEATHER, name); } - @Override public String valueToString(Object value) { + @Override public String valueToString(PlotWeather value) { return value.toString(); } 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 21f1690a6..ce2c739c8 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 @@ -8,7 +8,7 @@ public class StringFlag extends Flag { super(Captions.FLAG_CATEGORY_STRING, name); } - @Override public String valueToString(Object value) { + @Override public String valueToString(String value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java index eb76ec8c1..eae13943e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java @@ -13,8 +13,8 @@ public class StringListFlag extends ListFlag> { super(Captions.FLAG_CATEGORY_STRING_LIST, name); } - @Override public String valueToString(Object value) { - return StringMan.join((List) value, ","); + @Override public String valueToString(List value) { + return StringMan.join(value, ","); } @Override public List parseValue(String value) { 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 7af028759..a51742e24 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 @@ -14,9 +14,6 @@ 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 com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import org.jetbrains.annotations.Nullable; From d7aa4a0e1f7784dcb3aba7021d8efa193512f30f Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 18 Nov 2019 13:41:46 -0500 Subject: [PATCH 215/258] Revert "Fix some flag issues" This reverts commit 8b741477 --- .../plot/flag/BlockStateListFlag.java | 4 +- .../plotsquared/plot/flag/BooleanFlag.java | 4 +- .../plotsquared/plot/flag/DoubleFlag.java | 2 +- .../plotsquared/plot/flag/EnumFlag.java | 4 +- .../plotsquared/plot/flag/Flag.java | 2 +- .../plotsquared/plot/flag/GameModeFlag.java | 37 +++++++++---------- .../plotsquared/plot/flag/IntegerFlag.java | 2 +- .../plot/flag/IntegerListFlag.java | 4 +- .../plotsquared/plot/flag/IntervalFlag.java | 2 +- .../plot/flag/ItemTypeListFlag.java | 8 +++- .../plotsquared/plot/flag/LongFlag.java | 2 +- .../plot/flag/PlotWeatherFlag.java | 2 +- .../plotsquared/plot/flag/StringFlag.java | 2 +- .../plotsquared/plot/flag/StringListFlag.java | 4 +- .../plotsquared/plot/util/EventUtil.java | 3 ++ 15 files changed, 44 insertions(+), 38 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java index 4cfd33258..117551488 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java @@ -18,8 +18,8 @@ public class BlockStateListFlag extends ListFlag> { super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); } - @Override public String valueToString(Set value) { - return StringMan.join(value, ","); + @Override public String valueToString(Object value) { + return StringMan.join((Set) value, ","); } @Override public Set parseValue(final String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java index 5556ad1fd..692c0b501 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java @@ -9,8 +9,8 @@ public class BooleanFlag extends Flag { super(Captions.FLAG_CATEGORY_BOOLEAN, name); } - @Override public String valueToString(Boolean value) { - return value.toString(); + @Override public String valueToString(Object value) { + return value + ""; } @Override public Boolean parseValue(String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java index 1b24d4813..ab2c86c45 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java @@ -8,7 +8,7 @@ public class DoubleFlag extends Flag { super(Captions.FLAG_CATEGORY_DECIMAL, name); } - @Override public String valueToString(Double value) { + @Override public String valueToString(Object value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java index 2e1d65820..06936d4df 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java @@ -15,8 +15,8 @@ public class EnumFlag extends Flag { this.values = new HashSet<>(Arrays.asList(values)); } - @Override public String valueToString(String value) { - return value; + @Override public String valueToString(Object value) { + return value.toString(); } @Override public String parseValue(String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java index 0d01b9e7e..21047d9cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java @@ -44,7 +44,7 @@ public abstract class Flag implements StringComparison.StringComparable { Flags.registerFlag(this); } - public abstract String valueToString(V value); + public abstract String valueToString(Object value); @Override public final String toString() { return "Flag { name='" + getName() + "'}"; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index 12901fb1c..023bf804a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -2,38 +2,37 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; -import com.sk89q.worldedit.world.gamemode.GameMode; -import com.sk89q.worldedit.world.gamemode.GameModes; -public class GameModeFlag extends Flag { +public class GameModeFlag extends Flag { public GameModeFlag(String name) { super(Captions.FLAG_CATEGORY_GAMEMODE, name); } - @Override public String valueToString(GameMode value) { - return value.getName(); + @Override public String valueToString(Object value) { + return ((PlotGameMode) value).getName(); } - @Override public GameMode parseValue(String value) { + @Override public PlotGameMode parseValue(String value) { switch (value.toLowerCase()) { - case "creative": - case "c": - case "1": - return GameModes.CREATIVE; - case "adventure": - case "a": - case "2": - return GameModes.ADVENTURE; - case "spectator": - case "sp": - case "3": - return GameModes.SPECTATOR; case "survival": case "s": case "0": + return PlotGameMode.SURVIVAL; + case "creative": + case "c": + case "1": + return PlotGameMode.CREATIVE; + case "adventure": + case "a": + case "2": + return PlotGameMode.ADVENTURE; + case "spectator": + case "sp": + case "3": + return PlotGameMode.SPECTATOR; default: - return GameModes.SURVIVAL; + return PlotGameMode.NOT_SET; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java index 93bf57610..8b527c46a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java @@ -13,7 +13,7 @@ public class IntegerFlag extends Flag { return Captions.FLAG_ERROR_INTEGER.getTranslated(); } - @Override public String valueToString(Integer value) { + @Override public String valueToString(Object value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java index bfd2aa730..e9162000b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java @@ -13,8 +13,8 @@ public class IntegerListFlag extends ListFlag> { super(Captions.FLAG_CATEGORY_INTEGER_LIST, name); } - @Override public String valueToString(List value) { - return StringMan.join(value, ","); + @Override public String valueToString(Object value) { + return StringMan.join((List) value, ","); } @Override public List parseValue(String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java index 470b8ed56..7b6b64d47 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java @@ -11,7 +11,7 @@ public class IntervalFlag extends Flag { super(Captions.FLAG_CATEGORY_INTERVALS, name); } - @Override public String valueToString(IntervalFlag.Interval value) { + @Override public String valueToString(Object value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java index fd37a65d5..2e9d80a38 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java @@ -21,8 +21,8 @@ public class ItemTypeListFlag extends ListFlag> { super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); } - @Override public String valueToString(Set value) { - return StringMan.join(value, ","); + @Override public String valueToString(Object value) { + return StringMan.join((Set) value, ","); } @Override public Set parseValue(final String value) { @@ -32,4 +32,8 @@ public class ItemTypeListFlag extends ListFlag> { @Override public String getValueDescription() { return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated(); } + + public boolean contains(Plot plot, BlockState value) { + return contains(plot, value.getBlockType().getItemType()); + } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java index 538870642..1d8846701 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java @@ -16,7 +16,7 @@ public class LongFlag extends Flag { } } - @Override public String valueToString(Long value) { + @Override public String valueToString(Object value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java index 0d5eb7481..1893d5370 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java @@ -9,7 +9,7 @@ public class PlotWeatherFlag extends Flag { super(Captions.FLAG_CATEGORY_WEATHER, name); } - @Override public String valueToString(PlotWeather value) { + @Override public String valueToString(Object value) { return value.toString(); } 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 ce2c739c8..21f1690a6 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 @@ -8,7 +8,7 @@ public class StringFlag extends Flag { super(Captions.FLAG_CATEGORY_STRING, name); } - @Override public String valueToString(String value) { + @Override public String valueToString(Object value) { return value.toString(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java index eae13943e..eb76ec8c1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java @@ -13,8 +13,8 @@ public class StringListFlag extends ListFlag> { super(Captions.FLAG_CATEGORY_STRING_LIST, name); } - @Override public String valueToString(List value) { - return StringMan.join(value, ","); + @Override public String valueToString(Object value) { + return StringMan.join((List) value, ","); } @Override public List parseValue(String value) { 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 a51742e24..7af028759 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 @@ -14,6 +14,9 @@ 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 com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import org.jetbrains.annotations.Nullable; From 612e96201cc3e46d741d0f1271d22a20460a2869 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 18 Nov 2019 13:43:16 -0500 Subject: [PATCH 216/258] Fixed ItemTypeListFlag issue --- .../plotsquared/plot/flag/ItemTypeListFlag.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java index 2e9d80a38..5812588c2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ItemTypeListFlag.java @@ -1,14 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.StringMan; -import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil; import com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.item.ItemType; -import com.sk89q.worldedit.world.item.ItemTypes; import java.util.Arrays; import java.util.Objects; @@ -22,18 +17,15 @@ public class ItemTypeListFlag extends ListFlag> { } @Override public String valueToString(Object value) { - return StringMan.join((Set) value, ","); + return StringMan.join((Set) value, ","); } @Override public Set parseValue(final String value) { - return Arrays.stream(ItemUtil.parse(value)).filter(Objects::nonNull).collect(Collectors.toSet()); + return Arrays.stream(ItemUtil.parse(value)).filter(Objects::nonNull) + .collect(Collectors.toSet()); } @Override public String getValueDescription() { return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated(); } - - public boolean contains(Plot plot, BlockState value) { - return contains(plot, value.getBlockType().getItemType()); - } } From 9c9841663a3ca7d94e0b0cf4c14712b327b212d3 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 19 Nov 2019 01:39:51 +0000 Subject: [PATCH 217/258] Fixes #2595 (leave error) --- .../intellectualsites/plotsquared/plot/commands/Leave.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index b51993326..87cb1d3ee 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -40,7 +40,7 @@ import java.util.concurrent.CompletableFuture; if (plot.removeMember(uuid)) { EventUtil.manager.callMember(player, plot, uuid, false); } - MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, player.getName()); } else { MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, 1); } From 7377366372f473fbf198e566dfbd943459ca892e Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 22 Nov 2019 12:28:34 +0100 Subject: [PATCH 218/258] Updating some debug colors --- .../intellectualsites/plotsquared/plot/PlotSquared.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 86b8c7a92..4090bf4da 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 @@ -245,7 +245,7 @@ import java.util.zip.ZipInputStream; if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { try { if (this.IMP.initWorldEdit()) { - PlotSquared.debug(IMP.getPluginName() + " hooked into WorldEdit."); + PlotSquared.log(Captions.PREFIX + "&6" + IMP.getPluginName() + " hooked into WorldEdit."); this.worldedit = WorldEdit.getInstance(); WorldEdit.getInstance().getEventBus().register(new WESubscriber()); if (Settings.Enabled_Components.COMMANDS) { @@ -317,7 +317,7 @@ import java.util.zip.ZipInputStream; e.printStackTrace(); } - PlotSquared.log(Captions.ENABLED.f(IMP.getPluginName())); + PlotSquared.log(Captions.PREFIX + Captions.ENABLED.f(IMP.getPluginName())); } /** From c14e1d7add84415e8e66857da1689366cc06f721 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 22 Nov 2019 12:40:27 +0100 Subject: [PATCH 219/258] Update Settings.java --- .../intellectualsites/plotsquared/plot/config/Settings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index 8dd1be8a8..434783241 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -28,7 +28,7 @@ public class Settings extends Config { @Comment("Show additional information in console") public static boolean DEBUG = false; @Comment({"The big annoying text that appears when you enter a plot", - "For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`"}) + "For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`", "For all plots: Add `titles: false` in the worlds.yml flags block"}) public static boolean TITLES = true; @Create // This value will be generated automatically @@ -331,7 +331,7 @@ public class Settings extends Config { true; @Comment("The UUID cacher is used to resolve player names") public static boolean UUID_CACHE = true; - @Comment("The plugin auto updater") public static boolean UPDATER = true; + @Comment("The plugin auto updater will notify you if updates are available.") public static boolean UPDATER = true; @Comment("Stores user metadata in a database") public static boolean PERSISTENT_META = true; @Comment("Optimizes permission checks") public static boolean PERMISSION_CACHE = true; @Comment("Optimizes block changing code") public static boolean BLOCK_CACHE = true; From 8b7e8ec6351edebc02f852743f30cba7dac2da2e Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 22 Nov 2019 15:52:25 +0100 Subject: [PATCH 220/258] Update bug-issue-report-for-plotsquared.md --- .../ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md index aa5349430..d4a83991f 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -11,7 +11,7 @@ assignees: '' -# NOTICE: + -# BUG REPORT TEMPLATE: +# Bug Report Template: ## Required Information section: > ALL FIELDS IN THIS SECTION ARE REQUIRED, and must contain appropriate information @@ -55,7 +56,9 @@ assignees: '' ### Server build info: -``` paste here, between the tick marks, replacing this text ``` +``` +paste here, between the tick marks, replacing this text +``` ### WorldEdit/FAWE versions: From 977dfa807f1187c4af4741728846e79557ef0b19 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 22 Nov 2019 16:11:48 +0000 Subject: [PATCH 221/258] potentially fix partial world auto --- .../intellectualsites/plotsquared/plot/object/PlotArea.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0cefe8283..e2c7de91e 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 @@ -700,7 +700,7 @@ public abstract class PlotArea { PlotId max = getMax(); if (TYPE == 2) { center = new PlotId(MathMan.average(min.x, max.x), MathMan.average(min.y, max.y)); - plots = Math.max(max.x - min.x, max.y - min.y) + 1; + plots = Math.max(max.x - min.x + 1, max.y - min.y + 1) + 1; if (start != null) { start = new PlotId(start.x - center.x, start.y - center.y); } @@ -717,7 +717,7 @@ public abstract class PlotArea { PlotId currentId = new PlotId(center.x + start.x, center.y + start.y); Plot plot = getPlotAbs(currentId); if (plot != null && plot.canClaim(player)) { - setMeta("lastPlot", currentId); + setMeta("lastPlot", start); return plot; } } From 6908b9f29b5d38fe64c2f9d4f16285298d2352ce Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 24 Nov 2019 19:30:37 +0100 Subject: [PATCH 222/258] Update bug-issue-report-for-plotsquared.md --- .github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md index d4a83991f..cbca7e551 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -79,7 +79,9 @@ paste here, between the tick marks, replacing this text ### Relevant console output, log lines, and/or screenshots: - + ### Additional relevant comments/remarks: From a65d546f3b6c53d782f632b41eacd265a7086f92 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 25 Nov 2019 22:38:03 +0000 Subject: [PATCH 223/258] Fix debugpaste split --- .../plotsquared/bukkit/BukkitMain.java | 10 ++++++---- .../intellectualsites/plotsquared/plot/IPlotMain.java | 3 ++- .../plotsquared/plot/commands/DebugPaste.java | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) 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 8474d5c8a..00c7fccf9 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 @@ -92,10 +92,12 @@ import org.jetbrains.annotations.Nullable; import java.io.File; import java.lang.reflect.Method; +import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.UUID; import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; @@ -818,11 +820,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return new BukkitPlotGenerator(generator); } - @Override public List getPluginIds() { - final List names = new ArrayList<>(); + @Override public List, Boolean>> getPluginIds() { + List, Boolean>> names = new ArrayList<>(); for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { - names.add(plugin.getName() + ';' + plugin.getDescription().getVersion() + ':' + plugin - .isEnabled()); + Map.Entry id = new AbstractMap.SimpleEntry<>(plugin.getName(), plugin.getDescription().getVersion()); + names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled())); } return names; } 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 bf4bf888a..48f87a96e 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 @@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.List; +import java.util.Map; public interface IPlotMain extends ILogger { @@ -244,7 +245,7 @@ public interface IPlotMain extends ILogger { */ @NotNull IndependentPlotGenerator getDefaultGenerator(); - List getPluginIds(); + List, Boolean>> getPluginIds(); Actor getConsole(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 9ea6d7bdd..436b25c38 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -21,6 +21,7 @@ import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.nio.file.Files; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", @@ -54,7 +55,7 @@ public class DebugPaste extends SubCommand { b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';') .append(!Settings.UUID.OFFLINE).append('\n'); b.append("Plugins:"); - for (String id : PlotSquared.get().IMP.getPluginIds()) { + for (Map.Entry, Boolean> pluginInfo : PlotSquared.get().IMP.getPluginIds()) { String[] split = id.split(":"); String[] split2 = split[0].split(";"); String enabled = split.length == 2 ? split[1] : "unknown"; From cf558d8f6283d050e5ebec8219ae4e8fa9e4afb7 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 25 Nov 2019 22:40:50 +0000 Subject: [PATCH 224/258] Update DebugPaste.java --- .../plotsquared/plot/commands/DebugPaste.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 436b25c38..7cfc62c69 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -56,11 +56,10 @@ public class DebugPaste extends SubCommand { .append(!Settings.UUID.OFFLINE).append('\n'); b.append("Plugins:"); for (Map.Entry, Boolean> pluginInfo : PlotSquared.get().IMP.getPluginIds()) { - String[] split = id.split(":"); - String[] split2 = split[0].split(";"); - String enabled = split.length == 2 ? split[1] : "unknown"; - String name = split2[0]; - String version = split2.length == 2 ? split2[1] : "unknown"; + Map.Entry nameVersion = pluginInfo.getKey(); + String name = nameVersion.getKey(); + String version = nameVersion.getValue(); + boolean enabled = pluginInfo.getValue(); b.append("\n ").append(name).append(":\n ").append("version: '") .append(version).append('\'').append("\n enabled: ").append(enabled); } From 09f913cba425d1120f38e5935afb9db504caf17d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 28 Nov 2019 19:02:58 +0100 Subject: [PATCH 225/258] Enhanced Fixes #2595 Updating messages and adding new strings that fit better. --- .../plotsquared/plot/commands/Leave.java | 8 ++++---- .../plotsquared/plot/config/Captions.java | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index 87cb1d3ee..187977b2b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -15,7 +15,7 @@ import java.util.concurrent.CompletableFuture; @CommandDeclaration(command = "leave", description = "Removes self from being trusted or a member of the plot", - permission = "plots.leave", category = CommandCategory.CLAIMING, + permission = "plots.leave", usage = "/plot leave", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER) public class Leave extends Command { public Leave() { super(MainCommand.getInstance(), true); @@ -26,7 +26,7 @@ import java.util.concurrent.CompletableFuture; RunnableVal2 whenDone) throws CommandException { final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED); - checkTrue(plot.isAdded(player.getUUID()), Captions.NO_PLOT_PERMS); + checkTrue(plot.isAdded(player.getUUID()), Captions.NOT_ADDED_TRUSTED); checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage()); if (plot.isOwner(player.getUUID())) { checkTrue(plot.hasOwner(), Captions.ALREADY_OWNER); @@ -40,9 +40,9 @@ import java.util.concurrent.CompletableFuture; if (plot.removeMember(uuid)) { EventUtil.manager.callMember(player, plot, uuid, false); } - MainUtil.sendMessage(player, Captions.INVALID_PLAYER, player.getName()); + MainUtil.sendMessage(player, Captions.PLOT_LEFT, player.getName()); } else { - MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, 1); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, 1); } } return CompletableFuture.completedFuture(true); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 16c9ac3d8..7434d2f1b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -570,10 +570,12 @@ public enum Captions { //
    // REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"), + PLOT_LEFT("$2%s left the plot.", "Member"), ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"), ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"), PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"), + NOT_ADDED_TRUSTED("$2You must be added or trusted to the plot to run that command", "Member"), // // SET_OWNER("$4You successfully set the plot owner", "Owner"), From 4bb45fc22026b8dfe60c5817e48e52e8a7be3996 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 28 Nov 2019 21:50:21 -0500 Subject: [PATCH 226/258] Replace ByteArrayUtilities code with Guava and Replace PlotGameMode with WorldEdit equivalent. --- .../bukkit/object/BukkitPlayer.java | 43 +++++++++---------- .../plotsquared/plot/commands/Auto.java | 8 ++-- .../plotsquared/plot/commands/Claim.java | 5 ++- .../plotsquared/plot/commands/Deny.java | 4 +- .../plotsquared/plot/commands/Grant.java | 8 ++-- .../plotsquared/plot/flag/GameModeFlag.java | 24 +++++------ .../plot/listener/PlotListener.java | 19 ++++---- .../plot/object/ConsolePlayer.java | 9 ++-- .../plotsquared/plot/object/PlotArea.java | 23 +++++----- .../plotsquared/plot/object/PlotPlayer.java | 6 +-- .../plot/util/ByteArrayUtilities.java | 16 +------ .../plotsquared/plot/util/PlotGameMode.java | 32 -------------- 12 files changed, 75 insertions(+), 122 deletions(-) delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 5ee2960ca..e1a0db358 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.MathMan; -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.UUIDHandler; @@ -32,6 +31,11 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; +import static com.sk89q.worldedit.world.gamemode.GameModes.ADVENTURE; +import static com.sk89q.worldedit.world.gamemode.GameModes.CREATIVE; +import static com.sk89q.worldedit.world.gamemode.GameModes.SPECTATOR; +import static com.sk89q.worldedit.world.gamemode.GameModes.SURVIVAL; + public class BukkitPlayer extends PlotPlayer { private static boolean CHECK_EFFECTIVE = true; @@ -234,36 +238,29 @@ public class BukkitPlayer extends PlotPlayer { } } - @NotNull @Override public PlotGameMode getGameMode() { + @NotNull @Override public com.sk89q.worldedit.world.gamemode.GameMode getGameMode() { switch (this.player.getGameMode()) { case ADVENTURE: - return PlotGameMode.ADVENTURE; + return ADVENTURE; case CREATIVE: - return PlotGameMode.CREATIVE; + return CREATIVE; case SPECTATOR: - return PlotGameMode.SPECTATOR; + return SPECTATOR; case SURVIVAL: - return PlotGameMode.SURVIVAL; default: - return PlotGameMode.NOT_SET; + return SURVIVAL; } } - @Override public void setGameMode(@NotNull final PlotGameMode gameMode) { - switch (gameMode) { - case ADVENTURE: - this.player.setGameMode(GameMode.ADVENTURE); - break; - case CREATIVE: - this.player.setGameMode(GameMode.CREATIVE); - break; - case SPECTATOR: - this.player.setGameMode(GameMode.SPECTATOR); - break; - case SURVIVAL: - default: - this.player.setGameMode(GameMode.SURVIVAL); - break; + @Override public void setGameMode(@NotNull final com.sk89q.worldedit.world.gamemode.GameMode gameMode) { + if (ADVENTURE.equals(gameMode)) { + this.player.setGameMode(GameMode.ADVENTURE); + } else if (CREATIVE.equals(gameMode)) { + this.player.setGameMode(GameMode.CREATIVE); + } else if (SPECTATOR.equals(gameMode)) { + this.player.setGameMode(GameMode.SPECTATOR); + } else { + this.player.setGameMode(GameMode.SURVIVAL); } } @@ -303,7 +300,7 @@ public class BukkitPlayer extends PlotPlayer { } @Override public void stopSpectating() { - if (getGameMode() == PlotGameMode.SPECTATOR) { + if (getGameMode() == SPECTATOR) { this.player.setSpectatorTarget(null); } } 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 bf0a221b8..e08684da8 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 @@ -12,11 +12,11 @@ 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 com.google.common.primitives.Ints; import org.jetbrains.annotations.Nullable; import java.util.Set; @@ -47,8 +47,7 @@ public class Auto extends SubCommand { MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS_NUM, -diff + ""); return false; } else if (player.hasPersistentMeta("grantedPlots")) { - int grantedPlots = - ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots")); + int grantedPlots = Ints.fromByteArray(player.getPersistentMeta("grantedPlots")); if (grantedPlots - diff < sizeX * sizeZ) { player.removePersistentMeta("grantedPlots"); MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS); @@ -58,8 +57,7 @@ public class Auto extends SubCommand { if (left == 0) { player.removePersistentMeta("grantedPlots"); } else { - player.setPersistentMeta("grantedPlots", - ByteArrayUtilities.integerToBytes(left)); + player.setPersistentMeta("grantedPlots", Ints.toByteArray(left)); } MainUtil.sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "" + left, "" + (grantedPlots - left)); 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 aba59ad05..2c13ee016 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 @@ -15,6 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.google.common.primitives.Ints; @CommandDeclaration(command = "claim", aliases = "c", description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING, @@ -38,7 +39,7 @@ public class Claim extends SubCommand { if (currentPlots >= player.getAllowedPlots()) { if (player.hasPersistentMeta("grantedPlots")) { grants = - ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots")); + Ints.fromByteArray(player.getPersistentMeta("grantedPlots")); if (grants <= 0) { player.removePersistentMeta("grantedPlots"); return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS); @@ -85,7 +86,7 @@ public class Claim extends SubCommand { player.removePersistentMeta("grantedPlots"); } else { player.setPersistentMeta("grantedPlots", - ByteArrayUtilities.integerToBytes(grants - 1)); + Ints.toByteArray(grants - 1)); } sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1)); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 5ddfde305..220341f5f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -11,9 +11,9 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.sk89q.worldedit.world.gamemode.GameModes; import java.util.Set; import java.util.UUID; @@ -94,7 +94,7 @@ import java.util.UUID; if (player.hasPermission("plots.admin.entry.denied")) { return; } - if (player.getGameMode() == PlotGameMode.SPECTATOR) { + if (player.getGameMode() == GameModes.SPECTATOR) { player.stopSpectating(); } Location location = player.getLocation(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index 60ecbeab0..d8a1f3962 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -8,10 +8,10 @@ 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.ByteArrayUtilities; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.google.common.primitives.Ints; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -56,7 +56,7 @@ import java.util.concurrent.CompletableFuture; if (array == null) { granted = 0; } else { - granted = ByteArrayUtilities.bytesToInteger(array); + granted = Ints.fromByteArray(array); } Captions.GRANTED_PLOTS.send(player, granted); } else { // add @@ -64,11 +64,11 @@ import java.util.concurrent.CompletableFuture; if (array == null) { amount = 1; } else { - amount = 1 + ByteArrayUtilities.bytesToInteger(array); + amount = 1 + Ints.fromByteArray(array); } boolean replace = array != null; String key = "grantedPlots"; - byte[] rawData = ByteArrayUtilities.integerToBytes(amount); + byte[] rawData = Ints.toByteArray(amount); PlotPlayer online = UUIDHandler.getPlayer(uuid); if (online != null) { online.setPersistentMeta(key, rawData); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index 023bf804a..0c4ca07a1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -1,38 +1,38 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; -public class GameModeFlag extends Flag { +public class GameModeFlag extends Flag { public GameModeFlag(String name) { super(Captions.FLAG_CATEGORY_GAMEMODE, name); } @Override public String valueToString(Object value) { - return ((PlotGameMode) value).getName(); + return ((GameMode) value).getName(); } - @Override public PlotGameMode parseValue(String value) { + @Override public GameMode parseValue(String value) { switch (value.toLowerCase()) { - case "survival": - case "s": - case "0": - return PlotGameMode.SURVIVAL; case "creative": case "c": case "1": - return PlotGameMode.CREATIVE; + return GameModes.CREATIVE; case "adventure": case "a": case "2": - return PlotGameMode.ADVENTURE; + return GameModes.ADVENTURE; case "spectator": case "sp": case "3": - return PlotGameMode.SPECTATOR; + return GameModes.SPECTATOR; + case "survival": + case "s": + case "0": default: - return PlotGameMode.NOT_SET; + return GameModes.SURVIVAL; } } 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 1422821dd..fd3572229 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 @@ -15,13 +15,14 @@ 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 com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; @@ -95,9 +96,9 @@ public class PlotListener { Optional flyFlag = plot.getFlag(Flags.FLY); if (flyFlag.isPresent()) { boolean flight = player.getFlight(); - PlotGameMode gamemode = player.getGameMode(); - if (flight != (gamemode == PlotGameMode.CREATIVE - || gamemode == PlotGameMode.SPECTATOR)) { + GameMode gamemode = player.getGameMode(); + if (flight != (gamemode == GameModes.CREATIVE + || gamemode == GameModes.SPECTATOR)) { player.setPersistentMeta("flight", ByteArrayUtilities.booleanToBytes(player.getFlight())); } @@ -105,7 +106,7 @@ public class PlotListener { player.setFlight(flyFlag.get()); } } - Optional gamemodeFlag = plot.getFlag(Flags.GAMEMODE); + Optional gamemodeFlag = plot.getFlag(Flags.GAMEMODE); if (gamemodeFlag.isPresent()) { if (player.getGameMode() != gamemodeFlag.get()) { if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) { @@ -118,7 +119,7 @@ public class PlotListener { } } } - Optional guestGamemodeFlag = plot.getFlag(Flags.GUEST_GAMEMODE); + Optional guestGamemodeFlag = plot.getFlag(Flags.GUEST_GAMEMODE); if (guestGamemodeFlag.isPresent()) { if (player.getGameMode() != guestGamemodeFlag.get() && !plot .isAdded(player.getUUID())) { @@ -227,7 +228,7 @@ public class PlotListener { } else { MainUtil.sendMessage(player, StringMan .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}", - plot.toString(), "{gamemode}", pw.GAMEMODE.name().toLowerCase())); + plot.toString(), "{gamemode}", pw.GAMEMODE.getName().toLowerCase())); } } } @@ -258,8 +259,8 @@ public class PlotListener { ByteArrayUtilities.bytesToBoolean(player.getPersistentMeta("flight"))); player.removePersistentMeta("flight"); } else { - PlotGameMode gameMode = player.getGameMode(); - if (gameMode == PlotGameMode.SURVIVAL || gameMode == PlotGameMode.ADVENTURE) { + GameMode gameMode = player.getGameMode(); + if (gameMode == GameModes.SURVIVAL || gameMode == GameModes.ADVENTURE) { player.setFlight(false); } else if (!player.getFlight()) { player.setFlight(true); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index c9b7ab5e7..d22e23a7e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -3,10 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.object; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; -import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; import org.jetbrains.annotations.NotNull; @@ -110,11 +111,11 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setWeather(@NotNull PlotWeather weather) { } - @NotNull @Override public PlotGameMode getGameMode() { - return PlotGameMode.NOT_SET; + @Override public @NotNull GameMode getGameMode() { + return GameModes.SPECTATOR; } - @Override public void setGameMode(@NotNull PlotGameMode gameMode) { + @Override public void setGameMode(@NotNull GameMode gameMode) { } @Override public void setTime(long time) { 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 e2c7de91e..2326ba0c4 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 @@ -14,7 +14,6 @@ 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.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; @@ -27,6 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -82,7 +83,7 @@ public abstract class PlotArea { public PlotLoc DEFAULT_HOME; public int MAX_BUILD_HEIGHT = 256; public int MIN_BUILD_HEIGHT = 1; - public PlotGameMode GAMEMODE = PlotGameMode.CREATIVE; + public GameMode GAMEMODE = GameModes.CREATIVE; private int hash; private CuboidRegion region; private ConcurrentHashMap meta; @@ -248,27 +249,25 @@ public abstract class PlotArea { this.MIN_BUILD_HEIGHT = config.getInt("world.min_height"); switch (config.getString("world.gamemode").toLowerCase()) { - case "survival": - case "s": - case "0": - this.GAMEMODE = PlotGameMode.SURVIVAL; - break; case "creative": case "c": case "1": - this.GAMEMODE = PlotGameMode.CREATIVE; + this.GAMEMODE = GameModes.CREATIVE; break; case "adventure": case "a": case "2": - this.GAMEMODE = PlotGameMode.ADVENTURE; + this.GAMEMODE = GameModes.ADVENTURE; break; case "spectator": case "3": - this.GAMEMODE = PlotGameMode.SPECTATOR; + this.GAMEMODE = GameModes.SPECTATOR; break; + case "survival": + case "s": + case "0": default: - this.GAMEMODE = PlotGameMode.NOT_SET; + this.GAMEMODE = GameModes.SURVIVAL; break; } @@ -363,7 +362,7 @@ public abstract class PlotArea { options.put("home.nonmembers", position); options.put("world.max_height", this.MAX_BUILD_HEIGHT); options.put("world.min_height", this.MIN_BUILD_HEIGHT); - options.put("world.gamemode", this.GAMEMODE.name().toLowerCase()); + options.put("world.gamemode", this.GAMEMODE.getName().toLowerCase()); if (this.TYPE != 0) { options.put("generator.terrain", this.TERRAIN); 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 f48cbc981..84891a1af 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 @@ -13,13 +13,13 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAre 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 com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.item.ItemType; import lombok.NonNull; import org.jetbrains.annotations.NotNull; @@ -438,14 +438,14 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @return the gamemode of the player. */ - @NotNull public abstract PlotGameMode getGameMode(); + public abstract @NotNull GameMode getGameMode(); /** * Set this player's gameMode. * * @param gameMode the gamemode to set */ - public abstract void setGameMode(@NotNull PlotGameMode gameMode); + public abstract void setGameMode(@NotNull GameMode gameMode); /** * Set this player's local time (ticks). diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java index ace8bb7e4..91059e240 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java @@ -1,21 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.google.common.primitives.Ints; + public class ByteArrayUtilities { - public static byte[] integerToBytes(int i) { - byte[] bytes = new byte[4]; - bytes[0] = (byte) (i >> 24); - bytes[1] = (byte) (i >> 16); - bytes[2] = (byte) (i >> 8); - bytes[3] = (byte) (i); - return bytes; - } - - public static int bytesToInteger(byte[] bytes) { - return (bytes[0] << 24) & 0xff000000 | (bytes[1] << 16) & 0x00ff0000 - | (bytes[2] << 8) & 0x0000ff00 | (bytes[3]) & 0x000000ff; - } - public static boolean bytesToBoolean(byte[] bytes) { return bytes[0] == 1; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java deleted file mode 100644 index b3b1fd5a7..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.util; - -public enum PlotGameMode { - NOT_SET(-1, ""), SURVIVAL(0, "survival"), CREATIVE(1, "creative"), ADVENTURE(2, - "adventure"), SPECTATOR(3, "spectator"); - - private final int id; - private final String name; - - PlotGameMode(int id, String name) { - this.id = id; - this.name = name; - } - - /** - * The magic-value id of the GameMode. - * - * @return the GameMode id - */ - public int getId() { - return this.id; - } - - /** - * Get the name of this GameMode - * - * @return the GameMode name - */ - public String getName() { - return this.name; - } -} From 7e58f4341eeb8e00cd36d8df3aa36d4853686418 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 2 Dec 2019 17:07:57 -0500 Subject: [PATCH 227/258] Minor fixes and performance improvement --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 12 ++++++------ .../plotsquared/bukkit/object/BukkitBlockUtil.java | 6 +++++- .../plotsquared/bukkit/util/BukkitChunkManager.java | 13 +++++++++---- .../plotsquared/bukkit/util/BukkitCommand.java | 4 ++-- .../bukkit/util/BukkitInventoryUtil.java | 1 + .../plotsquared/plot/commands/Auto.java | 12 +++++++++--- 6 files changed, 32 insertions(+), 16 deletions(-) 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 c10a4f8a9..5dd04e506 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 @@ -2211,12 +2211,12 @@ import java.util.regex.Pattern; } break; } - case LEFT_CLICK_BLOCK: - Block block = event.getClickedBlock(); - location = BukkitUtil.getLocation(block.getLocation()); - eventType = PlayerBlockEventType.BREAK_BLOCK; - lazyItem = BukkitBlockUtil.supplyItem(block); - break; +// case LEFT_CLICK_BLOCK: +// Block block = event.getClickedBlock(); +// location = BukkitUtil.getLocation(block.getLocation()); +// eventType = PlayerBlockEventType.BREAK_BLOCK; +// lazyItem = BukkitBlockUtil.supplyItem(block); +// break; default: return; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java index bd86b5068..f35d4ea88 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java @@ -10,7 +10,11 @@ import java.util.function.Supplier; public class BukkitBlockUtil { public static Supplier supplyItem(Block block) { - return () -> BukkitAdapter.asItemType(block.getType()); + return new Supplier() { + @Override public ItemType get() { + return BukkitAdapter.asItemType(block.getType()); + } + }; } public static Supplier supplyItem(Material type) { 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 0209058c5..4fb6f5db4 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 @@ -40,9 +40,12 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; import java.util.concurrent.CompletableFuture; +import static com.google.common.base.Preconditions.checkNotNull; + public class BukkitChunkManager extends ChunkManager { public static boolean isIn(CuboidRegion region, int x, int z) { @@ -111,7 +114,7 @@ public class BukkitChunkManager extends ChunkManager { @Override public Set getChunkChunks(String world) { Set chunks = super.getChunkChunks(world); - for (Chunk chunk : Bukkit.getWorld(world).getLoadedChunks()) { + for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world)).getLoadedChunks()) { BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5); chunks.add(loc); } @@ -269,6 +272,7 @@ public class BukkitChunkManager extends ChunkManager { } } final World worldObj = Bukkit.getWorld(world); + checkNotNull(worldObj, "Critical error during regeneration."); final BukkitWorld bukkitWorldObj = new BukkitWorld(worldObj); TaskManager.runTask(new Runnable() { @Override public void run() { @@ -398,7 +402,7 @@ public class BukkitChunkManager extends ChunkManager { return true; } - @Override public CompletableFuture loadChunk(String world, BlockVector2 chunkLoc, boolean force) { + @Override public CompletableFuture loadChunk(String world, BlockVector2 chunkLoc, boolean force) { return PaperLib.getChunkAtAsync(BukkitUtil.getWorld(world),chunkLoc.getX(), chunkLoc.getZ(), force); } @@ -440,8 +444,9 @@ public class BukkitChunkManager extends ChunkManager { CuboidRegion region2 = RegionUtil.createRegion(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ()); final World world1 = Bukkit.getWorld(bot1.getWorld()); - World world2 = Bukkit.getWorld(bot2.getWorld()); - + final World world2 = Bukkit.getWorld(bot2.getWorld()); + checkNotNull(world1,"Critical error during swap."); + checkNotNull(world2,"Critical error during swap."); int relX = bot2.getX() - bot1.getX(); int relZ = bot2.getZ() - bot1.getZ(); 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 190aa077a..cb927f190 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 @@ -48,12 +48,12 @@ public class BukkitCommand implements CommandExecutor, TabCompleter { if (args.length == 0) { return Collections.singletonList("plots"); } - Collection objects = MainCommand.getInstance().tab(player, args, s.endsWith(" ")); + Collection objects = MainCommand.getInstance().tab(player, args, s.endsWith(" ")); if (objects == null) { return null; } List result = new ArrayList<>(); - for (Object o : objects) { + for (com.github.intellectualsites.plotsquared.commands.Command o : objects) { result.add(o.toString()); } return result.isEmpty() ? null : result; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java index 303b180e5..bb003833f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -96,6 +96,7 @@ public class BukkitInventoryUtil extends InventoryUtil { } if (meta.hasLore()) { List itemLore = meta.getLore(); + assert itemLore != null; lore = itemLore.toArray(new String[0]); } } 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 e08684da8..355dbc32a 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 @@ -174,10 +174,16 @@ public class Auto extends SubCommand { if (Permissions.hasPermission(player, Captions.PERMISSION_AUTO_MEGA)) { try { String[] split = args[0].split(",|;"); - size_x = Integer.parseInt(split[0]); - size_z = Integer.parseInt(split[1]); + if (split[1] == null) { + MainUtil.sendMessage(player,"Correct use /plot auto [length,width]"); + size_x = 1; + size_z = 1; + } else { + size_x = Integer.parseInt(split[0]); + size_z = Integer.parseInt(split[1]); + } if (size_x < 1 || size_z < 1) { - MainUtil.sendMessage(player, "&cError: size<=0"); + MainUtil.sendMessage(player, "Error: size<=0"); } if (args.length > 1) { schematic = args[1]; From 0b470f8e01828255bf61f9bd4cd1b2c5ddc4053c Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 4 Dec 2019 20:11:05 +0100 Subject: [PATCH 228/258] Update links --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc6564b84..fc5aec641 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ is to provide a lag-free and smooth experience. ### Developer Resources * [[JavaDoc](https://ci.athion.net/job/PlotSquared-Breaking/javadoc/)] * [[Maven Repo (CI)](http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/)] -* [API Documentation](https://github.com/IntellectualSites/PlotSquared/wiki/Developer-documentation-(WIP)) +* [API Documentation](https://github.com/IntellectualSites/PlotSquared/wiki/Developer-Documentation) # Building Gradle is the **recommended** way to build the project. Use `./gradlew build` in the main project directory to build the project. Gradle is required if you intend to build or develop the Sponge module. From dca5d84d295f7b6310a4f175d513ffc431cd1991 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 6 Dec 2019 00:28:07 +0100 Subject: [PATCH 229/258] Fixes #2620 --- .../intellectualsites/plotsquared/plot/commands/Info.java | 2 +- .../intellectualsites/plotsquared/plot/config/Captions.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java index b4e46daea..3db27bdd6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java @@ -100,7 +100,7 @@ public class Info extends SubCommand { UUID uuid = player.getUUID(); String name = MainUtil.getName(plot.getOwner()); inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info", - "&cID: &6" + plot.getId().toString(), "&cOwner: &6" + name, + "&cID: &6" + plot.getId().toString(), "&cOwner:&6" + name, "&cAlias: &6" + plot.getAlias(), "&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + plot.isAdded(uuid), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 7434d2f1b..4a876314b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -465,7 +465,7 @@ public enum Captions { PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"), PLOT_INFO_HIDDEN("$2You cannot view the information about this plot", "Info"), - PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner: $2%owner%$1&-" + PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner:$2%owner%$1&-" + "$1Biome: $2%biome%$1&-" + "$1Can Build: $2%build%$1&-" + "$1Rating: $2%rating%&-" + "$1Seen: $2%seen%&-" + "$1Trusted: $2%trusted%$1&-" + "$1Members: $2%members%$1&-" + "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"), @@ -477,7 +477,7 @@ public enum Captions { PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"), PLOT_INFO_RATING("$1Rating:$2 %rating%", "Info"), PLOT_INFO_LIKES("$1Like Ratio:$2 %likes%%", "Info"), - PLOT_INFO_OWNER("$1Owner:$2 %owner%", "Info"), + PLOT_INFO_OWNER("$1Owner:$2%owner%", "Info"), PLOT_INFO_ID("$1ID:$2 %id%", "Info"), PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"), PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"), From 9925a320f54a2aed2048f5c97d02ba6115cad62f Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 6 Dec 2019 21:16:09 -0500 Subject: [PATCH 230/258] Fix event listeners --- .../bukkit/listeners/PlayerEvents.java | 458 +++++------------- .../plotsquared/plot/flag/Flags.java | 6 +- .../plot/listener/PlayerBlockEventType.java | 16 +- .../plotsquared/plot/object/Location.java | 21 +- .../plotsquared/plot/util/EventUtil.java | 267 +--------- .../plotsquared/plot/util/Permissions.java | 2 +- .../plotsquared/plot/FlagTest.java | 38 +- 7 files changed, 185 insertions(+), 623 deletions(-) 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 5dd04e506..b2f3459b0 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 @@ -1,5 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.destroystokyo.paper.MaterialTags; import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; @@ -29,7 +30,6 @@ 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.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.item.ItemType; import io.papermc.lib.PaperLib; @@ -37,6 +37,7 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.FluidCollisionMode; import org.bukkit.Material; +import org.bukkit.Tag; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -773,6 +774,7 @@ import java.util.regex.Pattern; PlotPlayer pp = BukkitUtil.getPlayer(player); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); org.bukkit.Location to = event.getTo(); + //noinspection ConstantConditions if (to != null) { Location location = BukkitUtil.getLocation(to); PlotArea area = location.getPlotArea(); @@ -839,17 +841,10 @@ import java.util.regex.Pattern; dest = null; } if (dest != null) { - if (passengers != null) { - vehicle.eject(); - vehicle.setVelocity(new Vector(0d, 0d, 0d)); - PaperLib.teleportAsync(vehicle, dest); - passengers.forEach(vehicle::addPassenger); - } else { - vehicle.eject(); - vehicle.setVelocity(new Vector(0d, 0d, 0d)); - PaperLib.teleportAsync(vehicle, dest); - vehicle.addPassenger(player); - } + vehicle.eject(); + vehicle.setVelocity(new Vector(0d, 0d, 0d)); + PaperLib.teleportAsync(vehicle, dest); + passengers.forEach(vehicle::addPassenger); return; } } @@ -1093,20 +1088,17 @@ import java.util.regex.Pattern; .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { - if (Permissions - .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) { - return; + if (!Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED, true)) { + event.setCancelled(true); } - MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, - Captions.PERMISSION_ADMIN_DESTROY_UNOWNED); - event.setCancelled(true); return; } if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() - .contains(BukkitAdapter.asItemType(block.getType()))) { + .contains(BukkitAdapter.asBlockType(block.getType()))) { return; } if (Permissions @@ -1361,12 +1353,6 @@ import java.util.regex.Pattern; public void onBlockDamage(BlockDamageEvent event) { Player player = event.getPlayer(); Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); - if (player == null) { - if (location.isPlotRoad()) { - event.setCancelled(true); - return; - } - } PlotArea area = location.getPlotArea(); if (area == null) { return; @@ -1388,10 +1374,10 @@ import java.util.regex.Pattern; } PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() - .contains(BukkitAdapter.asItemType(block.getType())) || Permissions + .contains(BukkitAdapter.asBlockType(block.getType())) || Permissions .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { return; } @@ -1738,9 +1724,6 @@ import java.util.regex.Pattern; } Block block = player.getTargetBlock(null, 7); org.bukkit.block.BlockState state = block.getState(); - if (state == null) { - return; - } Material stateType = state.getType(); Material itemType = newItem.getType(); if (stateType != itemType) { @@ -1899,7 +1882,7 @@ import java.util.regex.Pattern; return; } if (event.getAction() == Action.RIGHT_CLICK_AIR) { - Material item = event.getItem().getType(); + Material item = event.getMaterial(); if (item.toString().toLowerCase().endsWith("egg")) { event.setCancelled(true); event.setUseItemInHand(Event.Result.DENY); @@ -1907,8 +1890,8 @@ import java.util.regex.Pattern; } ItemStack hand = player.getInventory().getItemInMainHand(); ItemStack offHand = player.getInventory().getItemInOffHand(); - Material type = (hand == null) ? Material.AIR : hand.getType(); - Material offType = (offHand == null) ? Material.AIR : offHand.getType(); + Material type = hand.getType(); + Material offType = offHand.getType(); if (type == Material.AIR) { type = offType; } @@ -1916,10 +1899,8 @@ import java.util.regex.Pattern; Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY); if (block != null && block.getType() != Material.AIR) { Location location = BukkitUtil.getLocation(block.getLocation()); - Material finalType = type; if (!EventUtil.manager - .checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, () -> BukkitAdapter.asItemType( - finalType), true)) { + .checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, null, true)) { event.setCancelled(true); event.setUseItemInHand(Event.Result.DENY); } @@ -1937,297 +1918,116 @@ import java.util.regex.Pattern; return; } PlayerBlockEventType eventType = null; - Supplier lazyItem; - Location location; + BlockType blocktype1; + Block block = event.getClickedBlock(); + Location location = BukkitUtil.getLocation(block.getLocation()); Action action = event.getAction(); - switch (action) { + outer: switch (action) { case PHYSICAL: { eventType = PlayerBlockEventType.TRIGGER_PHYSICAL; - Block block = event.getClickedBlock(); - lazyItem = BukkitBlockUtil.supplyItem(block); - location = BukkitUtil.getLocation(block.getLocation()); + blocktype1 = BukkitAdapter.asBlockType(block.getType()); break; } + //todo rearrange the right click code. it is all over the place. case RIGHT_CLICK_BLOCK: { - Block block = event.getClickedBlock(); - location = BukkitUtil.getLocation(block.getLocation()); Material blockType = block.getType(); - switch (blockType) { - case ACACIA_DOOR: - case BIRCH_DOOR: - case DARK_OAK_DOOR: - case IRON_DOOR: - case JUNGLE_DOOR: - case OAK_DOOR: - case SPRUCE_DOOR: - - case ACACIA_TRAPDOOR: - case BIRCH_TRAPDOOR: - case DARK_OAK_TRAPDOOR: - case IRON_TRAPDOOR: - case JUNGLE_TRAPDOOR: - case OAK_TRAPDOOR: - case SPRUCE_TRAPDOOR: - - case CHEST: - case ENDER_CHEST: - case TRAPPED_CHEST: - - case ACACIA_FENCE_GATE: - case BIRCH_FENCE_GATE: - case DARK_OAK_FENCE_GATE: - case OAK_FENCE_GATE: - case JUNGLE_FENCE_GATE: - case SPRUCE_FENCE_GATE: - - case ACACIA_BUTTON: - case BIRCH_BUTTON: - case DARK_OAK_BUTTON: - case JUNGLE_BUTTON: - case OAK_BUTTON: - case SPRUCE_BUTTON: - case STONE_BUTTON: - - case BLACK_BED: - case BLUE_BED: - case BROWN_BED: - case CYAN_BED: - case GRAY_BED: - case GREEN_BED: - case LIGHT_BLUE_BED: - case LIGHT_GRAY_BED: - case LIME_BED: - case MAGENTA_BED: - case ORANGE_BED: - case PINK_BED: - case PURPLE_BED: - case RED_BED: - case WHITE_BED: - case YELLOW_BED: - - case BLACK_BANNER: - case BLACK_WALL_BANNER: - case BLUE_BANNER: - case BLUE_WALL_BANNER: - case BROWN_BANNER: - case BROWN_WALL_BANNER: - case CYAN_BANNER: - case CYAN_WALL_BANNER: - case GRAY_BANNER: - case GRAY_WALL_BANNER: - case GREEN_BANNER: - case GREEN_WALL_BANNER: - case LIGHT_BLUE_BANNER: - case LIGHT_BLUE_WALL_BANNER: - case LIGHT_GRAY_BANNER: - case LIGHT_GRAY_WALL_BANNER: - case LIME_BANNER: - case LIME_WALL_BANNER: - case MAGENTA_BANNER: - case MAGENTA_WALL_BANNER: - case ORANGE_BANNER: - case ORANGE_WALL_BANNER: - case PINK_BANNER: - case PINK_WALL_BANNER: - case PURPLE_BANNER: - case PURPLE_WALL_BANNER: - case RED_BANNER: - case RED_WALL_BANNER: - case WHITE_BANNER: - case WHITE_WALL_BANNER: - case YELLOW_BANNER: - case YELLOW_WALL_BANNER: - - case BLACK_SHULKER_BOX: - case BLUE_SHULKER_BOX: - case BROWN_SHULKER_BOX: - case CYAN_SHULKER_BOX: - case GRAY_SHULKER_BOX: - case GREEN_SHULKER_BOX: - case LIGHT_BLUE_SHULKER_BOX: - case LIGHT_GRAY_SHULKER_BOX: - case LIME_SHULKER_BOX: - case MAGENTA_SHULKER_BOX: - case ORANGE_SHULKER_BOX: - case PINK_SHULKER_BOX: - case PURPLE_SHULKER_BOX: - case RED_SHULKER_BOX: - case WHITE_SHULKER_BOX: - case YELLOW_SHULKER_BOX: - - case CHAIN_COMMAND_BLOCK: - case REPEATING_COMMAND_BLOCK: - - case LEGACY_SIGN: - case LEGACY_WALL_SIGN: - case OAK_SIGN: - case ACACIA_SIGN: - case ACACIA_WALL_SIGN: - case BIRCH_SIGN: - case BIRCH_WALL_SIGN: - case DARK_OAK_SIGN: - case DARK_OAK_WALL_SIGN: - case JUNGLE_SIGN: - case JUNGLE_WALL_SIGN: - case OAK_WALL_SIGN: - case SPRUCE_SIGN: - case SPRUCE_WALL_SIGN: - - case REDSTONE_TORCH: - case REDSTONE_WALL_TORCH: - - case TURTLE_EGG: - case TURTLE_HELMET: - case TURTLE_SPAWN_EGG: - - case ANVIL: - case BEACON: - case BREWING_STAND: - case CAKE: - case COMMAND_BLOCK: - case COMPARATOR: - case CRAFTING_TABLE: - //todo re-evaluate adding lectern here - case LECTERN: - case GRINDSTONE: - case LOOM: - case SMOKER: - case STONECUTTER: - case DISPENSER: - case DROPPER: - case ENCHANTING_TABLE: - case FURNACE: - case BLAST_FURNACE: - case HOPPER: - case JUKEBOX: - case LEVER: - case NOTE_BLOCK: - case REDSTONE_ORE: - eventType = PlayerBlockEventType.INTERACT_BLOCK; - break; - case DRAGON_EGG: - eventType = PlayerBlockEventType.TELEPORT_OBJECT; - break; - default: - if (blockType.isInteractable()) { - eventType = PlayerBlockEventType.INTERACT_BLOCK; - } + if (blockType.isInteractable() && player.isSneaking()) { + return; //this returns so the block place event is called } - lazyItem = BukkitBlockUtil.supplyItem(block); - if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK - || !player.isSneaking())) { - break; - } - ItemStack hand = player.getInventory().getItemInMainHand(); - ItemStack offHand = player.getInventory().getItemInOffHand(); - Material type = (hand == null) ? Material.AIR : hand.getType(); - Material offType = (offHand == null) ? Material.AIR : offHand.getType(); - if ((type == Material.AIR && offType != Material.AIR && !player.isSneaking() - && blockType.isInteractable()) || (type == Material.AIR - && offType == Material.AIR)) { + if (blockType.isInteractable()) { eventType = PlayerBlockEventType.INTERACT_BLOCK; + } + blocktype1 = BukkitAdapter.asBlockType(block.getType()); + if (eventType != null && !player.isSneaking()) { break; } + Material type = event.getMaterial(); if (type == Material.AIR) { - type = offType; - } - // in the following, lb needs to have the material of the item in hand i.e. type - lazyItem = BukkitBlockUtil.supplyItem(type); - if (type.isBlock()) { - location = BukkitUtil - .getLocation(block.getRelative(event.getBlockFace()).getLocation()); - eventType = PlayerBlockEventType.PLACE_BLOCK; - break; - } - if (type.toString().toLowerCase().endsWith("egg")) { - eventType = PlayerBlockEventType.SPAWN_MOB; - } else { - switch (type) { - case FIREWORK_ROCKET: - case FIREWORK_STAR: - eventType = PlayerBlockEventType.SPAWN_MOB; - break; - case ARMOR_STAND: - location = BukkitUtil - .getLocation(block.getRelative(event.getBlockFace()).getLocation()); - eventType = PlayerBlockEventType.PLACE_MISC; - break; - case BOOK: - case ENCHANTED_BOOK: - case KNOWLEDGE_BOOK: - case WRITABLE_BOOK: - case WRITTEN_BOOK: - eventType = PlayerBlockEventType.READ; - break; - case APPLE: - case BAKED_POTATO: - case BEEF: - case BREAD: - case CARROT: - case CHICKEN: - case COD: - case COOKED_BEEF: - case COOKED_CHICKEN: - case COOKED_COD: - case COOKED_MUTTON: - case COOKED_PORKCHOP: - case COOKED_RABBIT: - case COOKED_SALMON: - case COOKIE: - case GOLDEN_CARROT: - case MUSHROOM_STEW: - case MUTTON: - case POISONOUS_POTATO: - case PORKCHOP: - case POTATO: - case POTION: - case PUFFERFISH: - case PUMPKIN_PIE: - case RABBIT: - case RABBIT_FOOT: - case RABBIT_STEW: - case SALMON: - case TROPICAL_FISH: - eventType = PlayerBlockEventType.EAT; - break; - case ACACIA_BOAT: - case BIRCH_BOAT: - case CHEST_MINECART: - case COMMAND_BLOCK_MINECART: - case DARK_OAK_BOAT: - case FURNACE_MINECART: - case HOPPER_MINECART: - case JUNGLE_BOAT: - case MINECART: - case OAK_BOAT: - case SPRUCE_BOAT: - case TNT_MINECART: - eventType = PlayerBlockEventType.PLACE_VEHICLE; - break; - default: - eventType = PlayerBlockEventType.INTERACT_BLOCK; - break; + if (!player.isSneaking() && blockType.isInteractable()) { + eventType = PlayerBlockEventType.INTERACT_BLOCK; + break outer; } } + + // in the following, lb needs to have the material of the item in hand i.e. type + if (type == Material.REDSTONE || type == Material.STRING + || type == Material.PUMPKIN_SEEDS || type == Material.MELON_SEEDS + || type == Material.COCOA_BEANS || type == Material.WHEAT_SEEDS + || type == Material.BEETROOT_SEEDS || type == Material.SWEET_BERRIES || type + .isBlock()) { + //eventType = PlayerBlockEventType.PLACE_BLOCK; + return; + } + if (PaperLib.isPaper()) { + if (MaterialTags.SPAWN_EGGS.isTagged(type) || Material.EGG.equals(type)) { + eventType = PlayerBlockEventType.SPAWN_MOB; + break outer; + } + } else { + if (type.toString().toLowerCase().endsWith("egg")) { + eventType = PlayerBlockEventType.SPAWN_MOB; + break outer; + } + } + if (type.isEdible()) { + //Allow all players to eat while also allowing the block place event ot be fired + return; + } + switch (type) { + case ACACIA_BOAT: + case BIRCH_BOAT: + case CHEST_MINECART: + case COMMAND_BLOCK_MINECART: + case DARK_OAK_BOAT: + case FURNACE_MINECART: + case HOPPER_MINECART: + case JUNGLE_BOAT: + case MINECART: + case OAK_BOAT: + case SPRUCE_BOAT: + case TNT_MINECART: + eventType = PlayerBlockEventType.PLACE_VEHICLE; + break outer; + case FIREWORK_ROCKET: + case FIREWORK_STAR: + eventType = PlayerBlockEventType.SPAWN_MOB; + break outer; + case BOOK: + case KNOWLEDGE_BOOK: + case WRITABLE_BOOK: + case WRITTEN_BOOK: + eventType = PlayerBlockEventType.READ; + break outer; + case ARMOR_STAND: + location = BukkitUtil + .getLocation(block.getRelative(event.getBlockFace()).getLocation()); + eventType = PlayerBlockEventType.PLACE_MISC; + break outer; + } break; } -// case LEFT_CLICK_BLOCK: -// Block block = event.getClickedBlock(); -// location = BukkitUtil.getLocation(block.getLocation()); -// eventType = PlayerBlockEventType.BREAK_BLOCK; -// lazyItem = BukkitBlockUtil.supplyItem(block); -// break; + case LEFT_CLICK_BLOCK: { + location = BukkitUtil.getLocation(block.getLocation()); + // eventType = PlayerBlockEventType.BREAK_BLOCK; + blocktype1 = BukkitAdapter.asBlockType(block.getType()); + if (block.getType() == Material.DRAGON_EGG) { + eventType = PlayerBlockEventType.TELEPORT_OBJECT; + break; + } + + return; + } default: return; } if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) { - if (player.getInventory().getItemInMainHand().getType() == Material - .getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) { + if (event.getMaterial() == Material.getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) { return; } } - if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, lazyItem, true)) { + if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, blocktype1, true)) { event.setCancelled(true); + event.setUseInteractedBlock(Event.Result.DENY); } } @@ -2348,7 +2148,6 @@ import java.util.regex.Pattern; Plot plot = location.getOwnedPlot(); if (plot == null || !plot.getFlag(Flags.BLOCK_BURN, false)) { event.setCancelled(true); - return; } } @@ -2359,16 +2158,7 @@ import java.util.regex.Pattern; Entity ignitingEntity = event.getIgnitingEntity(); Block block = event.getBlock(); BlockIgniteEvent.IgniteCause igniteCause = event.getCause(); - Location location1; - if (block != null) { - location1 = BukkitUtil.getLocation(block.getLocation()); - } else if (ignitingEntity != null) { - location1 = BukkitUtil.getLocation(ignitingEntity); - } else if (player != null) { - location1 = BukkitUtil.getLocation(player); - } else { - return; - } + Location location1 = BukkitUtil.getLocation(block.getLocation()); PlotArea area = location1.getPlotArea(); if (area == null) { return; @@ -2534,9 +2324,9 @@ import java.util.regex.Pattern; Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> use = plot.getFlag(Flags.USE); + Optional> use = plot.getFlag(Flags.USE); Block block = event.getBlockClicked(); - if (use.isPresent() && use.get().contains(BukkitAdapter.asItemType(block.getType()))) { + if (use.isPresent() && use.get().contains(BukkitAdapter.asBlockType(block.getType()))) { return; } if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -2801,11 +2591,11 @@ import java.util.regex.Pattern; } } - @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST) public void onEntityCombustByEntity(EntityCombustByEntityEvent event) { EntityDamageByEntityEvent eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), - EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration()); + EntityDamageEvent.DamageCause.FIRE_TICK, event.getDuration()); onEntityDamageByEntityEvent(eventChange); if (eventChange.isCancelled()) { event.setCancelled(true); @@ -3069,12 +2859,12 @@ import java.util.regex.Pattern; @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void blockCreate(BlockPlaceEvent event) { + Player player = event.getPlayer(); Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); PlotArea area = location.getPlotArea(); if (area == null) { return; } - Player player = event.getPlayer(); PlotPlayer pp = BukkitUtil.getPlayer(player); Plot plot = area.getPlot(location); if (plot != null) { @@ -3085,25 +2875,23 @@ import java.util.regex.Pattern; .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { - MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, - Captions.PERMISSION_ADMIN_BUILD_UNOWNED); + if (!Permissions + .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED, true)) { event.setCancelled(true); return; } } else if (!plot.isAdded(pp.getUUID())) { - Set place = plot.getFlag(Flags.PLACE, null); - if (place != null) { - Block block = event.getBlock(); - if (place.contains(BukkitAdapter.asItemType(block.getType()))) { - return; - } + Optional> place = plot.getFlag(Flags.PLACE); + Block block = event.getBlock(); + if (place.isPresent() && place.get().contains(BukkitAdapter.asBlockType(block.getType()))) { + return; } - if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + return; + } else { MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); - return; } } else if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -3119,10 +2907,10 @@ import java.util.regex.Pattern; sendBlockChange(block.getLocation(), block.getBlockData()); } } - } else if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { - MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, - Captions.PERMISSION_ADMIN_BUILD_ROAD); - event.setCancelled(true); } + if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { + return; + } + event.setCancelled(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index 3347fad8b..6df44dca7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -58,9 +58,9 @@ public final class Flags { public static final BooleanFlag BLOCK_IGNITION = new BooleanFlag("block-ignition"); public static final BooleanFlag SOIL_DRY = new BooleanFlag("soil-dry"); public static final StringListFlag BLOCKED_CMDS = new StringListFlag("blocked-cmds"); - public static final ItemTypeListFlag USE = new ItemTypeListFlag("use"); - public static final ItemTypeListFlag BREAK = new ItemTypeListFlag("break"); - public static final ItemTypeListFlag PLACE = new ItemTypeListFlag("place"); + public static final BlockStateListFlag USE = new BlockStateListFlag("use"); + public static final BlockStateListFlag BREAK = new BlockStateListFlag("break"); + public static final BlockStateListFlag PLACE = new BlockStateListFlag("place"); public static final BooleanFlag DEVICE_INTERACT = new BooleanFlag("device-interact"); public static final BooleanFlag VEHICLE_BREAK = new BooleanFlag("vehicle-break"); public static final BooleanFlag VEHICLE_PLACE = new BooleanFlag("vehicle-place"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java index 815f5ea43..c226d87aa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; public enum PlayerBlockEventType { // Non interactive - EAT, READ, + READ, // Right click with monster egg SPAWN_MOB, @@ -11,21 +11,11 @@ public enum PlayerBlockEventType { TELEPORT_OBJECT, // armor stands - PLACE_MISC, // blocks - PLACE_BLOCK, // paintings / item frames - PLACE_HANGING, // vehicles + PLACE_MISC, PLACE_VEHICLE, // armor stands - BREAK_MISC, // blocks - BREAK_BLOCK, // paintings / item frames - BREAK_HANGING, BREAK_VEHICLE, - - // armor stands - INTERACT_MISC, // blocks - INTERACT_BLOCK, // vehicle - INTERACT_VEHICLE, // item frame / painting - INTERACT_HANGING, + INTERACT_BLOCK, // blocks // Pressure plate, tripwire etc TRIGGER_PHYSICAL, 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 30c8b19c8..78532942d 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 @@ -9,9 +9,9 @@ import lombok.Setter; public class Location implements Cloneable, Comparable { - @Getter private int x; - @Getter private int y; - @Getter private int z; + private int x; + private int y; + private int z; @Getter @Setter private float yaw; @Getter @Setter private float pitch; @Getter @Setter private String world; @@ -31,6 +31,18 @@ public class Location implements Cloneable, Comparable { this(world, x, y, z, 0f, 0f); } + public int getX() { + return this.x; + } + + public int getY() { + return this.y; + } + + public int getZ() { + return this.z; + } + public void setX(int x) { this.x = x; this.blockVector3 = BlockVector3.at(x, y, z); @@ -53,7 +65,8 @@ public class Location implements Cloneable, Comparable { this.z = blockVector3.getZ(); } - @Override public Location clone() { + @Override + public Location clone() { try { return (Location) super.clone(); } catch (CloneNotSupportedException e) { 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 7af028759..21b06cf9b 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 @@ -14,18 +14,14 @@ 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 com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.item.ItemType; -import com.sk89q.worldedit.world.item.ItemTypes; import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.UUID; -import java.util.function.Supplier; public abstract class EventUtil { @@ -105,7 +101,7 @@ public abstract class EventUtil { } public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type, - Location location, Supplier item, boolean notifyPerms) { + Location location, BlockType blockType, boolean notifyPerms) { PlotArea area = location.getPlotArea(); assert area != null; Plot plot = area.getPlot(location); @@ -117,103 +113,8 @@ public abstract class EventUtil { switch (type) { case TELEPORT_OBJECT: return false; - case EAT: case READ: return true; - case BREAK_BLOCK: - if (plot == null) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), - notifyPerms); - } - if (!plot.hasOwner()) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), - notifyPerms); - } - Optional> use = plot.getFlag(Flags.USE); - if (use.isPresent()) { - Set value = use.get(); - if (value.contains(ItemTypes.AIR) || value - .contains(item.get())) { - return true; - } - } - Optional> destroy = plot.getFlag(Flags.BREAK); - if (destroy.isPresent()) { - Set value = destroy.get(); - if (value.contains(ItemTypes.AIR) || value - .contains(item.get())) { - return true; - } - } - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), - false)) { - return true; - } - return !(!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_BREAK.getTranslated())); - case BREAK_HANGING: - if (plot == null) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), - notifyPerms); - } - if (plot.getFlag(Flags.HANGING_BREAK).orElse(false)) { - return true; - } - if (plot.hasOwner()) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) - || !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_HANGING_BREAK.getTranslated())); - } - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), - notifyPerms); - case BREAK_MISC: - if (plot == null) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), - notifyPerms); - } - if (plot.getFlag(Flags.MISC_BREAK).orElse(false)) { - return true; - } - if (plot.hasOwner()) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) - || !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_MISC_BREAK.getTranslated())); - } - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), - notifyPerms); - case BREAK_VEHICLE: - if (plot == null) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), - notifyPerms); - } - if (plot.getFlag(Flags.VEHICLE_BREAK).orElse(false)) { - return true; - } - if (plot.hasOwner()) { - if (Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), - false)) { - return true; - } - return !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_VEHICLE_BREAK.getTranslated())); - } - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), - notifyPerms); case INTERACT_BLOCK: { if (plot == null) { return Permissions.hasPermission(player, @@ -225,10 +126,10 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } - Optional> flagValue = plot.getFlag(Flags.USE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(blockType)) { return Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil @@ -237,31 +138,6 @@ public abstract class EventUtil { } return true; } - case PLACE_BLOCK: { - if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_ROAD.getTranslated(), - notifyPerms); - } - if (!plot.hasOwner()) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_BUILD_UNOWNED.getTranslated(), - notifyPerms); - } - Optional> flagValue = plot.getFlag(Flags.PLACE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { - if (Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_BUILD_OTHER.getTranslated(), false)) { - return true; - } - return !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_PLACE.getTranslated())); - } - return true; - } case TRIGGER_PHYSICAL: { if (plot == null) { return Permissions.hasPermission(player, @@ -275,10 +151,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.DEVICE_INTERACT).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.USE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(blockType)) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -288,95 +164,6 @@ public abstract class EventUtil { } return true; } - case INTERACT_HANGING: { - if (plot == null) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), - notifyPerms); - } - if (!plot.hasOwner()) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), - notifyPerms); - } - if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) { - return true; - } - Optional> flagValue = plot.getFlag(Flags.USE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { - if (Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), - false)) { - return true; - } - return !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.getTranslated())); - } - return true; - } - case INTERACT_MISC: { - if (plot == null) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), - notifyPerms); - } - if (!plot.hasOwner()) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), - notifyPerms); - } - if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) { - return true; - } - Optional> flag = plot.getFlag(Flags.USE); - Set value = flag.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { - if (Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), - false)) { - return true; - } - return !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_MISC_INTERACT - .getTranslated())); - } - return true; - } - case INTERACT_VEHICLE: { - if (plot == null) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), - notifyPerms); - } - if (!plot.hasOwner()) { - return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), - notifyPerms); - } - if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) { - return true; - } - Optional> flag = plot.getFlag(Flags.USE); - Set value = flag.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { - if (Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), - false)) { - return true; - } - return !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_VEHICLE_USE - .getTranslated())); - } - return true; - } case SPAWN_MOB: { if (plot == null) { return Permissions.hasPermission(player, @@ -391,10 +178,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.PLACE); - Set value = flagValue.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { + Optional> flagValue = plot.getFlag(Flags.PLACE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(blockType)) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -421,10 +208,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.PLACE); - Set value = flag.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { + Optional> flag = plot.getFlag(Flags.PLACE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(blockType)) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -449,24 +236,8 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } - if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) { - return true; - } - Optional> flag = plot.getFlag(Flags.PLACE); - Set value = flag.orElse(null); - if (value == null || !value.contains(ItemTypes.AIR) && !value - .contains(item.get())) { - if (Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), - false)) { - return true; - } - return !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_VEHICLE_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE - .getTranslated())); - } - return true; + Optional flag1 = plot.getFlag(Flags.VEHICLE_PLACE); + return flag1.orElse(false); default: break; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java index c9a332bb9..f11639813 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java @@ -89,7 +89,7 @@ public class Permissions { } /** - * Check if a PlotPlayer has a permission, and optionally send the no permission message if applicable. + * Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable. * * @param player * @param permission diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java index f5748b644..b925ce2a2 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java @@ -32,23 +32,23 @@ public class FlagTest { DBFunc.dbManager = new AbstractDBTest(); } - @Test public void flagTest() throws Exception { - Plot plot = new Plot(null, new PlotId(0, 0)); - plot.owner = UUID.fromString("84499644-ad72-454b-a19d-f28c28df382b"); - //plot.setFlag(use, use.parseValue("33,33:1,6:4")); //TODO fix this so FlagTest will run during compile - Optional flag = plot.getFlag(use); - if (flag.isPresent()) { - System.out.println(Flags.USE.valueToString(flag.get())); - testBlock = ItemTypes.BONE_BLOCK; - flag.get().add(testBlock); - } - flag.ifPresent(collection -> System.out.println(Flags.USE.valueToString(collection))); - Optional> flag2 = plot.getFlag(Flags.USE); - if (flag2.isPresent()) { - // assertThat(flag2.get(), (Matcher>) IsCollectionContaining.hasItem(testBlock)); - } - if (flag.isPresent() && flag2.isPresent()) { - assertEquals(flag.get(), flag2.get()); - } - } +// @Test public void flagTest() throws Exception { +// Plot plot = new Plot(null, new PlotId(0, 0)); +// plot.owner = UUID.fromString("84499644-ad72-454b-a19d-f28c28df382b"); +// //plot.setFlag(use, use.parseValue("33,33:1,6:4")); //TODO fix this so FlagTest will run during compile +// Optional flag = plot.getFlag(use); +// if (flag.isPresent()) { +// System.out.println(Flags.USE.valueToString(flag.get())); +// testBlock = ItemTypes.BONE_BLOCK; +// flag.get().add(testBlock); +// } +// flag.ifPresent(collection -> System.out.println(Flags.USE.valueToString(collection))); +// Optional> flag2 = plot.getFlag(Flags.USE); +// if (flag2.isPresent()) { +// // assertThat(flag2.get(), (Matcher>) IsCollectionContaining.hasItem(testBlock)); +// } +// if (flag.isPresent() && flag2.isPresent()) { +// assertEquals(flag.get(), flag2.get()); +// } +// } } From 7760631751b939d6bbb4d7315aa2b74bc359fb6f Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 6 Dec 2019 21:18:56 -0500 Subject: [PATCH 231/258] Remove deprecated method from Captions.java --- .../plotsquared/plot/PlotSquared.java | 3 +- .../plotsquared/plot/commands/Auto.java | 5 ++- .../plotsquared/plot/commands/Claim.java | 4 +- .../plotsquared/plot/commands/FlagCmd.java | 37 +++++++++++-------- .../plotsquared/plot/commands/Grant.java | 6 ++- .../plotsquared/plot/commands/ListCmd.java | 17 +++++---- .../plotsquared/plot/commands/Set.java | 9 +++-- .../plotsquared/plot/commands/SetCommand.java | 10 +++-- .../plotsquared/plot/config/Captions.java | 4 -- .../plotsquared/plot/object/PlotPlayer.java | 6 ++- .../plotsquared/plot/util/EventUtil.java | 2 +- .../plot/util/LegacyConverter.java | 8 ++-- .../plotsquared/plot/util/MainUtil.java | 4 +- 13 files changed, 66 insertions(+), 49 deletions(-) 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 4090bf4da..25e861b35 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 @@ -317,7 +317,8 @@ import java.util.zip.ZipInputStream; e.printStackTrace(); } - PlotSquared.log(Captions.PREFIX + Captions.ENABLED.f(IMP.getPluginName())); + PlotSquared.log(Captions.PREFIX + Captions + .format(Captions.ENABLED.getTranslated(), IMP.getPluginName())); } /** 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 355dbc32a..d3148370c 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 @@ -218,11 +218,12 @@ public class Auto extends SubCommand { sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic); return true; } - if (!Permissions.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) + if (!Permissions.hasPermission(player, + Captions.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)); + Captions.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)); return true; } } 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 2c13ee016..a10e83aca 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 @@ -11,7 +11,6 @@ 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; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; @@ -59,7 +58,8 @@ public class Claim extends SubCommand { "non-existent: " + schematic); } if (!Permissions - .hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) + .hasPermission(player, Captions + .format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic); 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 8ec105c88..bfe3cc4c9 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 @@ -40,8 +40,9 @@ public class FlagCmd extends SubCommand { private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) { key = key.toLowerCase(); value = value.toLowerCase(); - String perm = - Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()); + String perm = Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), + value.toLowerCase()); if (flag instanceof IntegerFlag && MathMan.isInteger(value)) { try { int numeric = Integer.parseInt(value); @@ -52,9 +53,9 @@ public class FlagCmd extends SubCommand { Settings.Limit.MAX_PLOTS; final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric; if (!result) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_FLAG_KEY_VALUE - .f(key.toLowerCase(), value.toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), value.toLowerCase())); } return result; } @@ -65,13 +66,14 @@ public class FlagCmd extends SubCommand { final BlockStateListFlag blockListFlag = (BlockStateListFlag) flag; Set parsedBlocks = blockListFlag.parseValue(value); for (final BlockType block : parsedBlocks) { - final String permission = Captions.PERMISSION_SET_FLAG_KEY_VALUE - .f(key.toLowerCase(), block.toString().toLowerCase()); + final String permission = Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), block.toString().toLowerCase()); final boolean result = Permissions.hasPermission(player, permission); if (!result) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_FLAG_KEY_VALUE - .f(key.toLowerCase(), value.toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), value.toLowerCase())); return false; } } @@ -79,8 +81,9 @@ public class FlagCmd extends SubCommand { } final boolean result = Permissions.hasPermission(player, perm); if (!result) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), + value.toLowerCase())); } return result; } @@ -196,11 +199,13 @@ public class FlagCmd extends SubCommand { "/plot flag remove [values]"); return false; } - if (!Permissions.hasPermission(player, - Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) { + if (!Permissions.hasPermission(player, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), + args[1].toLowerCase()))) { if (args.length != 3) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), + args[1].toLowerCase())); return false; } for (String entry : args[2].split(",")) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index d8a1f3962..a3d8855ec 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -32,8 +32,10 @@ import java.util.concurrent.CompletableFuture; switch (arg0) { case "add": case "check": - if (!Permissions.hasPermission(player, Captions.PERMISSION_GRANT.f(arg0))) { - Captions.NO_PERMISSION.send(player, Captions.PERMISSION_GRANT.f(arg0)); + if (!Permissions.hasPermission(player, + Captions.format(Captions.PERMISSION_GRANT.getTranslated(), arg0))) { + Captions.NO_PERMISSION.send(player, + Captions.format(Captions.PERMISSION_GRANT.getTranslated(), arg0)); return CompletableFuture.completedFuture(false); } if (args.length > 2) { 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 2b70e48e5..8230922c6 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 @@ -137,9 +137,10 @@ public class ListCmd extends SubCommand { return false; } if (!Permissions - .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) { + .hasPermission(player, + Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_LIST_WORLD_NAME.f(world)); + Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world)); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots(world)); @@ -161,9 +162,10 @@ public class ListCmd extends SubCommand { return false; } if (!Permissions - .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) { + .hasPermission(player, + Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_LIST_WORLD_NAME.f(world)); + Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world)); return false; } plots = area == null ? new ArrayList() : new ArrayList<>(area.getPlots()); @@ -308,9 +310,10 @@ public class ListCmd extends SubCommand { return false; } if (!Permissions - .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]))) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_LIST_WORLD_NAME.f(args[0])); + .hasPermission(player, Captions + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0])); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots(args[0])); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 8106b81b9..438086b43 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -50,10 +50,11 @@ import java.util.stream.IntStream; for (String component : components) { if (component.equalsIgnoreCase(args[0])) { - if (!Permissions.hasPermission(player, - Captions.PERMISSION_SET_COMPONENT.f(component))) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_SET_COMPONENT.f(component)); + if (!Permissions.hasPermission(player, Captions + .format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), component))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions + .format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), + component)); return false; } if (args.length < 2) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index 8b746c624..8ec4bee2c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -18,18 +18,20 @@ public abstract class SetCommand extends SubCommand { } if (!plot.hasOwner()) { if (!Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { + .hasPermission(player, + Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_ADMIN_COMMAND.f(getFullId())); + Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId())); MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED); return false; } } if (!plot.isOwner(player.getUUID())) { if (!Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { + .hasPermission(player, + Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_ADMIN_COMMAND.f(getFullId())); + Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId())); MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 4a876314b..be175260b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -774,10 +774,6 @@ public enum Captions { } } - @Deprecated public String f(final Object... args) { - return format(getTranslated(), args); - } - @Override public String toString() { return this.translatedString; } 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 84891a1af..059f20559 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 @@ -612,7 +612,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { if (getMeta("teleportOnLogin", true)) { teleport(location); sendMessage( - Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX + Captions.format(Captions.TELEPORTED_TO_PLOT.getTranslated()) + + " (quitLoc) (" + plotX + "," + plotZ + ")"); } }); @@ -623,7 +624,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { if (getMeta("teleportOnLogin", true)) { if (plot.isLoaded()) { teleport(location); - sendMessage(Captions.TELEPORTED_TO_PLOT.f() + sendMessage(Captions.format( + Captions.TELEPORTED_TO_PLOT.getTranslated()) + " (quitLoc-unloaded) (" + plotX + "," + plotZ + ")"); } 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 21b06cf9b..da6b4e4e8 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 @@ -87,7 +87,7 @@ public abstract class EventUtil { .getArea() instanceof SinglePlotArea)) { TaskManager.runTask(() -> plot.teleportPlayer(player)); MainUtil.sendMessage(player, - Captions.TELEPORTED_TO_ROAD.f() + " (on-login) " + "(" + plot.getId().x + ";" + plot + Captions.format(Captions.TELEPORTED_TO_ROAD.getTranslated()) + " (on-login) " + "(" + plot.getId().x + ";" + plot .getId().y + ")"); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java index 93faabe87..38db9b9f4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java @@ -81,7 +81,8 @@ import java.util.Map; @NonNull final String key, @NonNull final String block) { final BlockBucket bucket = this.blockToBucket(block); this.setString(section, key, bucket); - PlotSquared.log(Captions.LEGACY_CONFIG_REPLACED.f(block, bucket.toString())); + PlotSquared.log(Captions + .format(Captions.LEGACY_CONFIG_REPLACED.getTranslated(), block, bucket.toString())); } private void convertBlockList(@NonNull final ConfigurationSection section, @@ -89,8 +90,9 @@ import java.util.Map; final BlockState[] blocks = this.splitBlockList(blockList); final BlockBucket bucket = this.blockListToBucket(blocks); this.setString(section, key, bucket); - PlotSquared.log( - Captions.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString())); + PlotSquared.log(Captions + .format(Captions.LEGACY_CONFIG_REPLACED.getTranslated(), plotBlockArrayString(blocks), + bucket.toString())); } private String plotBlockArrayString(@NonNull final BlockState[] blocks) { 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 b224e201a..15abc1bd6 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 @@ -789,7 +789,9 @@ public class MainUtil { value = df.format(value); } flags.append(prefix) - .append(Captions.PLOT_FLAG_LIST.f(entry.getKey().getName(), value)); + .append(Captions + .format(Captions.PLOT_FLAG_LIST.getTranslated(), entry.getKey().getName(), + value)); prefix = ", "; } } From 3ba29583fcde44126fc61669dcc9836ef0a33dbb Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 7 Dec 2019 17:40:15 +0100 Subject: [PATCH 232/258] Add all colors to style.yml For further releases , we should aim to get a rid of the styles.yml and $ codes. I've seen a lot of people struggling with them, and if you want to use other formatting codes, you need to yamlize the non yamlized messages, otherwise it won't work properly. --- .../plotsquared/plot/PlotSquared.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 25e861b35..880f2aaab 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 @@ -1828,11 +1828,24 @@ import java.util.zip.ZipInputStream; if (this.version != null) { this.style.set("Version", this.version.toString()); } - Map object = new HashMap<>(4); + this.style.set("Information", "Left Row: PlotSquared color codes ($), right row: Minecraft color codes (&)"); + Map object = new HashMap<>(16); object.put("color.1", "6"); object.put("color.2", "7"); object.put("color.3", "8"); object.put("color.4", "3"); + object.put("color.5", "1"); + object.put("color.6", "2"); + object.put("color.7", "4"); + object.put("color.8", "5"); + object.put("color.9", "9"); + object.put("color.10", "0"); + object.put("color.11", "a"); + object.put("color.12", "b"); + object.put("color.13", "c"); + object.put("color.14", "d"); + object.put("color.15", "e"); + object.put("color.16", "f"); if (!this.style.contains("color")) { for (Entry node : object.entrySet()) { this.style.set(node.getKey(), node.getValue()); From 781a4d8d78bff471494764cf3bba8005ee25bfa9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2019 18:25:18 +0000 Subject: [PATCH 233/258] Bump org.ajoberstar.grgit from 3.1.1 to 4.0.0 Bumps org.ajoberstar.grgit from 3.1.1 to 4.0.0. Signed-off-by: dependabot-preview[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4a8237379..8a03527df 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ buildscript { plugins { id "maven-publish" - id "org.ajoberstar.grgit" version "3.1.1" + id "org.ajoberstar.grgit" version "4.0.0" } group = "com.github.intellectualsites.plotsquared" From c1a7844f4a3fed8043037f0a17af6af81e0c596c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2019 18:25:42 +0000 Subject: [PATCH 234/258] Bump lombok from 1.18.8 to 1.18.10 Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.8 to 1.18.10. - [Release notes](https://github.com/rzwitserloot/lombok/releases) - [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown) - [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.8...v1.18.10) Signed-off-by: dependabot-preview[bot] --- Core/build.gradle | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/build.gradle b/Core/build.gradle index 865e18257..6d70d77d3 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -9,7 +9,7 @@ dependencies { because("Minecraft uses GSON 2.8.0") force = true } - implementation("org.projectlombok:lombok:1.18.8") + implementation("org.projectlombok:lombok:1.18.10") compileOnly("org.projectlombok:lombok:1.18.8") testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") diff --git a/build.gradle b/build.gradle index 8a03527df..05971ee6c 100644 --- a/build.gradle +++ b/build.gradle @@ -83,7 +83,7 @@ subprojects { because("Minecraft uses Guava 21 as of 1.13") } compileOnly("org.jetbrains:annotations:17.0.0") - compileClasspath("org.projectlombok:lombok:1.18.8") + compileClasspath("org.projectlombok:lombok:1.18.10") testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") From 4ba5b6da1dd20fae5e49784a8f687c781520b2ce Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2019 07:36:06 +0000 Subject: [PATCH 235/258] Bump annotations from 17.0.0 to 18.0.0 Bumps [annotations](https://github.com/JetBrains/java-annotations) from 17.0.0 to 18.0.0. - [Release notes](https://github.com/JetBrains/java-annotations/releases) - [Commits](https://github.com/JetBrains/java-annotations/compare/17.0.0...18.0.0) Signed-off-by: dependabot-preview[bot] --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 05971ee6c..28988c1e5 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { configurations.all { resolutionStrategy { force("org.ow2.asm:asm:7.2") - force("org.jetbrains:annotations:17.0.0") + force("org.jetbrains:annotations:18.0.0") } } } @@ -94,7 +94,7 @@ subprojects { resolutionStrategy { force("junit:junit:4.12") force("com.google.guava:guava:21.0") - force("org.jetbrains:annotations:17.0.0") + force("org.jetbrains:annotations:18.0.0") force("com.google.code.findbugs:jsr305:3.0.2") } } From e5423b5e08c64cb1e8128d859dd014952f6e43b9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2019 07:26:55 +0000 Subject: [PATCH 236/258] Bump kotlin-stdlib from 1.3.50 to 1.3.61 Bumps [kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.3.50 to 1.3.61. - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/v1.3.61/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.50...v1.3.61) Signed-off-by: dependabot-preview[bot] --- Bukkit/build.gradle | 2 +- Core/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 4dd1d8f48..bfc358d03 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -84,7 +84,7 @@ shadowJar { include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) include(dependency("com.squareup.okhttp3:okhttp:3.12.0")) include(dependency("com.squareup.okio:okio:2.2.2")) - include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) + include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.61")) include(dependency("io.papermc:paperlib:1.0.2")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) } diff --git a/Core/build.gradle b/Core/build.gradle index 6d70d77d3..80456c626 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -17,7 +17,7 @@ dependencies { implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") implementation("com.squareup.okhttp3:okhttp:3.12.0") implementation("com.squareup.okio:okio:2.2.2") - implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50") + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.61") } sourceCompatibility = 1.8 From 1097f44febe5ce82e85e96a9e11fda4a74e3057e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2019 07:35:42 +0000 Subject: [PATCH 237/258] Bump retrofit from 2.4.0 to 2.6.2 Bumps [retrofit](https://github.com/square/retrofit) from 2.4.0 to 2.6.2. - [Release notes](https://github.com/square/retrofit/releases) - [Changelog](https://github.com/square/retrofit/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/retrofit/commits) Signed-off-by: dependabot-preview[bot] --- Bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index bfc358d03..c57f1c7ff 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -22,7 +22,7 @@ dependencies { implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile("io.papermc:paperlib:1.0.2") - compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0") + compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.6.2") implementation("net.kyori:text-adapter-bukkit:3.0.3") compile("net.milkbowl.vault:VaultAPI:1.7") { exclude(module: "bukkit") From 4e2c90e399a0c18ee9d1575bbccb8a4b6d1783a7 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2019 18:26:16 +0000 Subject: [PATCH 238/258] Bump gson from 2.8.0 to 2.8.6 Bumps [gson](https://github.com/google/gson) from 2.8.0 to 2.8.6. - [Release notes](https://github.com/google/gson/releases) - [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/gson/compare/gson-parent-2.8.0...gson-parent-2.8.6) Signed-off-by: dependabot-preview[bot] --- Core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/build.gradle b/Core/build.gradle index 80456c626..a4d125b8e 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -5,7 +5,7 @@ def textVersion = "3.0.2" dependencies { implementation("org.yaml:snakeyaml:1.25") - implementation("com.google.code.gson:gson:2.8.0") { + implementation("com.google.code.gson:gson:2.8.6") { because("Minecraft uses GSON 2.8.0") force = true } From eb09e0a633d27bf605b61772707915ff56baaf39 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2019 18:24:56 +0000 Subject: [PATCH 239/258] Bump okhttp from 3.12.0 to 4.2.2 Bumps [okhttp](https://github.com/square/okhttp) from 3.12.0 to 4.2.2. - [Release notes](https://github.com/square/okhttp/releases) - [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okhttp/compare/parent-3.12.0...parent-4.2.2) Signed-off-by: dependabot-preview[bot] --- Bukkit/build.gradle | 2 +- Core/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index c57f1c7ff..2a975ab65 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -82,7 +82,7 @@ shadowJar { // update notification stuff include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) - include(dependency("com.squareup.okhttp3:okhttp:3.12.0")) + include(dependency("com.squareup.okhttp3:okhttp:4.2.2")) include(dependency("com.squareup.okio:okio:2.2.2")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.61")) include(dependency("io.papermc:paperlib:1.0.2")) diff --git a/Core/build.gradle b/Core/build.gradle index a4d125b8e..735cd5a40 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -15,7 +15,7 @@ dependencies { annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") - implementation("com.squareup.okhttp3:okhttp:3.12.0") + implementation("com.squareup.okhttp3:okhttp:4.2.2") implementation("com.squareup.okio:okio:2.2.2") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.61") } From 241589fdb0949686eb3ee4461018ce8606ca0c2d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 7 Dec 2019 18:56:43 +0100 Subject: [PATCH 240/258] Revert "Bump retrofit from 2.4.0 to 2.6.2" This reverts commit 1097f44febe5ce82e85e96a9e11fda4a74e3057e. --- Bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 2a975ab65..e3ab0db97 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -22,7 +22,7 @@ dependencies { implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile("io.papermc:paperlib:1.0.2") - compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.6.2") + compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0") implementation("net.kyori:text-adapter-bukkit:3.0.3") compile("net.milkbowl.vault:VaultAPI:1.7") { exclude(module: "bukkit") From 7d8a5213dd54cc5a5edb587db341ad31565c8a00 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2019 18:17:32 +0000 Subject: [PATCH 241/258] Bump okio from 2.2.2 to 2.4.1 Bumps [okio](https://github.com/square/okio) from 2.2.2 to 2.4.1. - [Release notes](https://github.com/square/okio/releases) - [Changelog](https://github.com/square/okio/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okio/compare/2.2.2...2.4.1) Signed-off-by: dependabot-preview[bot] --- Bukkit/build.gradle | 2 +- Core/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index e3ab0db97..95bf96671 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -83,7 +83,7 @@ shadowJar { include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) include(dependency("com.squareup.okhttp3:okhttp:4.2.2")) - include(dependency("com.squareup.okio:okio:2.2.2")) + include(dependency("com.squareup.okio:okio:2.4.1")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.61")) include(dependency("io.papermc:paperlib:1.0.2")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) diff --git a/Core/build.gradle b/Core/build.gradle index 735cd5a40..4d57e4c86 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -16,7 +16,7 @@ dependencies { testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") implementation("com.squareup.okhttp3:okhttp:4.2.2") - implementation("com.squareup.okio:okio:2.2.2") + implementation("com.squareup.okio:okio:2.4.1") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.61") } From 07b69426904ed3a6edcd9401ce4671d5c1e19aeb Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 9 Dec 2019 14:43:53 -0500 Subject: [PATCH 242/258] Minor code tweaks --- .../plotsquared/bukkit/BukkitMain.java | 14 +- .../bukkit/generator/BukkitPlotGenerator.java | 7 +- .../bukkit/listeners/PlayerEvents.java | 40 ++-- .../bukkit/util/BukkitInventoryUtil.java | 178 +++++++++--------- .../bukkit/util/BukkitVersion.java | 2 - .../bukkit/uuid/LowerOfflineUUIDWrapper.java | 3 +- .../bukkit/uuid/SQLUUIDHandler.java | 5 +- .../plotsquared/plot/object/BlockBucket.java | 8 +- .../plotsquared/plot/object/Location.java | 10 +- .../plotsquared/plot/object/PlotArea.java | 7 +- .../plotsquared/plot/util/EventUtil.java | 3 +- .../plot/util/block/ChunkBlockQueue.java | 13 +- 12 files changed, 160 insertions(+), 130 deletions(-) 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 00c7fccf9..4ac6a77f2 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 @@ -171,7 +171,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain getLogger().info("-------- PlotSquared Update Check --------"); if (throwable != null) { getLogger().severe(String - .format("Could not check for update. Reason: %s", + .format("Could not check for updates. Reason: %s", throwable.getMessage())); } else { if (updateDescription == null) { @@ -180,8 +180,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } else { getLogger() .info("There appears to be a PlotSquared update available!"); - getLogger().info(String.format("You are running version %s," - + " the newest available version is %s", + getLogger().info(String.format( + "You are running version %s, the newest available version is %s", getPluginVersionString(), updateDescription.getVersion())); getLogger().info( String.format("Update URL: %s", updateDescription.getUrl())); @@ -540,6 +540,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case PUFFERFISH: case PHANTOM: case ILLUSIONER: + case CAT: + case PANDA: + case FOX: + case PILLAGER: + case TRADER_LLAMA: + case WANDERING_TRADER: + case RAVAGER: + //case BEE: default: { if (Settings.Enabled_Components.KILL_ROAD_MOBS) { Location location = entity.getLocation(); 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 beafb2dc8..1536afa3d 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 @@ -73,7 +73,9 @@ public class BukkitPlotGenerator extends ChunkGenerator return this.platformGenerator; } - @Override @NotNull public List getDefaultPopulators(@NotNull World world) { + @Override + @NotNull + public List getDefaultPopulators(@NotNull World world) { try { if (!this.loaded) { String name = world.getName(); @@ -117,7 +119,8 @@ public class BukkitPlotGenerator extends ChunkGenerator return toAdd; } - @Override @NotNull + @Override + @NotNull public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome) { 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 b2f3459b0..bf72c544e 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 @@ -640,7 +640,7 @@ import java.util.regex.Pattern; Optional> flag = plot.getFlag(Flags.BLOCKED_CMDS); if (flag.isPresent() && !Permissions .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { - List blocked_cmds = flag.get(); + List blockedCommands = flag.get(); String part = parts[0]; if (parts[0].contains(":")) { part = parts[0].split(":")[1]; @@ -674,7 +674,7 @@ import java.util.regex.Pattern; if (!s1.equals(part)) { msg = msg.replace(s1, part); } - for (String s : blocked_cmds) { + for (String s : blockedCommands) { Pattern pattern; if (!RegExUtil.compiledPatterns.containsKey(s)) { RegExUtil.compiledPatterns.put(s, pattern = Pattern.compile(s)); @@ -745,8 +745,8 @@ import java.util.regex.Pattern; .text(" --------").color("$2").send(pp); new PlotMessage("There appears to be a PlotSquared update available!") .color("$1").send(pp); - new PlotMessage(String.format("You are running version %s," - + " the newest available version is %s", + new PlotMessage(String.format( + "You are running version %s, the newest available version is %s", bukkitMain.getPluginVersionString(), updateDescription.getVersion())).color("$1").send(pp); new PlotMessage("Update URL").color("$1").text(": ").color("$2") @@ -1340,12 +1340,6 @@ import java.util.regex.Pattern; if (Flags.ICE_FORM.isFalse(plot)) { event.setCancelled(true); } - return; - case STONE: - case OBSIDIAN: - case COBBLESTONE: - // TODO event ? - return; } } @@ -1491,8 +1485,7 @@ import java.util.regex.Pattern; event.setCancelled(true); return; } - List blocks = event.getBlocks(); - for (Block block1 : blocks) { + for (Block block1 : event.getBlocks()) { Location bloc = BukkitUtil.getLocation(block1.getLocation()); if (!area.contains(bloc.getX(), bloc.getZ()) || !area .contains(bloc.getX() + relative.getBlockX(), bloc.getZ() + relative.getBlockZ())) { @@ -1650,11 +1643,11 @@ import java.util.regex.Pattern; location = BukkitUtil.getLocation(blocks.get(i).getLocation()); Plot plot = area.getOwnedPlot(location); /* - * plot -> the base plot of the merged area - * origin -> the plot where the event gets called + * plot → the base plot of the merged area + * origin → the plot where the event gets called */ - // Are plot and origin not the same AND are both plots merged + // Are plot and origin different AND are both plots merged if (!Objects.equals(plot, origin) && (!plot.isMerged() && !origin.isMerged())) { event.getBlocks().remove(i); } @@ -2025,6 +2018,18 @@ import java.util.regex.Pattern; return; } } + if (eventType == null) { + PlotSquared.log("Please report this to PlotSquared Developers: "); + PlotSquared.log("Action: " + event.getAction().toString()); + PlotSquared.log("HasItem: " + event.hasItem()); + PlotSquared.log("HasBlock: " + event.hasBlock()); + PlotSquared.log("getItem: " + (event.hasItem() ? Objects.requireNonNull(event.getItem()) + .toString() : "null")); + PlotSquared.log("getBlockFace: " + (event.getBlockFace() != null ? event.getBlockFace().toString() : "null")); + PlotSquared.log("isBlockInHand: " + (event.isBlockInHand())); + PlotSquared.log("getClickedBlock: " + (event.getClickedBlock() != null ? event.getClickedBlock().toString() : "null")); + return; + } if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, blocktype1, true)) { event.setCancelled(true); event.setUseInteractedBlock(Event.Result.DENY); @@ -2372,6 +2377,11 @@ import java.util.regex.Pattern; return; } Player p = event.getPlayer(); + if (p != null) { + PlotSquared.debug("PlotSquared does not support HangingPlaceEvent for non-players."); + event.setCancelled(true); + return; + } PlotPlayer pp = BukkitUtil.getPlayer(p); Plot plot = area.getPlot(location); if (plot == null) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java index bb003833f..7f0a3119f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -22,105 +22,105 @@ import java.util.stream.IntStream; public class BukkitInventoryUtil extends InventoryUtil { - @Override public void open(PlotInventory inv) { - BukkitPlayer bp = (BukkitPlayer) inv.player; - Inventory inventory = Bukkit.createInventory(null, inv.size * 9, inv.getTitle()); - PlotItemStack[] items = inv.getItems(); - for (int i = 0; i < inv.size * 9; i++) { - PlotItemStack item = items[i]; - if (item != null) { - inventory.setItem(i, getItem(item)); - } + @Override public void open(PlotInventory inv) { + BukkitPlayer bp = (BukkitPlayer) inv.player; + Inventory inventory = Bukkit.createInventory(null, inv.size * 9, inv.getTitle()); + PlotItemStack[] items = inv.getItems(); + for (int i = 0; i < inv.size * 9; i++) { + PlotItemStack item = items[i]; + if (item != null) { + inventory.setItem(i, getItem(item)); + } + } + bp.player.openInventory(inventory); } - bp.player.openInventory(inventory); - } - @Override public void close(PlotInventory inv) { - if (!inv.isOpen()) { - return; + @Override public void close(PlotInventory inv) { + if (!inv.isOpen()) { + return; + } + BukkitPlayer bp = (BukkitPlayer) inv.player; + bp.player.closeInventory(); } - BukkitPlayer bp = (BukkitPlayer) inv.player; - bp.player.closeInventory(); - } - @Override public void setItem(PlotInventory inv, int index, PlotItemStack item) { - BukkitPlayer bp = (BukkitPlayer) inv.player; - InventoryView opened = bp.player.getOpenInventory(); - if (!inv.isOpen()) { - return; + @Override public void setItem(PlotInventory inv, int index, PlotItemStack item) { + BukkitPlayer bp = (BukkitPlayer) inv.player; + InventoryView opened = bp.player.getOpenInventory(); + if (!inv.isOpen()) { + return; + } + opened.setItem(index, getItem(item)); + bp.player.updateInventory(); } - opened.setItem(index, getItem(item)); - bp.player.updateInventory(); - } - private static ItemStack getItem(PlotItemStack item) { - if (item == null) { - return null; + private static ItemStack getItem(PlotItemStack item) { + if (item == null) { + return null; + } + ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.amount); + ItemMeta meta = null; + if (item.name != null) { + meta = stack.getItemMeta(); + meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', item.name)); + } + if (item.lore != null) { + if (meta == null) { + meta = stack.getItemMeta(); + } + List lore = new ArrayList<>(); + for (String entry : item.lore) { + lore.add(ChatColor.translateAlternateColorCodes('&', entry)); + } + meta.setLore(lore); + } + if (meta != null) { + stack.setItemMeta(meta); + } + return stack; } - ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.amount); - ItemMeta meta = null; - if (item.name != null) { - meta = stack.getItemMeta(); - meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', item.name)); - } - if (item.lore != null) { - if (meta == null) { - meta = stack.getItemMeta(); - } - List lore = new ArrayList<>(); - for (String entry : item.lore) { - lore.add(ChatColor.translateAlternateColorCodes('&', entry)); - } - meta.setLore(lore); - } - if (meta != null) { - stack.setItemMeta(meta); - } - return stack; - } - public PlotItemStack getItem(ItemStack item) { - if (item == null) { - return null; + public PlotItemStack getItem(ItemStack item) { + if (item == null) { + return null; + } + // int id = item.getTypeId(); + Material id = item.getType(); + ItemMeta meta = item.getItemMeta(); + int amount = item.getAmount(); + String name = null; + String[] lore = null; + if (item.hasItemMeta()) { + assert meta != null; + if (meta.hasDisplayName()) { + name = meta.getDisplayName(); + } + if (meta.hasLore()) { + List itemLore = meta.getLore(); + assert itemLore != null; + lore = itemLore.toArray(new String[0]); + } + } + return new PlotItemStack(id.name(), amount, name, lore); } - // int id = item.getTypeId(); - Material id = item.getType(); - ItemMeta meta = item.getItemMeta(); - int amount = item.getAmount(); - String name = null; - String[] lore = null; - if (item.hasItemMeta()) { - assert meta != null; - if (meta.hasDisplayName()) { - name = meta.getDisplayName(); - } - if (meta.hasLore()) { - List itemLore = meta.getLore(); - assert itemLore != null; - lore = itemLore.toArray(new String[0]); - } - } - return new PlotItemStack(id.name(), amount, name, lore); - } - @Override public PlotItemStack[] getItems(PlotPlayer player) { - BukkitPlayer bp = (BukkitPlayer) player; - PlayerInventory inv = bp.player.getInventory(); - return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i))) - .toArray(PlotItemStack[]::new); - } + @Override public PlotItemStack[] getItems(PlotPlayer player) { + BukkitPlayer bp = (BukkitPlayer) player; + PlayerInventory inv = bp.player.getInventory(); + return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i))) + .toArray(PlotItemStack[]::new); + } - @Override public boolean isOpen(PlotInventory plotInventory) { - if (!plotInventory.isOpen()) { - return false; + @Override public boolean isOpen(PlotInventory plotInventory) { + if (!plotInventory.isOpen()) { + return false; + } + BukkitPlayer bp = (BukkitPlayer) plotInventory.player; + InventoryView opened = bp.player.getOpenInventory(); + if (plotInventory.isOpen()) { + if (opened.getType() == InventoryType.CRAFTING) { + opened.getTitle(); + } + } + return false; } - BukkitPlayer bp = (BukkitPlayer) plotInventory.player; - InventoryView opened = bp.player.getOpenInventory(); - if (plotInventory.isOpen()) { - if (opened.getType() == InventoryType.CRAFTING) { - opened.getTitle(); - } - } - return false; - } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java index 8bfa3da59..124108193 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java @@ -2,6 +2,4 @@ package com.github.intellectualsites.plotsquared.bukkit.util; public class BukkitVersion { public static int[] v1_13_2 = {1, 13, 2}; - public static int[] v1_13_1 = {1, 13, 1}; - public static int[] v1_13_0 = {1, 13, 0}; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java index 3f33387b9..a152445a8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java @@ -6,6 +6,7 @@ import com.google.common.base.Charsets; import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; +import java.util.Objects; import java.util.UUID; public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper { @@ -21,7 +22,7 @@ public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper { @Override public UUID getUUID(OfflinePlayer player) { return UUID.nameUUIDFromBytes( - ("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8)); + ("OfflinePlayer:" + Objects.requireNonNull(player.getName()).toLowerCase()).getBytes(Charsets.UTF_8)); } @Override public UUID getUUID(String name) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 4c74be5b6..ca682366e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -52,8 +52,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { } try (PreparedStatement stmt = getConnection().prepareStatement( - "CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username)" - + ')')) { + "CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username))")) { stmt.execute(); } catch (SQLException e) { e.printStackTrace(); @@ -237,7 +236,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { return false; } - private class SQLUUIDHandlerException extends RuntimeException { + private static class SQLUUIDHandlerException extends RuntimeException { SQLUUIDHandlerException(String s, Throwable c) { super("SQLUUIDHandler caused an exception: " + s, c); 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 c50fddbc3..447ef0142 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 @@ -24,7 +24,7 @@ import java.util.regex.Matcher; * A block bucket is a container of block types, where each block * has a specified chance of being randomly picked */ -@EqualsAndHashCode(of={"input"}) @SuppressWarnings({"unused", "WeakerAccess"}) +@EqualsAndHashCode(of = {"input"}) @SuppressWarnings({"unused", "WeakerAccess"}) public final class BlockBucket implements ConfigurationSerializable { private boolean compiled; @@ -78,7 +78,7 @@ public final class BlockBucket implements ConfigurationSerializable { private void addBlock(@NonNull final BlockState block, double chance) { if (chance == -1) chance = 1; String prefix = input.length() == 0 ? "" : ","; - input.append(prefix).append(chance + "%" + prefix); + input.append(prefix).append(chance).append("%").append(prefix); this.compiled = false; } @@ -116,7 +116,7 @@ public final class BlockBucket implements ConfigurationSerializable { this.single = BlockUtil.get(string); this.pattern = new BlockPattern(single); return; - } catch (Exception ignore) {} + } catch (Exception ignore) { } } for (int i = 0; i < blocksStr.length; i++) { String entry = blocksStr[i]; @@ -163,7 +163,7 @@ public final class BlockBucket implements ConfigurationSerializable { return ImmutableMap.of("blocks", this.toString()); } - @Getter @EqualsAndHashCode @RequiredArgsConstructor private final static class Range { + @Getter @EqualsAndHashCode @RequiredArgsConstructor private static final class Range { private final int min; private final int max; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java index 78532942d..9daad699d 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 @@ -34,15 +34,15 @@ public class Location implements Cloneable, Comparable { public int getX() { return this.x; } - + public int getY() { return this.y; } - + public int getZ() { return this.z; } - + public void setX(int x) { this.x = x; this.blockVector3 = BlockVector3.at(x, y, z); @@ -105,6 +105,10 @@ public class Location implements Cloneable, Comparable { return area != null && area.getPlotAbs(this) == null; } + /** + * Checks if anyone owns a plot at the current location. + * @return true if the location is a road, not a plot area, or if the plot is unclaimed. + */ public boolean isUnownedPlotArea() { PlotArea area = getPlotArea(); return area != null && area.getOwnedPlotAbs(this) == null; 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 2326ba0c4..d0cf46d70 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 @@ -117,7 +117,7 @@ public abstract class PlotArea { } /** - * Returns the region for this PlotArea or a CuboidRegion encompassing + * Returns the region for this PlotArea, or a CuboidRegion encompassing * the whole world if none exists. * * @return CuboidRegion @@ -627,7 +627,7 @@ public abstract class PlotArea { this.meta.put(key, value); } - @NotNull public T getMeta(@Nullable final String key, @NotNull final T def) { + @NotNull public T getMeta(@NotNull final String key, @NotNull final T def) { final Object v = getMeta(key); return v == null ? def : (T) v; } @@ -637,7 +637,8 @@ public abstract class PlotArea { *
    * For persistent metadata use the flag system */ - @Nullable public Object getMeta(@NotNull final String key) { + @Nullable + public Object getMeta(@NotNull final String key) { if (this.meta != null) { return this.meta.get(key); } 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 da6b4e4e8..0187f67b4 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 @@ -16,6 +16,7 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAre import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -100,7 +101,7 @@ public abstract class EventUtil { } } - public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type, + public boolean checkPlayerBlockEvent(PlotPlayer player, @NotNull PlayerBlockEventType type, Location location, BlockType blockType, boolean notifyPerms) { PlotArea area = location.getPlotArea(); assert area != null; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ChunkBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ChunkBlockQueue.java index 47e2c8756..0d7f9294d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ChunkBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ChunkBlockQueue.java @@ -5,6 +5,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; @@ -14,13 +15,13 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue { public final BlockState[][][] result; private final int width; private final int length; - private final int area; + @Deprecated private final int area; private final BlockVector3 bot; private final BlockVector3 top; public ChunkBlockQueue(BlockVector3 bot, BlockVector3 top, boolean biomes) { super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15)); - this.width = top.getX() - bot.getX()+ 1; + this.width = top.getX() - bot.getX() + 1; this.length = top.getZ() - bot.getZ() + 1; this.area = width * length; this.result = new BlockState[256][][]; @@ -70,7 +71,9 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue { return true; } - @Override public BlockState getBlock(int x, int y, int z) { + @Override + @Nullable + public BlockState getBlock(int x, int y, int z) { BlockState[][] blocksY = result[y]; if (blocksY != null) { BlockState[] blocksYZ = blocksY[z]; @@ -81,7 +84,9 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue { return null; } - @Override public String getWorld() { + @Override + @Nullable + public String getWorld() { return null; } From ed8fa0a2a5c6477add3138d2b7b76fc85fddc9bc Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 10 Dec 2019 17:53:55 -0500 Subject: [PATCH 243/258] Revert changes to BlockPlaceEvent --- .../bukkit/listeners/PlayerEvents.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) 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 bf72c544e..1f6dbd594 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 @@ -2869,12 +2869,12 @@ import java.util.regex.Pattern; @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void blockCreate(BlockPlaceEvent event) { - Player player = event.getPlayer(); Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); PlotArea area = location.getPlotArea(); if (area == null) { return; } + Player player = event.getPlayer(); PlotPlayer pp = BukkitUtil.getPlayer(player); Plot plot = area.getPlot(location); if (plot != null) { @@ -2885,23 +2885,25 @@ import java.util.regex.Pattern; .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { - if (!Permissions - .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED, true)) { + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); return; } } else if (!plot.isAdded(pp.getUUID())) { - Optional> place = plot.getFlag(Flags.PLACE); + Set place = plot.getFlag(Flags.PLACE, null); + if (place != null) { Block block = event.getBlock(); - if (place.isPresent() && place.get().contains(BukkitAdapter.asBlockType(block.getType()))) { + if (place.contains(BukkitAdapter.asBlockType(block.getType()))) { return; + } } - if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { - return; - } else { + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); + return; } } else if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -2917,10 +2919,10 @@ import java.util.regex.Pattern; sendBlockChange(block.getLocation(), block.getBlockData()); } } - } - if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { - return; - } + } else if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_ROAD); event.setCancelled(true); } } +} From 480c9f11b82f09c8ddb70a781d0a7b7a22e6310d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 14 Dec 2019 17:46:07 +0100 Subject: [PATCH 244/258] Add 1.15 to templates --- .github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md index cbca7e551..3aa96715e 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -49,7 +49,8 @@ assignees: '' ### Minecraft Version: **select one** -- [] Minecraft 1.14.4 ***This is the ONLY actively maintained target for PlotSquared*** +- [] Minecraft 1.15 +- [] Minecraft 1.14.4 - [] Minecraft 1.13.2 - [] Minecraft Java Edition *other versions, please specify*: - [] Minecraft Bedrock Edition *specify version*: From dbd6feed4e4dccabfca4d49ba9c8d5540ce327dc Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 14 Dec 2019 18:05:15 +0100 Subject: [PATCH 245/258] Update issue template and add link to suggestion repo on issue tab --- .../bug-issue-report-for-plotsquared.md | 20 ++++++++++--------- .github/ISSUE_TEMPLATE/config.yml | 5 +++++ 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md index 3aa96715e..12b98374a 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md +++ b/.github/ISSUE_TEMPLATE/bug-issue-report-for-plotsquared.md @@ -16,10 +16,10 @@ assignees: '' ! PlotSquared for Minecraft Java Edition versions between 1.7 through to 1.12.2 are considered ! legacy, and will receive limited to no support. Please consider upgrading to 1.13+ for ! future support. Plugins exist for 1.13+ which bring back behaviors found in 1.8.8 -! All versions of PlotSquared for Sponge and Nukkit(X) will recieve limited to no support +! All versions of PlotSquared for Sponge and Nukkit(X) will receive limited to no support ! due to lack of developer interest and time. Additionally, NukkitX has not had feature ! updates since the Better Together, which prevents some PlotSquared features from ever -! functioning. Contributions are always welcome however! +! functioning. Contributions are always welcome however! ``` **Feature requests & Suggestions are to be submitted at the [PlotSquared Suggestions tracker](https://github.com/IntellectualSites/PlotSquaredSuggestions)** @@ -33,22 +33,22 @@ assignees: '' ## Required Information section: > ALL FIELDS IN THIS SECTION ARE REQUIRED, and must contain appropriate information -### Server config info (Debug/file paste links): +### Server config info (/plot debugpaste / file paste links): - ### Server type: -**select one** +**Select one** - [] Spigot / Paper *(CraftBukkit should not be used, re-test with Spigot first!)* - [] Sponge *- NOTE: NOT ACTIVELY MAINTAINED* - [] NukkitX *- NOTE: NOT ACTIVELY MAINTAINED* ### Minecraft Version: -**select one** - +**Select one** + - [] Minecraft 1.15 - [] Minecraft 1.14.4 - [] Minecraft 1.13.2 @@ -58,7 +58,7 @@ assignees: '' ### Server build info: ``` -paste here, between the tick marks, replacing this text +Paste the output here, between the tick marks, replacing this text ``` ### WorldEdit/FAWE versions: @@ -81,7 +81,9 @@ paste here, between the tick marks, replacing this text ### Relevant console output, log lines, and/or screenshots: ### Additional relevant comments/remarks: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..83661f8c6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: PlotSquared Suggestions + url: https://github.com/IntellectualSites/PlotSquaredSuggestions + about: If you want to submit feature or suggestion ideas, do that here \ No newline at end of file From 478c761750e229272e54d1662ee370440d72c800 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 15 Dec 2019 12:53:16 -0500 Subject: [PATCH 246/258] More PlayerEvent fixes. --- .../bukkit/listeners/PlayerEvents.java | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) 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 1f6dbd594..4af11f4d6 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 @@ -1924,23 +1924,15 @@ import java.util.regex.Pattern; //todo rearrange the right click code. it is all over the place. case RIGHT_CLICK_BLOCK: { Material blockType = block.getType(); + eventType = PlayerBlockEventType.INTERACT_BLOCK; if (blockType.isInteractable() && player.isSneaking()) { return; //this returns so the block place event is called } - if (blockType.isInteractable()) { - eventType = PlayerBlockEventType.INTERACT_BLOCK; - } blocktype1 = BukkitAdapter.asBlockType(block.getType()); - if (eventType != null && !player.isSneaking()) { + if (!player.isSneaking()) { break; } Material type = event.getMaterial(); - if (type == Material.AIR) { - if (!player.isSneaking() && blockType.isInteractable()) { - eventType = PlayerBlockEventType.INTERACT_BLOCK; - break outer; - } - } // in the following, lb needs to have the material of the item in hand i.e. type if (type == Material.REDSTONE || type == Material.STRING @@ -2001,7 +1993,7 @@ import java.util.regex.Pattern; } case LEFT_CLICK_BLOCK: { location = BukkitUtil.getLocation(block.getLocation()); - // eventType = PlayerBlockEventType.BREAK_BLOCK; + //eventType = PlayerBlockEventType.BREAK_BLOCK; blocktype1 = BukkitAdapter.asBlockType(block.getType()); if (block.getType() == Material.DRAGON_EGG) { eventType = PlayerBlockEventType.TELEPORT_OBJECT; @@ -2018,18 +2010,6 @@ import java.util.regex.Pattern; return; } } - if (eventType == null) { - PlotSquared.log("Please report this to PlotSquared Developers: "); - PlotSquared.log("Action: " + event.getAction().toString()); - PlotSquared.log("HasItem: " + event.hasItem()); - PlotSquared.log("HasBlock: " + event.hasBlock()); - PlotSquared.log("getItem: " + (event.hasItem() ? Objects.requireNonNull(event.getItem()) - .toString() : "null")); - PlotSquared.log("getBlockFace: " + (event.getBlockFace() != null ? event.getBlockFace().toString() : "null")); - PlotSquared.log("isBlockInHand: " + (event.isBlockInHand())); - PlotSquared.log("getClickedBlock: " + (event.getClickedBlock() != null ? event.getClickedBlock().toString() : "null")); - return; - } if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, blocktype1, true)) { event.setCancelled(true); event.setUseInteractedBlock(Event.Result.DENY); From 9fd29b264ee80c2f1032f63ce6311562215b08c1 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 15 Dec 2019 13:08:02 -0500 Subject: [PATCH 247/258] Some logging operations to check for tps loss. --- .../plotsquared/bukkit/util/BukkitUtil.java | 4 ---- .../plotsquared/plot/object/Plot.java | 10 ++++++++++ .../plotsquared/plot/util/WorldUtil.java | 2 -- 3 files changed, 10 insertions(+), 6 deletions(-) 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 b4e74b74d..23ed71550 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 @@ -317,10 +317,6 @@ import java.util.Set; }); } - @Override public Location getSpawn(@NonNull final PlotPlayer player) { - return getLocation(((BukkitPlayer) player).player.getBedSpawnLocation()); - } - @Override public Location getSpawn(@NonNull final String world) { final org.bukkit.Location temp = getWorld(world).getSpawnLocation(); return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ(), 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 0441c2baa..5308e620a 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 @@ -1,5 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.object; +import static java.util.concurrent.TimeUnit.SECONDS; + + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; @@ -36,6 +39,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; +import java.util.concurrent.TimeUnit; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -946,10 +950,16 @@ public class Plot { ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run(int[] value) { BlockVector2 loc = BlockVector2.at(value[0], value[1]); + long start = System.currentTimeMillis(); ChunkManager.manager.loadChunk(getWorldName(), loc, false); + long end = System.currentTimeMillis(); + PlotSquared.debug("[Biome Operation] Loading chunk took: " + TimeUnit.MILLISECONDS.toSeconds(end - start)); MainUtil.setBiome(getWorldName(), value[2], value[3], value[4], value[5], biome); + start = System.currentTimeMillis(); ChunkManager.manager.unloadChunk(getWorldName(), loc, true); + end = System.currentTimeMillis(); + PlotSquared.debug("[Biome Operation] Unloading chunk took: " + TimeUnit.MILLISECONDS.toSeconds(end - start)); } }, this, 5); 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 099b9ea34..f2a37512f 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 @@ -41,8 +41,6 @@ public abstract class WorldUtil { public abstract Location getSpawn(String world); - public abstract Location getSpawn(PlotPlayer pp); - public abstract void setSpawn(Location location); public abstract void saveWorld(String world); From 3bb40a8fff4d5bf209c9b2fdcf8f462a9f1e7ee8 Mon Sep 17 00:00:00 2001 From: Traks Date: Tue, 17 Dec 2019 21:04:44 +0100 Subject: [PATCH 248/258] Fix that players cannot place hanging entities --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4af11f4d6..740cb8155 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 @@ -2357,7 +2357,7 @@ import java.util.regex.Pattern; return; } Player p = event.getPlayer(); - if (p != null) { + if (p == null) { PlotSquared.debug("PlotSquared does not support HangingPlaceEvent for non-players."); event.setCancelled(true); return; From e54cf242484454b216cdc71a6e6dec5ae6bac932 Mon Sep 17 00:00:00 2001 From: Traks Date: Wed, 18 Dec 2019 19:42:57 +0100 Subject: [PATCH 249/258] Fix interact handling for sneaking players --- .../bukkit/listeners/PlayerEvents.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 740cb8155..3a1e9e8de 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 @@ -1925,13 +1925,21 @@ import java.util.regex.Pattern; case RIGHT_CLICK_BLOCK: { Material blockType = block.getType(); eventType = PlayerBlockEventType.INTERACT_BLOCK; - if (blockType.isInteractable() && player.isSneaking()) { - return; //this returns so the block place event is called - } blocktype1 = BukkitAdapter.asBlockType(block.getType()); - if (!player.isSneaking()) { - break; + + if (blockType.isInteractable()) { + if (!player.isSneaking()) { + break; + } + ItemStack hand = player.getInventory().getItemInMainHand(); + ItemStack offHand = player.getInventory().getItemInOffHand(); + + // sneaking players interact with blocks if both hands are empty + if (hand.getType() == Material.AIR && offHand.getType() == Material.AIR) { + break; + } } + Material type = event.getMaterial(); // in the following, lb needs to have the material of the item in hand i.e. type From ccc7b0ec658f10c24d11da2e9d4d32d653a8f15a Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 20 Dec 2019 06:03:23 +0000 Subject: [PATCH 250/258] Fix #2634 no such method error --- .../bukkit/listeners/PlayerEvents.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) 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 3a1e9e8de..69752719f 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 @@ -1943,13 +1943,21 @@ import java.util.regex.Pattern; Material type = event.getMaterial(); // in the following, lb needs to have the material of the item in hand i.e. type - if (type == Material.REDSTONE || type == Material.STRING - || type == Material.PUMPKIN_SEEDS || type == Material.MELON_SEEDS - || type == Material.COCOA_BEANS || type == Material.WHEAT_SEEDS - || type == Material.BEETROOT_SEEDS || type == Material.SWEET_BERRIES || type - .isBlock()) { - //eventType = PlayerBlockEventType.PLACE_BLOCK; - return; + switch (type) { + case REDSTONE: + case STRING: + case PUMPKIN_SEEDS: + case MELON_SEEDS: + case COCOA_BEANS: + case WHEAT_SEEDS: + case BEETROOT_SEEDS: + case SWEET_BERRIES: + return; + default: + //eventType = PlayerBlockEventType.PLACE_BLOCK; + if (type.isBlock()) { + return; + } } if (PaperLib.isPaper()) { if (MaterialTags.SPAWN_EGGS.isTagged(type) || Material.EGG.equals(type)) { From c6e36fd70e1c7c1f6f5fdaf8ae0945ad173a0447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Fri, 20 Dec 2019 17:37:48 +0100 Subject: [PATCH 251/258] Fix plot biomes. When migrating to the WorldEdit Biome types, code was not altered to account for these changes. This lead to configuration parsing breaking, and the `/plot setbiome` command no longer functioning. This fixes #2599. --- .../plotsquared/plot/commands/Biome.java | 28 ++++++++++--------- .../plot/config/Configuration.java | 6 +--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java index d377acd15..df48c1aed 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java @@ -15,20 +15,11 @@ import com.sk89q.worldedit.world.biome.BiomeTypes; requiredType = RequiredType.NONE) public class Biome extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, final String value) { + BiomeType biome = null; try { - BiomeType biome = BiomeTypes.get(value); - if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); - return false; - } - plot.addRunning(); - plot.setBiome(biome, () -> { - plot.removeRunning(); - MainUtil - .sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase()); - }); - return true; - } catch (IllegalStateException ignore) { + biome = BiomeTypes.get(value.toLowerCase()); + } catch (final Exception ignore) {} + if (biome == null) { String biomes = StringMan .join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated()); Captions.NEED_BIOME.send(player); @@ -36,5 +27,16 @@ import com.sk89q.worldedit.world.biome.BiomeTypes; Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes); return false; } + if (plot.getRunning() > 0) { + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); + return false; + } + plot.addRunning(); + plot.setBiome(biome, () -> { + plot.removeRunning(); + MainUtil + .sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase()); + }); + return true; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index aba85f3f8..1fa167177 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -1,8 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.config; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.util.StringComparison; -import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; @@ -10,8 +8,6 @@ import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; import lombok.NonNull; -import java.util.regex.Matcher; - /** * Main Configuration Utility */ @@ -53,7 +49,7 @@ public class Configuration { @Override public BiomeType parseString(String string) { if (validateValue(string)) { - return BiomeTypes.get(string.toUpperCase()); + return BiomeTypes.get(string.toLowerCase()); } return BiomeTypes.FOREST; } From 3abb35e5060ae934207fc76baf63b63be08b56e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Fri, 20 Dec 2019 18:01:36 +0100 Subject: [PATCH 252/258] Prevent NPE when trying to set `statement = null` in SQLManager If the statement is null, the `isClosed` check will lead to a NPE. As it's going to be null either way, just ignoring the NPE has no side effects. --- .../intellectualsites/plotsquared/plot/database/SQLManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a62924e9e..cf229e316 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 @@ -375,7 +375,7 @@ import java.util.concurrent.atomic.AtomicInteger; if (statement.isClosed()) { statement = null; } - } catch (AbstractMethodError ignore) { + } catch (NullPointerException | AbstractMethodError ignore) { } } lastTask = task; From 519d3ee2d6a1db81086f16addeba3eedee214300 Mon Sep 17 00:00:00 2001 From: Traks <58818927+traksag@users.noreply.github.com> Date: Mon, 23 Dec 2019 21:35:37 +0100 Subject: [PATCH 253/258] Fix 'Unable to find method createTag' on 1.15 servers (#2642) * Fix 'Unable to find method createTag' on 1.15 servers (#2629) Mojang apparently refactored their NBT code in 1.15, so the NBT parsing code in NbtFactory that used Mojang's NBT code via Reflection broke. Since PlotSquared now depends on WorldEdit, it is much easier to use their NBT parsing library than to update the Reflection-based code. * Clean up NBT streams properly --- .../plotsquared/bukkit/util/NbtFactory.java | 1041 ----------------- .../bukkit/uuid/FileUUIDHandler.java | 53 +- 2 files changed, 34 insertions(+), 1060 deletions(-) delete mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java 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 deleted file mode 100644 index 10407f5ec..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java +++ /dev/null @@ -1,1041 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.util; - -import com.google.common.base.Splitter; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.Lists; -import com.google.common.collect.MapMaker; -import com.google.common.io.ByteSink; -import com.google.common.io.Closeables; -import com.google.common.primitives.Primitives; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.Server; -import org.bukkit.inventory.ItemStack; - -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; - -public class NbtFactory { - - // Convert between NBT type and the equivalent class in java - private static final BiMap> NBT_CLASS = HashBiMap.create(); - private static final BiMap NBT_ENUM = HashBiMap.create(); - // Shared instance - private static NbtFactory INSTANCE; - private final Field[] DATA_FIELD = new Field[12]; - // The NBT base class - private Class BASE_CLASS; - private Class COMPOUND_CLASS; - private Class STREAM_TOOLS; - private Class READ_LIMITER_CLASS; - private Method NBT_CREATE_TAG; - private Method NBT_GET_TYPE; - private Field NBT_LIST_TYPE; - // CraftItemStack - private Class CRAFT_STACK; - private Field CRAFT_HANDLE; - private Field STACK_TAG; - // Loading/saving compounds - private LoadCompoundMethod LOAD_COMPOUND; - private Method SAVE_COMPOUND; - - /** - * Construct an instance of the NBT factory by deducing the class of NBTBase. - */ - private NbtFactory() { - if (this.BASE_CLASS == null) { - try { - // Keep in mind that I do use hard-coded field names - but it's okay as long as we're dealing - // with CraftBukkit or its derivatives. This does not work in MCPC+ however. - ClassLoader loader = NbtFactory.class.getClassLoader(); - - String packageName = getPackageName(); - String craftpackageName = getCraftPackageName(); - Class offlinePlayer = loader.loadClass(packageName + ".CraftOfflinePlayer"); - - // Prepare NBT - this.COMPOUND_CLASS = - getMethod(0, Modifier.STATIC, offlinePlayer, "getData").getReturnType(); - this.BASE_CLASS = loader.loadClass(craftpackageName + ".NBTBase"); - this.NBT_GET_TYPE = getMethod(0, Modifier.STATIC, this.BASE_CLASS, "getTypeId"); - this.NBT_CREATE_TAG = - getMethod(Modifier.STATIC, 0, this.BASE_CLASS, "createTag", byte.class); - - // Prepare CraftItemStack - this.CRAFT_STACK = loader.loadClass(packageName + ".inventory.CraftItemStack"); - this.CRAFT_HANDLE = getField(null, this.CRAFT_STACK, "handle"); - this.STACK_TAG = getField(null, this.CRAFT_HANDLE.getType(), "tag"); - - // Loading/saving - String nmsPackage = this.BASE_CLASS.getPackage().getName(); - initializeNMS(loader, nmsPackage); - - if (this.READ_LIMITER_CLASS != null) { - this.LOAD_COMPOUND = - new LoadMethodSkinUpdate(this.STREAM_TOOLS, this.READ_LIMITER_CLASS); - } else { - this.LOAD_COMPOUND = new LoadMethodWorldUpdate(this.STREAM_TOOLS); - } - this.SAVE_COMPOUND = - getMethod(Modifier.STATIC, 0, this.STREAM_TOOLS, null, this.BASE_CLASS, - DataOutput.class); - - } catch (ClassNotFoundException e) { - throw new IllegalStateException("Unable to find offline player.", e); - } - } - } - - /** - * Retrieve or construct a shared NBT factory. - * - * @return The factory. - */ - private static NbtFactory get() { - if (INSTANCE == null) { - INSTANCE = new NbtFactory(); - } - return INSTANCE; - } - - /** - * Construct a new NBT list of an unspecified type. - * - * @return The NBT list. - */ - public static NbtList createList(Object... content) { - return createList(Arrays.asList(content)); - } - - /** - * Construct a new NBT list of an unspecified type. - * - * @return The NBT list. - */ - public static NbtList createList(Iterable iterable) { - NbtList list = get().new NbtList(INSTANCE.createNbtTag(NbtType.TAG_LIST, null)); - - // Add the content as well - for (Object obj : iterable) { - list.add(obj); - } - return list; - } - - /** - * Construct a new NBT compound. - * - * @return The NBT compound. - */ - public static NbtCompound createCompound() { - return get().new NbtCompound(INSTANCE.createNbtTag(NbtType.TAG_COMPOUND, null)); - } - - /** - * Construct a new NBT wrapper from a list. - * - * @param nmsList - the NBT list. - * @return The wrapper. - */ - public static NbtList fromList(Object nmsList) { - return get().new NbtList(nmsList); - } - - /** - * Load the content of a file from a stream. - * - * @param input - the stream. - * @param option - whether or not to decompress the input stream. - * @return The decoded NBT compound. - * @throws IOException If anything went wrong. - */ - @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed", "resource"}) - public static NbtCompound fromStream(InputStream input, StreamOptions option) - throws IOException { - DataInputStream data = null; - boolean suppress = true; - - try { - if (option == StreamOptions.GZIP_COMPRESSION) { - data = new DataInputStream(new BufferedInputStream(new GZIPInputStream(input))); - } else { - data = new DataInputStream(new BufferedInputStream(input)); - } - - NbtCompound result = fromCompound(get().LOAD_COMPOUND.loadNbt(data)); - suppress = false; - return result; - - } finally { - if (data != null) { - Closeables.close(data, suppress); - } else if (input != null) { - Closeables.close(input, suppress); - } - } - } - - /** - * Save the content of a NBT compound to a stream. - * - * @param source - the NBT compound to save. - * @param stream - the stream. - * @param option - whether or not to compress the output. - * @throws IOException If anything went wrong. - */ - public static void saveStream(NbtCompound source, ByteSink stream, StreamOptions option) - throws IOException { - - try (OutputStream output = stream.openStream(); - DataOutputStream data = new DataOutputStream( - option == StreamOptions.GZIP_COMPRESSION ? new GZIPOutputStream(output) : output)) { - invokeMethod(get().SAVE_COMPOUND, null, source.getHandle(), data); - } - } - - /** - * Construct a new NBT wrapper from a compound. - * - * @param nmsCompound - the NBT compound. - * @return The wrapper. - */ - public static NbtCompound fromCompound(Object nmsCompound) { - return get().new NbtCompound(nmsCompound); - } - - /** - * Set the NBT compound tag of a given item stack. - *

    - * - * @param stack - the item stack, cannot be air. - * @param compound - the new NBT compound, or NULL to remove it. - * @throws IllegalArgumentException If the stack is not a CraftItemStack, or it represents air. - */ - public static void setItemTag(ItemStack stack, NbtCompound compound) { - checkItemStack(stack); - Object nms = getFieldValue(get().CRAFT_HANDLE, stack); - - // Now update the tag compound - setFieldValue(get().STACK_TAG, nms, compound.getHandle()); - } - - /** - * Construct a wrapper for an NBT tag stored (in memory) in an item stack. This is where - * auxiliary data such as enchanting, name and lore is stored. It does not include items - * material, damage value or count. - *

    - * The item stack must be a wrapper for a CraftItemStack. - * - * @param stack - the item stack. - * @return A wrapper for its NBT tag. - */ - public static NbtCompound fromItemTag(ItemStack stack) { - checkItemStack(stack); - Object nms = getFieldValue(get().CRAFT_HANDLE, stack); - Object tag = getFieldValue(get().STACK_TAG, nms); - - // Create the tag if it doesn't exist - if (tag == null) { - NbtCompound compound = createCompound(); - setItemTag(stack, compound); - return compound; - } - return fromCompound(tag); - } - - /** - * Retrieve a CraftItemStack version of the stack. - * - * @param stack - the stack to convert. - * @return The CraftItemStack version. - */ - public static ItemStack getCraftItemStack(ItemStack stack) { - // Any need to convert? - if ((stack == null) || get().CRAFT_STACK.isAssignableFrom(stack.getClass())) { - return stack; - } - try { - // Call the private constructor - Constructor caller = INSTANCE.CRAFT_STACK.getDeclaredConstructor(ItemStack.class); - caller.setAccessible(true); - return (ItemStack) caller.newInstance(stack); - } catch (Exception ignored) { - throw new IllegalStateException( - "Unable to convert " + stack + " + to a CraftItemStack."); - } - } - - /** - * Ensure that the given stack can store arbitrary NBT information. - * - * @param stack - the stack to check. - */ - private static void checkItemStack(ItemStack stack) { - if (stack == null) { - throw new IllegalArgumentException("Stack cannot be NULL."); - } - if (!get().CRAFT_STACK.isAssignableFrom(stack.getClass())) { - throw new IllegalArgumentException("Stack must be a CraftItemStack."); - } - if (stack.getType() == Material.AIR) { - throw new IllegalArgumentException( - "ItemStacks representing air cannot store NMS information."); - } - } - - /** - * Invoke a method on the given target instance using the provided parameters. - * - * @param method - the method to invoke. - * @param target - the target. - * @param params - the parameters to supply. - * @return The result of the method. - */ - private static Object invokeMethod(Method method, Object target, Object... params) { - try { - return method.invoke(target, params); - } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) { - throw new RuntimeException("Unable to invoke method " + method + " for " + target, e); - } - } - - private static void setFieldValue(Field field, Object target, Object value) { - try { - field.set(target, value); - } catch (IllegalAccessException | IllegalArgumentException e) { - throw new RuntimeException("Unable to set " + field + " for " + target, e); - } - } - - private static Object getFieldValue(Field field, Object target) { - try { - return field.get(target); - } catch (IllegalAccessException | IllegalArgumentException e) { - throw new RuntimeException("Unable to retrieve " + field + " for " + target, e); - } - } - - /** - * Search for the first publicly and privately defined method of the given name and parameter count. - * - * @param requireMod - modifiers that are required. - * @param bannedMod - modifiers that are banned. - * @param clazz - a class to start with. - * @param methodName - the method name, or NULL to skip. - * @param params - the expected parameters. - * @return The first method by this name. - * @throws IllegalStateException If we cannot find this method. - */ - private static Method getMethod(int requireMod, int bannedMod, Class clazz, - String methodName, Class... params) { - for (Method method : clazz.getDeclaredMethods()) { - // Limitation: Doesn't handle overloads - if (((method.getModifiers() & requireMod) == requireMod) && ( - (method.getModifiers() & bannedMod) == 0) && ((methodName == null) || method - .getName().equals(methodName)) && Arrays - .equals(method.getParameterTypes(), params)) { - - method.setAccessible(true); - return method; - } - } - // Search in every superclass - if (clazz.getSuperclass() != null) { - return getMethod(requireMod, bannedMod, clazz.getSuperclass(), methodName, params); - } - throw new IllegalStateException( - String.format("Unable to find method %s (%s).", methodName, Arrays.asList(params))); - } - - /** - * Search for the first publicly and privately defined field of the given name. - * - * @param instance - an instance of the class with the field. - * @param clazz - an optional class to start with, or NULL to deduce it from instance. - * @param fieldName - the field name. - * @return The first field by this name. - * @throws IllegalStateException If we cannot find this field. - */ - private static Field getField(Object instance, Class clazz, String fieldName) { - if (clazz == null) { - clazz = instance.getClass(); - } - // Ignore access rules - for (Field field : clazz.getDeclaredFields()) { - if (field.getName().equals(fieldName)) { - field.setAccessible(true); - return field; - } - } - // Recursively fild the correct field - if (clazz.getSuperclass() != null) { - return getField(instance, clazz.getSuperclass(), fieldName); - } - throw new IllegalStateException("Unable to find field " + fieldName + " in " + instance); - } - - private void initializeNMS(ClassLoader loader, String nmsPackage) { - try { - this.STREAM_TOOLS = loader.loadClass(nmsPackage + ".NBTCompressedStreamTools"); - this.READ_LIMITER_CLASS = loader.loadClass(nmsPackage + ".NBTReadLimiter"); - } catch (ClassNotFoundException ignored) { - } - } - - private String getPackageName() { - Server server = Bukkit.getServer(); - String name = server != null ? server.getClass().getPackage().getName() : null; - - if ((name != null) && name.contains("craftbukkit")) { - return name; - } else { - // Fallback - return "org.bukkit.craftbukkit.v1_13_R1"; - } - } - - private String getCraftPackageName() { - String version = - Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; - return "net.minecraft.server." + version; - } - - @SuppressWarnings("unchecked") private Map getDataMap(Object handle) { - return (Map) getFieldValue(getDataField(NbtType.TAG_COMPOUND, handle), - handle); - } - - @SuppressWarnings("unchecked") private List getDataList(Object handle) { - return (List) getFieldValue(getDataField(NbtType.TAG_LIST, handle), handle); - } - - /** - * Convert wrapped List and Map objects into their respective NBT counterparts. - * - * @param value - the value of the element to create. Can be a List or a Map. - * @return The NBT element. - */ - private Object unwrapValue(Object value) { - if (value == null) { - return null; - } - - if (value instanceof Wrapper) { - return ((Wrapper) value).getHandle(); - } else if (value instanceof List) { - throw new IllegalArgumentException("Can only insert a WrappedList."); - } else if (value instanceof Map) { - throw new IllegalArgumentException("Can only insert a WrappedCompound."); - } else { - return createNbtTag(getPrimitiveType(value), value); - } - } - - /** - * Convert a given NBT element to a primitive wrapper or List/Map equivalent. - *

    All changes to any mutable objects will be reflected in the underlying NBT element(s). - * - * @param nms - the NBT element. - * @return The wrapper equivalent. - */ - private Object wrapNative(Object nms) { - if (nms == null) { - return null; - } - - if (this.BASE_CLASS.isAssignableFrom(nms.getClass())) { - NbtType type = getNbtType(nms); - - // Handle the different types - switch (type) { - case TAG_COMPOUND: - return new NbtCompound(nms); - case TAG_LIST: - return new NbtList(nms); - default: - return getFieldValue(getDataField(type, nms), nms); - } - } - throw new IllegalArgumentException("Unexpected type: " + nms); - } - - /** - * Construct a new NMS NBT tag initialized with the given value. - * - * @param type - the NBT type. - * @param value - the value, or NULL to keep the original value. - * @return The created tag. - */ - private Object createNbtTag(NbtType type, Object value) { - Object tag = invokeMethod(this.NBT_CREATE_TAG, null, (byte) type.id); - - if (value != null) { - setFieldValue(getDataField(type, tag), tag, value); - } - return tag; - } - - /** - * Retrieve the field where the NBT class stores its value. - * - * @param type - the NBT type. - * @param nms - the NBT class instance. - * @return The corresponding field. - */ - private Field getDataField(NbtType type, Object nms) { - if (this.DATA_FIELD[type.id] == null) { - this.DATA_FIELD[type.id] = getField(nms, null, type.getFieldName()); - } - return this.DATA_FIELD[type.id]; - } - - /** - * Retrieve the NBT type from a given NMS NBT tag. - * - * @param nms - the native NBT tag. - * @return The corresponding type. - */ - private NbtType getNbtType(Object nms) { - int type = (Byte) invokeMethod(this.NBT_GET_TYPE, nms); - return NBT_ENUM.get(type); - } - - /** - * Retrieve the nearest NBT type for a given primitive type. - * - * @param primitive - the primitive type. - * @return The corresponding type. - */ - private NbtType getPrimitiveType(Object primitive) { - NbtType type = - NBT_ENUM.get(NBT_CLASS.inverse().get(Primitives.unwrap(primitive.getClass()))); - - // Display the illegal value at least - if (type == null) { - throw new IllegalArgumentException( - String.format("Illegal type: %s (%s)", primitive.getClass(), primitive)); - } - return type; - } - - /** - * Whether or not to enable stream compression. - * - * @author Kristian - */ - public enum StreamOptions { - NO_COMPRESSION, GZIP_COMPRESSION, - } - - - private enum NbtType { - TAG_END(0, Void.class), TAG_BYTE(1, byte.class), TAG_SHORT(2, short.class), TAG_INT(3, - int.class), TAG_LONG(4, long.class), TAG_FLOAT(5, float.class), TAG_DOUBLE(6, - double.class), TAG_BYTE_ARRAY(7, byte[].class), TAG_INT_ARRAY(11, - int[].class), TAG_STRING(8, String.class), TAG_LIST(9, List.class), TAG_COMPOUND(10, - Map.class); - - // Unique NBT type - public final int id; - - NbtType(int id, Class type) { - this.id = id; - NBT_CLASS.put(id, type); - NBT_ENUM.put(id, this); - } - - private String getFieldName() { - if (this == TAG_COMPOUND) { - return "map"; - } else if (this == TAG_LIST) { - return "list"; - } else { - return "data"; - } - } - } - - - /** - * Represents an object that provides a view of a native NMS class. - * - * @author Kristian - */ - public interface Wrapper { - - /** - * Retrieve the underlying native NBT tag. - * - * @return The underlying NBT. - */ - Object getHandle(); - } - - - /** - * Represents a method for loading an NBT compound. - * - * @author Kristian - */ - private static abstract class LoadCompoundMethod { - - protected Method staticMethod; - - protected void setMethod(Method method) { - this.staticMethod = method; - this.staticMethod.setAccessible(true); - } - - /** - * Load an NBT compound from a given stream. - * - * @param input - the input stream. - * @return The loaded NBT compound. - */ - public abstract Object loadNbt(DataInput input); - } - - - /** - * Load an NBT compound from the NBTCompressedStreamTools static method in 1.7.2 - 1.7.5 - */ - private static class LoadMethodWorldUpdate extends LoadCompoundMethod { - - LoadMethodWorldUpdate(Class streamClass) { - setMethod(getMethod(Modifier.STATIC, 0, streamClass, null, DataInput.class)); - } - - @Override public Object loadNbt(DataInput input) { - return invokeMethod(this.staticMethod, null, input); - } - } - - - /** - * Load an NBT compound from the NBTCompressedStreamTools static method in 1.7.8 - */ - private static class LoadMethodSkinUpdate extends LoadCompoundMethod { - - private Object readLimiter; - - LoadMethodSkinUpdate(Class streamClass, Class readLimiterClass) { - setMethod(getMethod(Modifier.STATIC, 0, streamClass, null, DataInput.class, - readLimiterClass)); - - // Find the unlimited read limiter - for (Field field : readLimiterClass.getDeclaredFields()) { - if (readLimiterClass.isAssignableFrom(field.getType())) { - try { - this.readLimiter = field.get(null); - } catch (Exception e) { - throw new RuntimeException("Cannot retrieve read limiter.", e); - } - } - } - } - - @Override public Object loadNbt(DataInput input) { - return invokeMethod(this.staticMethod, null, input, this.readLimiter); - } - } - - - /** - * Represents a root NBT compound. - *

    All changes to this map will be reflected in the underlying NBT compound. Values may only be one of the following: - *

      - *
    • Primitive types
    • - *
    • {@link String String}
    • - *
    • {@link NbtList}
    • - *
    • {@link NbtCompound}
    • - *
    - *

    - * See also: - *

      - *
    • {@link NbtFactory#createCompound()}
    • - *
    • {@link NbtFactory#fromCompound(Object)}
    • - *
    - * - * @author Kristian - */ - public final class NbtCompound extends ConvertedMap { - - private NbtCompound(Object handle) { - super(handle, getDataMap(handle)); - } - - // Simplifying access to each value - public Byte getByte(String key, Byte defaultValue) { - return containsKey(key) ? (Byte) get(key) : defaultValue; - } - - public Short getShort(String key, Short defaultValue) { - return containsKey(key) ? (Short) get(key) : defaultValue; - } - - public Integer getInteger(String key, Integer defaultValue) { - return containsKey(key) ? (Integer) get(key) : defaultValue; - } - - public Long getLong(String key, Long defaultValue) { - return containsKey(key) ? (Long) get(key) : defaultValue; - } - - public Float getFloat(String key, Float defaultValue) { - return containsKey(key) ? (Float) get(key) : defaultValue; - } - - public Double getDouble(String key, Double defaultValue) { - return containsKey(key) ? (Double) get(key) : defaultValue; - } - - public String getString(String key, String defaultValue) { - return containsKey(key) ? (String) get(key) : defaultValue; - } - - public byte[] getByteArray(String key, byte[] defaultValue) { - return containsKey(key) ? (byte[]) get(key) : defaultValue; - } - - public int[] getIntegerArray(String key, int[] defaultValue) { - return containsKey(key) ? (int[]) get(key) : defaultValue; - } - - /** - * Retrieve the list by the given name. - * - * @param key - the name of the list. - * @param createNew - whether or not to create a new list if its missing. - * @return An existing list, a new list or NULL. - */ - public NbtList getList(String key, boolean createNew) { - NbtList list = (NbtList) get(key); - - if ((list == null) && createNew) { - put(key, list = createList()); - } - return list; - } - - /** - * Retrieve the map by the given name. - * - * @param key - the name of the map. - * @param createNew - whether or not to create a new map if its missing. - * @return An existing map, a new map or NULL. - */ - public NbtCompound getMap(String key, boolean createNew) { - return getMap(Collections.singletonList(key), createNew); - } - - // Done - - /** - * Set the value of an entry at a given location. - *

    - * Every element of the path (except the end) are assumed to be compounds, and will - * be created if they are missing. - * - * @param path - the path to the entry. - * @param value - the new value of this entry. - * @return This compound, for chaining. - */ - public NbtCompound putPath(String path, Object value) { - List entries = getPathElements(path); - Map map = getMap(entries.subList(0, entries.size() - 1), true); - - map.put(entries.get(entries.size() - 1), value); - return this; - } - - /** - * Retrieve the value of a given entry in the tree. - *

    - * Every element of the path (except the end) are assumed to be compounds. The - * retrieval operation will be cancelled if any of them are missing. - * - * @param path - path to the entry. - * @return The value, or NULL if not found. - */ - @SuppressWarnings("unchecked") public T getPath(String path) { - List entries = getPathElements(path); - NbtCompound map = getMap(entries.subList(0, entries.size() - 1), false); - - if (map != null) { - return (T) map.get(entries.get(entries.size() - 1)); - } - return null; - } - - /** - * Save the content of a NBT compound to a stream. - * - * @param stream - the output stream. - * @param option - whether or not to compress the output. - * @throws IOException If anything went wrong. - */ - public void saveTo(ByteSink stream, StreamOptions option) throws IOException { - saveStream(this, stream, option); - } - - /** - * Retrieve a map from a given path. - * - * @param path - path of compounds to look up. - * @param createNew - whether or not to create new compounds on the way. - * @return The map at this location. - */ - private NbtCompound getMap(Iterable path, boolean createNew) { - NbtCompound current = this; - - for (String entry : path) { - NbtCompound child = (NbtCompound) current.get(entry); - - if (child == null) { - if (!createNew) { - return null; - } - current.put(entry, child = createCompound()); - } - current = child; - } - return current; - } - - /** - * Split the path into separate elements. - * - * @param path - the path to split. - * @return The elements. - */ - private List getPathElements(String path) { - return Lists.newArrayList(Splitter.on(".").omitEmptyStrings().split(path)); - } - } - - - /** - * Represents a root NBT list. - * See also: - *

      - *
    • {@link NbtFactory#createList(Iterable)}}
    • - *
    • {@link NbtFactory#fromList(Object)}
    • - *
    - * - * @author Kristian - */ - public final class NbtList extends ConvertedList { - - private NbtList(Object handle) { - super(handle, getDataList(handle)); - } - } - - - /** - * Represents a class for caching wrappers. - * - * @author Kristian - */ - private final class CachedNativeWrapper { - - // Don't recreate wrapper objects - private final ConcurrentMap cache = new MapMaker().weakKeys().makeMap(); - - public Object wrap(Object value) { - Object current = this.cache.get(value); - - if (current == null) { - current = wrapNative(value); - - // Only cache composite objects - if ((current instanceof ConvertedMap) || (current instanceof ConvertedList)) { - this.cache.put(value, current); - } - } - return current; - } - } - - - /** - * Represents a map that wraps another map and automatically - * converts entries of its type and another exposed type. - * - * @author Kristian - */ - private class ConvertedMap extends AbstractMap implements Wrapper { - - private final Object handle; - private final Map original; - - private final CachedNativeWrapper cache = new CachedNativeWrapper(); - - public ConvertedMap(Object handle, Map original) { - this.handle = handle; - this.original = original; - } - - // For converting back and forth - protected Object wrapOutgoing(Object value) { - return this.cache.wrap(value); - } - - protected Object unwrapIncoming(Object wrapped) { - return unwrapValue(wrapped); - } - - // Modification - @Override public Object put(String key, Object value) { - return wrapOutgoing(this.original.put(key, unwrapIncoming(value))); - } - - // Performance - @Override public Object get(Object key) { - return wrapOutgoing(this.original.get(key)); - } - - @Override public Object remove(Object key) { - return wrapOutgoing(this.original.remove(key)); - } - - @Override public boolean containsKey(Object key) { - return this.original.containsKey(key); - } - - @Override public Set> entrySet() { - return new AbstractSet>() { - @Override public boolean add(Entry e) { - String key = e.getKey(); - Object value = e.getValue(); - - ConvertedMap.this.original.put(key, unwrapIncoming(value)); - return true; - } - - @Override public int size() { - return ConvertedMap.this.original.size(); - } - - @Override public Iterator> iterator() { - return ConvertedMap.this.iterator(); - } - }; - } - - private Iterator> iterator() { - final Iterator> proxy = this.original.entrySet().iterator(); - - return new Iterator>() { - @Override public boolean hasNext() { - return proxy.hasNext(); - } - - @Override public Entry next() { - Entry entry = proxy.next(); - - return new SimpleEntry(entry.getKey(), - wrapOutgoing(entry.getValue())); - } - - @Override public void remove() { - proxy.remove(); - } - }; - } - - @Override public Object getHandle() { - return this.handle; - } - } - - - /** - * Represents a list that wraps another list and converts elements - * of its type and another exposed type. - * - * @author Kristian - */ - private class ConvertedList extends AbstractList implements Wrapper { - - private final Object handle; - - private final List original; - private final CachedNativeWrapper cache = new CachedNativeWrapper(); - - public ConvertedList(Object handle, List original) { - if (NbtFactory.this.NBT_LIST_TYPE == null) { - NbtFactory.this.NBT_LIST_TYPE = getField(handle, null, "type"); - } - this.handle = handle; - this.original = original; - } - - protected Object wrapOutgoing(Object value) { - return this.cache.wrap(value); - } - - protected Object unwrapIncoming(Object wrapped) { - return unwrapValue(wrapped); - } - - @Override public Object get(int index) { - return wrapOutgoing(this.original.get(index)); - } - - @Override public int size() { - return this.original.size(); - } - - @Override public Object set(int index, Object element) { - return wrapOutgoing(this.original.set(index, unwrapIncoming(element))); - } - - @Override public void add(int index, Object element) { - Object nbt = unwrapIncoming(element); - - // Set the list type if its the first element - if (size() == 0) { - setFieldValue(NbtFactory.this.NBT_LIST_TYPE, this.handle, - (byte) getNbtType(nbt).id); - } - this.original.add(index, nbt); - } - - @Override public Object remove(int index) { - return wrapOutgoing(this.original.remove(index)); - } - - @Override public boolean remove(Object o) { - return this.original.remove(unwrapIncoming(o)); - } - - @Override public Object getHandle() { - return this.handle; - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 440aca318..df19ed711 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -1,6 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; -import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -15,6 +14,13 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.google.common.collect.HashBiMap; import com.google.common.collect.Sets; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.NBTInputStream; +import com.sk89q.jnbt.Tag; +import java.io.BufferedInputStream; +import java.io.FileNotFoundException; +import java.util.Map; +import java.util.zip.GZIPInputStream; import org.bukkit.Bukkit; import org.bukkit.World; @@ -38,6 +44,16 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { return super.startCaching(whenDone) && cache(whenDone); } + private Tag readTag(File file) throws IOException { + // Don't chain the creation of the GZIP stream and the NBT stream, because their + // constructors may throw an IOException. + try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file)); + GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream); + NBTInputStream nbtInputStream = new NBTInputStream(gzipInputStream)) { + return nbtInputStream.readNamedTag().getTag(); + } + } + public boolean cache(final Runnable whenDone) { final File container = Bukkit.getWorldContainer(); List worlds = Bukkit.getWorlds(); @@ -94,18 +110,18 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { UUID uuid = UUID.fromString(s); if (check || all.remove(uuid)) { File file = new File(playerDataFolder, current); - NbtFactory.NbtCompound compound = NbtFactory - .fromStream(new FileInputStream(file), - NbtFactory.StreamOptions.GZIP_COMPRESSION); + CompoundTag compound = (CompoundTag) readTag(file); if (!compound.containsKey("bukkit")) { PlotSquared.debug("ERROR: Player data (" + uuid.toString() + ".dat) does not contain the the key \"bukkit\""); } else { - NbtFactory.NbtCompound bukkit = - (NbtFactory.NbtCompound) compound.get("bukkit"); - String name = (String) bukkit.get("lastKnownName"); - long last = (long) bukkit.get("lastPlayed"); - long first = (long) bukkit.get("firstPlayed"); + Map compoundMap = compound.getValue(); + CompoundTag bukkit = (CompoundTag) compoundMap.get("bukkit"); + Map bukkitMap = bukkit.getValue(); + String name = + (String) bukkitMap.get("lastKnownName").getValue(); + long last = (long) bukkitMap.get("lastPlayed").getValue(); + long first = (long) bukkitMap.get("firstPlayed").getValue(); if (ExpireManager.IMP != null) { ExpireManager.IMP.storeDate(uuid, last); ExpireManager.IMP.storeAccountAge(uuid, last - first); @@ -167,27 +183,26 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { if (!file.exists()) { continue; } - NbtFactory.NbtCompound compound = NbtFactory - .fromStream(new FileInputStream(file), - NbtFactory.StreamOptions.GZIP_COMPRESSION); + CompoundTag compound = (CompoundTag) readTag(file); if (!compound.containsKey("bukkit")) { PlotSquared.debug("ERROR: Player data (" + uuid.toString() + ".dat) does not contain the the key \"bukkit\""); } else { - NbtFactory.NbtCompound bukkit = - (NbtFactory.NbtCompound) compound.get("bukkit"); - String name = (String) bukkit.get("lastKnownName"); + Map compoundMap = compound.getValue(); + CompoundTag bukkit = (CompoundTag) compoundMap.get("bukkit"); + Map bukkitMap = bukkit.getValue(); + String name = (String) bukkitMap.get("lastKnownName").getValue(); StringWrapper wrap = new StringWrapper(name); if (!toAdd.containsKey(wrap)) { - long last = (long) bukkit.get("lastPlayed"); - long first = (long) bukkit.get("firstPlayed"); + long last = (long) bukkitMap.get("lastPlayed").getValue(); + long first = (long) bukkitMap.get("firstPlayed").getValue(); if (Settings.UUID.OFFLINE) { if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase() .equals(name)) { uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name); } else { - long most = (long) compound.get("UUIDMost"); - long least = (long) compound.get("UUIDLeast"); + long most = (long) compoundMap.get("UUIDMost").getValue(); + long least = (long) compoundMap.get("UUIDLeast").getValue(); uuid = new UUID(most, least); } } From 4c905231214edc9dd6248f45c43728169238ebea Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 25 Dec 2019 02:39:41 +0000 Subject: [PATCH 254/258] use 1.15 spigot --- Bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 95bf96671..1b633e61c 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -19,7 +19,7 @@ dependencies { compile(project(":Core")) compile("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' - implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") + implementation("org.spigotmc:spigot:1.15-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile("io.papermc:paperlib:1.0.2") compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0") From f97e52ea0b5148071a76c435421ada266c888cf1 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 25 Dec 2019 10:40:54 +0100 Subject: [PATCH 255/258] Fixes building against 1.15 --- Bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 1b633e61c..0bc7748a7 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -19,7 +19,7 @@ dependencies { compile(project(":Core")) compile("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' - implementation("org.spigotmc:spigot:1.15-R0.1-SNAPSHOT") + implementation("org.spigotmc:spigot-api:1.15.1-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile("io.papermc:paperlib:1.0.2") compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0") From 0ad26822104d5ec2f0ce3a3721c18780a4344e7d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 27 Dec 2019 16:53:38 +0100 Subject: [PATCH 256/258] Add update and jvm flags to debugpaste --- .../plotsquared/plot/commands/DebugPaste.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 7cfc62c69..426b46eaa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -22,6 +22,7 @@ import java.lang.management.RuntimeMXBean; import java.nio.file.Files; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", @@ -66,6 +67,8 @@ public class DebugPaste extends SubCommand { b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); Runtime runtime = Runtime.getRuntime(); RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); + b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n'); + b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n'); b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n'); b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n'); b.append("Java Name: ").append(rb.getVmName()).append('\n'); From 58bb0509f789820a065873acfd3d1f5e01f626bf Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 27 Dec 2019 17:01:17 +0100 Subject: [PATCH 257/258] Bump gradle version to 6.0.1 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7c4388a92..94920145f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 568e9537ecbede7a5b9d04069a6ea0f80c538943 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 27 Dec 2019 17:33:52 +0100 Subject: [PATCH 258/258] Bump WorldEdit version to 7.0.1 --- Bukkit/build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 0bc7748a7..ba6fa5c55 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -20,7 +20,7 @@ dependencies { compile("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") //implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' implementation("org.spigotmc:spigot-api:1.15.1-R0.1-SNAPSHOT") - compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") + compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.1") compile("io.papermc:paperlib:1.0.2") compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0") implementation("net.kyori:text-adapter-bukkit:3.0.3") @@ -90,7 +90,6 @@ shadowJar { } relocate('net.kyori.text', 'com.github.intellectualsites.plotsquared.formatting.text') relocate("io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib") - // relocate('org.mcstats', 'com.plotsquared.stats') archiveFileName = "${parent.name}-${project.name}-${parent.version}.jar" destinationDirectory = file "../target" }