Facebook
From Obese Partdridge, 6 Years ago, written in JavaScript.
This paste is a reply to Untitled from Big Lion - view diff
Embed
Download Paste or View Raw
Hits: 280
  1.         @EventHandler
  2.         public void onBreak(BlockBreakEvent e){
  3.                 final Block b = e.getBlock();
  4.                 if(b.getType() == Material.ENDER_STONE){
  5.                         ItemStack drop = new ItemStack(Material.ENDER_STONE, 1);
  6.                         b.setType(Material.ENDER_STONE);
  7.                         if(!(e.getPlayer().getGameMode() != GameMode.CREATIVE)){
  8.                                 b.getWorld().dropItemNaturally(b.getLocation(), drop);
  9.                         } else {
  10.                                 return;
  11.                         }
  12.                         e.setCancelled(true);
  13.                         return;
  14.                 }
  15.                 if(b.getType() == Material.STONE){
  16.                         final Location loc = new Location(b.getLocation().getWorld(), b.getX(), b.getY() - 1.0D, b.getZ());
  17.                         if(loc.getBlock().getType() == Material.ENDER_STONE){
  18.                                 Bukkit.getScheduler().runTaskLater(Main.getInst(), new Runnable() {
  19.                                        
  20.                                         @Override
  21.                                         public void run() {
  22.                                                 if(loc.getBlock().getType() == Material.ENDER_STONE){
  23.                                                         b.setType(Material.STONE);
  24.                                                 }
  25.                                                
  26.                                         }
  27.                                 }, 25L);
  28.                         }
  29.                 }
  30.         }