Fire BlockFadeEvent when soil turns back to dirt. Fixes BUKKIT-1854
This commit is contained in:
parent
558411692a
commit
9ab40b1ab3
@ -2,7 +2,10 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
// CraftBukkit start
|
||||||
|
import org.bukkit.event.entity.EntityInteractEvent;
|
||||||
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
public class BlockSoil extends Block {
|
public class BlockSoil extends Block {
|
||||||
|
|
||||||
@ -37,6 +40,13 @@ public class BlockSoil extends Block {
|
|||||||
if (l > 0) {
|
if (l > 0) {
|
||||||
world.setData(i, j, k, l - 1);
|
world.setData(i, j, k, l - 1);
|
||||||
} else if (!this.l(world, i, j, k)) {
|
} else if (!this.l(world, i, j, k)) {
|
||||||
|
// CraftBukkit start
|
||||||
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
|
if (CraftEventFactory.callBlockFadeEvent(block, Block.DIRT.id).isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
world.setTypeId(i, j, k, Block.DIRT.id);
|
world.setTypeId(i, j, k, Block.DIRT.id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -49,7 +59,7 @@ public class BlockSoil extends Block {
|
|||||||
// CraftBukkit start - interact soil
|
// CraftBukkit start - interact soil
|
||||||
org.bukkit.event.Cancellable cancellable;
|
org.bukkit.event.Cancellable cancellable;
|
||||||
if (entity instanceof EntityHuman) {
|
if (entity instanceof EntityHuman) {
|
||||||
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
||||||
} else {
|
} else {
|
||||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
|
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
|
||||||
world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user