From c85ff7ddda440f3d90c9340f3958fd4b982238b0 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 12 Dec 2020 17:52:24 +0100 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 4/4] 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;