Advertisement
Guest User

BlockBreak

a guest
Nov 14th, 2015
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package com.JLDev.listeners;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Material;
  5. import org.bukkit.Sound;
  6. import org.bukkit.event.Listener;
  7. import org.bukkit.event.block.BlockBreakEvent;
  8.  
  9. import com.JLDev.main.Main;
  10.  
  11. public class BlockBreak implements Listener{
  12. @SuppressWarnings("unused")
  13. private Main main;
  14. public BlockBreak(Main main){
  15. this.main = main;
  16. }
  17. public void onBlockBreak(BlockBreakEvent e){
  18. if(!e.getPlayer().hasPermission("can.break.block")){
  19. if(e.getBlock().getType() != Material.FIRE){
  20. if(e.getBlock().getType() != Material.GRASS){
  21. e.setCancelled(true);
  22. e.getPlayer().sendMessage(Main.prefix + ChatColor.DARK_RED + "You do not have permission to break blocks!");
  23. e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.WOLF_BARK, 2, 2);
  24.  
  25. }
  26. }
  27.  
  28. }
  29. }
  30.  
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement