SPIGOT-4570: Add FluidLevelChangeEvent

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-01-08 21:23:11 +11:00
parent 73e6e274ff
commit 5a915978fa
3 changed files with 40 additions and 4 deletions

View File

@@ -232,7 +232,7 @@ public class CraftBlock implements Block {
@Override
public String toString() {
return "CraftBlock{pos=" + position + ",type=" + getType() + ",data=" + getNMS() + '}';
return "CraftBlock{pos=" + position + ",type=" + getType() + ",data=" + getNMS() + ",fluid=" + world.getFluid(position) + '}';
}
public static BlockFace notchToBlockFace(EnumDirection notch) {

View File

@@ -835,6 +835,12 @@ public class CraftEventFactory {
return !event.isCancelled();
}
public static FluidLevelChangeEvent callFluidLevelChangeEvent(World world, BlockPosition block, IBlockData newData) {
FluidLevelChangeEvent event = new FluidLevelChangeEvent(CraftBlock.at(world, block), CraftBlockData.fromData(newData));
world.getServer().getPluginManager().callEvent(event);
return event;
}
public static FoodLevelChangeEvent callFoodLevelChangeEvent(EntityHuman entity, int level) {
FoodLevelChangeEvent event = new FoodLevelChangeEvent(entity.getBukkitEntity(), level);
entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);