mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-09-29 23:17:26 +02:00
Fix for FallBreak not working on old versions
This commit is contained in:
parent
0adf619737
commit
2812c6d07d
@ -83,21 +83,18 @@ public class FallBreak implements Listener {
|
|||||||
}
|
}
|
||||||
}, 2L, 1L);
|
}, 2L, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler
|
||||||
public void onSpawnFallingBlock(EntitySpawnEvent event) {
|
public void onFallingBlockModify(EntityChangeBlockEvent event) {
|
||||||
if(event.getEntity() instanceof FallingBlock) {
|
if(event.getEntity() instanceof FallingBlock) {
|
||||||
WorldManager worldManager = plugin.getWorldManager();
|
WorldManager worldManager = plugin.getWorldManager();
|
||||||
if (worldManager.isIslandWorld(event.getEntity().getLocation().getWorld())) {
|
if (worldManager.isIslandWorld(event.getEntity().getLocation().getWorld())) {
|
||||||
fallingBlocks.add((FallingBlock) event.getEntity());
|
if (!event.getTo().equals(CompatibleMaterial.AIR.getMaterial())){
|
||||||
|
fallingBlocks.remove((FallingBlock) event.getEntity());
|
||||||
|
} else if(!event.isCancelled()) {
|
||||||
|
fallingBlocks.add((FallingBlock) event.getEntity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDespawnFallingBlock(EntityChangeBlockEvent event) {
|
|
||||||
if(event.getEntity() instanceof FallingBlock && !event.getTo().equals(CompatibleMaterial.AIR.getMaterial())) {
|
|
||||||
fallingBlocks.remove((FallingBlock) event.getEntity());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user