breakevent
This commit is contained in:
parent
08772a06da
commit
f64315c638
1 changed files with 8 additions and 5 deletions
|
|
@ -10,6 +10,7 @@ import org.bukkit.entity.EntityType;
|
|||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
|
|
@ -100,11 +101,12 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
|||
// }
|
||||
// }
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (event.getEntity() instanceof FallingBlock) {
|
||||
FallingBlock block = (FallingBlock) event.getEntity();
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
Block block = event.getBlock();
|
||||
if (block.getWorld().getEnvironment() == World.Environment.THE_END) {
|
||||
// The falling block is in the End world
|
||||
// The block is in the End world
|
||||
if (block.getBlockData() instanceof FallingBlock) {
|
||||
// The block that was broken is a falling block
|
||||
String message = "I found a falling block in the End!";
|
||||
Bukkit.broadcastMessage(message);
|
||||
}
|
||||
|
|
@ -115,6 +117,7 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
|||
|
||||
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onFallingBlockToBlock(EntityChangeBlockEvent e){
|
||||
if(e.getEntityType() == EntityType.FALLING_BLOCK){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue