From 17e784c2833bfe66c0d9e7ffa7ef90a980b0c254 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 1 Nov 2019 21:45:06 -0400 Subject: [PATCH 1/6] Revert dependency upgrades --- Bukkit/build.gradle | 8 ++++---- Core/build.gradle | 8 ++++---- build.gradle | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index cebffd2a6..10e61bb8d 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -22,7 +22,7 @@ dependencies { implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile("io.papermc:paperlib:1.0.2") - compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.6.2") + compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0") implementation("net.kyori:text-adapter-bukkit:3.0.3") compile("net.milkbowl.vault:VaultAPI:1.7") { exclude(module: "bukkit") @@ -81,9 +81,9 @@ shadowJar { include(dependency(":Core")) // update notification stuff include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) - include(dependency("com.squareup.retrofit2:retrofit:2.6.2")) - include(dependency("com.squareup.okhttp3:okhttp:4.2.2")) - include(dependency("com.squareup.okio:okio:2.4.1")) + include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) + include(dependency("com.squareup.okhttp3:okhttp:3.12.0")) + include(dependency("com.squareup.okio:okio:1.14.0")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) include(dependency("io.papermc:paperlib:1.0.2")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) diff --git a/Core/build.gradle b/Core/build.gradle index bc7737b71..0329af1fe 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -5,18 +5,18 @@ def textVersion = "3.0.2" dependencies { implementation("org.yaml:snakeyaml:1.25") - implementation("com.google.code.gson:gson:2.8.6") { + implementation("com.google.code.gson:gson:2.8.0") { because("Minecraft uses GSON 2.8.0") force = true } - implementation("org.projectlombok:lombok:1.18.10") + implementation("org.projectlombok:lombok:1.18.8") compileOnly("org.projectlombok:lombok:1.18.8") testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") - implementation("com.squareup.okhttp3:okhttp:4.2.2") - implementation("com.squareup.okio:okio:2.4.1") + implementation("com.squareup.okhttp3:okhttp:3.12.0") + implementation("com.squareup.okio:okio:1.14.0") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50") } diff --git a/build.gradle b/build.gradle index 667ba16f8..d7052ca6d 100644 --- a/build.gradle +++ b/build.gradle @@ -75,7 +75,7 @@ subprojects { because("Minecraft uses Guava 21 as of 1.13") } compileOnly("org.jetbrains:annotations:17.0.0") - compileClasspath("org.projectlombok:lombok:1.18.10") + compileClasspath("org.projectlombok:lombok:1.18.8") testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") From fed516972485be7fed34af2e1292d27041a49d30 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 5 Nov 2019 15:23:48 +0000 Subject: [PATCH 2/6] Get sign lines sync --- .../plotsquared/bukkit/util/BukkitUtil.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java index a6f49ca66..bf7ed114a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java @@ -8,6 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.worldedit.bukkit.BukkitWorld; @@ -312,13 +313,15 @@ import java.util.Set; } @Override @Nullable public String[] getSign(@NonNull final Location location) { - Block block = getWorld(location.getWorld()) - .getBlockAt(location.getX(), location.getY(), location.getZ()); - if (block.getState() instanceof Sign) { - Sign sign = (Sign) block.getState(); - return sign.getLines(); - } - return null; + Block block = getWorld(location.getWorld()).getBlockAt(location.getX(), location.getY(), location.getZ()); + return TaskManager.IMP.sync(new RunnableVal() { + @Override public void run(String[] value) { + if (block.getState() instanceof Sign) { + Sign sign = (Sign) block.getState(); + this.value = sign.getLines(); + } + } + }); } @Override public Location getSpawn(@NonNull final PlotPlayer player) { From 72c6f1165a363a2510d614045d14170571374348 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 7 Nov 2019 17:02:08 +0100 Subject: [PATCH 3/6] Fix okio --- Core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/build.gradle b/Core/build.gradle index 0329af1fe..865e18257 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -16,7 +16,7 @@ dependencies { testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") implementation("com.squareup.okhttp3:okhttp:3.12.0") - implementation("com.squareup.okio:okio:1.14.0") + implementation("com.squareup.okio:okio:2.2.2") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50") } From 834d78603740ceef74d2a23d424303c30f66cc40 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 7 Nov 2019 17:02:34 +0100 Subject: [PATCH 4/6] Fix okio --- Bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 10e61bb8d..4dd1d8f48 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -83,7 +83,7 @@ shadowJar { include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")) include(dependency("com.squareup.retrofit2:retrofit:2.4.0")) include(dependency("com.squareup.okhttp3:okhttp:3.12.0")) - include(dependency("com.squareup.okio:okio:1.14.0")) + include(dependency("com.squareup.okio:okio:2.2.2")) include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")) include(dependency("io.papermc:paperlib:1.0.2")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) From 37280779b076c7a2ce4e783c5e2d2683b1d85d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 10 Nov 2019 12:06:33 +0100 Subject: [PATCH 5/6] Make `/plot setowner` require an argument. Fixes #2501. --- .../plotsquared/plot/commands/Owner.java | 28 ++++++++++--------- .../plotsquared/plot/config/Captions.java | 1 + 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 55dbdbda4..82ec9f652 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -20,6 +20,10 @@ import java.util.UUID; requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, String value) { + if (value == null || value.isEmpty()) { + Captions.SET_OWNER_MISSING_PLAYER.send(player); + return false; + } Set plots = plot.getConnectedPlots(); UUID uuid = null; String name = null; @@ -75,20 +79,18 @@ import java.util.UUID; final String finalName = name; final UUID finalUUID = uuid; final boolean removeDenied = plot.isDenied(finalUUID); - Runnable run = new Runnable() { - @Override public void run() { - if (plot.setOwner(finalUUID, player)) { - if (removeDenied) - plot.removeDenied(finalUUID); - plot.setSign(finalName); - MainUtil.sendMessage(player, Captions.SET_OWNER); - if (other != null) { - MainUtil.sendMessage(other, Captions.NOW_OWNER, - plot.getArea() + ";" + plot.getId()); - } - } else { - MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED); + Runnable run = () -> { + if (plot.setOwner(finalUUID, player)) { + if (removeDenied) + plot.removeDenied(finalUUID); + plot.setSign(finalName); + MainUtil.sendMessage(player, Captions.SET_OWNER); + if (other != null) { + MainUtil.sendMessage(other, Captions.NOW_OWNER, + plot.getArea() + ";" + plot.getId()); } + } else { + MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED); } }; if (hasConfirmation(player)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 68783e02e..16c9ac3d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -578,6 +578,7 @@ public enum Captions { // SET_OWNER("$4You successfully set the plot owner", "Owner"), SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"), + SET_OWNER_MISSING_PLAYER("$1You need to specify a new owner. Correct usage is: $2/plot setowner ", "Owner"), NOW_OWNER("$4You are now owner of plot %s", "Owner"), // // From a221d6fd07848b807dd82a3c7f3fe1a3a16ba063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 10 Nov 2019 12:10:38 +0100 Subject: [PATCH 6/6] Run tasks synchronously on Bukkit when the plugin is disabled. Previously, the tasks would fail to run, as the scheduler prevents disabled plugins from running tasks. This would cause problems on server shutdown, especially when the SQLManager attempts to perform database queries. This fixes #2446. --- .../plotsquared/bukkit/util/BukkitTaskManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java index 56448ff34..0d00f7741 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java @@ -24,8 +24,12 @@ public class BukkitTaskManager extends TaskManager { } @Override public void taskAsync(Runnable runnable) { - this.bukkitMain.getServer().getScheduler().runTaskAsynchronously(this.bukkitMain, runnable) - .getTaskId(); + if (this.bukkitMain.isEnabled()) { + this.bukkitMain.getServer().getScheduler() + .runTaskAsynchronously(this.bukkitMain, runnable).getTaskId(); + } else { + runnable.run(); + } } @Override public void task(Runnable runnable) {