stoneharry

Untitled

Aug 15th, 2012
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1.     @EventHandler
  2.     public void onBlockPlace(BlockPlaceEvent event)
  3.     {
  4.         blocks_placed.push(event.getBlockPlaced().getLocation());
  5.     }
  6.    
  7.     @EventHandler
  8.     public void onBlockBreak(BlockBreakEvent event)
  9.     {
  10.         blocks_broke_location.push(event.getBlock().getLocation());
  11.         blocks_broke_type.add(event.getBlock().getType());
  12.     }
  13.    
  14.     public void resetGame()
  15.     {
  16.         Bukkit.broadcastMessage(ChatColor.RED + "[ChaoticUnited] " + ChatColor.AQUA + "Restoring arena... This may cause some lag.");
  17.        
  18.         int i;
  19.         for (i = 0; i < blocks_placed.size() - 1; i++)
  20.         {
  21.             Location loc = (Location)blocks_placed.pop();
  22.             loc.getBlock().setType(Material.AIR);
  23.         }
  24.        
  25.         for (i = 0; i < blocks_broke_location.size() - 1; i++)
  26.         {
  27.             Material mat = (Material)blocks_broke_type.pop();
  28.             Location loc = (Location)blocks_broke_location.pop();
  29.             loc.getBlock().setType(mat);
  30.         }
  31.        
  32.         Bukkit.broadcastMessage(ChatColor.RED + "[ChaoticUnited] " + ChatColor.AQUA + "Done!");
  33.        
  34.         gameRunning = false;
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment