Lexepi

Untitled

Nov 9th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. package Rush;
  2.  
  3.  
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.Location;
  7. import org.bukkit.Material;
  8. import org.bukkit.block.Block;
  9. import org.bukkit.entity.EntityType;
  10. import org.bukkit.event.EventHandler;
  11. import org.bukkit.event.Listener;
  12. import org.bukkit.event.entity.EntityExplodeEvent;
  13. import org.bukkit.plugin.java.JavaPlugin;
  14.  
  15. public class TestTush extends JavaPlugin implements Listener{
  16.  
  17.  
  18. public void onEnable(){
  19. Bukkit.getPluginManager().registerEvents(this, this);
  20. }
  21.  
  22. @EventHandler
  23. public void onBlockExplode(EntityExplodeEvent e) {
  24. e.setCancelled(true);
  25. for(Block block : e.blockList()) {
  26. if(block.getLocation() == new Location(block.getWorld() ,-116, 79, 56)){
  27. if(block.getType() == Material.BED_BLOCK || block.getType() == Material.BED) {
  28. block.setType(Material.AIR) ;
  29. }
  30. }
  31. if(block.getType() != Material.BED_BLOCK || block.getType() != Material.BED){
  32. e.setCancelled(true);
  33. }
  34. if(block.getType() == Material.TNT){
  35. block.setType(Material.AIR);
  36. block.getWorld().spawnEntity(block.getLocation(), EntityType.PRIMED_TNT);
  37. }
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment