From 5d4cf3b705287bb99d4c1125afebc7ff5d0faa72 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 10 Nov 2020 17:24:37 +0000 Subject: [PATCH 1/8] setowner should allow null UUIDs --- .../main/java/com/plotsquared/core/command/Owner.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Owner.java b/Core/src/main/java/com/plotsquared/core/command/Owner.java index f19790dc5..42e2df5e8 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Owner.java +++ b/Core/src/main/java/com/plotsquared/core/command/Owner.java @@ -146,15 +146,7 @@ public class Owner extends SetCommand { } catch (Exception ignored) { } } else { - PlotSquared.get().getImpromptuUUIDPipeline().getSingle(value, (uuid, throwable) -> { - if (throwable instanceof TimeoutException) { - MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); - } else if (throwable != null) { - MainUtil.sendMessage(player, Captions.INVALID_PLAYER, value); - } else { - uuidConsumer.accept(uuid); - } - }); + PlotSquared.get().getImpromptuUUIDPipeline().getSingle(value, (uuid, throwable) -> uuidConsumer.accept(uuid)); } return true; } From ef95334fe69a2644f600b44771d50d43a521012f Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Mon, 23 Nov 2020 18:32:28 +0100 Subject: [PATCH 2/8] Update actions worflow --- .github/stale.yml | 16 ----------- .github/workflows/build.yml | 20 ++++++++++++++ .github/workflows/gradle.yml | 27 ------------------- .github/workflows/validate-gradle-wrapper.yml | 12 +++++++++ 4 files changed, 32 insertions(+), 43 deletions(-) delete mode 100644 .github/stale.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/gradle.yml create mode 100644 .github/workflows/validate-gradle-wrapper.yml diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 96a6248b7..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Issues with these labels will never be considered stale -exemptLabels: - - [‼] high priority -# Label to use when marking an issue as stale -staleLabel: Old -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..5344ca758 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: "build" + +on: ["pull_request", "push"] + +jobs: + build: + strategy: + matrix: + java: ["1.8", "11"] + os: ["ubuntu-18.04"] + runs-on: "${{ matrix.os }}" + steps: + - name: "Checkout Repository" + uses: "actions/checkout@v2.3.4" + - name: "Setup JDK ${{ matrix.java }}" + uses: "actions/setup-java@v1.4.3" + with: + java-version: "${{ matrix.java }}" + - name: "Clean Build" + run: "./gradlew clean build" \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index 1f19a8e80..000000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Java CI - -on: - push: - branches: - - 'v5' - - 'v6' - pull_request: - branches: - - 'v5' - - 'v6' - -jobs: - test: - runs-on: ubuntu-18.04 - - steps: - - name: Checkout - uses: actions/checkout@v2.0.0 - - name: Setup Java JDK 1.8 - uses: actions/setup-java@v1.3.0 - with: - java-version: 1.8 - - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v1 - - name: Test with Gradle - run: ./gradlew clean build diff --git a/.github/workflows/validate-gradle-wrapper.yml b/.github/workflows/validate-gradle-wrapper.yml new file mode 100644 index 000000000..e82749525 --- /dev/null +++ b/.github/workflows/validate-gradle-wrapper.yml @@ -0,0 +1,12 @@ +name: "validate gradle wrapper" + +on: ["pull_request", "push"] + +jobs: + build: + runs-on: "ubuntu-18.04" + steps: + - name: "Checkout Repository" + uses: "actions/checkout@v2.3.4" + - name: "Validate Gradle Wrapper" + uses: "gradle/wrapper-validation-action@v1.0.3" \ No newline at end of file From 585111ca38bdc0ededcc656873975cbf4535a669 Mon Sep 17 00:00:00 2001 From: Traks <58818927+traksag@users.noreply.github.com> Date: Tue, 24 Nov 2020 16:32:35 +0100 Subject: [PATCH 3/8] Cancel boat placement on interactable blocks, fixes PS-175 (#2934) * Cancel boat placement on interactable blocks, fixes PS-175 * Keep boat protection for old game versions Co-authored-by: NotMyFault --- .../bukkit/listener/PlayerEventListener.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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 c5bcfd8c9..996c5a2d8 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -85,6 +85,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.data.Waterlogged; import org.bukkit.command.PluginCommand; import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Boat; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.HumanEntity; @@ -100,6 +101,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityPickupItemEvent; +import org.bukkit.event.entity.EntityPlaceEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingPlaceEvent; @@ -1068,6 +1070,34 @@ public class PlayerEventListener extends PlotListener implements Listener { } } + // Boats can sometimes be placed on interactable blocks such as levers, + // see PS-175. Armor stands, minecarts and end crystals (the other entities + // supported by this event) don't have this issue. + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void onBoatPlace(EntityPlaceEvent event) { + Player player = event.getPlayer(); + if (player == null) { + return; + } + Entity placed = event.getEntity(); + if (!(placed instanceof Boat)) { + return; + } + BukkitPlayer pp = BukkitUtil.getPlayer(player); + PlotArea area = pp.getPlotAreaAbs(); + if (area == null) { + return; + } + PlayerBlockEventType eventType = PlayerBlockEventType.PLACE_VEHICLE; + Block block = event.getBlock(); + BlockType blockType = BukkitAdapter.asBlockType(block.getType()); + Location location = BukkitUtil.getLocation(block.getLocation()); + if (!PlotSquared.get().getEventDispatcher() + .checkPlayerBlockEvent(pp, eventType, location, blockType, true)) { + event.setCancelled(true); + } + } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBucketEmpty(PlayerBucketEmptyEvent event) { BlockFace bf = event.getBlockFace(); From ee7f683b76abdae898563ca791b9973fc6c562e5 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 26 Nov 2020 16:54:38 +0000 Subject: [PATCH 4/8] Bump paperlib, fix single worlds. --- Bukkit/build.gradle | 4 ++-- Bukkit/pom.xml | 4 ++-- .../com/plotsquared/bukkit/managers/BukkitWorldManager.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index f8770c04f..ff2e398fd 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -28,7 +28,7 @@ dependencies { compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.2.0") { exclude(module: "bukkit") } - compile("io.papermc:paperlib:1.0.4") + compile("io.papermc:paperlib:1.0.5") implementation("net.kyori:text-adapter-bukkit:3.0.3") compile("com.github.MilkBowl:VaultAPI:1.7") { exclude(module: "bukkit") @@ -94,7 +94,7 @@ task copyFiles { shadowJar { dependencies { include(dependency(":PlotSquared-Core")) - include(dependency("io.papermc:paperlib:1.0.4")) + include(dependency("io.papermc:paperlib:1.0.5")) include(dependency("net.kyori:text-adapter-bukkit:3.0.3")) include(dependency("org.bstats:bstats-bukkit:1.7")) include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT")) diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml index e059f957f..7918a3e5a 100644 --- a/Bukkit/pom.xml +++ b/Bukkit/pom.xml @@ -21,7 +21,7 @@ com.plotsquared PlotSquared-Core - 5.13.8 + 5.13.9 compile @@ -45,7 +45,7 @@ io.papermc paperlib - 1.0.4 + 1.0.5 compile diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java index 4646868a1..a1fbb6428 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java @@ -62,7 +62,7 @@ public class BukkitWorldManager implements PlatformWorldManager { } protected void setGenerator(@Nullable final String worldName, @Nullable final String generator) { - if (generator == null) { + if (generator == null || worldName != null && worldName.contains(".")) { return; } File file = new File("bukkit.yml").getAbsoluteFile(); From c85ff7ddda440f3d90c9340f3958fd4b982238b0 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 12 Dec 2020 17:52:24 +0100 Subject: [PATCH 5/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a05b3ea21..1d8614201 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ is to provide a lag-free and smooth experience. * [Discord](https://discord.gg/KxkjDVg) * [Wiki](https://wiki.intellectualsites.com/plotsquared/home) * [Issues](https://issues.intellectualsites.com/projects/ps) +* [Translations](https://intellectualsites.crowdin.com/plotsquared/) ### Developer Resources * [API Documentation](https://wiki.intellectualsites.com/en/plotsquared/developer/development-portal) From 6d7117739441921d8fb08920428fe594ba951455 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 13 Dec 2020 21:09:05 +0000 Subject: [PATCH 6/8] Don't save corrupt schematics so that when they load, they work. --- .../java/com/plotsquared/core/util/SchematicHandler.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index 92b1b2ef4..987aa3fff 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -537,7 +537,7 @@ public abstract class SchematicHandler { schematic.put("Palette", new CompoundTag(paletteTag)); schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray())); schematic - .put("TileEntities", new ListTag(CompoundTag.class, tileEntities)); + .put("BlockEntities", new ListTag(CompoundTag.class, tileEntities)); schematic.put("BiomePaletteMax", new IntTag(biomePalette.size())); @@ -602,8 +602,6 @@ public abstract class SchematicHandler { values.put(entry.getKey(), entry.getValue()); } - // Remove 'id' if it exists. We want 'Id' - values.remove("id"); // Positions are kept in NBT, we don't want that. values.remove("x"); @@ -612,6 +610,11 @@ public abstract class SchematicHandler { values.put("Id", new StringTag(block.getNbtId())); + + // Remove 'id' if it exists. We want 'Id'. + // Do this after we get "getNbtId" cos otherwise "getNbtId" doesn't work. + // Dum. + values.remove("id"); values.put("Pos", new IntArrayTag( new int[] {rx, ry, rz})); From 5e88cabb4b7d55c8f5f8f145f9bffea73c8e900b Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 14 Dec 2020 14:32:34 +0000 Subject: [PATCH 7/8] compare UUID to UUID, not UUIDMapping fix PS-182 --- Core/src/main/java/com/plotsquared/core/command/Deny.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Deny.java b/Core/src/main/java/com/plotsquared/core/command/Deny.java index e1b2536f1..858b3bf78 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Deny.java +++ b/Core/src/main/java/com/plotsquared/core/command/Deny.java @@ -95,7 +95,7 @@ public class Deny extends SubCommand { } plot.addDenied(uuidMapping.getUuid()); PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuidMapping.getUuid(), true); - if (!uuidMapping.equals(DBFunc.EVERYONE)) { + if (!uuidMapping.getUuid().equals(DBFunc.EVERYONE)) { handleKick(PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid()), plot); } else { for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) { From de3ba9a25cc3b214a7d3c4954998dcea39ea51ee Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 14 Dec 2020 14:53:53 +0000 Subject: [PATCH 8/8] re-send block change for blocks with gravity if they're physicsed fixes PS-159 --- .../bukkit/listener/BlockEventListener.java | 48 +++++++------------ .../bukkit/listener/EntityEventListener.java | 3 ++ 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java index bd0d61405..e84bf475a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -187,17 +187,24 @@ public class BlockEventListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPhysicsEvent(BlockPhysicsEvent event) { + Block block = event.getBlock(); + Location location = BukkitUtil.getLocation(block.getLocation()); + PlotArea area = location.getPlotArea(); + if (area == null) { + return; + } + Plot plot = area.getOwnedPlotAbs(location); + if (plot == null) { + return; + } + if (event.getChangedType().hasGravity() && plot.getFlag(DisablePhysicsFlag.class)) { + event.setCancelled(true); + sendBlockChange(event.getBlock().getLocation(), event.getBlock().getBlockData()); + plot.debug("Prevented block physics and resent block change because disable-physics = true"); + return; + } switch (event.getChangedType()) { case COMPARATOR: { - Block block = event.getBlock(); - Location location = BukkitUtil.getLocation(block.getLocation()); - if (location.isPlotArea()) { - return; - } - Plot plot = location.getOwnedPlotAbs(); - if (plot == null) { - return; - } if (!plot.getFlag(RedstoneFlag.class)) { event.setCancelled(true); plot.debug("Prevented comparator update because redstone = false"); @@ -211,16 +218,6 @@ public class BlockEventListener implements Listener { case TURTLE_EGG: case TURTLE_HELMET: case TURTLE_SPAWN_EGG: { - Block block = event.getBlock(); - Location location = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = location.getPlotArea(); - if (area == null) { - return; - } - Plot plot = area.getOwnedPlotAbs(location); - if (plot == null) { - return; - } if (plot.getFlag(DisablePhysicsFlag.class)) { event.setCancelled(true); plot.debug("Prevented block physics because disable-physics = true"); @@ -229,21 +226,11 @@ public class BlockEventListener implements Listener { } default: if (Settings.Redstone.DETECT_INVALID_EDGE_PISTONS) { - Block block = event.getBlock(); switch (block.getType()) { case PISTON: case STICKY_PISTON: org.bukkit.block.data.Directional piston = (org.bukkit.block.data.Directional) block.getBlockData(); - Location location = BukkitUtil.getLocation(block.getLocation()); - PlotArea area = location.getPlotArea(); - if (area == null) { - return; - } - Plot plot = area.getOwnedPlotAbs(location); - if (plot == null) { - return; - } switch (piston.getFacing()) { case EAST: location.setX(location.getX() + 1); @@ -261,8 +248,7 @@ public class BlockEventListener implements Listener { Plot newPlot = area.getOwnedPlotAbs(location); if (!plot.equals(newPlot)) { event.setCancelled(true); - plot.debug( - "Prevented piston update because of invalid edge piston detection"); + plot.debug("Prevented piston update because of invalid edge piston detection"); return; } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java index 342d4e6f0..7c43d8de1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java @@ -201,6 +201,9 @@ public class EntityEventListener implements Listener { if (plot == null || plot.getFlag(DisablePhysicsFlag.class)) { event.setCancelled(true); if (plot != null) { + if (block.getType().hasGravity()) { + BlockEventListener.sendBlockChange(block.getLocation(), block.getBlockData()); + } plot.debug("Falling block event was cancelled because disable-physics = true"); } return;