Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. package net.ikillforfun.dghc.listeners;
  2.  
  3. import org.bukkit.event.block.*;
  4. import net.ikillforfun.dghc.utils.*;
  5. import org.bukkit.entity.*;
  6. import org.bukkit.block.*;
  7. import org.bukkit.*;
  8. import org.bukkit.event.*;
  9.  
  10. public class BoyListener implements Listener {
  11. @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  12. public void BlockPlace(final BlockPlaceEvent e) {
  13. if (e.isCancelled()) {
  14. return;
  15. }
  16. final Player p = e.getPlayer();
  17. final Block u = e.getBlock().getLocation().add(0.0, 1.0, 0.0)
  18. .getBlock();
  19. if (p.getItemInHand() == null || !p.getItemInHand().hasItemMeta()) {
  20. return;
  21. }
  22. final Block b = e.getBlock();
  23. if (p.getItemInHand().getItemMeta().getDisplayName()
  24. .equalsIgnoreCase(ChatUtil.fixColor("&5&lBOYFARMER"))) {
  25. final Location loc = e.getBlockPlaced().getLocation();
  26. for (int i = 0; i < 100
  27. && !loc.getBlock().getType()
  28. .equals((Object) Material.BEDROCK); ++i) {
  29. if (loc.getBlock().getType()
  30. .equals((Object) Material.DRAGON_EGG)) {
  31. break;
  32. }
  33. loc.getBlock().setType(Material.OBSIDIAN);
  34. loc.subtract(0.0, 1.0, 0.0);
  35. }
  36. }
  37. if (p.getItemInHand().getItemMeta().getDisplayName()
  38. .equalsIgnoreCase(ChatUtil.fixColor("&6&lSANDFARMER"))) {
  39. final Location loc = e.getBlockPlaced().getLocation();
  40. for (int i = 0; i < 100
  41. && !loc.getBlock().getType()
  42. .equals((Object) Material.BEDROCK); ++i) {
  43. if (loc.getBlock().getType()
  44. .equals((Object) Material.DRAGON_EGG)) {
  45. break;
  46. }
  47. loc.getBlock().setType(Material.SAND);
  48. loc.subtract(0.0, 1.0, 0.0);
  49. }
  50. }
  51. if (p.getItemInHand().getItemMeta().getDisplayName()
  52. .equalsIgnoreCase(ChatUtil.fixColor("&7&lKOPACZ FOSY"))) {
  53. final Location loc = e.getBlockPlaced().getLocation();
  54. for (int i = 0; i < 100
  55. && !loc.getBlock().getType()
  56. .equals((Object) Material.BEDROCK); ++i) {
  57. if (loc.getBlock().getType()
  58. .equals((Object) Material.DRAGON_EGG)) {
  59. break;
  60. }
  61. loc.getBlock().setType(Material.AIR);
  62. loc.subtract(0.0, 1.0, 0.0);
  63. }
  64. }
  65. e.getPlayer().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 20);
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement