Created
October 30, 2014 17:42
-
-
Save jimmikaelkael/e5812bcf4c7b098a6d6a to your computer and use it in GitHub Desktop.
TestBlockTicking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.jimmikaelkael; | |
import org.bukkit.Bukkit; | |
import org.bukkit.block.Block; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.EventPriority; | |
import org.bukkit.event.Listener; | |
import org.bukkit.event.block.BlockFadeEvent; | |
import org.bukkit.event.block.BlockGrowEvent; | |
import org.bukkit.event.block.BlockSpreadEvent; | |
import org.bukkit.event.world.StructureGrowEvent; | |
import org.bukkit.plugin.java.JavaPlugin; | |
public class TestBlockTicking extends JavaPlugin implements Listener { | |
@Override | |
public void onEnable() { | |
getLogger().info("TestBlockTicking enabled."); | |
Bukkit.getPluginManager().registerEvents(this, this); | |
} | |
@Override | |
public void onDisable() { | |
getLogger().info("TestBlockTicking disabled."); | |
} | |
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) | |
public void onBlockSpread(BlockSpreadEvent e) { | |
Block b = e.getBlock(); | |
getLogger().info("BlockSpreadEvent at: " + b.getX() + ", " + b.getY() + ", " + b.getZ()); | |
//e.setCancelled(true); | |
} | |
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) | |
public void onBlockFade(BlockFadeEvent e) { | |
Block b = e.getBlock(); | |
getLogger().info("BlockFadeEvent at: " + b.getX() + ", " + b.getY() + ", " + b.getZ()); | |
//e.setCancelled(true); | |
} | |
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) | |
public void onBlockGrow(BlockGrowEvent e) { | |
Block b = e.getBlock(); | |
getLogger().info("BlockGrowEvent at: " + b.getX() + ", " + b.getY() + ", " + b.getZ()); | |
//e.setCancelled(true); | |
} | |
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) | |
public void onStructureGrow(StructureGrowEvent e) { | |
Block b = e.getLocation().getBlock(); | |
getLogger().info("StructureGrowEvent at: " + b.getX() + ", " + b.getY() + ", " + b.getZ()); | |
getLogger().info("number of blocks: " + e.getBlocks().size()); | |
getLogger().info("tree type: " + e.getSpecies().name()); | |
//e.setCancelled(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment