9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-27 19:09:09 +00:00

Additional slime world event listener

This commit is contained in:
XiaoMoMi
2024-11-04 04:03:42 +08:00
parent 9b14f07df9
commit e0df70529d
7 changed files with 41 additions and 14 deletions

View File

@@ -81,6 +81,7 @@ public class GreenhouseBlock extends AbstractCustomCropsBlock {
CustomCropsBlockState state = getOrFixState(world, pos3);
GreenhouseGlassBreakEvent breakEvent = new GreenhouseGlassBreakEvent(event.entityBreaker(), event.blockBreaker(), event.location(), event.brokenID(), state, event.reason());
if (EventUtils.fireAndCheckCancel(breakEvent)) {
breakEvent.setCancelled(true);
return;
}
world.removeBlockState(pos3);

View File

@@ -81,6 +81,7 @@ public class ScarecrowBlock extends AbstractCustomCropsBlock {
CustomCropsBlockState state = getOrFixState(world, pos3);
ScarecrowBreakEvent breakEvent = new ScarecrowBreakEvent(event.entityBreaker(), event.blockBreaker(), event.location(), event.brokenID(), state, event.reason());
if (EventUtils.fireAndCheckCancel(breakEvent)) {
event.setCancelled(true);
return;
}
world.removeBlockState(pos3);

View File

@@ -72,6 +72,8 @@ public interface WorldManager extends Reloadable {
*/
boolean unloadWorld(World world, boolean disabling);
boolean isMechanicEnabled(World world);
/**
* Retrieves a CustomCrops world based on the specified Bukkit world, if loaded.
*