Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BlockRegen implements Listener {
- public static ArrayList<Block> block = new ArrayList<Block>();
- @EventHandler
- public void onBlockBreak(BlockBreakEvent e)
- {
- Player p = (Player) e.getPlayer();
- Block b = e.getBlock();
- timer(b, Material.GOLD_ORE);
- e.setCancelled(true);
- b.setType(Material.COBBLESTONE);
- block.add(b);
- for(ItemStack is : b.getDrops())
- {
- p.getInventory().addItem(is);
- }
- b.getDrops().clear();
- }
- public void timer(final Block b, final Material m)
- {
- Bukkit.getScheduler().runTaskLater(TowerInvasion.plugin, new Runnable()
- {
- public void run()
- {
- b.setType(m);
- block.remove(b);
- }
- }
- , 600L);
- }
- @EventHandler
- public void onBlockBreak2(BlockBreakEvent e)
- {
- Block b = e.getBlock();
- if(block.contains(b))
- e.setCancelled(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement