diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ce96082ac..5926f3a57 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
- uses: actions/checkout@v3.0.0
+ uses: actions/checkout@v3
- name: Validate Gradle Wrapper"
- uses: gradle/wrapper-validation-action@v1.0.4
+ uses: gradle/wrapper-validation-action@v1
- name: Setup Java
- uses: actions/setup-java@v3.0.0
+ uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
diff --git a/.gitignore b/.gitignore
index a33dda199..d1add4d55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,7 +41,8 @@ hs_err_pid*
*.iml
## Directory-based project format:
-.idea/
+/.idea/*
+!/.idea/icon.svg
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
@@ -74,9 +75,6 @@ hs_err_pid*
# IntelliJ
/out/
-# mpeltonen/sbt-idea plugin
-.idea_modules/
-
# JIRA plugin
atlassian-ide-plugin.xml
diff --git a/.idea/icon.svg b/.idea/icon.svg
new file mode 100644
index 000000000..e40b9f700
--- /dev/null
+++ b/.idea/icon.svg
@@ -0,0 +1,49 @@
+
+
diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts
index 5356c0a06..072c03a9e 100644
--- a/Bukkit/build.gradle.kts
+++ b/Bukkit/build.gradle.kts
@@ -83,7 +83,7 @@ tasks.named("shadowJar") {
relocate("org.jetbrains", "com.plotsquared.core.annotations.jetbrains.annotation")
relocate("org.intellij.lang", "com.plotsquared.core.annotations.intellij.annotations")
relocate("javax.annotation", "com.plotsquared.core.annotations.javax.annotation")
- relocate("com.google.code.findbugs", "com.plotsquared.core.annotations.jsr305")
+ relocate("com.github.spotbugs", "com.plotsquared.core.spotbugs")
relocate("javax.inject", "com.plotsquared.core.annotations.javax.inject")
relocate("net.jcip", "com.plotsquared.core.annotations.jcip")
relocate("edu.umd.cs.findbugs", "com.plotsquared.core.annotations.findbugs")
diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
index 8628daa02..06110b633 100644
--- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
+++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
@@ -76,7 +76,6 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PremiumVerification;
-import com.plotsquared.core.util.RegExUtil;
import com.plotsquared.core.util.entity.EntityCategories;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime;
@@ -223,10 +222,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
}
- @SuppressWarnings("StringSplitter")
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void playerCommand(PlayerCommandPreprocessEvent event) {
- String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim();
+ String msg = event.getMessage().replace("/", "").toLowerCase(Locale.ROOT).trim();
if (msg.isEmpty()) {
return;
}
@@ -240,11 +238,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
String[] parts = msg.split(" ");
Plot plot = plotPlayer.getCurrentPlot();
// Check WorldEdit
- switch (parts[0].toLowerCase()) {
+ switch (parts[0]) {
case "up":
- case "/up":
case "worldedit:up":
- case "worldedit:/up":
if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER, true))) {
event.setCancelled(true);
@@ -258,63 +254,67 @@ public class PlayerEventListener extends PlotListener implements Listener {
List blockedCommands = plot != null ?
plot.getFlag(BlockedCmdsFlag.class) :
area.getFlag(BlockedCmdsFlag.class);
- if (!blockedCommands.isEmpty() && !Permissions
- .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
- String part = parts[0];
- if (parts[0].contains(":")) {
- part = parts[0].split(":")[1];
- msg = msg.replace(parts[0].split(":")[0] + ':', "");
- }
- String s1 = part;
- List aliases = new ArrayList<>();
- for (HelpTopic cmdLabel : Bukkit.getServer().getHelpMap().getHelpTopics()) {
- if (part.equals(cmdLabel.getName())) {
- break;
- }
- String label = cmdLabel.getName().replaceFirst("/", "");
- if (aliases.contains(label)) {
- continue;
- }
- PluginCommand p;
- if ((p = Bukkit.getPluginCommand(label)) != null) {
- for (String a : p.getAliases()) {
- if (aliases.contains(a)) {
- continue;
- }
- aliases.add(a);
- a = a.replaceFirst("/", "");
- if (!a.equals(label) && a.equals(part)) {
- part = label;
- break;
- }
- }
- }
- }
- if (!s1.equals(part)) {
- msg = msg.replace(s1, part);
- }
- for (String s : blockedCommands) {
- Pattern pattern;
- if (!RegExUtil.compiledPatterns.containsKey(s)) {
- RegExUtil.compiledPatterns.put(s, pattern = Pattern.compile(s));
+ if (blockedCommands.isEmpty()) {
+ return;
+ }
+ if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
+ return;
+ }
+ // When using namespaced commands, we're not interested in the namespace
+ String part = parts[0];
+ if (part.contains(":")) {
+ String[] namespaced = part.split(":");
+ part = namespaced[1];
+ msg = msg.substring(namespaced[0].length() + 1);
+ }
+ msg = replaceAliases(msg, part);
+ for (String blocked : blockedCommands) {
+ if (blocked.equalsIgnoreCase(msg)) {
+ String perm;
+ if (plot != null && plot.isAdded(plotPlayer.getUUID())) {
+ perm = "plots.admin.command.blocked-cmds.shared";
} else {
- pattern = RegExUtil.compiledPatterns.get(s);
+ perm = "plots.admin.command.blocked-cmds.road";
}
- if (pattern.matcher(msg).matches()) {
- String perm;
- if (plot != null && plot.isAdded(plotPlayer.getUUID())) {
- perm = "plots.admin.command.blocked-cmds.shared";
- } else {
- perm = "plots.admin.command.blocked-cmds.road";
+ if (!Permissions.hasPermission(plotPlayer, perm)) {
+ plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
+ event.setCancelled(true);
+ }
+ return;
+ }
+ }
+ }
+
+ private String replaceAliases(String msg, String part) {
+ String s1 = part;
+ Set aliases = new HashSet<>();
+ for (HelpTopic cmdLabel : Bukkit.getServer().getHelpMap().getHelpTopics()) {
+ if (part.equals(cmdLabel.getName())) {
+ break;
+ }
+ String label = cmdLabel.getName().replaceFirst("/", "");
+ if (aliases.contains(label)) {
+ continue;
+ }
+ PluginCommand p = Bukkit.getPluginCommand(label);
+ if (p != null) {
+ for (String a : p.getAliases()) {
+ if (aliases.contains(a)) {
+ continue;
}
- if (!Permissions.hasPermission(plotPlayer, perm)) {
- plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
- event.setCancelled(true);
+ aliases.add(a);
+ a = a.replaceFirst("/", "");
+ if (!a.equals(label) && a.equals(part)) {
+ part = label;
+ break;
}
- return;
}
}
}
+ if (!s1.equals(part)) {
+ msg = msg.replace(s1, part);
+ }
+ return msg;
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
diff --git a/Core/build.gradle.kts b/Core/build.gradle.kts
index fa79fa3bb..9bf697e9d 100644
--- a/Core/build.gradle.kts
+++ b/Core/build.gradle.kts
@@ -22,7 +22,7 @@ dependencies {
api(libs.guiceassistedinject) {
exclude("com.google.inject", "guice")
}
- api(libs.findbugs)
+ api(libs.spotbugs)
// Plugins
compileOnly(libs.worldeditCore) {
diff --git a/Core/src/main/java/com/plotsquared/core/command/Confirm.java b/Core/src/main/java/com/plotsquared/core/command/Confirm.java
index ea50a5111..5db5f93ae 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Confirm.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Confirm.java
@@ -48,7 +48,7 @@ public class Confirm extends SubCommand {
player.sendMessage(TranslatableCaption.of("confirm.expired_confirm"));
return false;
}
- TaskManager.runTaskAsync(command.command);
+ TaskManager.runTask(command.command);
return true;
}
diff --git a/Core/src/main/java/com/plotsquared/core/command/Load.java b/Core/src/main/java/com/plotsquared/core/command/Load.java
index 91d99deeb..86878d15a 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Load.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Load.java
@@ -40,6 +40,7 @@ import com.plotsquared.core.plot.schematic.Schematic;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler;
+import com.plotsquared.core.util.TimeUtil;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
@@ -205,7 +206,7 @@ public class Load extends SubCommand {
if (split.length < 5) {
continue;
}
- String time = secToTime((System.currentTimeMillis() / 1000) - Long.parseLong(split[0]));
+ String time = TimeUtil.secToTime((System.currentTimeMillis() / 1000) - Long.parseLong(split[0]));
String world = split[1];
PlotId id = PlotId.fromString(split[2] + ';' + split[3]);
String size = split[4];
@@ -223,6 +224,10 @@ public class Load extends SubCommand {
}
}
+ /**
+ * @deprecated Use {@link TimeUtil#secToTime(long)}
+ */
+ @Deprecated(forRemoval = true, since = "6.6.2")
public String secToTime(long time) {
StringBuilder toreturn = new StringBuilder();
if (time >= 33868800) {
diff --git a/Core/src/main/java/com/plotsquared/core/command/SetHome.java b/Core/src/main/java/com/plotsquared/core/command/SetHome.java
index 4b9c44650..c54691c36 100644
--- a/Core/src/main/java/com/plotsquared/core/command/SetHome.java
+++ b/Core/src/main/java/com/plotsquared/core/command/SetHome.java
@@ -57,8 +57,12 @@ public class SetHome extends SetCommand {
Plot base = plot.getBasePlot(false);
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()
+ BlockLoc rel = new BlockLoc(
+ location.getX() - bottom.getX(),
+ location.getY(), // y is absolute
+ location.getZ() - bottom.getZ(),
+ location.getYaw(),
+ location.getPitch()
);
base.setHome(rel);
player.sendMessage(TranslatableCaption.of("position.position_set"));
diff --git a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java
index 7957ac912..19de13cc6 100644
--- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java
+++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java
@@ -389,7 +389,7 @@ public class ClassicPlotManager extends SquarePlotManager {
if (!plot.isMerged(Direction.NORTH)) {
int z = bot.getZ();
for (int x = bot.getX(); x < top.getX(); x++) {
- for (int y = classicPlotWorld.getMaxBuildHeight(); y <= classicPlotWorld.WALL_HEIGHT; y++) {
+ for (int y = classicPlotWorld.getMinBuildHeight(); y <= classicPlotWorld.WALL_HEIGHT; y++) {
queue.setBlock(x, y, z, blocks);
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
index aa7153370..5d3dcfaba 100644
--- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
+++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
@@ -309,7 +309,7 @@ public class PlotListener {
}
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
final UUID plotOwner = plot.getOwnerAbs();
- String owner = PlayerManager.resolveName(plotOwner, false).getComponent(player);
+ String owner = PlayerManager.resolveName(plotOwner, true).getComponent(player);
Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" +
".title_entered_plot");
Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" +
diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java
index 8b0e78610..b709de857 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java
@@ -1465,7 +1465,7 @@ public class Plot {
.at(
bottom.getWorldName(),
bottom.getX() + home.getX(),
- bottom.getY() + home.getY(),
+ home.getY(), // y is absolute
bottom.getZ() + home.getZ(),
home.getYaw(),
home.getPitch()
diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
index 042c2e14f..68052f02c 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
@@ -333,10 +333,9 @@ public final class PlotModificationManager {
ids.add(current.getId());
}
this.plot.clearRatings();
- QueueCoordinator queue = null;
+ QueueCoordinator queue = this.plot.getArea().getQueue();
if (createSign) {
this.removeSign();
- queue = this.plot.getArea().getQueue();
}
PlotManager manager = this.plot.getArea().getPlotManager();
if (createRoad) {
diff --git a/Core/src/main/java/com/plotsquared/core/util/RegExUtil.java b/Core/src/main/java/com/plotsquared/core/util/RegExUtil.java
index b45f1af68..bf6113089 100644
--- a/Core/src/main/java/com/plotsquared/core/util/RegExUtil.java
+++ b/Core/src/main/java/com/plotsquared/core/util/RegExUtil.java
@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
+@Deprecated(since = "6.6.2", forRemoval = true)
public class RegExUtil {
public static Map compiledPatterns;
diff --git a/Core/src/main/java/com/plotsquared/core/util/TimeUtil.java b/Core/src/main/java/com/plotsquared/core/util/TimeUtil.java
index 0e4593a4b..851649a05 100644
--- a/Core/src/main/java/com/plotsquared/core/util/TimeUtil.java
+++ b/Core/src/main/java/com/plotsquared/core/util/TimeUtil.java
@@ -44,27 +44,27 @@ public final class TimeUtil {
StringBuilder toReturn = new StringBuilder();
if (time >= 33868800) {
int years = (int) (time / 33868800);
- time -= years * 33868800;
+ time -= years * 33868800L;
toReturn.append(years).append("y ");
}
if (time >= 604800) {
int weeks = (int) (time / 604800);
- time -= weeks * 604800;
+ time -= weeks * 604800L;
toReturn.append(weeks).append("w ");
}
if (time >= 86400) {
int days = (int) (time / 86400);
- time -= days * 86400;
+ time -= days * 86400L;
toReturn.append(days).append("d ");
}
if (time >= 3600) {
int hours = (int) (time / 3600);
- time -= hours * 3600;
+ time -= hours * 3600L;
toReturn.append(hours).append("h ");
}
if (time >= 60) {
int minutes = (int) (time / 60);
- time -= minutes * 60;
+ time -= minutes * 60L;
toReturn.append(minutes).append("m ");
}
if (toReturn.length() == 0 || time > 0) {
diff --git a/build.gradle.kts b/build.gradle.kts
index 2747a97a4..fbb588b3a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -18,7 +18,7 @@ plugins {
idea
}
-version = "6.6.2-SNAPSHOT"
+version = "6.6.3-SNAPSHOT"
allprojects {
group = "com.plotsquared"
@@ -40,6 +40,9 @@ allprojects {
maven {
name = "Jitpack"
url = uri("https://jitpack.io")
+ content {
+ includeModule("com.github.MilkBowl", "VaultAPI")
+ }
}
maven {
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 88476b2bd..10f1156a3 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -6,9 +6,9 @@ guava = "31.0.1-jre" # Version set by Minecraft
# Platform expectations
paper = "1.18.1-R0.1-SNAPSHOT"
-checker-qual = "3.21.3"
+checker-qual = "3.21.4"
guice = "5.1.0"
-findbugs = "3.0.1"
+spotbugs = "4.6.0"
snakeyaml = "1.30" # Version set by Bukkit
# Adventure & MiniMessage
@@ -17,8 +17,8 @@ adventure-text-minimessage = "4.1.0-SNAPSHOT"
adventure-platform-bukkit = "4.0.1"
# Plugins
-worldedit = "7.2.9"
-fawe = "2.1.0"
+worldedit = "7.2.10"
+fawe = "2.1.1"
vault = "1.7.1"
placeholderapi = "2.11.1"
luckperms = "5.4"
@@ -33,7 +33,7 @@ arkitektonika = "2.1.1"
paster = "1.1.4"
bstats = "3.0.0"
paperlib = "1.0.7"
-squirrelid = "0.3.0"
+squirrelid = "0.3.1"
serverlib = "2.3.1"
http4j = "1.3"
@@ -56,7 +56,7 @@ log4j = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref =
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
guice = { group = "com.google.inject", name = "guice", version.ref = "guice" }
guiceassistedinject = { group = "com.google.inject.extensions", name = "guice-assistedinject", version.ref = "guice" }
-findbugs = { group = "com.google.code.findbugs", name = "annotations", version.ref = "findbugs" }
+spotbugs = { group = "com.github.spotbugs", name = "spotbugs-annotations", version.ref = "spotbugs" }
# Adventure & MiniMessage
adventure = { group = "net.kyori", name = "adventure-api", version.ref = "adventure-api" }
@@ -78,7 +78,7 @@ prtree = { group = "com.intellectualsites.prtree", name = "PRTree", version.ref
aopalliance = { group = "aopalliance", name = "aopalliance", version.ref = "aopalliance" }
cloudServices = { group = "cloud.commandframework", name = "cloud-services", version.ref = "cloud-services" }
mvdwapi = { group = "com.intellectualsites.mvdwplaceholderapi", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" }
-squirrelid = { group = "com.github.EngineHub", name = "SquirrelID", version.ref = "squirrelid" }
+squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
serverlib = { group = "dev.notmyfault.serverlib", name = "ServerLib", version.ref = "serverlib" }
bstats = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" }
paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 00e33edef..aa991fcea 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists