Archiviert
13
0

SPIGOT-665: Fix ghost blocks when cancelling piston events

Dieser Commit ist enthalten in:
Thinkofdeath 2015-03-09 22:34:05 +00:00
Ursprung ad2f806097
Commit 5cb9b70aaa

Datei anzeigen

@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPiston.java 2015-02-26 22:40:22.195608144 +0000 --- /home/matt/mc-dev-private//net/minecraft/server/BlockPiston.java 2015-03-09 22:33:56.816544171 +0000
+++ src/main/java/net/minecraft/server/BlockPiston.java 2015-02-26 22:40:22.199608144 +0000 +++ src/main/java/net/minecraft/server/BlockPiston.java 2015-03-09 22:33:56.816544171 +0000
@@ -2,6 +2,18 @@ @@ -2,6 +2,18 @@
import java.util.List; import java.util.List;
@ -46,15 +46,15 @@
this.a(world, blockposition, enumdirection, false); this.a(world, blockposition, enumdirection, false);
} }
} else { } else {
@@ -286,10 +309,46 @@ @@ -286,10 +309,53 @@
if (!pistonextendschecker.a()) { if (!pistonextendschecker.a()) {
return false; return false;
} else { } else {
+ // CraftBukkit start + // CraftBukkit start
+ final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ +
+ final List moved = pistonextendschecker.getMovedBlocks(); + final List<BlockPosition> moved = pistonextendschecker.getMovedBlocks();
+ final List broken = pistonextendschecker.getBrokenBlocks(); + final List<BlockPosition> broken = pistonextendschecker.getBrokenBlocks();
+ +
+ List<org.bukkit.block.Block> blocks = new AbstractList<org.bukkit.block.Block>() { + List<org.bukkit.block.Block> blocks = new AbstractList<org.bukkit.block.Block>() {
+ +
@ -86,6 +86,13 @@
+ world.getServer().getPluginManager().callEvent(event); + world.getServer().getPluginManager().callEvent(event);
+ +
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ for (BlockPosition b : broken) {
+ world.notify(b);
+ }
+ for (BlockPosition b : moved) {
+ world.notify(b);
+ world.notify(b.shift(enumdirection1));
+ }
+ return false; + return false;
+ } + }
+ // CraftBukkit end + // CraftBukkit end