mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
71 lines
3.0 KiB
Diff
71 lines
3.0 KiB
Diff
--- a/net/minecraft/server/BlockConcretePowder.java
|
|
+++ b/net/minecraft/server/BlockConcretePowder.java
|
|
@@ -1,5 +1,10 @@
|
|
package net.minecraft.server;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.block.CraftBlockState;
|
|
+import org.bukkit.event.block.BlockFormEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class BlockConcretePowder extends BlockFalling {
|
|
|
|
private final IBlockData a;
|
|
@@ -12,7 +17,7 @@
|
|
@Override
|
|
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {
|
|
if (canHarden(world, blockposition, iblockdata1)) {
|
|
- world.setTypeAndData(blockposition, this.a, 3);
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.a, 3); // CraftBukkit
|
|
}
|
|
|
|
}
|
|
@@ -23,7 +28,24 @@
|
|
BlockPosition blockposition = blockactioncontext.getClickPosition();
|
|
IBlockData iblockdata = world.getType(blockposition);
|
|
|
|
- return canHarden(world, blockposition, iblockdata) ? this.a : super.getPlacedState(blockactioncontext);
|
|
+ // CraftBukkit start
|
|
+ if (!canHarden(world, blockposition, iblockdata)) {
|
|
+ return super.getPlacedState(blockactioncontext);
|
|
+ }
|
|
+
|
|
+ // TODO: An event factory call for methods like this
|
|
+ CraftBlockState blockState = CraftBlockState.getBlockState(world, blockposition);
|
|
+ blockState.setData(this.a);
|
|
+
|
|
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
|
|
+ world.getMinecraftServer().server.getPluginManager().callEvent(event);
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ return blockState.getHandle();
|
|
+ }
|
|
+
|
|
+ return super.getPlacedState(blockactioncontext);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
private static boolean canHarden(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) {
|
|
@@ -59,6 +81,20 @@
|
|
|
|
@Override
|
|
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
|
- return a((IBlockAccess) generatoraccess, blockposition) ? this.a : super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
|
+ // CraftBukkit start
|
|
+ if (a((IBlockAccess) generatoraccess, blockposition)) {
|
|
+ CraftBlockState blockState = CraftBlockState.getBlockState(generatoraccess, blockposition);
|
|
+ blockState.setData(this.a);
|
|
+
|
|
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
|
|
+ generatoraccess.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event);
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ return blockState.getHandle();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|