Advertisement
Guest User

help ben

a guest
Aug 29th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.51 KB | None | 0 0
  1. /* */ package me.flobgaming.BardBuffs;
  2. /* */
  3. /* */ import com.massivecraft.factions.FPlayer;
  4. /* */ import com.massivecraft.factions.FPlayers;
  5. /* */ import com.massivecraft.factions.Faction;
  6. /* */ import java.util.Collection;
  7. /* */ import java.util.HashMap;
  8. /* */ import java.util.Iterator;
  9. /* */ import org.bukkit.Bukkit;
  10. /* */ import org.bukkit.ChatColor;
  11. /* */ import org.bukkit.Location;
  12. /* */ import org.bukkit.Material;
  13. /* */ import org.bukkit.Server;
  14. /* */ import org.bukkit.entity.Player;
  15. /* */ import org.bukkit.event.EventHandler;
  16. /* */ import org.bukkit.event.Listener;
  17. /* */ import org.bukkit.event.player.PlayerInteractEvent;
  18. /* */ import org.bukkit.event.player.PlayerQuitEvent;
  19. /* */ import org.bukkit.inventory.ItemStack;
  20. /* */ import org.bukkit.inventory.PlayerInventory;
  21. /* */ import org.bukkit.plugin.PluginManager;
  22. /* */ import org.bukkit.plugin.java.JavaPlugin;
  23. /* */ import org.bukkit.potion.PotionEffect;
  24. /* */ import org.bukkit.potion.PotionEffectType;
  25. /* */ import org.bukkit.scheduler.BukkitRunnable;
  26. /* */
  27. /* */ public class Main extends JavaPlugin
  28. /* */ implements Listener
  29. /* */ {
  30. /* 29 */ private HashMap<String, Integer> factionCdWheat = new HashMap();
  31. /* 30 */ private HashMap<String, Integer> factionCdSpider = new HashMap();
  32. /* 31 */ private HashMap<String, Integer> factionCdSugar = new HashMap();
  33. /* 32 */ private HashMap<String, Integer> factionCdBlaze = new HashMap();
  34. /* 33 */ private HashMap<String, Integer> factionCdFeather = new HashMap();
  35. /* 34 */ private HashMap<String, Integer> factionCdIron = new HashMap();
  36. /* 35 */ private HashMap<String, Integer> factionCdGhast = new HashMap();
  37. /* 36 */ private HashMap<String, Integer> factionCdMagma = new HashMap();
  38. /* 37 */ private HashMap<String, Integer> factionCdSugar2 = new HashMap();
  39. /* 38 */ private HashMap<String, Integer> factionCdFeather2 = new HashMap();
  40. /* 39 */ private HashMap<String, String> playerFaction = new HashMap();
  41. /* 40 */ private HashMap<String, String> speedTimer = new HashMap();
  42. /* */
  43. /* */ public void onEnable()
  44. /* */ {
  45. /* 44 */ getServer().getPluginManager().registerEvents(this, this);
  46. /* */
  47. /* 46 */ new BukkitRunnable()
  48. /* */ {
  49. /* */ public void run()
  50. /* */ {
  51. /* */ Player[] arrayOfPlayer;
  52. /* 51 */ int j = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  53. /* 52 */ for (int i = 0; i < j; i++)
  54. /* */ {
  55. /* 54 */ Player pl = arrayOfPlayer[i];
  56. /* 55 */ FPlayer player = FPlayers.getInstance().getByPlayer(pl);
  57. /* 56 */ Faction pF = player.getFaction();
  58. /* 57 */ Main.this.playerFaction.put(pl.getName(), pF.getTag());
  59. /* */ }
  60. /* */ }
  61. /* */ }
  62. /* 60 */ .runTaskTimer(this, 20L, 20L);
  63. /* */ }
  64. /* */
  65. /* */ public void onDisable() {
  66. /* */ }
  67. /* */
  68. /* */ public void startCooldown(final String player, Integer time, final HashMap<String, Integer> map) {
  69. /* 67 */ map.put(player, time);
  70. /* */
  71. /* 69 */ new BukkitRunnable()
  72. /* */ {
  73. /* */ public void run()
  74. /* */ {
  75. /* 73 */ if (map.containsKey(player))
  76. /* */ {
  77. /* 75 */ if (((Integer)map.get(player)).intValue() - 1 != 0)
  78. /* */ {
  79. /* 77 */ map.put(player, Integer.valueOf(((Integer)map.get(player)).intValue() - 1));
  80. /* */ }
  81. /* */ else
  82. /* */ {
  83. /* 81 */ map.remove(player);
  84. /* 82 */ cancel();
  85. /* */ }
  86. /* */ }
  87. /* */ else
  88. /* 86 */ cancel();
  89. /* */ }
  90. /* */ }
  91. /* 89 */ .runTaskTimer(this, 20L, 20L);
  92. /* */ }
  93. /* */
  94. /* */ @EventHandler
  95. /* */ public void onPlayerQuit(PlayerQuitEvent evt)
  96. /* */ {
  97. /* 95 */ this.playerFaction.remove(evt.getPlayer().getName());
  98. /* */ }
  99. /* */
  100. /* */ @EventHandler
  101. /* */ public void onInteract(PlayerInteractEvent evt)
  102. /* */ {
  103. /* 101 */ final Player player = evt.getPlayer();
  104. /* 102 */ if (this.playerFaction.containsKey(player.getName()))
  105. /* */ {
  106. /* 104 */ String playerfaction = (String)this.playerFaction.get(player.getName());
  107. /* 105 */ if ((evt.getItem() != null) && (player.getInventory().getHelmet() != null) && (player.getInventory().getChestplate() != null) && (player.getInventory().getLeggings() != null) && (player.getInventory().getBoots() != null))
  108. /* */ {
  109. /* */ PotionEffect pe;
  110. /* 110 */ if ((player.getInventory().getHelmet().getType().equals(Material.GOLD_HELMET)) && (player.getInventory().getChestplate().getType().equals(Material.GOLD_CHESTPLATE)) && (player.getInventory().getLeggings().getType().equals(Material.GOLD_LEGGINGS)) && (player.getInventory().getBoots().getType().equals(Material.GOLD_BOOTS)))
  111. /* */ {
  112. /* 113 */ if (evt.getItem().getType().equals(Material.WHEAT))
  113. /* */ {
  114. /* 115 */ if (this.factionCdWheat.containsKey(playerfaction))
  115. /* */ {
  116. /* 117 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdWheat.get(playerfaction) + " more seconds.");
  117. /* 118 */ evt.setCancelled(true);
  118. /* */ }
  119. /* */ else
  120. /* */ {
  121. /* */ Player[] arrayOfPlayer;
  122. /* 122 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  123. /* 123 */ for (int i = 0; i < m; i++)
  124. /* */ {
  125. /* 125 */ Player pl = arrayOfPlayer[i];
  126. /* 126 */ if ((player.getName() != pl.getName()) &&
  127. /* 127 */ (this.playerFaction.containsKey(pl.getName())) &&
  128. /* 128 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  129. /* 129 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  130. /* */ {
  131. /* 131 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 200, 2));
  132. /* 132 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used wheat to give you the saturation effect.");
  133. /* */ }
  134. /* */ }
  135. /* 135 */ player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 200, 2));
  136. /* 136 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You successfully gave your faction members saturation.");
  137. /* 137 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  138. /* 138 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  139. /* */ else {
  140. /* 140 */ player.getInventory().remove(player.getInventory().getItemInHand());
  141. /* */ }
  142. /* 142 */ player.updateInventory();
  143. /* 143 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdWheat);
  144. /* */ }
  145. /* 145 */ evt.setCancelled(true);
  146. /* 146 */ return;
  147. /* */ }
  148. /* 148 */ if (evt.getItem().getType().equals(Material.SPIDER_EYE))
  149. /* */ {
  150. /* 150 */ if (this.factionCdSpider.containsKey(playerfaction))
  151. /* */ {
  152. /* 152 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdSpider.get(playerfaction) + " more seconds.");
  153. /* 153 */ evt.setCancelled(true);
  154. /* */ }
  155. /* */ else
  156. /* */ {
  157. /* */ Player[] arrayOfPlayer;
  158. /* 157 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  159. /* 158 */ for (int i = 0; i < m; i++)
  160. /* */ {
  161. /* 160 */ Player pl = arrayOfPlayer[i];
  162. /* 161 */ if ((player.getName() != pl.getName()) &&
  163. /* 162 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  164. /* */ {
  165. /* 164 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 200, 2));
  166. /* 165 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used a spider eye to give you the wither effect.");
  167. /* */ }
  168. /* */ }
  169. /* 168 */ player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 200, 2));
  170. /* 169 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You successfully withered everybody within 15 blocks of you.");
  171. /* 170 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  172. /* 171 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  173. /* */ else {
  174. /* 173 */ player.getInventory().remove(player.getInventory().getItemInHand());
  175. /* */ }
  176. /* 175 */ player.updateInventory();
  177. /* 176 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdSpider);
  178. /* */ }
  179. /* 178 */ evt.setCancelled(true);
  180. /* 179 */ return;
  181. /* */ }
  182. /* 181 */ if (evt.getItem().getType().equals(Material.SUGAR))
  183. /* */ {
  184. /* 183 */ if (this.factionCdSugar.containsKey(playerfaction))
  185. /* */ {
  186. /* 185 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdSugar.get(playerfaction) + " more seconds.");
  187. /* 186 */ evt.setCancelled(true);
  188. /* */ }
  189. /* */ else
  190. /* */ {
  191. /* */ Player[] arrayOfPlayer;
  192. /* 190 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  193. /* 191 */ for (int i = 0; i < m; i++)
  194. /* */ {
  195. /* 193 */ final Player pl = arrayOfPlayer[i];
  196. /* 194 */ if ((player.getName() != pl.getName()) &&
  197. /* 195 */ (this.playerFaction.containsKey(pl.getName())) &&
  198. /* 196 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  199. /* 197 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  200. /* */ {
  201. /* 199 */ if (pl.hasPotionEffect(PotionEffectType.SPEED)) {
  202. /* 200 */ for (Iterator localIterator = pl.getActivePotionEffects().iterator(); localIterator.hasNext(); ) { pe = (PotionEffect)localIterator.next();
  203. /* 201 */ if (pe.getType().equals(PotionEffectType.SPEED))
  204. /* */ {
  205. /* 203 */ this.speedTimer.put(pl.getName(), pe.getDuration() / 20 + ":" + pe.getAmplifier());
  206. /* 204 */ pl.removePotionEffect(PotionEffectType.SPEED);
  207. /* 205 */ new BukkitRunnable()
  208. /* */ {
  209. /* */ public void run()
  210. /* */ {
  211. /* 209 */ String[] splitter = ((String)Main.this.speedTimer.get(pl.getName())).split(":");
  212. /* 210 */ int duration = Integer.parseInt(splitter[0]);
  213. /* 211 */ int amplifier = Integer.parseInt(splitter[1]);
  214. /* 212 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, duration * 20, amplifier));
  215. /* 213 */ Main.this.speedTimer.remove(pl.getName());
  216. /* */ }
  217. /* */ }
  218. /* 215 */ .runTaskLater(this, 220L);
  219. /* */ }
  220. /* */ }
  221. /* */ }
  222. /* 219 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 2));
  223. /* 220 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used sugar to give you the speed effect.");
  224. /* */ }
  225. /* */ }
  226. /* 223 */ if (player.hasPotionEffect(PotionEffectType.SPEED)) {
  227. /* 224 */ for (PotionEffect pe : player.getActivePotionEffects()) {
  228. /* 225 */ if (pe.getType().equals(PotionEffectType.SPEED))
  229. /* */ {
  230. /* 227 */ this.speedTimer.put(player.getName(), pe.getDuration() / 20 + ":" + pe.getAmplifier());
  231. /* 228 */ player.removePotionEffect(PotionEffectType.SPEED);
  232. /* 229 */ new BukkitRunnable()
  233. /* */ {
  234. /* */ public void run()
  235. /* */ {
  236. /* 233 */ String[] splitter = ((String)Main.this.speedTimer.get(player.getName())).split(":");
  237. /* 234 */ int duration = Integer.parseInt(splitter[0]);
  238. /* 235 */ int amplifier = Integer.parseInt(splitter[1]);
  239. /* 236 */ player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, duration * 20, amplifier));
  240. /* 237 */ Main.this.speedTimer.remove(player.getName());
  241. /* */ }
  242. /* */ }
  243. /* 239 */ .runTaskLater(this, 220L);
  244. /* */ }
  245. /* */ }
  246. /* */ }
  247. /* 243 */ player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 2));
  248. /* 244 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You successfully gave your faction members speed.");
  249. /* 245 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  250. /* 246 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  251. /* */ else {
  252. /* 248 */ player.getInventory().remove(player.getInventory().getItemInHand());
  253. /* */ }
  254. /* 250 */ player.updateInventory();
  255. /* 251 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdSugar);
  256. /* */ }
  257. /* 253 */ evt.setCancelled(true);
  258. /* 254 */ return;
  259. /* */ }
  260. /* 256 */ if (evt.getItem().getType().equals(Material.BLAZE_POWDER))
  261. /* */ {
  262. /* 258 */ if (this.factionCdBlaze.containsKey(playerfaction))
  263. /* */ {
  264. /* 260 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdBlaze.get(playerfaction) + " more seconds.");
  265. /* 261 */ evt.setCancelled(true);
  266. /* */ }
  267. /* */ else
  268. /* */ {
  269. /* */ Player[] arrayOfPlayer;
  270. /* 265 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  271. /* 266 */ for (int j = 0; j < m; j++)
  272. /* */ {
  273. /* 268 */ Player pl = arrayOfPlayer[j];
  274. /* 269 */ if ((player.getName() != pl.getName()) &&
  275. /* 270 */ (this.playerFaction.containsKey(pl.getName())) &&
  276. /* 271 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  277. /* 272 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  278. /* */ {
  279. /* 274 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 0));
  280. /* 275 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used blaze powder to give you the strength effect.");
  281. /* */ }
  282. /* */ }
  283. /* 278 */ player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 0));
  284. /* 279 */ player.sendMessage(ChatColor.DARK_GREEN + "You gave your faction members strength.");
  285. /* 280 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  286. /* 281 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  287. /* */ else {
  288. /* 283 */ player.getInventory().remove(player.getInventory().getItemInHand());
  289. /* */ }
  290. /* 285 */ player.updateInventory();
  291. /* 286 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdBlaze);
  292. /* */ }
  293. /* 288 */ evt.setCancelled(true);
  294. /* 289 */ return;
  295. /* */ }
  296. /* 291 */ if (evt.getItem().getType().equals(Material.FEATHER))
  297. /* */ {
  298. /* 293 */ if (this.factionCdFeather.containsKey(playerfaction))
  299. /* */ {
  300. /* 295 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdFeather.get(playerfaction) + " more seconds.");
  301. /* 296 */ evt.setCancelled(true);
  302. /* */ }
  303. /* */ else
  304. /* */ {
  305. /* */ Player[] arrayOfPlayer;
  306. /* 300 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  307. /* 301 */ for (int j = 0; j < m; j++)
  308. /* */ {
  309. /* 303 */ Player pl = arrayOfPlayer[j];
  310. /* 304 */ if ((player.getName() != pl.getName()) &&
  311. /* 305 */ (this.playerFaction.containsKey(pl.getName())) &&
  312. /* 306 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  313. /* 307 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  314. /* */ {
  315. /* 309 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 200, 1));
  316. /* 310 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used a feather to give you the jump effect.");
  317. /* */ }
  318. /* */ }
  319. /* 313 */ player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 200, 1));
  320. /* 314 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You successfully gave your faction members jump.");
  321. /* 315 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  322. /* 316 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  323. /* */ else {
  324. /* 318 */ player.getInventory().remove(player.getInventory().getItemInHand());
  325. /* */ }
  326. /* 320 */ player.updateInventory();
  327. /* 321 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdFeather);
  328. /* */ }
  329. /* 323 */ evt.setCancelled(true);
  330. /* 324 */ return;
  331. /* */ }
  332. /* 326 */ if (evt.getItem().getType().equals(Material.IRON_INGOT))
  333. /* */ {
  334. /* 328 */ if (this.factionCdIron.containsKey(playerfaction))
  335. /* */ {
  336. /* 330 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdIron.get(playerfaction) + " more seconds.");
  337. /* 331 */ evt.setCancelled(true);
  338. /* */ }
  339. /* */ else
  340. /* */ {
  341. /* */ Player[] arrayOfPlayer;
  342. /* 335 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  343. /* 336 */ for (int j = 0; j < m; j++)
  344. /* */ {
  345. /* 338 */ Player pl = arrayOfPlayer[j];
  346. /* 339 */ if ((player.getName() != pl.getName()) &&
  347. /* 340 */ (this.playerFaction.containsKey(pl.getName())) &&
  348. /* 341 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  349. /* 342 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  350. /* */ {
  351. /* 344 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 1));
  352. /* 345 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used a iron ingot to give you the resistance effect.");
  353. /* */ }
  354. /* */ }
  355. /* 348 */ player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 1));
  356. /* 349 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You successfully gave your faction members resistance.");
  357. /* 350 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  358. /* 351 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  359. /* */ else {
  360. /* 353 */ player.getInventory().remove(player.getInventory().getItemInHand());
  361. /* */ }
  362. /* 355 */ player.updateInventory();
  363. /* 356 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdIron);
  364. /* */ }
  365. /* 358 */ evt.setCancelled(true);
  366. /* 359 */ return;
  367. /* */ }
  368. /* 361 */ if (evt.getItem().getType().equals(Material.GHAST_TEAR))
  369. /* */ {
  370. /* 363 */ if (this.factionCdGhast.containsKey(playerfaction))
  371. /* */ {
  372. /* 365 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdGhast.get(playerfaction) + " more seconds.");
  373. /* 366 */ evt.setCancelled(true);
  374. /* */ }
  375. /* */ else
  376. /* */ {
  377. /* */ Player[] arrayOfPlayer;
  378. /* 370 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  379. /* 371 */ for (int j = 0; j < m; j++)
  380. /* */ {
  381. /* 373 */ Player pl = arrayOfPlayer[j];
  382. /* 374 */ if ((player.getName() != pl.getName()) &&
  383. /* 375 */ (this.playerFaction.containsKey(pl.getName())) &&
  384. /* 376 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  385. /* 377 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  386. /* */ {
  387. /* 379 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 1));
  388. /* 380 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used a ghast tear to give you the regeneration effect.");
  389. /* */ }
  390. /* */ }
  391. /* 383 */ player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 1));
  392. /* 384 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You gave your faction members regeneration.");
  393. /* 385 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  394. /* 386 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  395. /* */ else {
  396. /* 388 */ player.getInventory().remove(player.getInventory().getItemInHand());
  397. /* */ }
  398. /* 390 */ player.updateInventory();
  399. /* 391 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdGhast);
  400. /* */ }
  401. /* 393 */ evt.setCancelled(true);
  402. /* 394 */ return;
  403. /* */ }
  404. /* 396 */ if (evt.getItem().getType().equals(Material.MAGMA_CREAM))
  405. /* */ {
  406. /* 398 */ if (this.factionCdMagma.containsKey(playerfaction))
  407. /* */ {
  408. /* 400 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdMagma.get(playerfaction) + " more seconds.");
  409. /* 401 */ evt.setCancelled(true);
  410. /* */ }
  411. /* */ else
  412. /* */ {
  413. /* */ Player[] arrayOfPlayer;
  414. /* 405 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  415. /* 406 */ for (int j = 0; j < m; j++)
  416. /* */ {
  417. /* 408 */ Player pl = arrayOfPlayer[j];
  418. /* 409 */ if ((player.getName() != pl.getName()) &&
  419. /* 410 */ (this.playerFaction.containsKey(pl.getName())) &&
  420. /* 411 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  421. /* 412 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  422. /* */ {
  423. /* 414 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 0));
  424. /* 415 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used some magma cream to give you the fire resistance effect.");
  425. /* */ }
  426. /* */ }
  427. /* 418 */ player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 0));
  428. /* 419 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You successfully gave your faction members fire resistance.");
  429. /* 420 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  430. /* 421 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  431. /* */ else {
  432. /* 423 */ player.getInventory().remove(player.getInventory().getItemInHand());
  433. /* */ }
  434. /* 425 */ player.updateInventory();
  435. /* 426 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdMagma);
  436. /* */ }
  437. /* 428 */ evt.setCancelled(true);
  438. /* */ }
  439. /* */ }
  440. /* 431 */ else if ((player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) && (player.getInventory().getChestplate().getType().equals(Material.LEATHER_CHESTPLATE)) &&
  441. /* 432 */ (player.getInventory().getLeggings().getType().equals(Material.LEATHER_LEGGINGS)) && (player.getInventory().getBoots().getType().equals(Material.LEATHER_BOOTS)))
  442. /* */ {
  443. /* 434 */ if (evt.getItem().getType().equals(Material.SUGAR))
  444. /* */ {
  445. /* 436 */ if (this.factionCdSugar2.containsKey(playerfaction))
  446. /* */ {
  447. /* 438 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdSugar2.get(playerfaction) + " more seconds.");
  448. /* 439 */ evt.setCancelled(true);
  449. /* */ }
  450. /* */ else
  451. /* */ {
  452. /* */ Player[] arrayOfPlayer;
  453. /* 443 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  454. /* */ PotionEffect pe;
  455. /* 444 */ for (int j = 0; j < m; j++)
  456. /* */ {
  457. /* 446 */ final Player pl = arrayOfPlayer[j];
  458. /* 447 */ if ((player.getName() != pl.getName()) &&
  459. /* 448 */ (this.playerFaction.containsKey(pl.getName())) &&
  460. /* 449 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  461. /* 450 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  462. /* */ {
  463. /* 452 */ if (pl.hasPotionEffect(PotionEffectType.SPEED)) {
  464. /* 453 */ for (pe = pl.getActivePotionEffects().iterator(); pe.hasNext(); ) { pe = (PotionEffect)pe.next();
  465. /* 454 */ if (pe.getType().equals(PotionEffectType.SPEED))
  466. /* */ {
  467. /* 456 */ this.speedTimer.put(pl.getName(), pe.getDuration() / 20 + ":" + pe.getAmplifier());
  468. /* 457 */ pl.removePotionEffect(PotionEffectType.SPEED);
  469. /* 458 */ new BukkitRunnable()
  470. /* */ {
  471. /* */ public void run()
  472. /* */ {
  473. /* 462 */ String[] splitter = ((String)Main.this.speedTimer.get(pl.getName())).split(":");
  474. /* 463 */ int duration = Integer.parseInt(splitter[0]);
  475. /* 464 */ int amplifier = Integer.parseInt(splitter[1]);
  476. /* 465 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, duration * 20, amplifier));
  477. /* 466 */ Main.this.speedTimer.remove(pl.getName());
  478. /* */ }
  479. /* */ }
  480. /* 468 */ .runTaskLater(this, 220L);
  481. /* */ }
  482. /* */ }
  483. /* */ }
  484. /* 472 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 3));
  485. /* 473 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used sugar to give you the speed effect.");
  486. /* */ }
  487. /* */ }
  488. /* 476 */ if (player.hasPotionEffect(PotionEffectType.SPEED)) {
  489. /* 477 */ for (PotionEffect pe : player.getActivePotionEffects()) {
  490. /* 478 */ if (pe.getType().equals(PotionEffectType.SPEED))
  491. /* */ {
  492. /* 480 */ this.speedTimer.put(player.getName(), pe.getDuration() / 20 + ":" + pe.getAmplifier());
  493. /* 481 */ player.removePotionEffect(PotionEffectType.SPEED);
  494. /* 482 */ new BukkitRunnable()
  495. /* */ {
  496. /* */ public void run()
  497. /* */ {
  498. /* 486 */ String[] splitter = ((String)Main.this.speedTimer.get(player.getName())).split(":");
  499. /* 487 */ int duration = Integer.parseInt(splitter[0]);
  500. /* 488 */ int amplifier = Integer.parseInt(splitter[1]);
  501. /* 489 */ player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, duration * 20, amplifier));
  502. /* 490 */ Main.this.speedTimer.remove(player.getName());
  503. /* */ }
  504. /* */ }
  505. /* 492 */ .runTaskLater(this, 220L);
  506. /* */ }
  507. /* */ }
  508. /* */ }
  509. /* 496 */ player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 3));
  510. /* 497 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You successfully gave yourself the speed effect.");
  511. /* 498 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  512. /* 499 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  513. /* */ else {
  514. /* 501 */ player.getInventory().remove(player.getInventory().getItemInHand());
  515. /* */ }
  516. /* 503 */ player.updateInventory();
  517. /* 504 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdSugar2);
  518. /* */ }
  519. /* 506 */ evt.setCancelled(true);
  520. /* 507 */ return;
  521. /* */ }
  522. /* 509 */ if (evt.getItem().getType().equals(Material.FEATHER))
  523. /* */ {
  524. /* 511 */ if (this.factionCdFeather2.containsKey(playerfaction))
  525. /* */ {
  526. /* 513 */ player.sendMessage(ChatColor.RED + "ERROR: You are still in a cooldown for " + this.factionCdFeather2.get(playerfaction) + " more seconds.");
  527. /* 514 */ evt.setCancelled(true);
  528. /* */ }
  529. /* */ else
  530. /* */ {
  531. /* */ Player[] arrayOfPlayer;
  532. /* 518 */ int m = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  533. /* 519 */ for (int k = 0; k < m; k++)
  534. /* */ {
  535. /* 521 */ Player pl = arrayOfPlayer[k];
  536. /* 522 */ if ((player.getName() != pl.getName()) &&
  537. /* 523 */ (this.playerFaction.containsKey(pl.getName())) &&
  538. /* 524 */ (((String)this.playerFaction.get(pl.getName())).equalsIgnoreCase(playerfaction)) &&
  539. /* 525 */ (pl.getLocation().distance(player.getLocation()) <= 15.0D))
  540. /* */ {
  541. /* 527 */ pl.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 200, 1));
  542. /* 528 */ pl.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW + player.getName() + ChatColor.DARK_GREEN + " used a feather to give you the jump effect.");
  543. /* */ }
  544. /* */ }
  545. /* 531 */ player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 200, 1));
  546. /* 532 */ player.sendMessage(ChatColor.DARK_GREEN + "[" + ChatColor.YELLOW + "BardBuff" + ChatColor.DARK_GREEN + "] " + ChatColor.DARK_GREEN + "You successfully gave yourself the jump effect.");
  547. /* 533 */ if (player.getInventory().getItemInHand().getAmount() != 1)
  548. /* 534 */ player.getInventory().getItemInHand().setAmount(player.getInventory().getItemInHand().getAmount() - 1);
  549. /* */ else {
  550. /* 536 */ player.getInventory().remove(player.getInventory().getItemInHand());
  551. /* */ }
  552. /* 538 */ player.updateInventory();
  553. /* 539 */ startCooldown(playerfaction, Integer.valueOf(20), this.factionCdFeather2);
  554. /* */ }
  555. /* 541 */ evt.setCancelled(true);
  556. /* 542 */ return;
  557. /* */ }
  558. /* */ }
  559. /* */ }
  560. /* */ }
  561. /* */ }
  562. /* */ }
  563.  
  564. /* Location: /Users/jasontalkst3ch/Desktop/current/Bard.jar
  565. * Qualified Name: me.flobgaming.BardBuffs.Main
  566. * JD-Core Version: 0.6.2
  567. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement