Advertisement
DSHunterMC

Untitled

Nov 26th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 KB | None | 0 0
  1. package Events;
  2.  
  3.  
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.GameMode;
  6. import org.bukkit.Material;
  7. import org.bukkit.Sound;
  8. import org.bukkit.WeatherType;
  9. import org.bukkit.World;
  10. import org.bukkit.block.Block;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.event.EventHandler;
  13. import org.bukkit.event.Listener;
  14. import org.bukkit.event.block.Action;
  15. import org.bukkit.event.block.BlockPlaceEvent;
  16. import org.bukkit.event.player.PlayerInteractEvent;
  17. import org.bukkit.event.player.PlayerJoinEvent;
  18. import org.bukkit.potion.PotionEffect;
  19. import org.bukkit.potion.PotionEffectType;
  20.  
  21. public class EventsClass implements Listener {
  22.  
  23. @EventHandler
  24. public void onJoin (PlayerJoinEvent e) {
  25. Player p = e.getPlayer();
  26.  
  27. if(p.hasPlayedBefore()) {
  28. e.setJoinMessage(ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Hexigon" +
  29. ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "HF" + ChatColor.AQUA + ">>" +
  30. ChatColor.GRAY + "" + ChatColor.BOLD + " Welcome back " + ChatColor.LIGHT_PURPLE + ChatColor.BOLD +
  31. e.getPlayer().getName() + ChatColor.GRAY + "" + ChatColor.BOLD + " to" + ChatColor.DARK_PURPLE + ChatColor.BOLD + " Hexigon" + ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "HF!");
  32. }else {
  33. e.setJoinMessage(ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Hexigon" +
  34. ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "HF" + ChatColor.AQUA + ">>" +
  35. ChatColor.GREEN + "" + ChatColor.BOLD + " Welcome " + ChatColor.DARK_GREEN +
  36. "" + ChatColor.BOLD + e.getPlayer().getName() + ChatColor.GREEN + "" + ChatColor.BOLD + " to" +ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + " Hexigon" + ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "HF");
  37.  
  38. }
  39. }
  40.  
  41. @EventHandler
  42. public void onInteract(PlayerInteractEvent e) {
  43. Action a = e.getAction();
  44. Player p = (Player) e.getPlayer();
  45. Block b = e.getClickedBlock();
  46.  
  47. if(a.equals(Action.LEFT_CLICK_BLOCK)) {
  48.  
  49. if(b.getType().equals(Material.BEACON)) {
  50. if(p.hasPermission("hhf.block.day")) {
  51. if(p.getGameMode().equals(GameMode.SURVIVAL)) {
  52. p.setPlayerTime(1000, false);
  53. p.sendMessage(ChatColor.GREEN + "Your time has been set to" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD + " Day!");
  54.  
  55. }
  56. }
  57. }
  58. }
  59.  
  60. if(a.equals(Action.RIGHT_CLICK_BLOCK)) {
  61.  
  62.  
  63. if(b.getType().equals(Material.REDSTONE_BLOCK)) {
  64. if(p.hasPermission("hhf.block.health-deduct")) {
  65. if(p.getGameMode().equals(GameMode.SURVIVAL)) {
  66. if(p.getHealth() != 0) {
  67. p.sendMessage(ChatColor.RED + "Your health has been" + ChatColor.RED + "" + ChatColor.BOLD + " Deducted!");
  68. p.setHealth(p.getHealth() - 1);
  69. p.playSound(p.getLocation(), Sound.BLOCK_CHORUS_FLOWER_DEATH, 1.0f, 1.0f);
  70. }
  71. }
  72. }
  73.  
  74. if(b.getType().equals(Material.PURPUR_BLOCK)) {
  75. if(p.hasPermission("hhf.block.weather-clear")) {
  76. if(p.getGameMode().equals(GameMode.SURVIVAL)) {
  77. p.sendMessage(ChatColor.GREEN + "Your weather has been" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD + " Cleared!");
  78. p.setPlayerWeather(WeatherType.CLEAR);
  79. p.playSound(p.getLocation(), Sound.ENTITY_ELDER_GUARDIAN_DEATH, 1.0f, 1.0f);
  80. }
  81. }
  82. }
  83.  
  84. if(b.getType().equals(Material.OBSIDIAN)) {
  85. if(p.hasPermission("hhf.block.night")) {
  86. if(p.getGameMode().equals(GameMode.SURVIVAL)) {
  87. p.setPlayerTime(13000, false);
  88. p.sendMessage(ChatColor.DARK_GRAY + "Your time has been set to" + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + " Night!");
  89.  
  90. }
  91. }
  92. }
  93.  
  94. if(b.getType().equals(Material.EMERALD_BLOCK)) {
  95. if(p.hasPermission("hhf.block.regen")) {
  96. if(p.getGameMode().equals(GameMode.SURVIVAL)) {
  97. if(p.getHealth() != 20);
  98. p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0));
  99. p.sendMessage(ChatColor.GREEN + "You have been given" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD + " Regeneration!");
  100. p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f);
  101.  
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108.  
  109. @EventHandler
  110. public void onPlace(BlockPlaceEvent e) {
  111. Block b = e.getBlock();
  112. Player p = e.getPlayer();
  113. World w = b.getWorld();
  114. if(b.getType().equals(Material.TNT)) {
  115. if(!p.isOp()) {
  116. if(p.hasPermission("hhf.tnt.stop")) {
  117. if(w.getName().equalsIgnoreCase("world")) {
  118. e.getBlockPlaced().setType(Material.BLAZE_POWDER);
  119. p.sendMessage(ChatColor.DARK_RED + "" + ChatColor.BOLD + "HHF" + ChatColor.RED + " - Griefing is not allowed in this world!");
  120. }
  121. }
  122. }
  123. }
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement