From ca954ccc97455264af054a6ac49e3e01d5a590a1 Mon Sep 17 00:00:00 2001
From: jewome62
Date: Sun, 11 Aug 2019 21:15:02 +0200
Subject: [PATCH 01/28] 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 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 02/28] 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 03/28] 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 04/28] 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 05/28] 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 06/28] 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 07/28] 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 08/28] 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 09/28] 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 10/28] 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 11/28] 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 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 12/28] 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 13/28] 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 14/28] 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 15/28] 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 16/28] 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 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 17/28] 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 18/28] 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 19/28] 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 20/28] 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 21/28] 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 22/28] 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 23/28] 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 24/28] 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 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 25/28] 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 26/28] 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 27/28] 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 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 28/28] 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;