Advertisement
Guest User

InfiniteCauldron

a guest
Feb 2nd, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. package me.nosma_stew.thewalkingdead;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.event.EventHandler;
  5. import org.bukkit.event.Listener;
  6. import org.bukkit.event.block.Action;
  7. import org.bukkit.event.player.PlayerInteractEvent;
  8. import org.bukkit.material.Cauldron;
  9.  
  10. public class InfiniteCauldron implements Listener
  11. {
  12. Main plugin;
  13. public InfiniteCauldron(Main plugin)
  14. {
  15. this.plugin = plugin;
  16.  
  17. }
  18.  
  19. @SuppressWarnings("deprecation")
  20. @EventHandler
  21. public void onCauldron(PlayerInteractEvent e)
  22. {
  23. if(e.getPlayer().getItemInHand() != null)
  24. {
  25. if (e.getPlayer().getItemInHand().getType() == Material.GLASS_BOTTLE || e.getPlayer().getItemInHand().getType() == Material.BUCKET)
  26. {
  27.  
  28. if(e.getAction() == Action.RIGHT_CLICK_BLOCK)
  29. {
  30. if (e.getClickedBlock().getType()== Material.CAULDRON)
  31. {
  32. Cauldron cauldron = (Cauldron) e.getClickedBlock().getState().getData();
  33. if (!cauldron.isFull())
  34. {
  35. cauldron.setData((byte) 3);
  36. }
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement