funkemunky

Untitled

Aug 6th, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 252.90 KB | None | 0 0
  1. package me.randomHashTags.RandomPackage.api;
  2.  
  3. import me.randomHashTags.RandomPackage.*;
  4. import org.bukkit.inventory.*;
  5. import org.bukkit.plugin.*;
  6. import java.io.*;
  7. import org.bukkit.event.server.*;
  8. import org.bukkit.command.*;
  9. import org.bukkit.configuration.file.*;
  10. import org.bukkit.enchantments.*;
  11. import org.bukkit.event.inventory.*;
  12. import java.math.*;
  13. import org.bukkit.potion.*;
  14. import java.util.*;
  15. import me.randomHashTags.RandomPackage.other.*;
  16. import me.randomHashTags.RandomPackage.versions.*;
  17. import org.bukkit.event.block.*;
  18. import org.bukkit.*;
  19. import org.bukkit.event.*;
  20. import org.bukkit.inventory.meta.*;
  21. import org.bukkit.util.*;
  22. import org.bukkit.event.player.*;
  23. import org.bukkit.event.entity.*;
  24. import org.bukkit.entity.*;
  25.  
  26. public class CustomEnchantments implements Listener
  27. {
  28. public boolean enabled;
  29. private static CustomEnchantments instance;
  30. private RandomPackage rp;
  31. private RandomPackageAPI api;
  32. private final String prefix;
  33. private Random random;
  34. private ItemStack item;
  35. private ItemMeta itemMeta;
  36. private String guardiansname;
  37. private String spiritsname;
  38. private String undeadrusename;
  39. private String configPrefix;
  40. private String SUCCESS;
  41. private String DESTROY;
  42. private String APPLY_TO_ITEM;
  43. private String WHITE_SCROLL_PROTECTED;
  44. private String ARMOR;
  45. private String HELMET;
  46. private String CHESTPLATE;
  47. private String LEGGINGS;
  48. private String BOOTS;
  49. private String TOOL;
  50. private String PICKAXE;
  51. private String AXE;
  52. private String SWORD;
  53. private String WEAPON;
  54. private String BOW;
  55. private String TRANSMOG;
  56. private String mcmmo;
  57. private boolean shootfireworks;
  58. private boolean alchemistAccept;
  59. private boolean tinkererAccept;
  60. private ItemStack[] items;
  61. private Inventory[] inventories;
  62. private String[] particlelist;
  63. private String[] particleloc;
  64. private FileConfiguration enchantments;
  65. private FileConfiguration enchantmentsInfo;
  66. private FileConfiguration messages;
  67. private FileConfiguration sounds;
  68. private FileConfiguration itemsConfig;
  69. private FileConfiguration particles;
  70. private FileConfiguration cemessages;
  71. private FactionsAPI fapi;
  72. private Plugin randompackage;
  73. private final String folder;
  74. private String[] enchantstrings;
  75. private Double[] doubles;
  76. private HashMap<String, String> enchants;
  77. private HashMap<Player, Double> marksman;
  78. private HashMap<Player, List<Player>> aegis;
  79. private HashMap<Player, ItemStack> commander;
  80. private HashMap<Player, ItemStack> protection;
  81. private HashMap<Player, ItemStack> implants;
  82. private HashMap<Player, ItemStack> teleblock;
  83. private ArrayList<ItemStack> bows;
  84. private ArrayList<UUID> soulmode;
  85. private ArrayList<UUID> dominate;
  86. private ArrayList<UUID> repairguard;
  87. private ArrayList<UUID> bowsp;
  88. private ArrayList<UUID> Teleblock;
  89. private ArrayList<UUID> phoenix;
  90. private ArrayList<UUID> divineimmolation;
  91. private ArrayList<Integer> dominatee;
  92. private List<String> addpotioneffect;
  93. private List<String> removepotioneffect;
  94. private List<String> applyinfo;
  95. private List<String> alchemistexchange;
  96. private List<String> alchemistclose;
  97. private List<String> tinkereraccept;
  98. private List<String> tinkerercancelled;
  99. private List<String> soulmodedeactivatedMoved;
  100. private List<String> soulmodedeactivatedDropped;
  101. private List<String> soulmodedeactivatedInteract;
  102. private List<String> soulmodedeactivatedRanOut;
  103. private List<String> soulmodeactivate;
  104. private List[] enchantmessages;
  105. public ArrayList<String> disabledenchantments;
  106. public ArrayList<String> detonate;
  107. public ArrayList<String> arrowdeflect;
  108. public ArrayList<String> unfocus;
  109. public ArrayList<String> lore;
  110. public HashMap<String, ArrayList<String>> customenchantments;
  111. public HashMap<String, ItemStack> revealitems;
  112. public HashMap<String, ItemStack> revealeditems;
  113. public HashMap<String, ItemStack> regulardust;
  114. public HashMap<String, ItemStack> primaldust;
  115. public HashMap<String, ItemStack> fireballs;
  116. private HashMap<String, String> revealeditemsfirework;
  117. private HashMap<String, String> applyformat;
  118. private HashMap<String, String> randomizationscrollappliesto;
  119. private HashMap<String, List<String>> revealitemsmessages;
  120. public HashMap<String, Integer> regulardustchance;
  121. public HashMap<String, Integer> primaldustchance;
  122. public ArrayList<String> allcustomenchantments;
  123. private ArrayList<ItemStack> soultrackers;
  124. private ArrayList<ItemStack> randomizationscrolls;
  125. private ArrayList<String> soultrackers_apply;
  126. private ArrayList<String> randomizationscrollrarities;
  127. public HashMap<String, Integer> enchantmaxlevel;
  128. private ArrayList<String> potioneffectEnchants;
  129. private ArrayList<List<String>> armorlore;
  130. private boolean doublestrike;
  131. private ArrayList<String> playerRage;
  132. private ArrayList<String> mobRage;
  133.  
  134. public CustomEnchantments() {
  135. this.enabled = false;
  136. this.rp = RandomPackage.getInstance();
  137. this.prefix = this.rp.prefix;
  138. this.random = new Random();
  139. this.item = new ItemStack(Material.APPLE);
  140. this.itemMeta = this.item.getItemMeta();
  141. this.mcmmo = null;
  142. this.shootfireworks = false;
  143. this.alchemistAccept = false;
  144. this.tinkererAccept = false;
  145. this.items = this.rp.items;
  146. this.inventories = this.rp.inventories;
  147. this.particlelist = this.rp.particles;
  148. this.particleloc = this.rp.particlesloc;
  149. this.fapi = FactionsAPI.getInstance();
  150. this.randompackage = RandomPackage.getPlugin;
  151. this.folder = "plugins" + File.separator + "RandomPackage" + File.separator + "Custom Enchantments" + File.separator;
  152. this.enchantstrings = new String[10000];
  153. this.doubles = new Double[10000];
  154. this.enchants = new HashMap<String, String>();
  155. this.marksman = new HashMap<Player, Double>();
  156. this.aegis = new HashMap<Player, List<Player>>();
  157. this.commander = new HashMap<Player, ItemStack>();
  158. this.protection = new HashMap<Player, ItemStack>();
  159. this.implants = new HashMap<Player, ItemStack>();
  160. this.teleblock = new HashMap<Player, ItemStack>();
  161. this.bows = new ArrayList<ItemStack>();
  162. this.soulmode = new ArrayList<UUID>();
  163. this.dominate = new ArrayList<UUID>();
  164. this.repairguard = new ArrayList<UUID>();
  165. this.bowsp = new ArrayList<UUID>();
  166. this.Teleblock = new ArrayList<UUID>();
  167. this.phoenix = new ArrayList<UUID>();
  168. this.divineimmolation = new ArrayList<UUID>();
  169. this.dominatee = new ArrayList<Integer>();
  170. this.enchantmessages = new List[1000];
  171. this.disabledenchantments = new ArrayList<String>();
  172. this.detonate = new ArrayList<String>();
  173. this.arrowdeflect = new ArrayList<String>();
  174. this.unfocus = new ArrayList<String>();
  175. this.lore = new ArrayList<String>();
  176. this.customenchantments = new HashMap<String, ArrayList<String>>();
  177. this.revealitems = new HashMap<String, ItemStack>();
  178. this.revealeditems = new HashMap<String, ItemStack>();
  179. this.regulardust = new HashMap<String, ItemStack>();
  180. this.primaldust = new HashMap<String, ItemStack>();
  181. this.fireballs = new HashMap<String, ItemStack>();
  182. this.revealeditemsfirework = new HashMap<String, String>();
  183. this.applyformat = new HashMap<String, String>();
  184. this.randomizationscrollappliesto = this.rp.randomizationscrollappliesto;
  185. this.revealitemsmessages = new HashMap<String, List<String>>();
  186. this.regulardustchance = new HashMap<String, Integer>();
  187. this.primaldustchance = new HashMap<String, Integer>();
  188. this.allcustomenchantments = new ArrayList<String>();
  189. this.soultrackers = this.rp.soultrackers;
  190. this.randomizationscrolls = this.rp.randomizationscrolls;
  191. this.soultrackers_apply = this.rp.soultrackers_apply;
  192. this.randomizationscrollrarities = this.rp.randomizationscrollrarities;
  193. this.enchantmaxlevel = new HashMap<String, Integer>();
  194. this.potioneffectEnchants = new ArrayList<String>();
  195. this.doublestrike = false;
  196. this.playerRage = new ArrayList<String>();
  197. this.mobRage = new ArrayList<String>();
  198. }
  199.  
  200. public static CustomEnchantments getInstance() {
  201. if (CustomEnchantments.instance == null) {
  202. CustomEnchantments.instance = new CustomEnchantments();
  203. }
  204. return CustomEnchantments.instance;
  205. }
  206.  
  207. private ItemStack setupItem(final FileConfiguration config, final String path) {
  208. String iitem = config.getString(String.valueOf(path) + ".item");
  209. if (iitem == null) {
  210. return null;
  211. }
  212. iitem = iitem.toLowerCase();
  213. if (Material.getMaterial(iitem.toUpperCase().split(":")[0]) == null) {
  214. return new ItemStack(Material.AIR);
  215. }
  216. int amount = 1;
  217. if (config.get(String.valueOf(path) + ".amount") != null) {
  218. amount = Integer.parseInt(config.getString(String.valueOf(path) + ".amount"));
  219. }
  220. int data = 0;
  221. if (config.getString(String.valueOf(path) + ".item").contains(":")) {
  222. data = Integer.parseInt(config.getString(String.valueOf(path) + ".item").split("\\:")[1]);
  223. }
  224. this.item = new ItemStack(Material.getMaterial(config.getString(String.valueOf(path) + ".item").toUpperCase().split(":")[0]), amount, (short)(byte)data);
  225. this.itemMeta = this.item.getItemMeta();
  226. this.lore.clear();
  227. if (config.get(String.valueOf(path) + ".name") != null) {
  228. this.itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(String.valueOf(path) + ".name")));
  229. }
  230. for (final String string : config.getStringList(String.valueOf(path) + ".lore")) {
  231. this.lore.add(ChatColor.translateAlternateColorCodes('&', string));
  232. }
  233. this.itemMeta.setLore((List)this.lore);
  234. this.lore.clear();
  235. this.item.setItemMeta(this.itemMeta);
  236. return this.item;
  237. }
  238.  
  239. @EventHandler
  240. private void pluginEnableEvent(final PluginEnableEvent event) {
  241. if (event.getPlugin().getName().equalsIgnoreCase("mcmmmo")) {
  242. this.mcmmo = "MCMMO";
  243. }
  244. else if (event.getPlugin() == RandomPackage.getPlugin) {
  245. this.api = RandomPackageAPI.getInstance();
  246. this.enabled = true;
  247. this.armorlore = CustomArmor.getInstance().armorlores;
  248. for (final World world : Bukkit.getServer().getWorlds()) {
  249. if (!world.getGameRuleValue("commandBlockOutput").equals("false")) {
  250. world.setGameRuleValue("commandBlockOutput", "false");
  251. }
  252. if (!world.getGameRuleValue("sendCommandFeedback").equals("false")) {
  253. world.setGameRuleValue("sendCommandFeedback", "false");
  254. }
  255. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "rg flag -w " + world.getName() + " __global__ pvp allow");
  256. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "rg flag -w " + world.getName() + " __global__ blockbreak allow");
  257. }
  258. this.cemessages = (FileConfiguration)YamlConfiguration.loadConfiguration(new File(String.valueOf(this.folder) + "messages.yml"));
  259. this.enchantmentsInfo = (FileConfiguration)YamlConfiguration.loadConfiguration(new File(String.valueOf(this.folder) + "info.yml"));
  260. this.enchantments = (FileConfiguration)YamlConfiguration.loadConfiguration(new File(String.valueOf(this.folder) + "enchantments.yml"));
  261. this.itemsConfig = (FileConfiguration)YamlConfiguration.loadConfiguration(new File(this.randompackage.getDataFolder() + File.separator + "items.yml"));
  262. this.messages = (FileConfiguration)YamlConfiguration.loadConfiguration(new File(this.randompackage.getDataFolder() + File.separator + "messages.yml"));
  263. this.particles = (FileConfiguration)YamlConfiguration.loadConfiguration(new File(this.randompackage.getDataFolder() + File.separator + "particles.yml"));
  264. this.sounds = (FileConfiguration)YamlConfiguration.loadConfiguration(new File(this.randompackage.getDataFolder() + File.separator + "sounds.yml"));
  265. String path = null;
  266. for (int i = 0; i <= 14; ++i) {
  267. if (i == 0) {
  268. path = "PlanetaryDeathbringer.multiplied-by";
  269. }
  270. else if (i == 1) {
  271. path = "Rage.multiplied-by";
  272. }
  273. else if (i == 2) {
  274. path = "Aegis.multiplied-by";
  275. }
  276. else if (i == 3) {
  277. path = "Assassin.close";
  278. }
  279. else if (i == 4) {
  280. path = "Assassin.close-damage";
  281. }
  282. else if (i == 5) {
  283. path = "Assassin.far-damage";
  284. }
  285. else if (i == 6) {
  286. path = "Dominate.multiplied-by";
  287. }
  288. else if (i == 7) {
  289. path = "Dominate.duration";
  290. }
  291. else if (i == 8) {
  292. path = "EagleEye.max";
  293. }
  294. else if (i == 9) {
  295. path = "IceFreeze.duration";
  296. }
  297. else if (i == 10) {
  298. path = "Curse.hp";
  299. }
  300. else if (i == 11) {
  301. path = "Leadership.radius";
  302. }
  303. else if (i == 12) {
  304. path = "Leadership.increased-damage";
  305. }
  306. else if (i == 13) {
  307. path = "DimensionRift.cobweb-chance";
  308. }
  309. else if (i == 14) {
  310. path = "DimensionRift.duration";
  311. }
  312. if (path != null && this.enchantments.get(path) != null) {
  313. this.doubles[i] = this.enchantments.getDouble(path);
  314. }
  315. }
  316. path = null;
  317. for (int i = 0; i <= 3; ++i) {
  318. if (i == 0) {
  319. path = "Inquisitive.level-one";
  320. }
  321. else if (i == 1) {
  322. path = "Inquisitive.levels";
  323. }
  324. else if (i == 2) {
  325. path = "MasterInquisitive.level-one";
  326. }
  327. else if (i == 3) {
  328. path = "MasterInquisitive.levels";
  329. }
  330. if (path != null && this.enchantments.get(path) != null) {
  331. this.enchantstrings[i] = this.enchantments.getString(path).toLowerCase();
  332. }
  333. }
  334. path = null;
  335. this.addpotioneffect = (List<String>)this.messages.getStringList("CustomEnchantments.apply-potion-effect");
  336. this.removepotioneffect = (List<String>)this.messages.getStringList("CustomEnchantments.remove-potion-effect");
  337. this.applyinfo = (List<String>)this.messages.getStringList("CustomEnchantments.books.apply-info");
  338. for (int i = 1; i < this.enchantmessages.length; ++i) {
  339. if (i == 1) {
  340. path = "ArrowBreak";
  341. }
  342. else if (i == 2) {
  343. path = "Blacksmith";
  344. }
  345. else if (i == 3) {
  346. path = "Blessed";
  347. }
  348. else if (i == 4) {
  349. path = "BloodLink";
  350. }
  351. else if (i == 5) {
  352. path = "Disarmor";
  353. }
  354. else if (i == 6) {
  355. path = "DivineImmolation";
  356. }
  357. else if (i == 7) {
  358. path = "DoubleStrike";
  359. }
  360. else if (i == 8) {
  361. path = "Dodge";
  362. }
  363. else if (i == 9) {
  364. path = "Enlighted";
  365. }
  366. else if (i == 10) {
  367. path = "Inversion";
  368. }
  369. else if (i == 11) {
  370. path = "KillAura";
  371. }
  372. else if (i == 12) {
  373. path = "NaturesWrath";
  374. }
  375. else if (i == 13) {
  376. path = "Sniper";
  377. }
  378. else if (i == 50) {
  379. path = "Unfocus";
  380. }
  381. else if (i == 51) {
  382. path = "Refocus";
  383. }
  384. else {
  385. path = null;
  386. }
  387. if (path != null) {
  388. this.enchantmessages[i] = this.cemessages.getStringList("enchants." + path);
  389. }
  390. }
  391. this.soulmodeactivate = (List<String>)this.messages.getStringList("Givedp.soul-mode.activate");
  392. this.soulmodedeactivatedMoved = (List<String>)this.messages.getStringList("Givedp.soul-mode.deactivate.moved");
  393. this.soulmodedeactivatedDropped = (List<String>)this.messages.getStringList("Givedp.soul-mode.deactivate.dropped");
  394. this.soulmodedeactivatedInteract = (List<String>)this.messages.getStringList("Givedp.soul-mode.deactivate.interact");
  395. this.soulmodedeactivatedRanOut = (List<String>)this.messages.getStringList("Givedp.soul-mode.deactivate.ran-out");
  396. this.alchemistexchange = (List<String>)this.messages.getStringList("Inventories.alchemist.exchange");
  397. this.alchemistclose = (List<String>)this.messages.getStringList("Inventories.alchemist.close");
  398. this.tinkereraccept = (List<String>)this.messages.getStringList("Inventories.tinkerer.accept-trade");
  399. this.tinkerercancelled = (List<String>)this.messages.getStringList("Inventories.tinkerer.cancel-trade");
  400. this.shootfireworks = this.itemsConfig.getBoolean("shoot-fireworks");
  401. this.SUCCESS = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("success"));
  402. this.DESTROY = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("destroy"));
  403. this.APPLY_TO_ITEM = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("apply"));
  404. this.WHITE_SCROLL_PROTECTED = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("white-scroll.apply"));
  405. this.TRANSMOG = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("transmog-scroll.apply"));
  406. this.ARMOR = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.armor"));
  407. this.HELMET = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.helmet"));
  408. this.CHESTPLATE = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.chestplate"));
  409. this.LEGGINGS = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.leggings"));
  410. this.BOOTS = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.boots"));
  411. this.WEAPON = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.weapon"));
  412. this.SWORD = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.sword"));
  413. this.AXE = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.axe"));
  414. this.BOW = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.bow"));
  415. this.PICKAXE = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.pickaxe"));
  416. this.TOOL = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("enchant-types.tool"));
  417. this.configPrefix = ChatColor.translateAlternateColorCodes('&', this.messages.getString("prefix"));
  418. this.guardiansname = ChatColor.translateAlternateColorCodes('&', this.enchantments.getString("Guardians.name"));
  419. this.spiritsname = ChatColor.translateAlternateColorCodes('&', this.enchantments.getString("Spirits.name"));
  420. this.undeadrusename = ChatColor.translateAlternateColorCodes('&', this.enchantments.getString("UndeadRuse.name"));
  421. for (final String string : this.enchantments.getStringList("Detonate.blacklisted-blocks")) {
  422. this.detonate.add(string.toUpperCase());
  423. }
  424. for (int i = 0; i <= 100; ++i) {
  425. if (this.itemsConfig.get("rarities." + i + ".name") != null) {
  426. final String rarity = this.itemsConfig.getString("rarities." + i + ".name").toLowerCase();
  427. this.customenchantments.put(rarity, new ArrayList<String>());
  428. this.revealitemsmessages.put(rarity, this.messages.getStringList("CustomEnchantments.books." + rarity));
  429. this.revealeditemsfirework.put(rarity, this.itemsConfig.getString("rarities." + i + ".revealed-item.firework"));
  430. this.item = new ItemStack(Material.APPLE, 1);
  431. this.itemMeta = this.item.getItemMeta();
  432. this.lore.clear();
  433. if (this.itemsConfig.get("rarities." + i + ".reveal-item.lore") != null) {
  434. this.revealitems.put(rarity, this.setupItem(this.itemsConfig, "rarities." + i + ".reveal-item"));
  435. }
  436. if (this.itemsConfig.get("rarities." + i + ".revealed-item.lore") != null) {
  437. this.revealeditems.put(rarity, this.setupItem(this.itemsConfig, "rarities." + i + ".revealed-item"));
  438. }
  439. if (this.itemsConfig.get("rarities." + i + ".revealed-item.apply-format") != null) {
  440. this.applyformat.put(rarity, ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("rarities." + i + ".revealed-item.apply-format")));
  441. }
  442. if (this.itemsConfig.get("rarities." + i + ".regular") != null) {
  443. this.regulardust.put(rarity, this.setupItem(this.itemsConfig, "rarities." + i + ".regular"));
  444. this.regulardustchance.put(rarity, this.itemsConfig.getInt("rarities." + i + ".regular.chance"));
  445. }
  446. if (this.itemsConfig.get("rarities." + i + ".primal") != null) {
  447. this.primaldust.put(rarity, this.setupItem(this.itemsConfig, "rarities." + i + ".primal"));
  448. this.primaldustchance.put(rarity, this.itemsConfig.getInt("rarities." + i + ".primal.chance"));
  449. }
  450. if (this.itemsConfig.get("rarities." + i + ".fireball") != null) {
  451. this.fireballs.put(rarity, this.setupItem(this.itemsConfig, "rarities." + i + ".fireball"));
  452. }
  453. }
  454. }
  455. RandomPackageEnchants[] values;
  456. for (int length = (values = RandomPackageEnchants.values()).length, k = 0; k < length; ++k) {
  457. final RandomPackageEnchants enchant = values[k];
  458. if (this.enchantments.get("chances." + enchant.name()) != null) {
  459. this.enchants.put(this.enchantmentsInfo.getString(String.valueOf(enchant.name()) + ".enchant-name"), this.enchantments.getString("chances." + enchant.name()).replace(" ", ""));
  460. }
  461. else {
  462. Bukkit.broadcastMessage(String.valueOf(this.prefix) + ChatColor.RED + "Missing proc chance for enchant " + ChatColor.GRAY + enchant.name());
  463. }
  464. String enchantname = null;
  465. String rarity2 = null;
  466. if (this.enchantmentsInfo.get(String.valueOf(enchant.name()) + ".enchant-name") != null) {
  467. enchantname = this.enchantmentsInfo.getString(String.valueOf(enchant.name()) + ".enchant-name");
  468. }
  469. else {
  470. Bukkit.broadcastMessage(String.valueOf(this.prefix) + ChatColor.RED + "Missing enchant-name for enchant " + ChatColor.GRAY + enchant.name());
  471. }
  472. if (this.enchantmentsInfo.get(String.valueOf(enchant.name()) + ".rarity") != null) {
  473. rarity2 = this.enchantmentsInfo.getString(String.valueOf(enchant.name()) + ".rarity").toLowerCase();
  474. }
  475. else {
  476. Bukkit.broadcastMessage(String.valueOf(this.prefix) + ChatColor.RED + "Missing rarity for enchant " + ChatColor.GRAY + enchant.name());
  477. }
  478. boolean enabled = false;
  479. if (this.enchantmentsInfo.get(String.valueOf(enchant.name()) + ".enabled") != null) {
  480. enabled = this.enchantmentsInfo.getBoolean(String.valueOf(enchant.name()) + ".enabled");
  481. }
  482. else {
  483. Bukkit.broadcastMessage(String.valueOf(this.prefix) + ChatColor.RED + "Missing enabled status for enchant " + ChatColor.GRAY + enchant.name());
  484. }
  485. final int maxlevel = this.enchantmentsInfo.getInt(String.valueOf(enchant.name()) + ".max-level");
  486. ArrayList<String> raritytype = null;
  487. if (!enabled) {
  488. raritytype = this.disabledenchantments;
  489. }
  490. else {
  491. raritytype = this.customenchantments.get(rarity2.toLowerCase());
  492. }
  493. this.enchantmaxlevel.put(enchantname, maxlevel);
  494. if (enchant.name().equals("AntiGravity") || enchant.name().equals("Aquatic") || enchant.name().equals("Drunk") || enchant.name().equals("Gears") || enchant.name().equals("Glowing") || enchant.name().equals("Obsidianshield") || enchant.name().equals("Overload") || enchant.name().equals("Springs") || enchant.name().equals("GodlyOverload")) {
  495. this.potioneffectEnchants.add(enchant.name());
  496. }
  497. if (raritytype != null) {
  498. final int rarityint = this.api.convertStringRarityToIntRarity(rarity2);
  499. if (!enabled) {
  500. raritytype.add(ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("rarities." + rarityint + ".revealed-item.apply-format").replace("{ENCHANT}", enchantname)));
  501. }
  502. else {
  503. for (int j = 1; j <= maxlevel; ++j) {
  504. raritytype.add(ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("rarities." + rarityint + ".revealed-item.name").replace("{ENCHANT}", String.valueOf(enchantname) + " " + this.replaceIntWithRomanNumerals(j))));
  505. }
  506. }
  507. for (int j = 1; j <= maxlevel; ++j) {
  508. this.allcustomenchantments.add(ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("rarities." + rarityint + ".revealed-item.name").replace("{ENCHANT}", String.valueOf(enchantname) + " " + this.replaceIntWithRomanNumerals(j))));
  509. }
  510. }
  511. }
  512. if (this.randompackage.getConfig().getBoolean("features.Items.soul-gem")) {
  513. Bukkit.getScheduler().scheduleSyncRepeatingTask(this.randompackage, (Runnable)new Runnable() {
  514. @Override
  515. public void run() {
  516. if (!CustomEnchantments.this.soulmode.isEmpty()) {
  517. for (final UUID uuid : CustomEnchantments.this.soulmode) {
  518. final Player player = Bukkit.getPlayer(uuid);
  519. if (Bukkit.getVersion().contains("1.8")) {
  520. player.getWorld().spigot().playEffect(new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY() + 0.5, player.getLocation().getZ()), Effect.FLYING_GLYPH, 0, 0, 0.0f, 1.0f, 1.0f, 1.0f, 100, 0);
  521. }
  522. }
  523. }
  524. }
  525. }, 0L, 7L);
  526. Bukkit.getScheduler().scheduleSyncRepeatingTask(this.randompackage, (Runnable)new Runnable() {
  527. @Override
  528. public void run() {
  529. if (!CustomEnchantments.this.soulmode.isEmpty()) {
  530. for (final UUID uuid : CustomEnchantments.this.divineimmolation) {
  531. final Player player = Bukkit.getPlayer(uuid);
  532. CustomEnchantments.access$3(CustomEnchantments.this, CustomEnchantments.this.getSoulGemInPlayerInventory(player, false));
  533. CustomEnchantments.this.depleteSouls(player, CustomEnchantments.this.item, CustomEnchantments.this.getRemainingIntFromString(CustomEnchantments.this.item.getItemMeta().getDisplayName()), 16);
  534. }
  535. }
  536. }
  537. }, 0L, 20L);
  538. }
  539. if (this.enchantmentsInfo.getBoolean("Commander.enabled")) {
  540. Bukkit.getScheduler().scheduleSyncRepeatingTask(this.randompackage, (Runnable)new Runnable() {
  541. @Override
  542. public void run() {
  543. for (final Player player : CustomEnchantments.this.commander.keySet()) {
  544. for (final String enchant : CustomEnchantments.this.getEnchantmentsOnItem(CustomEnchantments.this.commander.get(player))) {
  545. if (enchant.split(" ")[0].equals("Commander") && CustomEnchantments.this.random.nextInt(100) <= CustomEnchantments.this.getProckChance("Commander", Integer.parseInt(enchant.split(" ")[1]), player)) {
  546. CustomEnchantments.this.Commander(player, Integer.parseInt(enchant.split(" ")[1]));
  547. }
  548. }
  549. }
  550. }
  551. }, 0L, 200L);
  552. }
  553. if (this.enchantmentsInfo.getBoolean("Protection.enabled")) {
  554. Bukkit.getScheduler().scheduleSyncRepeatingTask(this.randompackage, (Runnable)new Runnable() {
  555. @Override
  556. public void run() {
  557. for (final Player player : CustomEnchantments.this.protection.keySet()) {
  558. for (final String enchant : CustomEnchantments.this.getEnchantmentsOnItem(CustomEnchantments.this.protection.get(player))) {
  559. if (enchant.split(" ")[0].equals("Protection") && CustomEnchantments.this.random.nextInt(100) <= CustomEnchantments.this.getProckChance("Protection", Integer.parseInt(enchant.split(" ")[1]), player)) {
  560. CustomEnchantments.this.Protection(player, Integer.parseInt(enchant.split(" ")[1]));
  561. }
  562. }
  563. }
  564. }
  565. }, 0L, 200L);
  566. }
  567. if (this.enchantmentsInfo.getBoolean("Implants.enabled")) {
  568. Bukkit.getScheduler().scheduleSyncRepeatingTask(this.randompackage, (Runnable)new Runnable() {
  569. @Override
  570. public void run() {
  571. for (final Player player : CustomEnchantments.this.implants.keySet()) {
  572. for (final String enchant : CustomEnchantments.this.getEnchantmentsOnItem(CustomEnchantments.this.implants.get(player))) {
  573. if (enchant.split(" ")[0].equals("Implants") && CustomEnchantments.this.random.nextInt(100) <= CustomEnchantments.this.getProckChance("Implants", Integer.parseInt(enchant.split(" ")[1]), player)) {
  574. CustomEnchantments.this.Implants(player);
  575. }
  576. }
  577. }
  578. }
  579. }, 0L, 120L);
  580. }
  581. }
  582. }
  583.  
  584. @EventHandler
  585. private void playerQuitEvent(final PlayerQuitEvent event) {
  586. if (this.soulmode.contains(event.getPlayer().getUniqueId())) {
  587. this.soulmode.remove(event.getPlayer().getUniqueId());
  588. }
  589. }
  590.  
  591. public ItemStack getBook(String rarityOrOEN, int level, final int success, final int destroy) {
  592. this.item = new ItemStack(Material.APPLE, 1);
  593. this.itemMeta = this.item.getItemMeta();
  594. this.lore.clear();
  595. if (rarityOrOEN == null) {
  596. return null;
  597. }
  598. String enchant = null;
  599. String OEN = this.getOriginalEnchantmentName(rarityOrOEN);
  600. if (OEN != null) {
  601. enchant = this.enchantmentsInfo.getString(String.valueOf(OEN) + ".enchant-name");
  602. rarityOrOEN = this.enchantmentsInfo.getString(String.valueOf(OEN) + ".rarity").toLowerCase();
  603. }
  604. rarityOrOEN = rarityOrOEN.toLowerCase();
  605. this.item = this.revealeditems.get(rarityOrOEN).clone();
  606. List<String> enchantlist = null;
  607. for (int i = 0; i < this.customenchantments.keySet().size(); ++i) {
  608. if (this.customenchantments.keySet().toArray()[i].equals(rarityOrOEN)) {
  609. enchantlist = this.customenchantments.get(rarityOrOEN);
  610. }
  611. }
  612. if (level < 0) {
  613. level = this.random.nextInt(enchantlist.size());
  614. }
  615. if (enchant == null) {
  616. enchant = enchantlist.get(level);
  617. OEN = this.getOriginalEnchantmentName(enchant);
  618. }
  619. else {
  620. enchant = this.item.getItemMeta().getDisplayName().replace("{ENCHANT}", String.valueOf(enchant) + " " + this.replaceIntWithRomanNumerals(level));
  621. }
  622. final String type = this.enchantmentsInfo.getString(String.valueOf(OEN) + ".enchant-type").toLowerCase();
  623. this.itemMeta = this.item.getItemMeta();
  624. this.lore.clear();
  625. for (final String string : this.itemMeta.getLore()) {
  626. if (string.equals("{SUCCESS}")) {
  627. this.lore.add(this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(success).toString()));
  628. }
  629. else if (string.equals("{DESTROY}")) {
  630. this.lore.add(this.DESTROY.replace("{PERCENT}", new StringBuilder().append(destroy).toString()));
  631. }
  632. else if (string.equals("{BOOK_LORE}")) {
  633. for (final String STRING : this.enchantmentsInfo.getStringList(String.valueOf(OEN) + ".lore")) {
  634. this.lore.add(ChatColor.translateAlternateColorCodes('&', STRING));
  635. }
  636. }
  637. else if (string.equals("{ENCHANT_TYPE}")) {
  638. if (type.equals("armor")) {
  639. this.lore.add(this.ARMOR);
  640. }
  641. else if (type.equals("axe")) {
  642. this.lore.add(this.AXE);
  643. }
  644. else if (type.equals("boots")) {
  645. this.lore.add(this.BOOTS);
  646. }
  647. else if (type.equals("bow")) {
  648. this.lore.add(this.BOW);
  649. }
  650. else if (type.equals("chestplate")) {
  651. this.lore.add(this.CHESTPLATE);
  652. }
  653. else if (type.equals("helmet")) {
  654. this.lore.add(this.HELMET);
  655. }
  656. else if (type.equals("leggings")) {
  657. this.lore.add(this.LEGGINGS);
  658. }
  659. else if (type.equals("pickaxe")) {
  660. this.lore.add(this.PICKAXE);
  661. }
  662. else if (type.equals("sword")) {
  663. this.lore.add(this.SWORD);
  664. }
  665. else if (type.equals("tool")) {
  666. this.lore.add(this.TOOL);
  667. }
  668. else {
  669. if (!type.equals("weapon")) {
  670. continue;
  671. }
  672. this.lore.add(this.WEAPON);
  673. }
  674. }
  675. else {
  676. if (!string.equals("{APPLY}")) {
  677. continue;
  678. }
  679. this.lore.add(this.APPLY_TO_ITEM);
  680. }
  681. }
  682. this.itemMeta.setDisplayName(enchant);
  683. this.itemMeta.setLore((List)this.lore);
  684. this.lore.clear();
  685. this.item.setItemMeta(this.itemMeta);
  686. return this.item;
  687. }
  688.  
  689. private String formatIntUsingCommas(final int integer) {
  690. return String.format("%,d", integer);
  691. }
  692.  
  693. @EventHandler
  694. private void inventoryClickEvents(final InventoryClickEvent event) {
  695. final Player player = (Player)event.getWhoClicked();
  696. final String title = event.getWhoClicked().getOpenInventory().getTopInventory().getTitle();
  697. if (title.equals(this.inventories[168].getTitle()) && event.getClick().equals((Object)ClickType.NUMBER_KEY)) {
  698. event.setCancelled(true);
  699. player.updateInventory();
  700. return;
  701. }
  702. if (!event.isCancelled() && event.getCurrentItem() != null && !event.getCurrentItem().getType().equals((Object)Material.AIR) && event.getWhoClicked().getOpenInventory() != null && event.getWhoClicked().getOpenInventory().getTopInventory() != null && event.getWhoClicked().getOpenInventory().getTopInventory().getTitle() != null && title.equals(this.inventories[168].getTitle())) {
  703. event.setCancelled(true);
  704. player.updateInventory();
  705. if (event.getClick().equals((Object)ClickType.NUMBER_KEY)) {
  706. return;
  707. }
  708. if (title.equals(this.inventories[168].getTitle())) {
  709. this.item = new ItemStack(Material.AIR);
  710. int SLOT = player.getOpenInventory().getTopInventory().firstEmpty();
  711. if ((player.getOpenInventory().getTopInventory().firstEmpty() == -1 && event.getRawSlot() > player.getOpenInventory().getTopInventory().getMaxStackSize()) || !event.getCurrentItem().hasItemMeta() || (event.getRawSlot() >= 4 && event.getRawSlot() <= 8) || (event.getRawSlot() >= 13 && event.getRawSlot() <= 17) || (event.getRawSlot() >= 22 && event.getRawSlot() <= 26) || (event.getRawSlot() >= 31 && event.getRawSlot() <= 35) || (event.getRawSlot() >= 40 && event.getRawSlot() <= 44) || (event.getRawSlot() >= 49 && event.getRawSlot() <= 53)) {
  712. return;
  713. }
  714. if (event.getCurrentItem().equals((Object)this.items[600])) {
  715. this.tinkererAccept = true;
  716. player.closeInventory();
  717. return;
  718. }
  719. if (event.getRawSlot() < player.getOpenInventory().getTopInventory().getSize()) {
  720. this.giveItem(player, event.getCurrentItem());
  721. event.setCurrentItem(new ItemStack(Material.AIR));
  722. SLOT = event.getRawSlot();
  723. }
  724. else if (event.getCurrentItem().getType().name().endsWith("HELMET") || event.getCurrentItem().getType().name().endsWith("CHESTPLATE") || event.getCurrentItem().getType().name().endsWith("LEGGINGS") || event.getCurrentItem().getType().name().endsWith("BOOTS") || event.getCurrentItem().getType().name().endsWith("SWORD") || event.getCurrentItem().getType().name().endsWith("AXE") || event.getCurrentItem().getType().name().endsWith("SPADE") || event.getCurrentItem().getType().name().endsWith("HOE") || event.getCurrentItem().getType().name().endsWith("BOW")) {
  725. int xp = 0;
  726. for (final Enchantment enchant : event.getCurrentItem().getEnchantments().keySet()) {
  727. xp += Integer.parseInt(this.enchantmentsInfo.getString("vanilla." + enchant.getName().toLowerCase()));
  728. }
  729. if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore()) {
  730. for (final String string : this.getEnchantmentsOnItem(event.getCurrentItem())) {
  731. xp += Integer.parseInt(this.enchantmentsInfo.getString(String.valueOf(string.split(" ")[0]) + ".tinkerer").split(":")[Integer.parseInt(string.split(" ")[1]) - 1]);
  732. }
  733. }
  734. if (xp != 0) {
  735. this.item = this.items[10].clone();
  736. this.itemMeta = this.item.getItemMeta();
  737. this.lore.clear();
  738. if (this.item.hasItemMeta() && this.item.getItemMeta().hasLore()) {
  739. for (String string : this.itemMeta.getLore()) {
  740. if (string.contains("{AMOUNT}")) {
  741. string = string.replace("{AMOUNT}", this.formatIntUsingCommas(xp));
  742. }
  743. else if (string.contains("{BOTTLER_NAME}")) {
  744. string = string.replace("{BOTTLER_NAME}", "Tinkerer");
  745. }
  746. this.lore.add(string);
  747. }
  748. }
  749. this.itemMeta.setLore((List)this.lore);
  750. this.lore.clear();
  751. this.item.setItemMeta(this.itemMeta);
  752. }
  753. }
  754. else {
  755. if (this.getOriginalEnchantmentName(event.getCurrentItem().getItemMeta().getDisplayName()) == null) {
  756. return;
  757. }
  758. final ItemStack itemstack = this.fireballs.get(this.enchantmentsInfo.getString(String.valueOf(this.getOriginalEnchantmentName(event.getCurrentItem().getItemMeta().getDisplayName())) + ".rarity").toLowerCase());
  759. if (itemstack == null) {
  760. return;
  761. }
  762. this.item = itemstack.clone();
  763. }
  764. int slot = 0;
  765. if (player.getOpenInventory().getTopInventory().firstEmpty() <= 8) {
  766. slot = 4;
  767. }
  768. else {
  769. slot = 5;
  770. }
  771. player.getOpenInventory().getTopInventory().setItem(SLOT + slot, this.item);
  772. if (event.getRawSlot() > player.getOpenInventory().getTopInventory().getSize()) {
  773. player.getOpenInventory().getTopInventory().setItem(player.getOpenInventory().getTopInventory().firstEmpty(), event.getCurrentItem());
  774. }
  775. event.setCurrentItem(new ItemStack(Material.AIR));
  776. }
  777. player.updateInventory();
  778. }
  779. }
  780.  
  781. @EventHandler
  782. private void inventoryCloseEvent(final InventoryCloseEvent event) {
  783. final Player player = (Player)event.getPlayer();
  784. if (event.getInventory() != null && event.getInventory().getTitle() != null && event.getInventory().getType().equals((Object)InventoryType.CHEST) && event.getInventory().getHolder() != null && event.getInventory().getHolder().toString().contains(event.getPlayer().getName())) {
  785. final String title = event.getInventory().getTitle();
  786. if (title.equals(this.inventories[0].getTitle()) || title.equals(this.inventories[1].getTitle()) || title.equals(this.inventories[168].getTitle())) {
  787. if (title.equals(this.inventories[0].getTitle())) {
  788. if (this.alchemistAccept) {
  789. this.sendStringListMessage(player.getUniqueId(), this.alchemistexchange, 0.0);
  790. this.alchemistAccept = false;
  791. }
  792. else {
  793. this.sendStringListMessage(player.getUniqueId(), this.alchemistclose, 0.0);
  794. }
  795. }
  796. else if (title.equals(this.inventories[168].getTitle())) {
  797. if (this.tinkererAccept) {
  798. this.sendStringListMessage(player.getUniqueId(), this.tinkereraccept, 0.0);
  799. this.tinkererAccept = false;
  800. for (int i = 0; i < event.getInventory().getSize(); ++i) {
  801. if (event.getInventory().getItem(i) != null && ((i >= 5 && i <= 7) || (i >= 14 && i <= 17) || (i >= 23 && i <= 26) || (i >= 32 && i <= 35) || (i >= 41 && i <= 44) || (i >= 50 && i <= 53))) {
  802. this.giveItem(player, event.getInventory().getItem(i));
  803. }
  804. }
  805. }
  806. else {
  807. this.sendStringListMessage(player.getUniqueId(), this.tinkerercancelled, 0.0);
  808. for (int i = 0; i < event.getInventory().getSize(); ++i) {
  809. if (event.getInventory().getItem(i) != null && ((i >= 1 && i <= 3) || (i >= 9 && i <= 12) || (i >= 18 && i <= 21) || (i >= 27 && i <= 30) || (i >= 36 && i <= 39) || (i >= 45 && i <= 48))) {
  810. this.giveItem(player, event.getInventory().getItem(i));
  811. }
  812. }
  813. }
  814. }
  815. if (player.isOnline()) {
  816. player.updateInventory();
  817. }
  818. }
  819. }
  820. }
  821.  
  822. private ItemStack getItemInHand(final Player player) {
  823. if (Bukkit.getVersion().contains("1.7") || Bukkit.getVersion().contains("1.8")) {
  824. return player.getInventory().getItemInHand();
  825. }
  826. return player.getInventory().getItemInMainHand();
  827. }
  828.  
  829. private void giveItem(final Player player, final ItemStack is) {
  830. if (player.getInventory().firstEmpty() < 0 && !is.hasItemMeta() && player.getInventory().getItem(player.getInventory().first(new ItemStack(is.getType(), player.getInventory().getItem(player.getInventory().first(is.getType())).getAmount(), (short)is.getData().getData()))).getAmount() > is.getMaxStackSize()) {
  831. player.getWorld().dropItem(player.getLocation(), is);
  832. }
  833. else if (player.getInventory().firstEmpty() == -1) {
  834. player.getWorld().dropItem(player.getLocation(), is);
  835. }
  836. else {
  837. player.getInventory().addItem(new ItemStack[] { is });
  838. player.updateInventory();
  839. }
  840. }
  841.  
  842. private void removeItem(final Player player, final ItemStack is, final int removeAmount) {
  843. for (int i = 0; i < player.getInventory().getSize(); ++i) {
  844. if (player.getInventory().getItem(i) != null && player.getInventory().getItem(i).getData().getData() == is.getData().getData() && player.getInventory().getItem(i).getType().equals((Object)is.getType()) && (!is.hasItemMeta() || (is.hasItemMeta() && is.getItemMeta().equals(player.getInventory().getItem(i).getItemMeta())))) {
  845. for (int z = 1; z <= removeAmount; ++z) {
  846. if (player.getInventory().getItem(i).getAmount() == 1) {
  847. player.getInventory().setItem(i, new ItemStack(Material.AIR));
  848. }
  849. else {
  850. player.getInventory().getItem(i).setAmount(player.getInventory().getItem(i).getAmount() - 1);
  851. }
  852. }
  853. return;
  854. }
  855. }
  856. player.updateInventory();
  857. }
  858.  
  859. private void sendStringListMessage(final UUID uuid, final List<String> message, final double d) {
  860. final Player player = Bukkit.getPlayer(uuid);
  861. if (message.size() > 0 && !message.get(0).equals("")) {
  862. for (String string : message) {
  863. if (string.contains("{PREFIX}")) {
  864. string = string.replace("{PREFIX}", this.configPrefix);
  865. }
  866. if (string.contains("{AMOUNT}")) {
  867. string = string.replace("{AMOUNT}", Double.toString(d));
  868. }
  869. string = ChatColor.translateAlternateColorCodes('&', string);
  870. if (player == null) {
  871. Bukkit.getConsoleSender().sendMessage(string);
  872. }
  873. else {
  874. player.sendMessage(string);
  875. }
  876. }
  877. }
  878. }
  879.  
  880. private int getRemainingIntFromString(String string) {
  881. string = ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', string)).replaceAll("\\p{L}", "").replaceAll("\\s", "").replaceAll("\\p{P}", "").replaceAll("\\p{S}", "");
  882. if (string == null || string.equals("")) {
  883. return -1;
  884. }
  885. return Integer.parseInt(string);
  886. }
  887.  
  888. private String getSoulGemColors(final int soulgemAmount) {
  889. if (soulgemAmount < 100) {
  890. return ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("soul-gem.colors.less-than-100"));
  891. }
  892. int last = 0;
  893. for (int i = 100; i <= 60000000; i += 100) {
  894. if (this.itemsConfig.get("soul-gem.colors." + i + "s") != null) {
  895. last = i;
  896. }
  897. if (soulgemAmount >= last && soulgemAmount <= i + 100) {
  898. return ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("soul-gem.colors." + last + "s"));
  899. }
  900. }
  901. return ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("soul-gem.colors.else"));
  902. }
  903.  
  904. public ArrayList<String> getEnchantmentsOnItem(final ItemStack is) {
  905. final ArrayList<String> enchants = new ArrayList<String>();
  906. if (is != null && !is.getType().equals((Object)Material.AIR) && is.hasItemMeta() && is.getItemMeta().hasLore()) {
  907. for (final String string : is.getItemMeta().getLore()) {
  908. if (string.split(" ").length - 1 != -1) {
  909. for (final String enchant : this.enchants.keySet()) {
  910. if (ChatColor.stripColor(string).startsWith(enchant)) {
  911. final String level = string.split(" ")[string.split(" ").length - 1].replace("IX", "9").replace("X", "10").replace("VIII", "8").replace("VII", "7").replace("VI", "6").replace("IV", "4").replace("V", "5").replace("III", "3").replace("II", "2").replace("I", "1").replace("\\p{L}", "").replace("\\p{M}", "").replace("\\p{Sc}", "").replace("\\p{Sk}", "").replace("\\p{So}", "").replace("\\p{Nl}", "").replace("\\p{No}", "");
  912. if (this.parseInt(level) == null) {
  913. continue;
  914. }
  915. enchants.add(String.valueOf(this.getOriginalEnchantmentName(enchant.replace(" ", ""))) + " " + level);
  916. }
  917. }
  918. }
  919. }
  920. }
  921. return enchants;
  922. }
  923.  
  924. private Integer parseInt(final String input) {
  925. try {
  926. return Integer.parseInt(input);
  927. }
  928. catch (NumberFormatException e) {
  929. return null;
  930. }
  931. }
  932.  
  933. public String getEnchantmentRarity(final String string) {
  934. final String OEN = this.getOriginalEnchantmentName(string);
  935. if (OEN != null) {
  936. return this.enchantmentsInfo.getString(String.valueOf(OEN) + ".rarity").toLowerCase();
  937. }
  938. return null;
  939. }
  940.  
  941. public String getOriginalEnchantmentName(String string) {
  942. string = ChatColor.stripColor(string);
  943. if (this.enchantmentsInfo.get(String.valueOf(string) + ".enchant-name") != null) {
  944. return string;
  945. }
  946. RandomPackageEnchants[] values;
  947. for (int length = (values = RandomPackageEnchants.values()).length, i = 0; i < length; ++i) {
  948. final RandomPackageEnchants enchant = values[i];
  949. if (string.toLowerCase().replace(" ", "").startsWith(enchant.name().toLowerCase()) || string.toLowerCase().replace(" ", "").startsWith(this.enchantmentsInfo.getString(String.valueOf(enchant.name()) + ".enchant-name").toLowerCase().replace(" ", ""))) {
  950. return enchant.name();
  951. }
  952. }
  953. return null;
  954. }
  955.  
  956. private int getTotalExperience(final Player player) {
  957. int experience = 0;
  958. final int level = player.getLevel();
  959. if (level >= 0 && level <= 15) {
  960. experience = (int)Math.ceil(Math.pow(level, 2.0) + 6 * level);
  961. final int requiredExperience = 2 * level + 7;
  962. final double currentExp = Double.parseDouble(Float.toString(player.getExp()));
  963. experience += (int)Math.ceil(currentExp * requiredExperience);
  964. return experience;
  965. }
  966. if (level > 15 && level <= 30) {
  967. experience = (int)Math.ceil(2.5 * Math.pow(level, 2.0) - 40.5 * level + 360.0);
  968. final int requiredExperience = 5 * level - 38;
  969. final double currentExp = Double.parseDouble(Float.toString(player.getExp()));
  970. experience += (int)Math.ceil(currentExp * requiredExperience);
  971. return experience;
  972. }
  973. experience = (int)Math.ceil(4.5 * Math.pow(level, 2.0) - 162.5 * level + 2220.0);
  974. final int requiredExperience = 9 * level - 158;
  975. final double currentExp = Double.parseDouble(Float.toString(player.getExp()));
  976. experience += (int)Math.ceil(currentExp * requiredExperience);
  977. return experience;
  978. }
  979.  
  980. private void setTotalExperience(final Player player, final int xp) {
  981. if (xp >= 0 && xp < 351) {
  982. final int a = 1;
  983. final int b = 6;
  984. final int c = -xp;
  985. final int level = (int)(-b + Math.sqrt(Math.pow(b, 2.0) - 4 * a * c)) / (2 * a);
  986. final int xpForLevel = (int)(Math.pow(level, 2.0) + 6 * level);
  987. final int remainder = xp - xpForLevel;
  988. final int experienceNeeded = 2 * level + 7;
  989. float experience = remainder / experienceNeeded;
  990. experience = this.round(experience, 2);
  991. player.setLevel(level);
  992. player.setExp(experience);
  993. }
  994. else if (xp >= 352 && xp < 1507) {
  995. final double a2 = 2.5;
  996. final double b2 = -40.5;
  997. final int c2 = -xp + 360;
  998. final double dLevel = (-b2 + Math.sqrt(Math.pow(b2, 2.0) - 4.0 * a2 * c2)) / (2.0 * a2);
  999. final int level2 = (int)Math.floor(dLevel);
  1000. final int xpForLevel2 = (int)(2.5 * Math.pow(level2, 2.0) - 40.5 * level2 + 360.0);
  1001. final int remainder2 = xp - xpForLevel2;
  1002. final int experienceNeeded2 = 5 * level2 - 38;
  1003. float experience2 = remainder2 / experienceNeeded2;
  1004. experience2 = this.round(experience2, 2);
  1005. player.setLevel(level2);
  1006. player.setExp(experience2);
  1007. }
  1008. else {
  1009. final double a2 = 4.5;
  1010. final double b2 = -162.5;
  1011. final int c2 = -xp + 2220;
  1012. final double dLevel = (-b2 + Math.sqrt(Math.pow(b2, 2.0) - 4.0 * a2 * c2)) / (2.0 * a2);
  1013. final int level2 = (int)Math.floor(dLevel);
  1014. final int xpForLevel2 = (int)(4.5 * Math.pow(level2, 2.0) - 162.5 * level2 + 2220.0);
  1015. final int remainder2 = xp - xpForLevel2;
  1016. final int experienceNeeded2 = 9 * level2 - 158;
  1017. float experience2 = remainder2 / experienceNeeded2;
  1018. experience2 = this.round(experience2, 2);
  1019. player.setLevel(level2);
  1020. player.setExp(experience2);
  1021. }
  1022. }
  1023.  
  1024. private float round(final float d, final int decimalPlace) {
  1025. BigDecimal bd = new BigDecimal(Float.toString(d));
  1026. bd = bd.setScale(decimalPlace, 5);
  1027. return bd.floatValue();
  1028. }
  1029.  
  1030. private int getEnchantmentLevel(String string) {
  1031. string = string.split(" ")[string.split(" ").length - 1].toLowerCase().replace("i", "1").replace("v", "2").replace("x", "3").replaceAll("\\p{L}", "").replace("1", "i").replace("2", "v").replace("3", "x").replaceAll("\\p{N}", "").replaceAll("\\p{P}", "").replaceAll("\\p{S}", "").replaceAll("\\p{M}", "").replaceAll("\\p{Z}", "");
  1032. if (string.equals("i")) {
  1033. return 1;
  1034. }
  1035. if (string.equals("ii")) {
  1036. return 2;
  1037. }
  1038. if (string.equals("iii")) {
  1039. return 3;
  1040. }
  1041. if (string.equals("iv")) {
  1042. return 4;
  1043. }
  1044. if (string.equals("v")) {
  1045. return 5;
  1046. }
  1047. if (string.equals("vi")) {
  1048. return 6;
  1049. }
  1050. if (string.equals("vii")) {
  1051. return 7;
  1052. }
  1053. if (string.equals("viii")) {
  1054. return 8;
  1055. }
  1056. if (string.equals("ix")) {
  1057. return 9;
  1058. }
  1059. if (string.equals("x")) {
  1060. return 10;
  1061. }
  1062. if (string.equals("xi")) {
  1063. return 11;
  1064. }
  1065. if (string.equals("xii")) {
  1066. return 12;
  1067. }
  1068. if (string.equals("xiii")) {
  1069. return 13;
  1070. }
  1071. if (string.equals("xiv")) {
  1072. return 14;
  1073. }
  1074. if (string.equals("xv")) {
  1075. return 15;
  1076. }
  1077. if (string.equals("xvi")) {
  1078. return 16;
  1079. }
  1080. if (string.equals("xvii")) {
  1081. return 17;
  1082. }
  1083. if (string.equals("xviii")) {
  1084. return 18;
  1085. }
  1086. if (string.equals("xix")) {
  1087. return 19;
  1088. }
  1089. if (string.equals("xx")) {
  1090. return 20;
  1091. }
  1092. return -1;
  1093. }
  1094.  
  1095. private String replaceIntWithRomanNumerals(final int integer) {
  1096. if (integer == 1) {
  1097. return "I";
  1098. }
  1099. if (integer == 2) {
  1100. return "II";
  1101. }
  1102. if (integer == 3) {
  1103. return "III";
  1104. }
  1105. if (integer == 4) {
  1106. return "IV";
  1107. }
  1108. if (integer == 5) {
  1109. return "V";
  1110. }
  1111. if (integer == 6) {
  1112. return "VI";
  1113. }
  1114. if (integer == 7) {
  1115. return "VII";
  1116. }
  1117. if (integer == 8) {
  1118. return "VIII";
  1119. }
  1120. if (integer == 9) {
  1121. return "IX";
  1122. }
  1123. if (integer == 10) {
  1124. return "X";
  1125. }
  1126. if (integer == 11) {
  1127. return "XI";
  1128. }
  1129. if (integer == 12) {
  1130. return "XII";
  1131. }
  1132. if (integer == 13) {
  1133. return "XIII";
  1134. }
  1135. if (integer == 14) {
  1136. return "XIV";
  1137. }
  1138. if (integer == 15) {
  1139. return "XV";
  1140. }
  1141. if (integer == 16) {
  1142. return "XVI";
  1143. }
  1144. if (integer == 17) {
  1145. return "XVII";
  1146. }
  1147. if (integer == 18) {
  1148. return "XVIII";
  1149. }
  1150. if (integer == 19) {
  1151. return "XIX";
  1152. }
  1153. if (integer == 20) {
  1154. return "XX";
  1155. }
  1156. return null;
  1157. }
  1158.  
  1159. private Color getColor(final String path) {
  1160. if (path == null) {
  1161. return null;
  1162. }
  1163. if (path.equalsIgnoreCase("aqua")) {
  1164. return Color.AQUA;
  1165. }
  1166. if (path.equalsIgnoreCase("black")) {
  1167. return Color.BLACK;
  1168. }
  1169. if (path.equalsIgnoreCase("blue")) {
  1170. return Color.BLUE;
  1171. }
  1172. if (path.equalsIgnoreCase("fuchsia")) {
  1173. return Color.FUCHSIA;
  1174. }
  1175. if (path.equalsIgnoreCase("gray")) {
  1176. return Color.GRAY;
  1177. }
  1178. if (path.equalsIgnoreCase("green")) {
  1179. return Color.GREEN;
  1180. }
  1181. if (path.equalsIgnoreCase("lime")) {
  1182. return Color.LIME;
  1183. }
  1184. if (path.equalsIgnoreCase("maroon")) {
  1185. return Color.MAROON;
  1186. }
  1187. if (path.equalsIgnoreCase("navy")) {
  1188. return Color.NAVY;
  1189. }
  1190. if (path.equalsIgnoreCase("olive")) {
  1191. return Color.OLIVE;
  1192. }
  1193. if (path.equalsIgnoreCase("orange")) {
  1194. return Color.ORANGE;
  1195. }
  1196. if (path.equalsIgnoreCase("purple")) {
  1197. return Color.PURPLE;
  1198. }
  1199. if (path.equalsIgnoreCase("red")) {
  1200. return Color.RED;
  1201. }
  1202. if (path.equalsIgnoreCase("silver")) {
  1203. return Color.SILVER;
  1204. }
  1205. if (path.equalsIgnoreCase("teal")) {
  1206. return Color.TEAL;
  1207. }
  1208. if (path.equalsIgnoreCase("white")) {
  1209. return Color.WHITE;
  1210. }
  1211. if (path.equalsIgnoreCase("yellow")) {
  1212. return Color.YELLOW;
  1213. }
  1214. return null;
  1215. }
  1216.  
  1217. public int getProckChance(final String OEN, final int level, final Player player) {
  1218. String chancestring = null;
  1219. if (this.enchantments.get("chances." + OEN) != null) {
  1220. chancestring = this.enchantments.getString("chances." + OEN).replace(" ", "").toLowerCase().replace("level", new StringBuilder().append(level).toString());
  1221. }
  1222. else {
  1223. chancestring = OEN.replace(" ", "").replace("level", new StringBuilder().append(level).toString());
  1224. }
  1225. int lucky = 0;
  1226. if (chancestring.contains("lucky") && player != null) {
  1227. boolean did = false;
  1228. ItemStack[] armorContents;
  1229. for (int length = (armorContents = player.getInventory().getArmorContents()).length, j = 0; j < length; ++j) {
  1230. final ItemStack is = armorContents[j];
  1231. if (!did && is != null && is.hasItemMeta() && is.getItemMeta().hasLore()) {
  1232. for (final String string : is.getItemMeta().getLore()) {
  1233. if (ChatColor.stripColor(string).startsWith(this.enchantmentsInfo.getString("Lucky.enchant-name"))) {
  1234. did = true;
  1235. lucky = Integer.parseInt(this.enchantments.getString("chances.Lucky").toLowerCase().replace("level", new StringBuilder().append(this.getEnchantmentLevel(string)).toString()));
  1236. }
  1237. }
  1238. }
  1239. }
  1240. }
  1241. chancestring = chancestring.replace("lucky", new StringBuilder().append(lucky).toString()).replace("\\p{L}", "");
  1242. String parentheses = null;
  1243. int prockchance = 0;
  1244. if (chancestring.contains("(") && chancestring.contains(")")) {
  1245. for (int z = 1; z <= 5; ++z) {
  1246. int startp = -1;
  1247. int endp = -1;
  1248. for (int i = 0; i < chancestring.length(); ++i) {
  1249. if (chancestring.substring(i, i + 1).equals("(")) {
  1250. startp = i;
  1251. }
  1252. else if (chancestring.substring(i, i + 1).equals(")")) {
  1253. endp = i + 1;
  1254. }
  1255. if (startp != -1 && endp != -1) {
  1256. parentheses = chancestring.substring(startp, endp);
  1257. prockchance = this.evaluate(parentheses.substring(1, parentheses.length() - 1));
  1258. chancestring = chancestring.replace(parentheses, new StringBuilder().append(prockchance).toString());
  1259. if (chancestring.endsWith("+") || chancestring.endsWith("-") || chancestring.endsWith("*") || chancestring.endsWith("/")) {
  1260. chancestring = chancestring.substring(0, chancestring.length() - 1);
  1261. }
  1262. if (chancestring.startsWith("+") || chancestring.startsWith("-") || chancestring.startsWith("*") || chancestring.startsWith("/")) {
  1263. chancestring = chancestring.substring(1);
  1264. }
  1265. startp = -1;
  1266. endp = -1;
  1267. }
  1268. }
  1269. }
  1270. }
  1271. return this.evaluate(chancestring);
  1272. }
  1273.  
  1274. private int evaluate(String input) {
  1275. int chance = 0;
  1276. for (int i = 1; i <= 5; ++i) {
  1277. String sign = null;
  1278. if (input.contains("*")) {
  1279. sign = String.valueOf(input.split("\\*")[0]) + "*" + input.split("\\*")[1];
  1280. chance = Math.multiplyExact(Integer.parseInt(input.split("\\*")[0]), Integer.parseInt(input.split("\\*")[1]));
  1281. }
  1282. else if (input.contains("/")) {
  1283. sign = String.valueOf(input.split("\\/")[0]) + "/" + input.split("\\/")[1];
  1284. chance = Math.floorDiv(Integer.parseInt(input.split("\\/")[0]), Integer.parseInt(input.split("\\/")[1]));
  1285. }
  1286. else if (input.contains("+")) {
  1287. sign = String.valueOf(input.split("\\+")[0]) + "+" + input.split("\\+")[1];
  1288. chance = Math.addExact(Integer.parseInt(input.split("\\+")[0]), Integer.parseInt(input.split("\\+")[1]));
  1289. }
  1290. else if (input.contains("-")) {
  1291. sign = String.valueOf(input.split("\\-")[0]) + "-" + input.split("\\-")[1];
  1292. chance = Math.subtractExact(Integer.parseInt(input.split("\\-")[0]), Integer.parseInt(input.split("\\-")[1]));
  1293. }
  1294. else if (Integer.valueOf(input) != null) {
  1295. return Integer.valueOf(input);
  1296. }
  1297. if (sign != null) {
  1298. input = input.replace(sign, new StringBuilder().append(chance).toString());
  1299. }
  1300. }
  1301. return chance;
  1302. }
  1303.  
  1304. private void givePotionEffects(final LivingEntity damager, final Player victim, final String OEN, final int level) {
  1305. int clarity = -1;
  1306. int metaphysical = -1;
  1307. if (victim != null) {
  1308. ItemStack[] armorContents;
  1309. for (int length = (armorContents = victim.getInventory().getArmorContents()).length, j = 0; j < length; ++j) {
  1310. final ItemStack is = armorContents[j];
  1311. if (is != null && is.hasItemMeta() && is.getItemMeta().hasLore()) {
  1312. for (final String enchant : this.getEnchantmentsOnItem(is)) {
  1313. final String OEn = enchant.split(" ")[0];
  1314. if (OEn.equals("Clarity")) {
  1315. if (Integer.parseInt(enchant.split(" ")[1]) <= clarity) {
  1316. continue;
  1317. }
  1318. clarity = Integer.parseInt(enchant.split(" ")[1]);
  1319. }
  1320. else {
  1321. if (!OEn.equals("Metaphysical")) {
  1322. continue;
  1323. }
  1324. metaphysical = this.getProckChance("Metaphysical", Integer.parseInt(enchant.split(" ")[1]), victim);
  1325. }
  1326. }
  1327. }
  1328. }
  1329. }
  1330. for (int i = 0; i <= 10; ++i) {
  1331. if (this.enchantments.get(String.valueOf(OEN) + ".potion-effects." + i) != null) {
  1332. final String[] string = this.enchantments.getString(String.valueOf(OEN) + ".potion-effects." + i).toLowerCase().split("\\:");
  1333. PotionEffect effect = new PotionEffect(this.getPotionEffectType(string[0]), this.getProckChance(string[2].replace(" ", "").replace("level", new StringBuilder().append(level).toString()), -1, null), this.getProckChance(string[1].replace(" ", "").replace("level", new StringBuilder().append(level).toString()), -1, null));
  1334. if (damager != null) {
  1335. damager.addPotionEffect(effect);
  1336. }
  1337. if (victim != null) {
  1338. if (effect.getType().equals((Object)PotionEffectType.BLINDNESS) && clarity >= effect.getAmplifier() + 1) {
  1339. effect = null;
  1340. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "execute " + victim.getName() + " ~ ~ ~ particle cloud " + victim.getEyeLocation().getX() + " " + (victim.getEyeLocation().getY() + 0.65) + " " + victim.getEyeLocation().getZ() + " 0.3 0.2 0.3 0 10");
  1341. }
  1342. if (effect.getType().equals((Object)PotionEffectType.SLOW) && metaphysical != -1 && this.random.nextInt(100) <= metaphysical) {
  1343. effect = null;
  1344. for (int o = 1; o <= 5; ++o) {
  1345. victim.getWorld().playEffect(victim.getEyeLocation(), Effect.BOW_FIRE, 1);
  1346. }
  1347. }
  1348. if (effect != null) {
  1349. victim.addPotionEffect(effect);
  1350. }
  1351. }
  1352. }
  1353. }
  1354. }
  1355.  
  1356. private PotionEffectType getPotionEffectType(String string) {
  1357. string = string.toLowerCase();
  1358. if (string.startsWith("f")) {
  1359. return PotionEffectType.FIRE_RESISTANCE;
  1360. }
  1361. if (string.startsWith("i")) {
  1362. return PotionEffectType.INVISIBILITY;
  1363. }
  1364. if (string.startsWith("st") || string.equalsIgnoreCase("increase_damage")) {
  1365. return PotionEffectType.INCREASE_DAMAGE;
  1366. }
  1367. if (string.startsWith("wa")) {
  1368. return PotionEffectType.WATER_BREATHING;
  1369. }
  1370. if (string.startsWith("reg")) {
  1371. return PotionEffectType.REGENERATION;
  1372. }
  1373. if (string.startsWith("sp")) {
  1374. return PotionEffectType.SPEED;
  1375. }
  1376. if (string.startsWith("po")) {
  1377. return PotionEffectType.POISON;
  1378. }
  1379. if (string.startsWith("instanth") || string.equals("heal")) {
  1380. return PotionEffectType.HEAL;
  1381. }
  1382. if (string.startsWith("n")) {
  1383. return PotionEffectType.NIGHT_VISION;
  1384. }
  1385. if (string.startsWith("we")) {
  1386. return PotionEffectType.WEAKNESS;
  1387. }
  1388. if (string.startsWith("sl")) {
  1389. return PotionEffectType.SLOW;
  1390. }
  1391. if (string.startsWith("m") || string.equals("mining_fatigue")) {
  1392. return PotionEffectType.SLOW_DIGGING;
  1393. }
  1394. if (string.startsWith("j")) {
  1395. return PotionEffectType.JUMP;
  1396. }
  1397. if (string.startsWith("healt")) {
  1398. return PotionEffectType.HEALTH_BOOST;
  1399. }
  1400. if (string.startsWith("dam") || string.startsWith("dmg")) {
  1401. return PotionEffectType.DAMAGE_RESISTANCE;
  1402. }
  1403. if (string.startsWith("wi")) {
  1404. return PotionEffectType.WITHER;
  1405. }
  1406. if (string.startsWith("bl")) {
  1407. return PotionEffectType.BLINDNESS;
  1408. }
  1409. if (string.startsWith("ab")) {
  1410. return PotionEffectType.ABSORPTION;
  1411. }
  1412. if (string.startsWith("co")) {
  1413. return PotionEffectType.CONFUSION;
  1414. }
  1415. if (string.startsWith("has")) {
  1416. return PotionEffectType.FAST_DIGGING;
  1417. }
  1418. if (string.startsWith("har")) {
  1419. return PotionEffectType.HARM;
  1420. }
  1421. if (string.startsWith("hu")) {
  1422. return PotionEffectType.HUNGER;
  1423. }
  1424. if (string.startsWith("sa")) {
  1425. return PotionEffectType.SATURATION;
  1426. }
  1427. Bukkit.broadcastMessage(string);
  1428. return null;
  1429. }
  1430.  
  1431. public int convertStringRarityToIntRarity(final String rarity) {
  1432. for (int i = 0; i < this.revealitems.size(); ++i) {
  1433. if (this.revealitems.keySet().toArray()[i].equals(rarity)) {
  1434. return i;
  1435. }
  1436. }
  1437. return -1;
  1438. }
  1439.  
  1440. public String getRevealItemRarity(final ItemStack is) {
  1441. if (is != null && is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
  1442. for (int i = 0; i < this.revealitems.size(); ++i) {
  1443. if (is.getItemMeta().equals(this.revealitems.get(this.revealitems.keySet().toArray()[i]).getItemMeta())) {
  1444. return this.revealitems.keySet().toArray()[i].toString();
  1445. }
  1446. }
  1447. }
  1448. return null;
  1449. }
  1450.  
  1451. public ItemStack getFireballRarity(final ItemStack is) {
  1452. if (is != null && is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
  1453. int i = 0;
  1454. while (i < this.fireballs.size()) {
  1455. if (this.fireballs.values().toArray()[i] != null && is.getItemMeta().equals(((ItemStack)this.fireballs.values().toArray()[i]).getItemMeta())) {
  1456. if (this.random.nextInt(100) <= (int)this.primaldustchance.values().toArray()[i]) {
  1457. return ((ItemStack)this.primaldust.values().toArray()[i]).clone();
  1458. }
  1459. if (this.random.nextInt(100) <= (int)this.regulardustchance.values().toArray()[i]) {
  1460. return ((ItemStack)this.regulardust.values().toArray()[i]).clone();
  1461. }
  1462. return this.items[20].clone();
  1463. }
  1464. else {
  1465. ++i;
  1466. }
  1467. }
  1468. }
  1469. return null;
  1470. }
  1471.  
  1472. private void getAndPlaySound(final Player player, final Location location, final String path, final boolean globalSound) {
  1473. if (Bukkit.getVersion().contains("1.8") && this.sounds.get("1.8.8." + path + ".sound") != null) {
  1474. player.playSound(player.getLocation(), Sound.valueOf(this.sounds.getString("1.8.8." + path + ".sound").toUpperCase()), (float)this.sounds.getInt("1.8.8." + path + ".volume"), (float)this.sounds.getInt("1.8.8." + path + ".pitch"));
  1475. }
  1476. else if (this.sounds.get("1.9+." + path + ".sound") != null) {
  1477. player.playSound(player.getLocation(), Sound.valueOf(this.sounds.getString("1.9+." + path + ".sound").toUpperCase()), (float)this.sounds.getInt("1.9+." + path + ".volume"), (float)this.sounds.getInt("1.9+." + path + ".pitch"));
  1478. }
  1479. }
  1480.  
  1481. private void playSuccess(final Player player) {
  1482. this.getAndPlaySound(player, player.getLocation(), "success-and-destroy.success", false);
  1483. for (int i = 1; i <= 15; ++i) {
  1484. player.getWorld().playEffect(player.getEyeLocation(), Effect.SPELL, 1);
  1485. }
  1486. }
  1487.  
  1488. private void playDestroy(final Player player) {
  1489. this.getAndPlaySound(player, player.getLocation(), "success-and-destroy.destroy", false);
  1490. for (int i = 1; i <= 15; ++i) {
  1491. player.getWorld().playEffect(player.getEyeLocation(), Effect.LAVA_POP, 1);
  1492. }
  1493. }
  1494.  
  1495. private RandomPackage.RPItem checkItemStackForRPItem(final ItemStack is) {
  1496. if (is == null || is.getType().equals((Object)Material.AIR) || !is.hasItemMeta() || !is.getItemMeta().hasLore()) {
  1497. return null;
  1498. }
  1499. if (this.items[0] != null && is.getItemMeta().equals(this.items[0].getItemMeta())) {
  1500. return RandomPackage.RPItem.ARMOR_ENCHANTMENT_ORB;
  1501. }
  1502. if (is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[1].getItemMeta().getDisplayName())) {
  1503. return RandomPackage.RPItem.BLACK_SCROLL;
  1504. }
  1505. if (is.getItemMeta().getLore().equals(this.items[22].getItemMeta().getLore())) {
  1506. return RandomPackage.RPItem.SOUL_GEM;
  1507. }
  1508. if (is.getItemMeta().equals(this.items[25].getItemMeta())) {
  1509. return RandomPackage.RPItem.TRANSMOG_SCROLL;
  1510. }
  1511. if ((this.items[39] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[39].getItemMeta().getDisplayName())) || (this.items[40] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[40].getItemMeta().getDisplayName())) || (this.items[41] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[41].getItemMeta().getDisplayName())) || (this.items[42] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[42].getItemMeta().getDisplayName())) || (this.items[43] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[43].getItemMeta().getDisplayName()))) {
  1512. return RandomPackage.RPItem.WEAPON_ENCHANTMENT_ORB;
  1513. }
  1514. if ((this.items[140] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[140].getItemMeta().getDisplayName())) || (this.items[141] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[141].getItemMeta().getDisplayName())) || (this.items[142] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[142].getItemMeta().getDisplayName())) || (this.items[143] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[143].getItemMeta().getDisplayName())) || (this.items[144] != null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().equals(this.items[144].getItemMeta().getDisplayName()))) {
  1515. return RandomPackage.RPItem.ARMOR_ENCHANTMENT_ORB;
  1516. }
  1517. if (is.getItemMeta().equals(this.items[27].getItemMeta())) {
  1518. return RandomPackage.RPItem.WHITE_SCROLL;
  1519. }
  1520. return null;
  1521. }
  1522.  
  1523. private int getSoulTrackerItemStackRarity(final ItemMeta itemmeta) {
  1524. for (int i = 0; i < this.soultrackers.size(); ++i) {
  1525. if (this.soultrackers.get(i).hasItemMeta() && this.soultrackers.get(i).getItemMeta().equals(itemmeta)) {
  1526. return i;
  1527. }
  1528. }
  1529. return -1;
  1530. }
  1531.  
  1532. private String getRandomizationScrollRarity(final ItemMeta itemmeta) {
  1533. for (int i = 0; i < this.randomizationscrolls.size(); ++i) {
  1534. if (this.randomizationscrolls.get(i) != null && itemmeta.equals(this.randomizationscrolls.get(i).getItemMeta())) {
  1535. return this.randomizationscrollrarities.get(i);
  1536. }
  1537. }
  1538. return null;
  1539. }
  1540.  
  1541. private String getDustRarity(final ItemStack itemstack) {
  1542. if (itemstack != null && itemstack.hasItemMeta() && itemstack.getItemMeta().hasDisplayName() && itemstack.getItemMeta().hasLore()) {
  1543. for (int i = 0; i < this.primaldust.size(); ++i) {
  1544. if (((ItemStack)this.primaldust.values().toArray()[i]).getItemMeta().getDisplayName().equals(itemstack.getItemMeta().getDisplayName())) {
  1545. return this.primaldust.keySet().toArray()[i] + "-primal";
  1546. }
  1547. }
  1548. for (int i = 0; i < this.regulardust.size(); ++i) {
  1549. if (((ItemStack)this.regulardust.values().toArray()[i]).getItemMeta().getDisplayName().equals(itemstack.getItemMeta().getDisplayName())) {
  1550. return this.regulardust.keySet().toArray()[i] + "-regular";
  1551. }
  1552. }
  1553. return null;
  1554. }
  1555. return null;
  1556. }
  1557.  
  1558. private void applyEnchantmentOrb(final InventoryClickEvent event, final String type) {
  1559. int previous = -1;
  1560. int j = 38;
  1561. if (type.equals("armor-enchantment-orb")) {
  1562. j = 139;
  1563. }
  1564. if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore()) {
  1565. for (int i = 1; i <= 5; ++i) {
  1566. if (this.itemsConfig.get(String.valueOf(type) + "." + i) != null && this.items[j + i] != null && ((this.itemsConfig.get(String.valueOf(type) + "." + (i - 1)) == null && i == 1) || (this.itemsConfig.get(String.valueOf(type) + "." + (i - 1)) != null && event.getCurrentItem().getItemMeta().getLore().contains(ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString(String.valueOf(type) + ".apply").replace("{SLOTS}", new StringBuilder().append(this.itemsConfig.getInt(String.valueOf(type) + "." + (i - 1) + ".slots")).toString()).replace("{ADD_SLOTS}", new StringBuilder().append(i - 1).toString())))))) {
  1567. previous = i - 1;
  1568. }
  1569. }
  1570. }
  1571. else {
  1572. previous = 0;
  1573. }
  1574. for (int i = 0; i <= 4; ++i) {
  1575. if (previous == i && !event.getCursor().getItemMeta().getDisplayName().equals(this.items[j + 1 + i].getItemMeta().getDisplayName())) {
  1576. return;
  1577. }
  1578. }
  1579. this.item = event.getCurrentItem();
  1580. this.itemMeta = this.item.getItemMeta();
  1581. this.lore.clear();
  1582. if (this.itemMeta.hasLore()) {
  1583. this.lore.addAll(this.itemMeta.getLore());
  1584. }
  1585. int percent = -1;
  1586. ++previous;
  1587. for (int k = 0; k < this.itemsConfig.getStringList(String.valueOf(type) + "." + previous + ".lore").size(); ++k) {
  1588. if (this.itemsConfig.getStringList(String.valueOf(type) + "." + previous + ".lore").get(k).contains("{PERCENT}")) {
  1589. percent = this.getRemainingIntFromString(event.getCursor().getItemMeta().getLore().get(k));
  1590. }
  1591. }
  1592. --previous;
  1593. if (this.random.nextInt(100) <= percent) {
  1594. if (previous == 0) {
  1595. this.lore.add(ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString(String.valueOf(type) + ".apply").replace("{SLOTS}", new StringBuilder().append(this.itemsConfig.getInt(String.valueOf(type) + ".1.slots")).toString()).replace("{ADD_SLOTS}", new StringBuilder().append(previous + 1).toString())));
  1596. }
  1597. else {
  1598. boolean did = false;
  1599. for (int l = 0; l < this.lore.size(); ++l) {
  1600. if (!did && this.lore.get(l).equals(ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString(String.valueOf(type) + ".apply").replace("{SLOTS}", new StringBuilder().append(this.itemsConfig.getInt(String.valueOf(type) + "." + previous + ".slots")).toString()).replace("{ADD_SLOTS}", new StringBuilder().append(previous).toString())))) {
  1601. did = true;
  1602. this.lore.set(l, ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString(String.valueOf(type) + ".apply").replace("{SLOTS}", new StringBuilder().append(this.itemsConfig.getInt(String.valueOf(type) + "." + (previous + 1) + ".slots")).toString()).replace("{ADD_SLOTS}", new StringBuilder().append(previous + 1).toString())));
  1603. }
  1604. }
  1605. if (!did) {
  1606. return;
  1607. }
  1608. }
  1609. this.playSuccess((Player)event.getWhoClicked());
  1610. this.itemMeta.setLore((List)this.lore);
  1611. this.lore.clear();
  1612. this.item.setItemMeta(this.itemMeta);
  1613. event.setCancelled(true);
  1614. event.setCurrentItem(this.item);
  1615. if (event.getCursor().getAmount() == 1) {
  1616. event.setCursor(new ItemStack(Material.AIR));
  1617. }
  1618. else {
  1619. event.getCursor().setAmount(event.getCursor().getAmount() - 1);
  1620. }
  1621. ((Player)event.getWhoClicked()).updateInventory();
  1622. return;
  1623. }
  1624. this.playDestroy((Player)event.getWhoClicked());
  1625. event.getWhoClicked().sendMessage("[CustomEnchantments] previous=" + previous + "; percent=" + percent + " - Report how you got this to RandomHashTags!");
  1626. }
  1627.  
  1628. @EventHandler
  1629. private void inventoryClickEvent(final InventoryClickEvent event) {
  1630. if (event.isCancelled()) {
  1631. return;
  1632. }
  1633. if (event.getWhoClicked().getOpenInventory().getTopInventory().getType().equals((Object)InventoryType.ANVIL)) {
  1634. if ((event.getCurrentItem() != null && event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasDisplayName() && event.getCurrentItem().getItemMeta().hasLore()) || event.getClick().equals((Object)ClickType.NUMBER_KEY)) {
  1635. String OEN = null;
  1636. if (event.getClick().equals((Object)ClickType.NUMBER_KEY) && event.getWhoClicked().getInventory().getItem(event.getHotbarButton()) != null) {
  1637. this.item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton());
  1638. if (this.item.hasItemMeta() && this.item.getItemMeta().hasDisplayName()) {
  1639. OEN = this.getOriginalEnchantmentName(this.item.getItemMeta().getDisplayName());
  1640. }
  1641. }
  1642. else {
  1643. this.item = event.getCurrentItem();
  1644. OEN = this.getOriginalEnchantmentName(event.getCurrentItem().getItemMeta().getDisplayName());
  1645. }
  1646. if (OEN != null && (this.allcustomenchantments.contains(this.item.getItemMeta().getDisplayName()) || this.getEnchantmentLevel(this.item.getItemMeta().getDisplayName()) > this.enchantmentsInfo.getInt(String.valueOf(OEN) + ".max-level"))) {
  1647. event.setCancelled(true);
  1648. ((Player)event.getWhoClicked()).updateInventory();
  1649. event.getWhoClicked().closeInventory();
  1650. }
  1651. }
  1652. return;
  1653. }
  1654. if (event.getCurrentItem() == null || event.getCurrentItem().getType().equals((Object)Material.AIR)) {
  1655. return;
  1656. }
  1657. if (event.getInventory().getType().equals((Object)InventoryType.CRAFTING) || event.getInventory().getType().equals((Object)InventoryType.PLAYER)) {
  1658. boolean success = false;
  1659. int enchantcount = -1;
  1660. if (this.checkItemStackForRPItem(event.getCursor()) != null || (event.getCursor().hasItemMeta() && this.getRandomizationScrollRarity(event.getCursor().getItemMeta()) != null) || (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore() && event.getCurrentItem().getItemMeta().getLore().equals(this.items[22].getItemMeta().getLore()) && this.soulmode.contains(event.getWhoClicked().getUniqueId()))) {
  1661. if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore() && event.getCurrentItem().getItemMeta().getLore().equals(this.items[22].getItemMeta().getLore()) && this.soulmode.contains(event.getWhoClicked().getUniqueId())) {
  1662. this.soulmode.remove(event.getWhoClicked().getUniqueId());
  1663. this.sendStringListMessage(event.getWhoClicked().getUniqueId(), this.soulmodedeactivatedMoved, 0.0);
  1664. return;
  1665. }
  1666. final String rsr = this.getRandomizationScrollRarity(event.getCursor().getItemMeta());
  1667. ArrayList<String> enchantmentsonitem = null;
  1668. if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore()) {
  1669. enchantmentsonitem = this.getEnchantmentsOnItem(event.getCurrentItem());
  1670. }
  1671. if (event.getCursor().getItemMeta().equals(this.items[27].getItemMeta())) {
  1672. if ((event.getCurrentItem().getType().name().endsWith("AXE") || event.getCurrentItem().getType().name().endsWith("SWORD") || event.getCurrentItem().getType().name().endsWith("SPADE") || event.getCurrentItem().getType().equals((Object)Material.BOW) || event.getCurrentItem().getType().equals((Object)Material.FISHING_ROD) || event.getCurrentItem().getType().name().endsWith("HELMET") || event.getCurrentItem().getType().name().endsWith("CHESTPLATE") || event.getCurrentItem().getType().name().endsWith("LEGGINGS") || event.getCurrentItem().getType().name().endsWith("BOOTS")) && (!event.getCurrentItem().hasItemMeta() || (event.getCurrentItem().hasItemMeta() && !event.getCurrentItem().getItemMeta().hasLore()) || (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore() && !event.getCurrentItem().getItemMeta().getLore().contains(this.WHITE_SCROLL_PROTECTED)))) {
  1673. this.item = event.getCurrentItem();
  1674. this.itemMeta = this.item.getItemMeta();
  1675. this.lore.clear();
  1676. if (this.item.hasItemMeta() && this.item.getItemMeta().hasLore()) {
  1677. this.lore.addAll(this.itemMeta.getLore());
  1678. }
  1679. this.lore.add(this.WHITE_SCROLL_PROTECTED);
  1680. this.itemMeta.setLore((List)this.lore);
  1681. this.lore.clear();
  1682. success = true;
  1683. }
  1684. }
  1685. else if (event.getCursor().getItemMeta().getLore().equals(this.items[22].getItemMeta().getLore()) && event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore() && event.getCurrentItem().getItemMeta().getLore().equals(this.items[22].getItemMeta().getLore())) {
  1686. this.item = this.items[22].clone();
  1687. this.itemMeta = this.item.getItemMeta();
  1688. final int gems = this.getRemainingIntFromString(event.getCurrentItem().getItemMeta().getDisplayName()) + this.getRemainingIntFromString(event.getCursor().getItemMeta().getDisplayName());
  1689. this.itemMeta.setDisplayName(this.item.getItemMeta().getDisplayName().replace("{SOULS}", String.valueOf(this.getSoulGemColors(gems)) + gems));
  1690. success = true;
  1691. }
  1692. else if (event.getCursor().getItemMeta().equals(this.items[25].getItemMeta())) {
  1693. if (event.getCurrentItem().getType().name().endsWith("AXE") || event.getCurrentItem().getType().name().endsWith("SWORD") || event.getCurrentItem().getType().name().endsWith("SPADE") || event.getCurrentItem().getType().equals((Object)Material.BOW) || event.getCurrentItem().getType().name().endsWith("HELMET") || event.getCurrentItem().getType().name().endsWith("CHESTPLATE") || event.getCurrentItem().getType().name().endsWith("LEGGINGS") || event.getCurrentItem().getType().name().endsWith("BOOTS")) {
  1694. this.api.applyTransmogScroll(event.getCurrentItem(), 0);
  1695. this.playSuccess((Player)event.getWhoClicked());
  1696. event.setCancelled(true);
  1697. event.setCurrentItem(event.getCurrentItem());
  1698. if (event.getCursor().getAmount() == 1) {
  1699. event.setCursor(new ItemStack(Material.AIR));
  1700. }
  1701. else {
  1702. event.getCursor().setAmount(event.getCursor().getAmount() - 1);
  1703. }
  1704. ((Player)event.getWhoClicked()).updateInventory();
  1705. return;
  1706. }
  1707. }
  1708. else {
  1709. if ((event.getCursor().getItemMeta().hasDisplayName() && this.items[39] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[39].getItemMeta().getDisplayName())) || (event.getCursor().getItemMeta().hasDisplayName() && this.items[40] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[40].getItemMeta().getDisplayName())) || (event.getCursor().getItemMeta().hasDisplayName() && this.items[41] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[41].getItemMeta().getDisplayName())) || (event.getCursor().getItemMeta().hasDisplayName() && this.items[42] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[42].getItemMeta().getDisplayName())) || (event.getCursor().getItemMeta().hasDisplayName() && this.items[43] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[43].getItemMeta().getDisplayName()))) {
  1710. if (event.getCurrentItem().getType().name().endsWith("SWORD") || event.getCurrentItem().getType().name().endsWith("_AXE")) {
  1711. this.applyEnchantmentOrb(event, "weapon-enchantment-orb");
  1712. }
  1713. return;
  1714. }
  1715. if ((event.getCursor().getItemMeta().hasDisplayName() && this.items[140] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[140].getItemMeta().getDisplayName())) || (event.getCursor().getItemMeta().hasDisplayName() && this.items[141] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[141].getItemMeta().getDisplayName())) || (event.getCursor().getItemMeta().hasDisplayName() && this.items[142] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[142].getItemMeta().getDisplayName())) || (event.getCursor().getItemMeta().hasDisplayName() && this.items[143] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[143].getItemMeta().getDisplayName())) || (event.getCursor().getItemMeta().hasDisplayName() && this.items[144] != null && event.getCursor().getItemMeta().getDisplayName().equals(this.items[144].getItemMeta().getDisplayName()))) {
  1716. if (event.getCurrentItem().getType().name().endsWith("HELMET") || event.getCurrentItem().getType().name().endsWith("CHESTPLATE") || event.getCurrentItem().getType().name().contains("LEGGINGS") || event.getCurrentItem().getType().name().contains("BOOTS")) {
  1717. this.applyEnchantmentOrb(event, "armor-enchantment-orb");
  1718. }
  1719. return;
  1720. }
  1721. if (event.getCursor().getItemMeta().hasDisplayName() && event.getCursor().getItemMeta().hasLore() && event.getCursor().getItemMeta().getDisplayName().equals(this.items[1].getItemMeta().getDisplayName()) && enchantmentsonitem != null) {
  1722. this.lore.clear();
  1723. this.lore.addAll(enchantmentsonitem);
  1724. if (this.lore.size() < 1) {
  1725. return;
  1726. }
  1727. enchantcount = enchantmentsonitem.size();
  1728. final String randomenchant = this.lore.get(this.random.nextInt(this.lore.size()));
  1729. int successPercent = -1;
  1730. int rarityint = -1;
  1731. final int enchantlevel = Integer.parseInt(randomenchant.split(" ")[randomenchant.split(" ").length - 1]);
  1732. final String OEN2 = this.getOriginalEnchantmentName(randomenchant);
  1733. final String enchantname = this.enchantmentsInfo.getString(String.valueOf(OEN2) + ".enchant-name");
  1734. rarityint = this.api.convertStringRarityToIntRarity(this.enchantmentsInfo.getString(String.valueOf(OEN2) + ".rarity").toLowerCase());
  1735. final String enchant = ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("rarities." + rarityint + ".revealed-item.apply-format").replace("{ENCHANT}", String.valueOf(enchantname) + " " + this.replaceIntWithRomanNumerals(enchantlevel)));
  1736. for (final String string : event.getCursor().getItemMeta().getLore()) {
  1737. if (this.getRemainingIntFromString(string) != -1) {
  1738. successPercent = this.getRemainingIntFromString(string);
  1739. }
  1740. }
  1741. this.giveItem((Player)event.getWhoClicked(), this.getBook(OEN2, enchantlevel, successPercent, 100).clone());
  1742. this.item = event.getCurrentItem();
  1743. this.itemMeta = event.getCurrentItem().getItemMeta();
  1744. this.lore.clear();
  1745. this.lore.addAll(event.getCurrentItem().getItemMeta().getLore());
  1746. int enchantslot = -1;
  1747. for (int i = 0; i < this.lore.size(); ++i) {
  1748. if (this.lore.get(i).equals(enchant)) {
  1749. enchantslot = i;
  1750. }
  1751. }
  1752. if (enchantslot == -1) {
  1753. return;
  1754. }
  1755. this.lore.remove(enchantslot);
  1756. this.itemMeta.setLore((List)this.lore);
  1757. this.lore.clear();
  1758. success = true;
  1759. }
  1760. else if ((rsr != null && this.randomizationscrollappliesto.get(rsr).equals("all")) || (rsr != null && event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasDisplayName() && event.getCurrentItem().getItemMeta().hasLore() && this.getEnchantmentRarity(event.getCurrentItem().getItemMeta().getDisplayName()) != null && rsr.equals(this.getEnchantmentRarity(event.getCurrentItem().getItemMeta().getDisplayName())))) {
  1761. this.item = event.getCurrentItem();
  1762. this.itemMeta = this.item.getItemMeta();
  1763. this.lore.clear();
  1764. for (String string2 : this.itemMeta.getLore()) {
  1765. if (string2.equals(this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(this.getRemainingIntFromString(string2)).toString()))) {
  1766. string2 = this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(this.random.nextInt(101)).toString());
  1767. }
  1768. else if (string2.equals(this.DESTROY.replace("{PERCENT}", new StringBuilder().append(this.getRemainingIntFromString(string2)).toString()))) {
  1769. string2 = this.DESTROY.replace("{PERCENT}", new StringBuilder().append(this.random.nextInt(101)).toString());
  1770. }
  1771. this.lore.add(ChatColor.translateAlternateColorCodes('&', string2));
  1772. }
  1773. this.itemMeta.setLore((List)this.lore);
  1774. this.lore.clear();
  1775. success = true;
  1776. }
  1777. }
  1778. if (success) {
  1779. this.playSuccess((Player)event.getWhoClicked());
  1780. this.item.setItemMeta(this.itemMeta);
  1781. if (this.item.getItemMeta().hasDisplayName() && this.item.getItemMeta().getDisplayName().contains(this.TRANSMOG.replace("{LORE_COUNT}", new StringBuilder().append(enchantcount).toString()))) {
  1782. this.api.applyTransmogScroll(this.item, enchantcount);
  1783. }
  1784. event.setCancelled(true);
  1785. event.setCurrentItem(this.item);
  1786. if (event.getCursor().getAmount() == 1) {
  1787. event.setCursor(new ItemStack(Material.AIR));
  1788. }
  1789. else {
  1790. event.getCursor().setAmount(event.getCursor().getAmount() - 1);
  1791. }
  1792. ((Player)event.getWhoClicked()).updateInventory();
  1793. }
  1794. }
  1795. else if (event.getCursor() != null && event.getCursor().hasItemMeta() && event.getCursor().getItemMeta().hasDisplayName() && event.getCursor().getItemMeta().hasLore() && this.getOriginalEnchantmentName(event.getCursor().getItemMeta().getDisplayName()) != null) {
  1796. final List<String> cursorLore = (List<String>)event.getCursor().getItemMeta().getLore();
  1797. if ((cursorLore.contains(this.ARMOR) && event.getCurrentItem().getType().name().endsWith("HELMET")) || (cursorLore.contains(this.ARMOR) && event.getCurrentItem().getType().name().endsWith("CHESTPLATE")) || (cursorLore.contains(this.ARMOR) && event.getCurrentItem().getType().name().endsWith("LEGGINGS")) || (cursorLore.contains(this.ARMOR) && event.getCurrentItem().getType().name().endsWith("BOOTS")) || (cursorLore.contains(this.HELMET) && event.getCurrentItem().getType().name().endsWith("HELMET")) || (cursorLore.contains(this.CHESTPLATE) && event.getCurrentItem().getType().name().endsWith("CHESTPLATE")) || (cursorLore.contains(this.LEGGINGS) && event.getCurrentItem().getType().name().endsWith("LEGGINGS")) || (cursorLore.contains(this.BOOTS) && event.getCurrentItem().getType().name().endsWith("BOOTS")) || (cursorLore.contains(this.AXE) && event.getCurrentItem().getType().name().endsWith("_AXE")) || (cursorLore.contains(this.BOW) && event.getCurrentItem().getType().name().endsWith("BOW")) || (this.getOriginalEnchantmentName(event.getCursor().getItemMeta().getDisplayName()).equals("Rage") && event.getCurrentItem().getType().name().endsWith("BOW")) || (cursorLore.contains(this.PICKAXE) && event.getCurrentItem().getType().name().endsWith("PICKAXE")) || (cursorLore.contains(this.SWORD) && event.getCurrentItem().getType().name().endsWith("SWORD")) || (cursorLore.contains(this.TOOL) && event.getCurrentItem().getType().name().endsWith("AXE")) || (cursorLore.contains(this.TOOL) && event.getCurrentItem().getType().name().endsWith("SPADE")) || (cursorLore.contains(this.WEAPON) && event.getCurrentItem().getType().name().endsWith("_AXE")) || (cursorLore.contains(this.WEAPON) && event.getCurrentItem().getType().name().endsWith("SWORD"))) {
  1798. this.item = event.getCurrentItem();
  1799. this.itemMeta = event.getCurrentItem().getItemMeta();
  1800. this.lore.clear();
  1801. int playerlevelcap = 0;
  1802. final int enchantsize = this.getEnchantmentsOnItem(this.item).size();
  1803. int succeSS = 0;
  1804. int destroy = 0;
  1805. final int bookEnchantLevel = this.getEnchantmentLevel(event.getCursor().getItemMeta().getDisplayName());
  1806. int currentEnchantLevel = 0;
  1807. final String OEN3 = this.getOriginalEnchantmentName(event.getCursor().getItemMeta().getDisplayName());
  1808. final String enchantName = this.enchantmentsInfo.getString(String.valueOf(OEN3) + ".enchant-name");
  1809. final String rarity = this.enchantmentsInfo.getString(String.valueOf(OEN3) + ".rarity").toLowerCase();
  1810. int level = -1;
  1811. int replace = -1;
  1812. boolean addnumber = false;
  1813. final ArrayList<String> enchantsonitem = this.getEnchantmentsOnItem(event.getCurrentItem());
  1814. boolean did = false;
  1815. if (OEN3.equals("DivineEnlighted") || OEN3.equals("GodlyOverload") || OEN3.equals("MasterInquisitive") || OEN3.equals("PlanetaryDeathbringer")) {
  1816. if (!event.getCurrentItem().hasItemMeta() || !event.getCurrentItem().getItemMeta().hasLore()) {
  1817. return;
  1818. }
  1819. if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore()) {
  1820. for (int j = 0; j < enchantsonitem.size(); ++j) {
  1821. if ((OEN3.equals("DivineEnlighted") && enchantsonitem.get(j).split(" ")[0].equals("Enlighted")) || (OEN3.equals("GodlyOverload") && enchantsonitem.get(j).split(" ")[0].equals("Overload")) || (OEN3.equals("MasterInquisitive") && enchantsonitem.get(j).split(" ")[0].equals("Inquisitive")) || (OEN3.equals("PlanetaryDeathbringer") && enchantsonitem.get(j).split(" ")[0].equals("Deathbringer"))) {
  1822. did = true;
  1823. }
  1824. }
  1825. }
  1826. if (!did) {
  1827. return;
  1828. }
  1829. }
  1830. if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore()) {
  1831. this.lore.addAll(event.getCurrentItem().getItemMeta().getLore());
  1832. for (int j = 0; j < enchantsonitem.size(); ++j) {
  1833. if ((OEN3.equals("DivineEnlighted") && enchantsonitem.get(j).split(" ")[0].equals("Enlighted")) || (OEN3.equals("GodlyOverload") && enchantsonitem.get(j).split(" ")[0].equals("Overload")) || (OEN3.equals("MasterInquisitive") && enchantsonitem.get(j).split(" ")[0].equals("Inquisitive")) || (OEN3.equals("PlanetaryDeathbringer") && enchantsonitem.get(j).split(" ")[0].equals("Deathbringer"))) {
  1834. if (Integer.parseInt(enchantsonitem.get(j).split(" ")[1]) != this.enchantmaxlevel.get(enchantName)) {
  1835. this.lore.clear();
  1836. return;
  1837. }
  1838. replace = j;
  1839. }
  1840. else if ((OEN3.equals("Enlighted") && enchantsonitem.get(j).split(" ")[0].equals("DivineEnlighted")) || (OEN3.equals("Deathbringer") && enchantsonitem.get(j).split(" ")[0].equals("PlanetaryDeathbringer")) || (OEN3.equals("Inquisitive") && enchantsonitem.get(j).split(" ")[0].equals("MasterInquisitive")) || (OEN3.equals("Overload") && enchantsonitem.get(j).split(" ")[0].equals("GodlyOverload"))) {
  1841. this.lore.clear();
  1842. return;
  1843. }
  1844. }
  1845. if (replace == -1) {
  1846. for (final String string3 : enchantsonitem) {
  1847. if (level == -1 && string3.split(" ")[0].equals(OEN3)) {
  1848. currentEnchantLevel = Integer.parseInt(string3.split(" ")[1]);
  1849. if (currentEnchantLevel + 1 > this.enchantmaxlevel.get(enchantName)) {
  1850. return;
  1851. }
  1852. if (bookEnchantLevel > currentEnchantLevel) {
  1853. level = bookEnchantLevel;
  1854. }
  1855. else {
  1856. level = currentEnchantLevel + 1;
  1857. }
  1858. }
  1859. }
  1860. }
  1861. }
  1862. for (int j = 0; j <= 100; ++j) {
  1863. if (event.getCursor().getItemMeta().getLore().contains(this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(j).toString()))) {
  1864. succeSS = j;
  1865. }
  1866. if (event.getCursor().getItemMeta().getLore().contains(this.DESTROY.replace("{PERCENT}", new StringBuilder().append(j).toString()))) {
  1867. destroy = j;
  1868. }
  1869. }
  1870. for (int j = 1; j <= 100; ++j) {
  1871. if (event.getWhoClicked().hasPermission("RandomPackage.levelcap." + j)) {
  1872. playerlevelcap = j;
  1873. }
  1874. }
  1875. for (int j = 1; j <= 5; ++j) {
  1876. if ((this.item.getType().name().contains("SWORD") || this.item.getType().name().contains("_AXE")) && this.itemMeta.hasLore() && this.itemsConfig.get("weapon-enchantment-orb." + j) != null && this.itemMeta.getLore().contains(ChatColor.translateAlternateColorCodes('&', this.itemsConfig.getString("weapon-enchantment-orb.apply").replace("{SLOTS}", new StringBuilder().append(this.itemsConfig.getInt("weapon-enchantment-orb." + j + ".slots")).toString()).replace("{ADD_SLOTS}", new StringBuilder().append(j).toString())))) {
  1877. playerlevelcap = this.itemsConfig.getInt("weapon-enchantment-orb." + j + ".slots");
  1878. }
  1879. }
  1880. if (enchantsize + 1 > playerlevelcap && level == -1) {
  1881. return;
  1882. }
  1883. if (this.random.nextInt(100) <= succeSS) {
  1884. final String applyf = this.applyformat.get(rarity);
  1885. final String preve = applyf.replace("{ENCHANT}", String.valueOf(enchantName) + " " + this.replaceIntWithRomanNumerals(currentEnchantLevel));
  1886. if (level != -1) {
  1887. this.lore.remove(preve);
  1888. this.lore.add(applyf.replace("{ENCHANT}", String.valueOf(enchantName) + " " + this.replaceIntWithRomanNumerals(level)));
  1889. }
  1890. else if (replace != -1) {
  1891. this.lore.set(replace, applyf.replace("{ENCHANT}", String.valueOf(enchantName) + " " + this.replaceIntWithRomanNumerals(bookEnchantLevel)));
  1892. }
  1893. else {
  1894. this.lore.add(applyf.replace("{ENCHANT}", String.valueOf(enchantName) + " " + this.replaceIntWithRomanNumerals(bookEnchantLevel)));
  1895. addnumber = true;
  1896. }
  1897. if (this.itemMeta.hasLore()) {
  1898. for (int k = 0; k < this.armorlore.size(); ++k) {
  1899. if (this.itemMeta.getLore().toString().substring(0, this.itemMeta.getLore().toString().length() - 1).contains(this.armorlore.get(k).toString().substring(0, this.armorlore.get(k).toString().length() - 1))) {
  1900. for (final String s : this.armorlore.get(k)) {
  1901. this.lore.remove(s);
  1902. this.lore.add(s);
  1903. }
  1904. }
  1905. }
  1906. for (final String string4 : this.itemMeta.getLore()) {
  1907. if (!this.lore.contains(string4) && !string4.equals(preve)) {
  1908. this.lore.add(string4);
  1909. }
  1910. }
  1911. if (this.itemMeta.getLore().contains(this.WHITE_SCROLL_PROTECTED)) {
  1912. this.lore.remove(this.WHITE_SCROLL_PROTECTED);
  1913. this.lore.add(this.WHITE_SCROLL_PROTECTED);
  1914. }
  1915. for (final String string4 : this.soultrackers_apply) {
  1916. if (this.itemMeta.getLore().get(this.itemMeta.getLore().size() - 1).startsWith(string4.replace("{SOULS}", ""))) {
  1917. final String s2 = this.itemMeta.getLore().get(this.itemMeta.getLore().size() - 1);
  1918. this.lore.remove(s2);
  1919. this.lore.add(s2);
  1920. }
  1921. }
  1922. }
  1923. this.playSuccess((Player)event.getWhoClicked());
  1924. }
  1925. else if (this.random.nextInt(101) <= destroy) {
  1926. this.playDestroy((Player)event.getWhoClicked());
  1927. if (!this.lore.contains(this.WHITE_SCROLL_PROTECTED)) {
  1928. this.item = new ItemStack(Material.AIR);
  1929. }
  1930. else {
  1931. this.lore.remove(this.WHITE_SCROLL_PROTECTED);
  1932. addnumber = false;
  1933. }
  1934. }
  1935. else {
  1936. this.playDestroy((Player)event.getWhoClicked());
  1937. }
  1938. if (!this.item.getType().equals((Object)Material.AIR)) {
  1939. this.itemMeta.setLore((List)this.lore);
  1940. this.lore.clear();
  1941. this.item.setItemMeta(this.itemMeta);
  1942. if (addnumber && this.itemMeta.hasDisplayName() && this.itemMeta.getDisplayName().contains(this.itemMeta.getDisplayName().replace(this.TRANSMOG.replace("{LORE_COUNT}", new StringBuilder().append(enchantsize).toString()), ""))) {
  1943. this.api.applyTransmogScroll(this.item, enchantsize);
  1944. }
  1945. }
  1946. event.setCancelled(true);
  1947. event.setCurrentItem(this.item);
  1948. if (event.getCursor().getAmount() == 1) {
  1949. event.setCursor(new ItemStack(Material.AIR));
  1950. }
  1951. else {
  1952. event.getCursor().setAmount(event.getCursor().getAmount() - 1);
  1953. }
  1954. ((Player)event.getWhoClicked()).updateInventory();
  1955. }
  1956. }
  1957. else if (event.getCursor() != null && event.getCursor().hasItemMeta() && event.getCursor().getItemMeta().hasLore() && event.getCursor().getItemMeta().hasDisplayName() && event.getCurrentItem() != null) {
  1958. final String dustrarity = this.getDustRarity(event.getCursor());
  1959. this.item = event.getCurrentItem();
  1960. this.itemMeta = this.item.getItemMeta();
  1961. this.lore.clear();
  1962. if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasDisplayName()) {
  1963. final String OEN4 = this.getOriginalEnchantmentName(event.getCurrentItem().getItemMeta().getDisplayName());
  1964. String enchantrarity = null;
  1965. final String randomizationscrollrarity = this.getRandomizationScrollRarity(event.getCursor().getItemMeta());
  1966. if (OEN4 != null) {
  1967. enchantrarity = this.enchantmentsInfo.getString(String.valueOf(OEN4) + ".rarity").toLowerCase();
  1968. }
  1969. if (randomizationscrollrarity != null) {
  1970. if (enchantrarity.equals(randomizationscrollrarity)) {
  1971. for (String string5 : this.itemMeta.getLore()) {
  1972. if (string5.equals(this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(this.getRemainingIntFromString(string5)).toString()))) {
  1973. string5 = this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(this.random.nextInt(101)).toString());
  1974. }
  1975. else if (string5.equals(this.DESTROY.replace("{PERCENT}", new StringBuilder().append(this.getRemainingIntFromString(string5)).toString()))) {
  1976. string5 = this.DESTROY.replace("{PERCENT}", new StringBuilder().append(this.random.nextInt(101)).toString());
  1977. }
  1978. this.lore.add(ChatColor.translateAlternateColorCodes('&', string5));
  1979. success = true;
  1980. }
  1981. }
  1982. }
  1983. else if (OEN4 != null && dustrarity != null) {
  1984. HashMap<String, ItemStack> type = null;
  1985. if (dustrarity.contains("primal")) {
  1986. type = this.primaldust;
  1987. }
  1988. else {
  1989. type = this.regulardust;
  1990. }
  1991. this.item = type.get(dustrarity.split("-")[0]).clone();
  1992. if (!dustrarity.startsWith(enchantrarity)) {
  1993. return;
  1994. }
  1995. int percent = -1;
  1996. for (int z = 0; z < this.item.getItemMeta().getLore().size(); ++z) {
  1997. if (this.item.getItemMeta().getLore().get(z).contains("{PERCENT}")) {
  1998. percent = this.getRemainingIntFromString(event.getCursor().getItemMeta().getLore().get(z));
  1999. }
  2000. }
  2001. if (percent == -1) {
  2002. return;
  2003. }
  2004. for (String string6 : this.itemMeta.getLore()) {
  2005. if (string6.equals(this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(this.getRemainingIntFromString(string6)).toString()))) {
  2006. int bookpercent = this.getRemainingIntFromString(string6);
  2007. if (bookpercent == 100) {
  2008. return;
  2009. }
  2010. if (bookpercent + percent > 100) {
  2011. bookpercent = 50;
  2012. percent = 50;
  2013. }
  2014. string6 = this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(bookpercent + percent).toString());
  2015. }
  2016. this.lore.add(ChatColor.translateAlternateColorCodes('&', string6));
  2017. }
  2018. this.item = event.getCurrentItem();
  2019. this.itemMeta = this.item.getItemMeta();
  2020. success = true;
  2021. }
  2022. }
  2023. final int soultrackerrarity = this.getSoulTrackerItemStackRarity(event.getCursor().getItemMeta());
  2024. if (soultrackerrarity != -1 && (event.getCurrentItem().getType().name().contains("SWORD") || event.getCurrentItem().getType().name().contains("_AXE"))) {
  2025. final String soultracker = this.soultrackers_apply.get(soultrackerrarity);
  2026. boolean did2 = false;
  2027. if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore()) {
  2028. this.lore.addAll(event.getCurrentItem().getItemMeta().getLore());
  2029. for (final String string5 : this.soultrackers_apply) {
  2030. if (!did2 && string5 != null && event.getCurrentItem().getItemMeta().getLore().get(event.getCurrentItem().getItemMeta().getLore().size() - 1).startsWith(string5.replace("{SOULS}", ""))) {
  2031. did2 = true;
  2032. this.lore.set(this.lore.size() - 1, soultracker.replace("{SOULS}", "0"));
  2033. }
  2034. }
  2035. if (!did2) {
  2036. this.lore.add(soultracker.replace("{SOULS}", "0"));
  2037. }
  2038. }
  2039. else {
  2040. this.lore.add(soultracker.replace("{SOULS}", "0"));
  2041. }
  2042. for (String string5 : this.messages.getStringList("Givedp.soul-trackers.apply." + soultracker.toLowerCase())) {
  2043. if (string5.contains("{ITEM}")) {
  2044. string5 = string5.replace("{ITEM}", event.getCurrentItem().getType().name());
  2045. }
  2046. event.getWhoClicked().sendMessage(ChatColor.translateAlternateColorCodes('&', string5));
  2047. }
  2048. success = true;
  2049. }
  2050. if (success) {
  2051. this.itemMeta.setLore((List)this.lore);
  2052. this.lore.clear();
  2053. this.item.setItemMeta(this.itemMeta);
  2054. event.setCancelled(true);
  2055. event.setCurrentItem(this.item);
  2056. if (event.getCursor().getAmount() == 1) {
  2057. event.setCursor(new ItemStack(Material.AIR));
  2058. }
  2059. else {
  2060. event.getCursor().setAmount(event.getCursor().getAmount() - 1);
  2061. }
  2062. ((Player)event.getWhoClicked()).updateInventory();
  2063. this.playSuccess((Player)event.getWhoClicked());
  2064. }
  2065. }
  2066. }
  2067. }
  2068.  
  2069. public void potionEffects(final Player player, final String enchant, final boolean removePotionEffects) {
  2070. final String OEN = enchant.split(" ")[0];
  2071. final int level = Integer.parseInt(enchant.split(" ")[1]);
  2072. for (int i = 1; i <= 10; ++i) {
  2073. if (this.enchantments.get(String.valueOf(OEN) + ".potion-effects." + i) != null) {
  2074. final String[] string = this.enchantments.getString(String.valueOf(OEN) + ".potion-effects." + i).toLowerCase().replace(" ", "").replace("level", new StringBuilder().append(level).toString()).split(":");
  2075. List<String> action = null;
  2076. final PotionEffectType potioneffecttype = this.getPotionEffectType(string[0]);
  2077. final int potioneffectlevel = this.evaluate(string[1]);
  2078. if (removePotionEffects) {
  2079. player.removePotionEffect(potioneffecttype);
  2080. action = this.removepotioneffect;
  2081. }
  2082. else {
  2083. player.addPotionEffect(new PotionEffect(potioneffecttype, this.evaluate(string[2]), potioneffectlevel));
  2084. action = this.addpotioneffect;
  2085. }
  2086. for (String String : action) {
  2087. if (String.contains("{ENCHANT}")) {
  2088. String = String.replace("{ENCHANT}", String.valueOf(this.enchantmentsInfo.getString(new StringBuilder(String.valueOf(OEN)).append(".enchant-name").toString())) + " " + this.replaceIntWithRomanNumerals(level));
  2089. }
  2090. if (String.contains("{POTION_EFFECT}")) {
  2091. String = String.replace("{POTION_EFFECT}", String.valueOf(potioneffecttype.getName()) + " " + this.replaceIntWithRomanNumerals(1 + potioneffectlevel));
  2092. }
  2093. player.sendMessage(ChatColor.translateAlternateColorCodes('&', String));
  2094. }
  2095. }
  2096. }
  2097. }
  2098.  
  2099. @EventHandler
  2100. private void removePotionEffect(final InventoryClickEvent event) {
  2101. if (event.isCancelled() || event.getClick().equals((Object)ClickType.DOUBLE_CLICK) || event.getClick().equals((Object)ClickType.CONTROL_DROP)) {
  2102. return;
  2103. }
  2104. if (event.getCurrentItem() != null && event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore() && event.getClickedInventory().getType().equals((Object)InventoryType.PLAYER) && event.getWhoClicked().getOpenInventory().getTopInventory().getType().equals((Object)InventoryType.CRAFTING) && event.isShiftClick() && !event.getSlotType().equals((Object)InventoryType.SlotType.ARMOR)) {
  2105. if ((event.getCurrentItem().getType().name().endsWith("HELMET") && event.getWhoClicked().getInventory().getHelmet() == null) || (event.getCurrentItem().getType().name().endsWith("CHESTPLATE") && event.getWhoClicked().getInventory().getChestplate() == null) || (event.getCurrentItem().getType().name().endsWith("LEGGINGS") && event.getWhoClicked().getInventory().getLeggings() == null) || (event.getCurrentItem().getType().name().endsWith("BOOTS") && event.getWhoClicked().getInventory().getBoots() == null)) {
  2106. for (final String enchant : this.getEnchantmentsOnItem(event.getCurrentItem())) {
  2107. final String OEN = enchant.split(" ")[0];
  2108. if (this.potioneffectEnchants.contains(OEN)) {
  2109. this.potionEffects((Player)event.getWhoClicked(), enchant, false);
  2110. }
  2111. else if (OEN.equals("EnderWalker")) {
  2112. this.getAndPlaySound((Player)event.getWhoClicked(), event.getWhoClicked().getLocation(), "enchants.EnderWalker", false);
  2113. }
  2114. else if (OEN.equals("Commander")) {
  2115. this.commander.put((Player)event.getWhoClicked(), event.getCurrentItem());
  2116. }
  2117. else {
  2118. if (!OEN.equals("Protection")) {
  2119. continue;
  2120. }
  2121. this.protection.put((Player)event.getWhoClicked(), event.getCurrentItem());
  2122. }
  2123. }
  2124. }
  2125. return;
  2126. }
  2127. if (event.getSlotType().equals((Object)InventoryType.SlotType.ARMOR)) {
  2128. if (event.getCurrentItem() != null && event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasLore()) {
  2129. if ((event.getRawSlot() == 5 && !event.getCurrentItem().getType().name().endsWith("HELMET")) || (event.getRawSlot() == 6 && !event.getCurrentItem().getType().name().endsWith("CHESTPLATE")) || (event.getRawSlot() == 7 && !event.getCurrentItem().getType().name().endsWith("LEGGINGS")) || (event.getRawSlot() == 8 && !event.getCurrentItem().getType().name().endsWith("BOOTS"))) {
  2130. return;
  2131. }
  2132. for (final String enchant : this.getEnchantmentsOnItem(event.getCurrentItem())) {
  2133. final String OEN = enchant.split(" ")[0];
  2134. if (this.potioneffectEnchants.contains(OEN)) {
  2135. this.potionEffects((Player)event.getWhoClicked(), enchant, true);
  2136. }
  2137. else if (OEN.equals("Commander")) {
  2138. this.commander.remove(event.getWhoClicked());
  2139. }
  2140. else if (OEN.equals("Protection")) {
  2141. this.protection.remove(event.getWhoClicked());
  2142. }
  2143. else {
  2144. if (!OEN.equals("RepairGuard")) {
  2145. continue;
  2146. }
  2147. this.repairguard.add(event.getWhoClicked().getUniqueId());
  2148. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  2149. @Override
  2150. public void run() {
  2151. CustomEnchantments.this.repairguard.remove(event.getWhoClicked().getUniqueId());
  2152. }
  2153. }, (long)(20 * Integer.parseInt(enchant.split(" ")[1])));
  2154. }
  2155. }
  2156. }
  2157. if (event.getCursor() != null && event.getCursor().hasItemMeta() && event.getCursor().getItemMeta().hasLore()) {
  2158. if ((event.getRawSlot() == 5 && !event.getCursor().getType().name().endsWith("HELMET")) || (event.getRawSlot() == 6 && !event.getCursor().getType().name().endsWith("CHESTPLATE")) || (event.getRawSlot() == 7 && !event.getCursor().getType().name().endsWith("LEGGINGS")) || (event.getRawSlot() == 8 && !event.getCursor().getType().name().endsWith("BOOTS"))) {
  2159. return;
  2160. }
  2161. for (final String enchant : this.getEnchantmentsOnItem(event.getCursor())) {
  2162. final String OEN = enchant.split(" ")[0];
  2163. if (this.potioneffectEnchants.contains(OEN)) {
  2164. this.potionEffects((Player)event.getWhoClicked(), enchant, false);
  2165. }
  2166. else if (OEN.equals("EnderWalker")) {
  2167. this.getAndPlaySound((Player)event.getWhoClicked(), event.getWhoClicked().getLocation(), "enchants.EnderWalker", false);
  2168. }
  2169. else if (OEN.equals("Commander")) {
  2170. this.commander.put((Player)event.getWhoClicked(), event.getCursor());
  2171. }
  2172. else {
  2173. if (!OEN.equals("Protection")) {
  2174. continue;
  2175. }
  2176. this.protection.put((Player)event.getWhoClicked(), event.getCursor());
  2177. }
  2178. }
  2179. }
  2180. }
  2181. }
  2182.  
  2183. @EventHandler
  2184. private void entityDamageByEntityEvent(final EntityDamageByEntityEvent event) {
  2185. if (event.isCancelled()) {
  2186. if (event.getEntity() instanceof Player && event.getDamager().getType().name().contains("ARROW") && ((Projectile)event.getDamager()).getShooter() instanceof Player) {
  2187. final Player shooter = (Player)((Projectile)event.getDamager()).getShooter();
  2188. final Player victim = (Player)event.getEntity();
  2189. for (int i = 0; i < this.bowsp.size(); ++i) {
  2190. if (this.bowsp.get(i).equals(shooter.getUniqueId())) {
  2191. final ArrayList<String> damagerenchants = this.getEnchantmentsOnItem(this.bows.get(i));
  2192. for (final String string : damagerenchants) {
  2193. final String OEN = string.split(" ")[0];
  2194. if (OEN.equals("Teleportation") && (this.fapi.relationIsAlly(shooter, victim) || this.fapi.relationIsMember(shooter, victim))) {
  2195. this.Teleportation((Projectile)event.getDamager(), shooter, victim);
  2196. }
  2197. }
  2198. }
  2199. }
  2200. }
  2201. return;
  2202. }
  2203. this.procEnchants(event);
  2204. }
  2205.  
  2206. public void procEnchants(final EntityDamageByEntityEvent event) {
  2207. if ((Bukkit.getPluginManager().getPlugin("WorldEdit") != null && Bukkit.getPluginManager().getPlugin("WorldGuard") != null && event.getEntity() instanceof Player && !RP_WorldEditWorldGuard.getInstance().locationHasPvPAllowed(event.getEntity().getWorld(), event.getEntity().getLocation())) || (event.getEntity() instanceof Player && event.getDamager() instanceof Player && !this.fapi.relationIsEnemyOrNull((Player)event.getEntity(), (Player)event.getDamager()) && !this.fapi.relationIsNeutral((Player)event.getEntity(), (Player)event.getDamager()))) {
  2208. event.setCancelled(true);
  2209. return;
  2210. }
  2211. if (event.getEntity() instanceof IronGolem && event.getEntity().getCustomName() != null && event.getDamager() instanceof Player) {
  2212. final String playername = ChatColor.stripColor(event.getEntity().getCustomName().replace(ChatColor.stripColor(this.guardiansname.replace("{PLAYER}", "")), ""));
  2213. if (Bukkit.getPlayer(playername) != null && Bukkit.getPlayer(playername).isOnline() && !Bukkit.getPlayer(playername).getName().equalsIgnoreCase(playername)) {
  2214. ItemStack[] armorContents;
  2215. for (int length = (armorContents = Bukkit.getPlayer(playername).getInventory().getArmorContents()).length, k = 0; k < length; ++k) {
  2216. final ItemStack is = armorContents[k];
  2217. if (is != null && !is.getType().equals((Object)Material.AIR) && is.hasItemMeta() && is.getItemMeta().hasLore()) {
  2218. for (final String enchant : this.getEnchantmentsOnItem(is)) {
  2219. if (enchant.split(" ")[0].equals("BloodLink") && this.random.nextInt(100) <= this.getProckChance("BloodLink", Integer.parseInt(enchant.split(" ")[1]), Bukkit.getPlayer(playername))) {
  2220. this.BloodLink(Bukkit.getPlayer(playername));
  2221. }
  2222. }
  2223. }
  2224. }
  2225. }
  2226. return;
  2227. }
  2228. if (event.getEntity() instanceof LivingEntity && event.getDamager() instanceof Player && this.getItemInHand((Player)event.getDamager()) != null && this.getItemInHand((Player)event.getDamager()).hasItemMeta() && this.getItemInHand((Player)event.getDamager()).getItemMeta().hasLore()) {
  2229. final Player damager = (Player)event.getDamager();
  2230. final LivingEntity victim = (LivingEntity)event.getEntity();
  2231. if (this.dominate.contains(damager.getUniqueId())) {
  2232. int d = 0;
  2233. for (int z = 0; z < this.dominate.size(); ++z) {
  2234. if (this.dominate.get(z).equals(damager.getUniqueId()) && d == 0) {
  2235. d = z;
  2236. }
  2237. }
  2238. event.setDamage(event.getDamage() * (event.getDamage() * this.dominatee.get(d) * this.doubles[7]));
  2239. }
  2240. final int shackle = 0;
  2241. for (final String enchant2 : this.getEnchantmentsOnItem(this.getItemInHand(damager))) {
  2242. final String OEN = enchant2.split(" ")[0];
  2243. final int level = Integer.parseInt(enchant2.split(" ")[1]);
  2244. int chance = 0;
  2245. if (!OEN.equals("Dodge")) {
  2246. chance = this.getProckChance(OEN, level, damager);
  2247. }
  2248. if (this.random.nextInt(100) <= chance || OEN.equals("Silence") || OEN.equals("Disarmor") || OEN.equals("DivineImmolation")) {
  2249. if (OEN.equals("Assassin")) {
  2250. this.Assassin(event, level);
  2251. }
  2252. else if (OEN.equals("Barbarian")) {
  2253. this.Barbarian(event, level, damager);
  2254. }
  2255. else if (OEN.equals("Demonforged") && victim instanceof Player) {
  2256. this.Demonforged((Player)victim, level, chance);
  2257. }
  2258. else if (OEN.equals("DivineImmolation") && this.soulmode.contains(event.getDamager().getUniqueId())) {
  2259. this.DivineImmolation(event, level);
  2260. }
  2261. else if (OEN.equals("Berserk")) {
  2262. this.Berserk(damager, level);
  2263. }
  2264. else if (OEN.equals("Blacksmith")) {
  2265. this.Blacksmith(event, damager, level);
  2266. }
  2267. else if (OEN.equals("Blessed")) {
  2268. this.Blessed(damager);
  2269. }
  2270. else if (OEN.equals("Blind")) {
  2271. this.Blind(event, level);
  2272. }
  2273. else if (OEN.equals("Cleave")) {
  2274. this.Cleave(damager, victim, level, event);
  2275. }
  2276. else if (OEN.equals("Confusion") && victim instanceof Player) {
  2277. this.Confusion((Player)victim, level);
  2278. }
  2279. else if (OEN.equals("DeepWounds") && victim instanceof Player) {
  2280. this.DeepWounds(event, (Player)victim, level);
  2281. }
  2282. else if (OEN.equals("Disarmor") && victim instanceof Player && ((Player)victim).getHealth() <= 8.0) {
  2283. boolean did = false;
  2284. ItemStack[] armorContents2;
  2285. for (int length2 = (armorContents2 = ((Player)victim).getInventory().getArmorContents()).length, l = 0; l < length2; ++l) {
  2286. final ItemStack is2 = armorContents2[l];
  2287. for (final String enchants : this.getEnchantmentsOnItem(is2)) {
  2288. if (enchants.split(" ")[0].equals("Sticky") && !did) {
  2289. chance -= this.getProckChance(enchants, level, damager);
  2290. did = true;
  2291. }
  2292. }
  2293. }
  2294. if (this.random.nextInt(100) > chance) {
  2295. continue;
  2296. }
  2297. this.Disarmor((Player)victim);
  2298. }
  2299. else if (OEN.equals("Dominate") && victim instanceof Player) {
  2300. this.Dominate(event, level);
  2301. }
  2302. else if (OEN.equals("DoubleStrike") && !this.doublestrike) {
  2303. this.procEnchants(event);
  2304. this.doublestrike = true;
  2305. this.sendStringListMessage(damager.getUniqueId(), this.enchantmessages[7], 0.0);
  2306. this.getAndPlaySound(damager, damager.getLocation(), "enchants.DoubleStrike", false);
  2307. }
  2308. else if (OEN.equals("Epicness") && victim instanceof Player) {
  2309. this.Epicness((Player)victim, level);
  2310. }
  2311. else if (OEN.equals("Enrage")) {
  2312. this.Enrage(event, damager, level);
  2313. }
  2314. else if (OEN.equals("Execute")) {
  2315. this.Execute(damager, level);
  2316. }
  2317. else if (OEN.equals("Featherweight")) {
  2318. this.Featherweight(damager, level);
  2319. }
  2320. else if (OEN.equals("Frozen") && victim instanceof Player) {
  2321. this.Frozen((Player)victim, level);
  2322. }
  2323. else if (OEN.equals("Greatsword") && victim instanceof Player) {
  2324. this.Greatsword(event, (Player)victim, level);
  2325. }
  2326. else if (OEN.equals("IceAspect") && victim instanceof Player) {
  2327. this.IceAspect((Player)victim, level);
  2328. }
  2329. else if (OEN.equals("IceFreeze") && victim instanceof Player) {
  2330. this.IceFreeze((Player)victim, level);
  2331. }
  2332. else if (OEN.equals("Insanity") && victim instanceof Player) {
  2333. this.Insanity(damager, level, (Player)victim, event);
  2334. }
  2335. else if (OEN.equals("Insomnia") && victim instanceof Player) {
  2336. this.Insomnia((Player)victim, level, event);
  2337. }
  2338. else if (OEN.equals("Lifesteal")) {
  2339. this.Lifesteal(event, damager);
  2340. }
  2341. else if (OEN.equals("Obliterate")) {
  2342. this.Obliterate(event, level);
  2343. }
  2344. else if (OEN.equals("Paralyze") && victim instanceof Player) {
  2345. this.Paralyze((Player)victim, level);
  2346. }
  2347. else if (OEN.equals("Poison")) {
  2348. this.Poison(victim, level);
  2349. }
  2350. else if (OEN.equals("Pummel") && victim instanceof Player) {
  2351. this.Pummel(damager, (Player)victim, level);
  2352. }
  2353. else if (OEN.equals("Rage")) {
  2354. this.Rage(event, damager, level);
  2355. }
  2356. else if (OEN.equals("Ravenous")) {
  2357. this.Ravenous(damager, level);
  2358. }
  2359. else if (OEN.equals("Shackle") && !(victim instanceof Player)) {
  2360. this.Shackle(event, level);
  2361. }
  2362. else if (OEN.equals("Silence") && victim instanceof Player) {
  2363. int solitude = 0;
  2364. for (final String str : this.getEnchantmentsOnItem(this.getItemInHand(damager))) {
  2365. if (str.equals("Solitude")) {
  2366. solitude = this.getProckChance(str, level, damager);
  2367. }
  2368. }
  2369. chance += solitude;
  2370. if (this.random.nextInt(100) > chance) {
  2371. continue;
  2372. }
  2373. this.Silence((Player)victim, level);
  2374. }
  2375. else if (OEN.equals("SkillSwipe") && victim instanceof Player) {
  2376. this.SkillSwipe((Player)victim, damager, level);
  2377. }
  2378. else if (OEN.equals("ThunderingBlow")) {
  2379. this.ThunderingBlow(event, level);
  2380. }
  2381. else if (OEN.equals("Trap") && victim instanceof Player) {
  2382. this.Trap((Player)victim, level);
  2383. }
  2384. else if (OEN.equals("Trickster") && victim instanceof Player) {
  2385. this.Trickster((Player)victim);
  2386. }
  2387. else {
  2388. if (!OEN.equals("Vampire")) {
  2389. continue;
  2390. }
  2391. this.Vampire(event, damager);
  2392. }
  2393. }
  2394. }
  2395. this.doublestrike = false;
  2396. final int lucky = 0;
  2397. ItemStack[] armorContents3;
  2398. for (int length3 = (armorContents3 = damager.getInventory().getArmorContents()).length, n = 0; n < length3; ++n) {
  2399. final ItemStack is3 = armorContents3[n];
  2400. if (is3 != null && is3.hasItemMeta() && is3.getItemMeta().hasLore()) {
  2401. for (final String enchant3 : this.getEnchantmentsOnItem(is3)) {
  2402. final String OEN2 = enchant3.split(" ")[0];
  2403. final int level2 = Integer.parseInt(enchant3.split(" ")[1]);
  2404. int chance2 = 0;
  2405. if (!OEN2.equals("Dodge")) {
  2406. chance2 = this.getProckChance(OEN2, level2, damager);
  2407. }
  2408. if (this.random.nextInt(100) <= chance2) {
  2409. if (OEN2.equals("PlanetaryDeathbringer")) {
  2410. this.PlanetaryDeathbringer(event);
  2411. }
  2412. else {
  2413. if (!OEN2.equals("Leadership")) {
  2414. continue;
  2415. }
  2416. this.Leadership(event, level2);
  2417. }
  2418. }
  2419. }
  2420. }
  2421. }
  2422. }
  2423. if ((event.getEntity() instanceof Player && event.getDamager() instanceof Player) || (event.getEntity() instanceof Player && event.getDamager() instanceof LivingEntity)) {
  2424. final Player victim2 = (Player)event.getEntity();
  2425. LivingEntity damager2 = (LivingEntity)event.getDamager();
  2426. if (damager2 instanceof Projectile && damager2.getType().name().contains("ARROW")) {
  2427. if (!(((Projectile)damager2).getShooter() instanceof Player)) {
  2428. return;
  2429. }
  2430. damager2 = (LivingEntity)((Projectile)damager2).getShooter();
  2431. }
  2432. boolean phoeniX = false;
  2433. final int phoenix = 1000 + this.random.nextInt(101);
  2434. this.item = this.getSoulGemInPlayerInventory(victim2, true);
  2435. ItemStack[] armorContents4;
  2436. for (int length4 = (armorContents4 = victim2.getInventory().getArmorContents()).length, n2 = 0; n2 < length4; ++n2) {
  2437. final ItemStack ap = armorContents4[n2];
  2438. if (ap != null && ap.hasItemMeta() && ap.getItemMeta().hasLore()) {
  2439. for (final String enchant3 : this.getEnchantmentsOnItem(ap)) {
  2440. int souls = 0;
  2441. if (this.item != null) {
  2442. souls = this.getRemainingIntFromString(this.item.getItemMeta().getDisplayName());
  2443. }
  2444. final String OEN3 = enchant3.split(" ")[0];
  2445. final int level3 = Integer.parseInt(enchant3.split(" ")[enchant3.split(" ").length - 1]);
  2446. int chance3 = 0;
  2447. if (!OEN3.equals("Dodge")) {
  2448. chance3 = this.getProckChance(OEN3, level3, victim2);
  2449. }
  2450. if (this.random.nextInt(100) <= chance3 || OEN3.equals("Dodge") || OEN3.equals("Immortal") || OEN3.equals("Phoenix")) {
  2451. if (OEN3.equals("Aegis") && damager2 instanceof Player) {
  2452. this.Aegis(event, (Player)damager2, level3);
  2453. }
  2454. else if (OEN3.equals("Angelic")) {
  2455. this.Angelic(victim2, level3);
  2456. }
  2457. else if (OEN3.equals("Armored") && damager2 instanceof Player) {
  2458. this.Armored(victim2, (Player)damager2, level3, event);
  2459. }
  2460. else if (OEN3.equals("ArrowDeflect") && damager2.getType().name().contains("ARROW")) {
  2461. this.ArrowDeflect(event, victim2, level3);
  2462. }
  2463. else if (OEN3.equals("Cactus")) {
  2464. this.Cactus(damager2, level3);
  2465. }
  2466. else if ((OEN3.equals("CreeperArmor") && event.getDamager().getType().equals((Object)EntityType.CREEPER)) || (OEN3.equals("CreeperArmor") && event.getDamager().getType().equals((Object)EntityType.PRIMED_TNT))) {
  2467. this.CreeperArmor(event, victim2, level3);
  2468. }
  2469. else if (OEN3.equals("Curse") && victim2.getHealth() <= this.doubles[10]) {
  2470. this.Curse(victim2, level3);
  2471. }
  2472. else if (OEN3.equals("Deathbringer")) {
  2473. this.Deathbringer(victim2, level3);
  2474. }
  2475. else if (OEN3.equals("DeathGod")) {
  2476. this.DeathGod(event, level3);
  2477. }
  2478. else if (OEN3.equals("Dodge")) {
  2479. if (victim2.isSneaking()) {
  2480. chance3 = this.getProckChance(this.enchantments.getString("chances." + OEN3 + ".if-sneaking"), level3, victim2);
  2481. }
  2482. else {
  2483. chance3 = this.getProckChance(this.enchantments.getString("chances." + OEN3 + ".not-sneaking"), level3, victim2);
  2484. }
  2485. if (this.random.nextInt(100) > chance3) {
  2486. continue;
  2487. }
  2488. this.Dodge(victim2, event);
  2489. }
  2490. else if (OEN3.equals("EnderShift")) {
  2491. this.EnderShift(victim2, level3);
  2492. }
  2493. else if (OEN3.equals("Enlighted")) {
  2494. this.Enlighted(victim2);
  2495. }
  2496. else if (OEN3.equals("Guardians")) {
  2497. this.Guardians(event, victim2, level3);
  2498. }
  2499. else if (OEN3.equals("Immortal") && this.item != null && souls - 5 - level3 >= 0) {
  2500. this.Immortal(victim2, ap);
  2501. this.depleteSouls(victim2, this.item, souls, 5 + this.random.nextInt(level3 * 4));
  2502. victim2.updateInventory();
  2503. }
  2504. else if (OEN3.equals("Inversion")) {
  2505. this.Inversion(event, victim2, level3);
  2506. }
  2507. else if (OEN3.equals("Molten")) {
  2508. this.Molten(damager2, level3);
  2509. }
  2510. else if (OEN3.equals("NaturesWrath") && this.item != null && souls - 75 >= 0) {
  2511. this.NaturesWrath(event, victim2, level3);
  2512. this.depleteSouls(victim2, this.item, souls, 75);
  2513. }
  2514. else if (OEN3.equals("Phoenix") && this.item != null && victim2.getHealth() - event.getFinalDamage() <= 0.0 && souls - phoenix >= 0 && !phoeniX) {
  2515. phoeniX = true;
  2516. this.Phoenix(event, victim2, level3);
  2517. this.depleteSouls(victim2, this.item, souls, phoenix);
  2518. }
  2519. else if (OEN3.equals("Poisoned")) {
  2520. this.Poisoned(damager2, level3);
  2521. }
  2522. else if (OEN3.equals("Ragdoll")) {
  2523. this.Ragdoll(victim2);
  2524. }
  2525. else if (OEN3.equals("Shockwave") && event.getDamager() instanceof Player) {
  2526. this.Shockwave((Player)event.getDamager(), level3);
  2527. }
  2528. else if (OEN3.equals("SmokeBomb")) {
  2529. this.SmokeBomb(damager2, level3);
  2530. }
  2531. else if (OEN3.equals("SpiritLink")) {
  2532. this.SpiritLink(victim2, level3);
  2533. }
  2534. else if (OEN3.equals("Spirits")) {
  2535. this.Spirits(victim2, level3);
  2536. }
  2537. else if (OEN3.equals("Stormcaller")) {
  2538. this.Stormcaller(damager2);
  2539. }
  2540. else if (OEN3.equals("RocketEscape")) {
  2541. this.RocketEscape(victim2, level3);
  2542. }
  2543. else if (OEN3.equals("Tank") && event.getDamager() instanceof Player) {
  2544. this.Tank(victim2, (Player)event.getDamager(), level3, event);
  2545. }
  2546. else if (OEN3.equals("Valor") && event.getDamager() instanceof Player && ((Player)event.getDamager()).getInventory().getItemInHand().getType().name().contains("SWORD")) {
  2547. this.Valor(event, level3);
  2548. }
  2549. else if (OEN3.equals("Voodoo")) {
  2550. this.Voodoo(damager2, level3);
  2551. }
  2552. else if (OEN3.equals("Wither")) {
  2553. this.Wither(damager2, level3);
  2554. }
  2555. else {
  2556. if (!OEN3.equals("UndeadRuse")) {
  2557. continue;
  2558. }
  2559. this.UndeadRuse(victim2, level3, damager2);
  2560. }
  2561. }
  2562. }
  2563. }
  2564. }
  2565. if (this.repairguard.contains(victim2.getUniqueId())) {
  2566. event.setDamage(event.getFinalDamage() / 2.0);
  2567. }
  2568. if (this.getItemInHand(victim2) != null && this.getItemInHand(victim2).getType().equals((Object)Material.BOW) && this.getItemInHand(victim2).hasItemMeta() && this.getItemInHand(victim2).getItemMeta().hasLore()) {
  2569. for (final String enchant4 : this.getEnchantmentsOnItem(this.getItemInHand(victim2))) {
  2570. final String OEN4 = enchant4.split(" ")[0];
  2571. final int level4 = Integer.parseInt(enchant4.split(" ")[1]);
  2572. final int chance4 = this.getProckChance(enchant4, level4, victim2);
  2573. if (this.random.nextInt(100) <= chance4 && OEN4.equals("Farcast")) {
  2574. this.Farcast(damager2, level4);
  2575. }
  2576. }
  2577. }
  2578. }
  2579. if (event.getEntity() instanceof Player && event.getDamager().getType().name().contains("ARROW") && ((Projectile)event.getDamager()).getShooter() instanceof Player) {
  2580. final Player damager = (Player)((Projectile)event.getDamager()).getShooter();
  2581. final Player victim3 = (Player)event.getEntity();
  2582. boolean heavy = false;
  2583. if (this.getItemInHand(victim3) != null && this.getItemInHand(victim3).hasItemMeta() && this.getItemInHand(victim3).getItemMeta().hasLore()) {
  2584. this.item = this.getItemInHand(victim3);
  2585. for (final String enchant2 : this.getEnchantmentsOnItem(this.item)) {
  2586. final String OEN = this.getOriginalEnchantmentName(enchant2);
  2587. final int level = Integer.parseInt(enchant2.split(" ")[1]);
  2588. final int chance = this.getProckChance(OEN, level, victim3);
  2589. if (this.random.nextInt(100) <= chance && OEN.equals("ArrowBreak") && this.item.getType().name().endsWith("_AXE")) {
  2590. this.ArrowBreak(event, victim3);
  2591. }
  2592. }
  2593. }
  2594. ItemStack[] armorContents5;
  2595. for (int length5 = (armorContents5 = victim3.getInventory().getArmorContents()).length, n3 = 0; n3 < length5; ++n3) {
  2596. final ItemStack is4 = armorContents5[n3];
  2597. if (is4 != null) {
  2598. for (final String enchant5 : this.getEnchantmentsOnItem(is4)) {
  2599. final String OEN5 = enchant5.split(" ")[0];
  2600. if (OEN5.equals("Heavy") || OEN5.equals("Marksman")) {
  2601. final int chance5 = this.getProckChance(OEN5, Integer.parseInt(enchant5.split(" ")[1]), victim3);
  2602. if (this.random.nextInt(100) > chance5) {
  2603. continue;
  2604. }
  2605. if (OEN5.equals("Heavy") && !heavy) {
  2606. heavy = true;
  2607. this.Heavy(event, victim3);
  2608. }
  2609. else {
  2610. if (!OEN5.equals("Marksman") || this.marksman.get(damager) == null) {
  2611. continue;
  2612. }
  2613. this.Marksman(event, this.marksman.get(damager));
  2614. this.marksman.remove(damager);
  2615. }
  2616. }
  2617. }
  2618. }
  2619. }
  2620. heavy = false;
  2621. if (this.unfocus.contains(victim3.getName())) {
  2622. event.setDamage(event.getDamage() * 0.5);
  2623. }
  2624. if (this.bowsp.contains(damager)) {
  2625. for (int i = 0; i < this.bowsp.size(); ++i) {
  2626. if (this.bowsp.get(i) == damager.getUniqueId()) {
  2627. for (final String enchant4 : this.getEnchantmentsOnItem(this.bows.get(i))) {
  2628. final String OEN4 = enchant4.split(" ")[0];
  2629. final int level4 = Integer.parseInt(enchant4.split(" ")[1]);
  2630. final int chance4 = this.getProckChance(OEN4, level4, damager);
  2631. if (this.random.nextInt(100) <= chance4) {
  2632. if (OEN4.equals("ArrowLifesteal")) {
  2633. this.ArrowLifesteal(victim3, damager);
  2634. }
  2635. else if (OEN4.equals("Longbow") && this.getItemInHand(victim3) != null && this.getItemInHand(victim3).getType().equals((Object)Material.BOW)) {
  2636. event.setDamage(event.getDamage() + level4);
  2637. }
  2638. else if (OEN4.equals("Piercing")) {
  2639. this.Piercing(event, level4);
  2640. }
  2641. else if (OEN4.equals("Snare")) {
  2642. this.Snare(victim3, level4);
  2643. }
  2644. else if (OEN4.equals("Sniper")) {
  2645. this.Sniper(event, damager, victim3, level4);
  2646. }
  2647. else {
  2648. if (!OEN4.equals("Unfocus") || this.unfocus.contains(victim3.getName())) {
  2649. continue;
  2650. }
  2651. this.unfocus.add(victim3.getName());
  2652. this.sendStringListMessage(victim3.getUniqueId(), this.enchantmessages[50], 0.0);
  2653. this.getAndPlaySound(victim3, victim3.getLocation(), "enchants.Unfocus", false);
  2654. this.getAndPlaySound(damager, damager.getLocation(), "enchants.Unfocus", false);
  2655. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  2656. @Override
  2657. public void run() {
  2658. if (victim3.isOnline()) {
  2659. CustomEnchantments.this.unfocus.remove(victim3.getName());
  2660. CustomEnchantments.this.sendStringListMessage(victim3.getUniqueId(), CustomEnchantments.this.enchantmessages[51], 0.0);
  2661. }
  2662. }
  2663. }, (long)(20 * level4 * 2));
  2664. }
  2665. }
  2666. }
  2667. }
  2668. }
  2669. }
  2670. return;
  2671. }
  2672. if (event.getEntity() instanceof LivingEntity && event.getEntity().getCustomName() != null && event.getEntity().getType().equals((Object)EntityType.IRON_GOLEM) && event.getDamager().getType().name().endsWith("ARROW") && ((Projectile)event.getDamager()).getShooter() instanceof Player && this.bowsp.contains(((Projectile)event.getDamager()).getShooter())) {
  2673. for (int j = 0; j < this.bowsp.size(); ++j) {
  2674. if (this.bowsp.get(j) == ((Player)((Projectile)event.getDamager()).getShooter()).getUniqueId()) {
  2675. for (final String enchant6 : this.getEnchantmentsOnItem(this.bows.get(j))) {
  2676. final String OEN6 = enchant6.split(" ")[0];
  2677. if (OEN6.equals("Hijack") && this.random.nextInt(100) <= this.getProckChance(OEN6, Integer.parseInt(enchant6.split(" ")[1]), (Player)((Projectile)event.getDamager()).getShooter())) {
  2678. for (final Player players : Bukkit.getWorld(event.getEntity().getWorld().getName()).getPlayers()) {
  2679. if (ChatColor.stripColor(event.getEntity().getCustomName()).contains(players.getName())) {
  2680. this.Hijack((IronGolem)event.getEntity(), (Player)((Projectile)event.getDamager()).getShooter(), players);
  2681. return;
  2682. }
  2683. }
  2684. }
  2685. }
  2686. }
  2687. }
  2688. }
  2689. }
  2690.  
  2691. public List<String> getBookLore(final String OEN) {
  2692. return (List<String>)this.enchantmentsInfo.getStringList(String.valueOf(OEN) + ".lore");
  2693. }
  2694.  
  2695. public String getEnchantmentType(final String OEN) {
  2696. return this.enchantmentsInfo.getString(String.valueOf(OEN) + ".enchant-type").toLowerCase();
  2697. }
  2698.  
  2699. public ItemStack formatBookLore(final ItemStack is, final String enchant, final int successPercent, final int destroyPercent) {
  2700. if (this.enchantmentsInfo == null) {
  2701. this.enchantmentsInfo = (FileConfiguration)YamlConfiguration.loadConfiguration(new File(this.randompackage.getDataFolder() + File.separator + "Custom Enchantments" + File.separator, "info.yml"));
  2702. }
  2703. if (is != null && is.hasItemMeta() && is.getItemMeta().hasLore() && is.getItemMeta().hasDisplayName() && enchant != null) {
  2704. this.itemMeta = is.getItemMeta();
  2705. this.lore.clear();
  2706. this.itemMeta.setDisplayName(enchant);
  2707. final String OEN = this.getOriginalEnchantmentName(enchant);
  2708. for (String string : this.itemMeta.getLore()) {
  2709. if (string.equals("{SUCCESS}")) {
  2710. string = this.SUCCESS.replace("{PERCENT}", new StringBuilder().append(successPercent).toString());
  2711. }
  2712. else if (string.equals("{DESTROY}")) {
  2713. string = this.DESTROY.replace("{PERCENT}", new StringBuilder().append(destroyPercent).toString());
  2714. }
  2715. else if (string.equals("{APPLY}")) {
  2716. string = this.APPLY_TO_ITEM;
  2717. }
  2718. else if (string.equals("{BOOK_LORE}")) {
  2719. for (final String booklore : this.enchantmentsInfo.getStringList(String.valueOf(OEN) + ".lore")) {
  2720. this.lore.add(ChatColor.translateAlternateColorCodes('&', booklore));
  2721. }
  2722. }
  2723. else if (string.equals("{ENCHANT_TYPE}")) {
  2724. string = this.itemsConfig.getString("enchant-types." + this.getEnchantmentType(OEN));
  2725. }
  2726. if (!string.equals("{BOOK_LORE}")) {
  2727. this.lore.add(ChatColor.translateAlternateColorCodes('&', string));
  2728. }
  2729. }
  2730. this.itemMeta.setLore((List)this.lore);
  2731. this.lore.clear();
  2732. is.setItemMeta(this.itemMeta);
  2733. return is;
  2734. }
  2735. return null;
  2736. }
  2737.  
  2738. private void setItemInHand(final Player player, final ItemStack is) {
  2739. if (Bukkit.getVersion().contains("1.8")) {
  2740. v1_8.getInstance().setItemInHand(player, is);
  2741. }
  2742. else {
  2743. v1_9.getInstance().setItemInHand(player, is);
  2744. }
  2745. }
  2746.  
  2747. private void removeItem(final PlayerInteractEvent event, final int amount) {
  2748. if (this.getItemInHand(event.getPlayer()) != null) {
  2749. final ItemStack iih = this.getItemInHand(event.getPlayer());
  2750. if (iih.getAmount() - amount <= 0) {
  2751. this.setItemInHand(event.getPlayer(), new ItemStack(Material.AIR));
  2752. }
  2753. else {
  2754. iih.setAmount(iih.getAmount() - amount);
  2755. }
  2756. event.getPlayer().updateInventory();
  2757. }
  2758. }
  2759.  
  2760. @EventHandler
  2761. private void interactArmorEvent(final PlayerInteractEvent event) {
  2762. if (event.getItem() == null || event.getItem().getType().equals((Object)Material.AIR) || !event.getItem().hasItemMeta() || !event.getItem().getItemMeta().hasLore() || (!event.getItem().getType().name().endsWith("HELMET") && !event.getItem().getType().name().endsWith("CHESTPLATE") && !event.getItem().getType().name().endsWith("LEGGINGS") && !event.getItem().getType().name().endsWith("BOOTS"))) {
  2763. return;
  2764. }
  2765. if ((event.getItem().getType().name().endsWith("HELMET") && event.getPlayer().getInventory().getHelmet() == null) || (event.getItem().getType().name().endsWith("CHESTPLATE") && event.getPlayer().getInventory().getChestplate() == null) || (event.getItem().getType().name().endsWith("LEGGINGS") && event.getPlayer().getInventory().getLeggings() == null) || (event.getItem().getType().name().endsWith("BOOTS") && event.getPlayer().getInventory().getBoots() == null)) {
  2766. if (event.getAction().equals((Object)Action.RIGHT_CLICK_AIR) || event.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK)) {
  2767. if (event.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK) && this.mcmmo != null && (event.getClickedBlock().getType().equals((Object)Material.GOLD_BLOCK) || event.getClickedBlock().getType().equals((Object)Material.IRON_BLOCK))) {
  2768. return;
  2769. }
  2770. final ItemStack item = event.getItem();
  2771. Bukkit.getScheduler().scheduleSyncDelayedTask(RandomPackage.getPlugin, (Runnable)new Runnable() {
  2772. @Override
  2773. public void run() {
  2774. if (CustomEnchantments.this.getItemInHand(event.getPlayer()).equals((Object)item)) {
  2775. return;
  2776. }
  2777. for (final String enchant : CustomEnchantments.this.getEnchantmentsOnItem(item)) {
  2778. final String OEN = enchant.split(" ")[0];
  2779. if (CustomEnchantments.this.potioneffectEnchants.contains(OEN)) {
  2780. CustomEnchantments.this.potionEffects(event.getPlayer(), enchant, false);
  2781. }
  2782. }
  2783. }
  2784. }, 1L);
  2785. }
  2786. }
  2787. else if (event.isCancelled() && event.getItem() != null && event.getAction().name().contains("RIGHT_CLICK") && ((event.getItem().getType().name().endsWith("HELMET") && event.getPlayer().getInventory().getHelmet() != null) || (event.getItem().getType().name().endsWith("CHESTPLATE") && event.getPlayer().getInventory().getChestplate() != null) || (event.getItem().getType().name().endsWith("LEGGINGS") && event.getPlayer().getInventory().getLeggings() != null) || (event.getItem().getType().name().endsWith("BOOTS") && event.getPlayer().getInventory().getBoots() != null))) {
  2788. final List<String> enchantsonitem = this.getEnchantmentsOnItem(event.getItem());
  2789. List<String> enchantsonarmor = null;
  2790. if (event.getItem().getType().name().endsWith("HELMET")) {
  2791. this.item = event.getPlayer().getInventory().getHelmet();
  2792. }
  2793. else if (event.getItem().getType().name().endsWith("CHESTPLATE")) {
  2794. this.item = event.getPlayer().getInventory().getChestplate();
  2795. }
  2796. else if (event.getItem().getType().name().endsWith("LEGGINGS")) {
  2797. this.item = event.getPlayer().getInventory().getLeggings();
  2798. }
  2799. else if (event.getItem().getType().name().endsWith("BOOTS")) {
  2800. this.item = event.getPlayer().getInventory().getBoots();
  2801. }
  2802. enchantsonarmor = this.getEnchantmentsOnItem(this.item);
  2803. for (final String enchant : enchantsonarmor) {
  2804. if (this.potioneffectEnchants.contains(enchant.split(" ")[0])) {
  2805. this.potionEffects(event.getPlayer(), enchant, true);
  2806. }
  2807. }
  2808. for (final String enchant : enchantsonitem) {
  2809. if (this.potioneffectEnchants.contains(enchant.split(" ")[0])) {
  2810. this.potionEffects(event.getPlayer(), enchant, false);
  2811. }
  2812. }
  2813. if (event.getItem().getType().name().endsWith("HELMET")) {
  2814. event.getPlayer().getInventory().setHelmet(event.getItem());
  2815. }
  2816. else if (event.getItem().getType().name().endsWith("CHESTPLATE")) {
  2817. event.getPlayer().getInventory().setChestplate(event.getItem());
  2818. }
  2819. else if (event.getItem().getType().name().endsWith("LEGGINGS")) {
  2820. event.getPlayer().getInventory().setLeggings(event.getItem());
  2821. }
  2822. else if (event.getItem().getType().name().endsWith("BOOTS")) {
  2823. event.getPlayer().getInventory().setBoots(event.getItem());
  2824. }
  2825. this.setItemInHand(event.getPlayer(), this.item);
  2826. event.getPlayer().updateInventory();
  2827. }
  2828. }
  2829.  
  2830. @EventHandler
  2831. private void playerInteractEvent(final PlayerInteractEvent event) {
  2832. if (event.getItem() != null && event.getItem().hasItemMeta() && event.getItem().getItemMeta().hasLore()) {
  2833. final ItemStack fireball = this.getFireballRarity(event.getItem());
  2834. final String revealitemrarity = this.getRevealItemRarity(event.getItem());
  2835. if (event.getItem().getItemMeta().hasDisplayName() && this.allcustomenchantments.contains(event.getItem().getItemMeta().getDisplayName())) {
  2836. this.sendStringListMessage(event.getPlayer().getUniqueId(), this.applyinfo, 0.0);
  2837. event.setCancelled(true);
  2838. }
  2839. else if (fireball != null) {
  2840. event.setCancelled(true);
  2841. this.removeItem(event, 1);
  2842. this.item = fireball.clone();
  2843. this.itemMeta = this.item.getItemMeta();
  2844. this.lore.clear();
  2845. if (!this.item.equals((Object)this.items[20])) {
  2846. this.getAndPlaySound(event.getPlayer(), event.getPlayer().getLocation(), "dust.reveal-dust", false);
  2847. for (int i = 1; i <= 15; ++i) {
  2848. event.getPlayer().getWorld().playEffect(event.getPlayer().getEyeLocation(), Effect.SPELL, 1);
  2849. }
  2850. }
  2851. else {
  2852. this.getAndPlaySound(event.getPlayer(), event.getPlayer().getLocation(), "dust.reveal-mystery-dust", false);
  2853. for (int i = 1; i <= 15; ++i) {
  2854. event.getPlayer().getWorld().playEffect(event.getPlayer().getEyeLocation(), Effect.LAVA_POP, 1);
  2855. }
  2856. }
  2857. final int randomprimal = this.getRandomPrimalPercent();
  2858. final int randomregular = this.getRandomDustPercent();
  2859. for (String string : this.itemMeta.getLore()) {
  2860. if (string.contains("{PERCENT}")) {
  2861. if (this.regulardust.values().contains(this.item)) {
  2862. string = string.replace("{PERCENT}", new StringBuilder().append(randomregular).toString());
  2863. }
  2864. else {
  2865. string = string.replace("{PERCENT}", new StringBuilder().append(randomprimal).toString());
  2866. }
  2867. }
  2868. this.lore.add(string);
  2869. }
  2870. this.itemMeta.setLore((List)this.lore);
  2871. this.lore.clear();
  2872. this.item.setItemMeta(this.itemMeta);
  2873. this.giveItem(event.getPlayer(), this.item);
  2874. }
  2875. else if (revealitemrarity != null) {
  2876. event.setCancelled(true);
  2877. ArrayList<String> enchantments = null;
  2878. String enchant = null;
  2879. if (revealitemrarity.equals("random")) {
  2880. enchantments = this.customenchantments.get(this.customenchantments.keySet().toArray()[this.random.nextInt(this.customenchantments.size())]);
  2881. }
  2882. else {
  2883. enchantments = this.customenchantments.get(revealitemrarity);
  2884. }
  2885. if (enchantments.size() == 0) {
  2886. return;
  2887. }
  2888. enchant = enchantments.get(this.random.nextInt(enchantments.size()));
  2889. this.item = this.getBook(enchant, this.getEnchantmentLevel(enchant), this.random.nextInt(101), this.random.nextInt(101));
  2890. this.removeItem(event.getPlayer(), event.getItem(), 1);
  2891. this.giveItem(event.getPlayer(), this.item);
  2892. for (String string : this.revealitemsmessages.get(revealitemrarity)) {
  2893. if (string.contains("{BOOK_NAME}")) {
  2894. string = string.replace("{BOOK_NAME}", enchant);
  2895. }
  2896. event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', string));
  2897. }
  2898. if (this.shootfireworks) {
  2899. final Firework fw = (Firework)event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), (Class)Firework.class);
  2900. final FireworkMeta fwm = fw.getFireworkMeta();
  2901. String[] string2 = null;
  2902. string2 = this.revealeditemsfirework.get(revealitemrarity).toLowerCase().replace(" ", "").split("\\:");
  2903. fwm.addEffects(new FireworkEffect[] { FireworkEffect.builder().trail(true).flicker(true).with(FireworkEffect.Type.valueOf(string2[0].toUpperCase())).withColor(this.getColor(string2[1])).withFade(this.getColor(string2[2])).withFlicker().withTrail().build() });
  2904. fwm.setPower(Integer.parseInt(string2[3]));
  2905. fw.setFireworkMeta(fwm);
  2906. }
  2907. }
  2908. else if (event.getItem().getItemMeta().getLore().equals(this.items[22].getItemMeta().getLore())) {
  2909. event.setCancelled(true);
  2910. if (this.soulmode.contains(event.getPlayer().getUniqueId())) {
  2911. this.soulmode.remove(event.getPlayer().getUniqueId());
  2912. this.sendStringListMessage(event.getPlayer().getUniqueId(), this.soulmodedeactivatedInteract, 0.0);
  2913. }
  2914. else if (this.getRemainingIntFromString(event.getItem().getItemMeta().getDisplayName()) <= 0) {
  2915. this.sendStringListMessage(event.getPlayer().getUniqueId(), this.soulmodedeactivatedRanOut, 0.0);
  2916. }
  2917. else {
  2918. this.soulmode.add(event.getPlayer().getUniqueId());
  2919. this.getAndPlaySound(event.getPlayer(), event.getPlayer().getLocation(), "soul-mode.enter", false);
  2920. this.sendStringListMessage(event.getPlayer().getUniqueId(), this.soulmodeactivate, 0.0);
  2921. }
  2922. }
  2923. else {
  2924. if (!event.getItem().getType().name().endsWith("AXE") && !event.getItem().getType().name().endsWith("SPADE")) {
  2925. return;
  2926. }
  2927. for (final String enchant2 : this.getEnchantmentsOnItem(event.getItem())) {
  2928. final String OEN = enchant2.split(" ")[0];
  2929. if (OEN.equals("Haste") || OEN.equals("ObsidianDestroyer")) {
  2930. final int level = Integer.parseInt(enchant2.split(" ")[1]);
  2931. final int chance = this.getProckChance(OEN, level, event.getPlayer());
  2932. if (this.random.nextInt(100) > chance) {
  2933. continue;
  2934. }
  2935. if (OEN.equals("Haste")) {
  2936. this.Haste(event, level);
  2937. }
  2938. else {
  2939. if (!OEN.equals("ObsidianDestroyer") || this.fapi.blockIsProtected(event.getPlayer(), event.getClickedBlock())) {
  2940. continue;
  2941. }
  2942. this.ObsidianDestroyer(event, level);
  2943. }
  2944. }
  2945. }
  2946. }
  2947. event.getPlayer().updateInventory();
  2948. }
  2949. }
  2950.  
  2951. private int getRandomPrimalPercent() {
  2952. return 10 + this.random.nextInt(21);
  2953. }
  2954.  
  2955. private int getRandomDustPercent() {
  2956. return 1 + this.random.nextInt(9);
  2957. }
  2958.  
  2959. @EventHandler
  2960. private void playerDropItemEvent(final PlayerDropItemEvent event) {
  2961. if (!event.isCancelled() && this.soulmode.contains(event.getPlayer().getUniqueId()) && event.getItemDrop().getItemStack().hasItemMeta() && event.getItemDrop().getItemStack().getItemMeta().hasLore() && event.getItemDrop().getItemStack().getItemMeta().getLore().equals(this.items[22].getItemMeta().getLore())) {
  2962. this.soulmode.remove(event.getPlayer().getUniqueId());
  2963. this.sendStringListMessage(event.getPlayer().getUniqueId(), this.soulmodedeactivatedDropped, 0.0);
  2964. }
  2965. }
  2966.  
  2967. @EventHandler(priority = EventPriority.HIGHEST)
  2968. private void blockBreakEvent(final BlockBreakEvent event) {
  2969. if (event.isCancelled() || this.getItemInHand(event.getPlayer()) == null || !this.getItemInHand(event.getPlayer()).hasItemMeta() || !this.getItemInHand(event.getPlayer()).getItemMeta().hasLore() || event.getPlayer().getGameMode().equals((Object)GameMode.CREATIVE)) {
  2970. return;
  2971. }
  2972. final Player player = event.getPlayer();
  2973. for (final String enchant : this.getEnchantmentsOnItem(this.getItemInHand(event.getPlayer()))) {
  2974. final String OEN = enchant.split(" ")[0];
  2975. final int level = Integer.parseInt(enchant.split(" ")[1]);
  2976. final int chance = this.getProckChance(OEN, level, player);
  2977. if (this.random.nextInt(100) <= chance) {
  2978. if (OEN.equals("AutoSmelt")) {
  2979. this.AutoSmelt(event, event.getPlayer(), event.getBlock().getType(), level);
  2980. }
  2981. else if (OEN.equals("Detonate")) {
  2982. this.Detonate(event, player, event.getBlock().getType());
  2983. }
  2984. else if (OEN.equals("Experience")) {
  2985. this.Experience(event, player, level);
  2986. }
  2987. else if (OEN.equals("Oxygenate")) {
  2988. this.Oxygenate(player);
  2989. }
  2990. else {
  2991. if (!OEN.equals("Telepathy") || event.getBlock().getType().equals((Object)Material.MOB_SPAWNER)) {
  2992. continue;
  2993. }
  2994. for (final ItemStack is : event.getBlock().getDrops()) {
  2995. this.giveItem(player, is);
  2996. }
  2997. event.setCancelled(true);
  2998. event.getBlock().setType(Material.AIR);
  2999. }
  3000. }
  3001. }
  3002. }
  3003.  
  3004. @EventHandler
  3005. private void playerItemHeldEvent(final PlayerItemHeldEvent event) {
  3006. if (this.divineimmolation.contains(event.getPlayer().getUniqueId())) {
  3007. this.divineimmolation.remove(event.getPlayer().getUniqueId());
  3008. }
  3009. if (this.soulmode.contains(event.getPlayer().getUniqueId()) && event.getPlayer().getInventory().getItem(event.getNewSlot()) != null && event.getPlayer().getInventory().getItem(event.getNewSlot()).getType().name().endsWith("SWORD")) {
  3010. for (final String enchant : this.getEnchantmentsOnItem(event.getPlayer().getInventory().getItem(event.getNewSlot()))) {
  3011. if (enchant.split(" ")[0].equals("DivineImmolation")) {
  3012. this.divineimmolation.add(event.getPlayer().getUniqueId());
  3013. }
  3014. }
  3015. }
  3016. }
  3017.  
  3018. private void DivineImmolation(final EntityDamageByEntityEvent event, final int level) {
  3019. event.getEntity().setFireTicks(level * 20 + 40);
  3020. if (event.getEntity() instanceof Player) {
  3021. ((Damageable)event.getEntity()).damage(level * 1.5);
  3022. }
  3023. else {
  3024. ((Damageable)event.getEntity()).damage(level * 3.5);
  3025. }
  3026. for (final Entity entity : event.getEntity().getNearbyEntities(level * 1.5, level * 1.5, level * 1.5)) {
  3027. if (!(entity instanceof Player) || (entity instanceof Player && entity != event.getDamager() && this.fapi.relationIsEnemyOrNull((Player)event.getDamager(), (Player)entity))) {
  3028. entity.setFireTicks(level * 20 + 40);
  3029. if (entity instanceof Player) {
  3030. ((Damageable)entity).damage(level * 1.5);
  3031. }
  3032. else {
  3033. if (!(entity instanceof Damageable)) {
  3034. continue;
  3035. }
  3036. ((Damageable)entity).damage(level * 3.5);
  3037. }
  3038. }
  3039. }
  3040. }
  3041.  
  3042. private void Immortal(final Player victim, final ItemStack is) {
  3043. is.setDurability((short)(is.getDurability() - 1));
  3044. }
  3045.  
  3046. private void NaturesWrath(final EntityDamageByEntityEvent event, final Player victim, final int level) {
  3047. for (final Entity entity : victim.getNearbyEntities(45.0, 45.0, 45.0)) {
  3048. if ((entity instanceof Player && this.fapi.relationIsEnemyOrNull(victim, (Player)entity)) || (!(entity instanceof Player) && entity instanceof Damageable)) {
  3049. for (int i = 0; i <= 11; ++i) {
  3050. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3051. @Override
  3052. public void run() {
  3053. if (!entity.isDead()) {
  3054. victim.getWorld().strikeLightning(entity.getLocation());
  3055. }
  3056. }
  3057. }, (long)(20 * i));
  3058. }
  3059. if (!(entity instanceof Player)) {
  3060. continue;
  3061. }
  3062. final Player Player = (Player)entity;
  3063. Player.setWalkSpeed(0.0f);
  3064. this.sendStringListMessage(Player.getUniqueId(), this.enchantmessages[13], 0.0);
  3065. Bukkit.getScheduler().scheduleSyncDelayedTask(RandomPackage.getPlugin, (Runnable)new Runnable() {
  3066. @Override
  3067. public void run() {
  3068. Player.setWalkSpeed(0.2f);
  3069. }
  3070. }, 220L);
  3071. }
  3072. }
  3073. }
  3074.  
  3075. private void Phoenix(final EntityDamageByEntityEvent event, final Player victim, final int level) {
  3076. if (!this.phoenix.contains(victim)) {
  3077. this.phoenix.add(victim.getUniqueId());
  3078. event.setCancelled(true);
  3079. victim.setHealth(victim.getMaxHealth());
  3080. this.getAndPlaySound(victim, victim.getLocation(), "enchants.Phoenix", true);
  3081. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3082. @Override
  3083. public void run() {
  3084. CustomEnchantments.this.phoenix.remove(victim);
  3085. }
  3086. }, (long)(12000 - 1200 * level));
  3087. }
  3088. }
  3089.  
  3090. @EventHandler(priority = EventPriority.HIGHEST)
  3091. private void projectileLaunchEvent(final ProjectileLaunchEvent event) {
  3092. if (event.getEntityType().equals((Object)EntityType.ENDER_PEARL) && event.getEntity().getShooter() instanceof Player && this.Teleblock.contains(event.getEntity().getShooter())) {
  3093. event.setCancelled(true);
  3094. this.giveItem((Player)event.getEntity().getShooter(), new ItemStack(Material.ARROW, 1));
  3095. ((Player)event.getEntity().getShooter()).updateInventory();
  3096. }
  3097. }
  3098.  
  3099. private void Teleblock(final Player victim, final int level) {
  3100. if (!this.Teleblock.contains(victim)) {
  3101. this.Teleblock.add(victim.getUniqueId());
  3102. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3103. @Override
  3104. public void run() {
  3105. CustomEnchantments.this.Teleblock.remove(victim);
  3106. }
  3107. }, (long)(20 * level + 100));
  3108. }
  3109. if (victim.getInventory().first(Material.ENDER_PEARL) != -1) {
  3110. this.removeItem(victim, victim.getInventory().getItem(victim.getInventory().first(Material.ENDER_PEARL)), this.random.nextInt(12) + level);
  3111. }
  3112. }
  3113.  
  3114. private void depleteSouls(final Player player, final ItemStack is, final int currentSouls, int depleteBy) {
  3115. if (currentSouls - depleteBy <= 0) {
  3116. this.sendStringListMessage(player.getUniqueId(), this.soulmodedeactivatedRanOut, 0.0);
  3117. depleteBy = currentSouls;
  3118. this.soulmode.remove(player.getUniqueId());
  3119. }
  3120. (this.itemMeta = is.getItemMeta()).setDisplayName(this.itemMeta.getDisplayName().replace(new StringBuilder().append(currentSouls).toString(), new StringBuilder().append(currentSouls - depleteBy).toString()));
  3121. is.setItemMeta(this.itemMeta);
  3122. }
  3123.  
  3124. private ItemStack getSoulGemInPlayerInventory(final Player player, final boolean checkWholeInv) {
  3125. int size = 0;
  3126. if (checkWholeInv) {
  3127. size = player.getInventory().getSize();
  3128. }
  3129. else {
  3130. size = 9;
  3131. }
  3132. for (int i = 0; i < size; ++i) {
  3133. this.item = player.getInventory().getItem(i);
  3134. if (this.item != null && !this.item.getType().equals((Object)Material.AIR) && this.item.hasItemMeta() && this.item.getItemMeta().hasDisplayName() && this.item.getItemMeta().hasLore() && this.item.getItemMeta().getLore().equals(this.items[22].getItemMeta().getLore())) {
  3135. return this.item;
  3136. }
  3137. }
  3138. return null;
  3139. }
  3140.  
  3141. @EventHandler
  3142. private void entityShootBowEvent(final EntityShootBowEvent event) {
  3143. if (event.isCancelled() || !(event.getEntity() instanceof Player) || (Bukkit.getPluginManager().getPlugin("WorldEdit") != null && Bukkit.getPluginManager().getPlugin("WorldGuard") != null && !RP_WorldEditWorldGuard.getInstance().locationHasPvPAllowed(event.getEntity().getWorld(), event.getProjectile().getLocation()))) {
  3144. return;
  3145. }
  3146. final Player player = (Player)event.getEntity();
  3147. if (event.getBow().hasItemMeta() && event.getBow().getItemMeta().hasLore()) {
  3148. for (final String enchant : this.getEnchantmentsOnItem(event.getBow())) {
  3149. final String OEN = enchant.split(" ")[0];
  3150. final int level = Integer.parseInt(enchant.split(" ")[1]);
  3151. final int chance = this.getProckChance(OEN, Integer.parseInt(enchant.split(" ")[1]), player);
  3152. if ((this.random.nextInt(100) <= chance || OEN.equals("Teleblock")) && !OEN.equals("Cowification") && OEN.equals("Teleblock") && this.soulmode.contains(player.getUniqueId())) {
  3153. this.depleteSouls(player, this.item = this.getSoulGemInPlayerInventory(player, false), this.getRemainingIntFromString(this.item.getItemMeta().getDisplayName()), level * 6);
  3154. this.teleblock.put(player, event.getBow());
  3155. }
  3156. }
  3157. }
  3158. double marksmanDamage = 0.0;
  3159. ItemStack[] armorContents;
  3160. for (int length = (armorContents = player.getInventory().getArmorContents()).length, i = 0; i < length; ++i) {
  3161. final ItemStack is = armorContents[i];
  3162. if (is != null && is.hasItemMeta() && is.getItemMeta().hasLore()) {
  3163. for (final String enchant2 : this.getEnchantmentsOnItem(is)) {
  3164. final String OEN2 = enchant2.split(" ")[0];
  3165. final int level2 = Integer.parseInt(enchant2.split(" ")[1]);
  3166. if (OEN2.equals("Marksman")) {
  3167. marksmanDamage += level2 * 0.25;
  3168. }
  3169. }
  3170. }
  3171. }
  3172. if (marksmanDamage != 0.0) {
  3173. this.marksman.put(player, marksmanDamage);
  3174. }
  3175. this.bows.add(event.getBow());
  3176. this.bowsp.add(event.getEntity().getUniqueId());
  3177. }
  3178.  
  3179. @EventHandler
  3180. private void projectileHitEvent(final ProjectileHitEvent event) {
  3181. if (event.getEntity().getShooter() instanceof Player && event.getEntity().getType().name().contains("ARROW")) {
  3182. final Player shooter = (Player)event.getEntity().getShooter();
  3183. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3184. @Override
  3185. public void run() {
  3186. Entity h = null;
  3187. if (event.getEntity().getNearbyEntities(0.0, 0.0, 0.0).size() != 0) {
  3188. h = event.getEntity().getNearbyEntities(0.0, 0.0, 0.0).get(0);
  3189. }
  3190. if (shooter != null && CustomEnchantments.this.bowsp.contains(shooter.getUniqueId())) {
  3191. for (int i = 0; i < CustomEnchantments.this.bowsp.size(); ++i) {
  3192. if (CustomEnchantments.this.bowsp.get(i) == shooter.getUniqueId()) {
  3193. for (final String enchant : CustomEnchantments.this.getEnchantmentsOnItem(CustomEnchantments.this.bows.get(i))) {
  3194. final String OEN = enchant.split(" ")[0];
  3195. final int level = Integer.parseInt(enchant.split(" ")[1]);
  3196. final int chance = CustomEnchantments.this.getProckChance(OEN, level, shooter);
  3197. if (CustomEnchantments.this.random.nextInt(100) <= chance || (OEN.equals("Teleblock") && CustomEnchantments.this.soulmode.contains(shooter.getUniqueId()) && CustomEnchantments.this.teleblock.get(shooter) != null && event.getEntity().getNearbyEntities(0.0, 0.0, 0.0).size() >= 1 && event.getEntity().getNearbyEntities(0.0, 0.0, 0.0).get(0) instanceof Player)) {
  3198. if (OEN.equals("EagleEye") && h != null && h instanceof Player) {
  3199. CustomEnchantments.this.EagleEye((Player)h);
  3200. }
  3201. else if (OEN.equals("DimensionRift")) {
  3202. CustomEnchantments.this.DimensionRift(h, level);
  3203. }
  3204. else if (OEN.equals("Explosive")) {
  3205. CustomEnchantments.this.Explosive(event.getEntity().getLocation(), event.getEntity());
  3206. }
  3207. else if (OEN.equals("Hellfire")) {
  3208. CustomEnchantments.this.Hellfire(event.getEntity(), shooter, level);
  3209. }
  3210. else if (OEN.equals("Lightning")) {
  3211. CustomEnchantments.this.Lightning(event.getEntity().getLocation(), event.getEntity());
  3212. }
  3213. else {
  3214. if (!OEN.equals("Teleblock")) {
  3215. continue;
  3216. }
  3217. CustomEnchantments.this.Teleblock(event.getEntity().getNearbyEntities(0.0, 0.0, 0.0).get(0), level);
  3218. }
  3219. }
  3220. }
  3221. CustomEnchantments.this.marksman.remove(shooter);
  3222. CustomEnchantments.this.teleblock.remove(shooter);
  3223. CustomEnchantments.this.bowsp.remove(i);
  3224. CustomEnchantments.this.bows.remove(i);
  3225. return;
  3226. }
  3227. }
  3228. }
  3229. }
  3230. }, 1L);
  3231. }
  3232. }
  3233.  
  3234. @EventHandler
  3235. private void entityTargetLivingEntityEvent(final EntityTargetLivingEntityEvent event) {
  3236. if (event.getEntity().getCustomName() != null && event.getTarget() instanceof Player && ((event.getEntityType().equals((Object)EntityType.IRON_GOLEM) && event.getEntity().getCustomName().equals(this.guardiansname.replace("{PLAYER}", event.getTarget().getName()))) || (event.getEntityType().equals((Object)EntityType.ZOMBIE) && event.getEntity().getCustomName().equals(this.undeadrusename.replace("{PLAYER}", event.getTarget().getName()))) || (event.getEntityType().equals((Object)EntityType.BLAZE) && event.getEntity().getCustomName().equals(this.spiritsname.replace("{PLAYER}", event.getTarget().getName()))))) {
  3237. event.setCancelled(true);
  3238. }
  3239. }
  3240.  
  3241. private void Aegis(final EntityDamageByEntityEvent event, final Player damager, final int level) {
  3242. if (!this.aegis.keySet().contains(event.getEntity())) {
  3243. this.aegis.put((Player)event.getEntity(), new ArrayList<Player>());
  3244. }
  3245. if (!this.aegis.get(event.getEntity()).isEmpty() && this.aegis.get(event.getEntity()).contains(damager) && 8 - level >= this.aegis.get(event.getEntity()).size()) {
  3246. event.setDamage(event.getDamage() * this.doubles[2]);
  3247. }
  3248. else {
  3249. this.aegis.get(event.getEntity()).add(damager);
  3250. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3251. @Override
  3252. public void run() {
  3253. CustomEnchantments.this.aegis.get(event.getEntity()).remove(damager);
  3254. }
  3255. }, 200L);
  3256. }
  3257. }
  3258.  
  3259. private void Angelic(final Player victim, final int level) {
  3260. this.givePotionEffects(null, victim, "Angelic", level);
  3261. }
  3262.  
  3263. private void ArrowBreak(final EntityDamageByEntityEvent event, final Player victim) {
  3264. event.setCancelled(true);
  3265. event.getDamager().remove();
  3266. this.sendStringListMessage(victim.getUniqueId(), this.enchantmessages[1], 0.0);
  3267. this.getAndPlaySound(victim, victim.getLocation(), "enchants.ArrowBreak", true);
  3268. }
  3269.  
  3270. private void ArrowDeflect(final EntityDamageByEntityEvent event, final Player victim, final int level) {
  3271. if (this.arrowdeflect.contains(String.valueOf(victim.getName()) + level)) {
  3272. event.setCancelled(true);
  3273. }
  3274. else {
  3275. this.arrowdeflect.add(String.valueOf(victim.getName()) + level);
  3276. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3277. @Override
  3278. public void run() {
  3279. CustomEnchantments.this.arrowdeflect.remove(String.valueOf(victim.getName()) + level);
  3280. }
  3281. }, (long)(40 - (int)(0.4 * level)));
  3282. }
  3283. }
  3284.  
  3285. private void ArrowLifesteal(final Player victim, final Player damager) {
  3286. if (victim.getHealth() - 1.0 <= 0.0) {
  3287. victim.setHealth(0.0);
  3288. }
  3289. else {
  3290. victim.setHealth(victim.getHealth() - 1.0);
  3291. }
  3292. damager.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 20, 2));
  3293. this.getAndPlaySound(damager, damager.getLocation(), "enchants.ArrowLifesteal", false);
  3294. }
  3295.  
  3296. private void Armored(final Player victim, final Player damager, final int level, final EntityDamageByEntityEvent event) {
  3297. if (this.getItemInHand(damager) == null || !this.getItemInHand(damager).getType().name().endsWith("_SWORD")) {
  3298. return;
  3299. }
  3300. double dividedDamage = 0.0;
  3301. ItemStack[] armorContents;
  3302. for (int length = (armorContents = victim.getInventory().getArmorContents()).length, i = 0; i < length; ++i) {
  3303. final ItemStack item = armorContents[i];
  3304. for (final String enchant : this.getEnchantmentsOnItem(item)) {
  3305. if (enchant.split(" ")[0].equals("Armored")) {
  3306. dividedDamage += 1.85 * level;
  3307. }
  3308. }
  3309. }
  3310. event.setDamage(event.getDamage() / dividedDamage);
  3311. }
  3312.  
  3313. private void Assassin(final EntityDamageByEntityEvent event, final int level) {
  3314. if (event.getEntity().getLocation().distance(event.getDamager().getLocation()) <= this.doubles[3]) {
  3315. event.setDamage(event.getDamage() * (1.0 + level * this.doubles[4]));
  3316. }
  3317. else {
  3318. event.setDamage(event.getDamage() * this.doubles[5]);
  3319. }
  3320. }
  3321.  
  3322. private void AutoSmelt(final BlockBreakEvent event, final Player player, final Material material, int level) {
  3323. if (material.equals((Object)Material.GOLD_ORE) || material.equals((Object)Material.IRON_ORE)) {
  3324. event.setCancelled(true);
  3325. event.getBlock().setType(Material.AIR);
  3326. for (final Enchantment enchant : this.getItemInHand(player).getEnchantments().keySet()) {
  3327. if (enchant.equals((Object)Enchantment.LOOT_BONUS_BLOCKS)) {
  3328. int fortune = this.random.nextInt(this.getItemInHand(player).getEnchantmentLevel(enchant) + 1);
  3329. if (fortune == 0) {
  3330. fortune = 1;
  3331. }
  3332. level *= fortune;
  3333. }
  3334. }
  3335. this.giveItem(player, new ItemStack(Material.getMaterial(material.name().replace("ORE", "INGOT")), level, (short)0));
  3336. this.getAndPlaySound(player, event.getBlock().getLocation(), "enchants.AutoSmelt", true);
  3337. }
  3338. }
  3339.  
  3340. private void Barbarian(final EntityDamageByEntityEvent event, final int level, final Player player) {
  3341. if (event.getEntity() instanceof Player && this.getItemInHand((Player)event.getEntity()) != null && this.getItemInHand((Player)event.getEntity()).getType().name().endsWith("_AXE")) {
  3342. event.setDamage(event.getDamage() * (1.1 + level * 0.05));
  3343. this.getAndPlaySound(player, player.getLocation(), "enchants.Barbarian", true);
  3344. }
  3345. }
  3346.  
  3347. private void Berserk(final Player player, final int level) {
  3348. this.givePotionEffects(null, player, "Berserk", level);
  3349. }
  3350.  
  3351. private void Blacksmith(final EntityDamageByEntityEvent event, final Player damager, final int level) {
  3352. event.setDamage(event.getDamage() * 0.5);
  3353. final int amount = this.random.nextInt(2) + 1;
  3354. ItemStack piece = new ItemStack(Material.LEATHER_BOOTS, 1);
  3355. ItemStack[] armorContents;
  3356. for (int length = (armorContents = damager.getInventory().getArmorContents()).length, i = 0; i < length; ++i) {
  3357. final ItemStack is = armorContents[i];
  3358. if (is != null && is.getDurability() > piece.getDurability()) {
  3359. piece = is;
  3360. }
  3361. }
  3362. if (piece.getDurability() - amount < 0) {
  3363. piece.setDurability((short)0);
  3364. }
  3365. else {
  3366. piece.setDurability((short)(piece.getDurability() - amount));
  3367. }
  3368. this.sendStringListMessage(damager.getUniqueId(), this.enchantmessages[2], 0.0);
  3369. this.getAndPlaySound(damager, damager.getLocation(), "enchants.Blacksmith", true);
  3370. damager.updateInventory();
  3371. }
  3372.  
  3373. public void Blessed(final Player player) {
  3374. for (final PotionEffect pe : player.getActivePotionEffects()) {
  3375. final PotionEffectType type = pe.getType();
  3376. if (type.equals((Object)PotionEffectType.BLINDNESS) || type.equals((Object)PotionEffectType.CONFUSION) || type.equals((Object)PotionEffectType.HARM) || type.equals((Object)PotionEffectType.HUNGER) || type.equals((Object)PotionEffectType.POISON) || type.equals((Object)PotionEffectType.SLOW) || type.equals((Object)PotionEffectType.SLOW_DIGGING) || type.equals((Object)PotionEffectType.WEAKNESS) || type.equals((Object)PotionEffectType.WITHER) || (!Bukkit.getVersion().contains("1.8") && type.equals((Object)PotionEffectType.getByName("UNLUCK"))) || (!Bukkit.getVersion().contains("1.8") && type.equals((Object)PotionEffectType.getByName("LEVITATION"))) || (!Bukkit.getVersion().contains("1.8") && type.equals((Object)PotionEffectType.getByName("GLOWING")))) {
  3377. player.removePotionEffect(type);
  3378. }
  3379. }
  3380. this.sendStringListMessage(player.getUniqueId(), this.enchantmessages[3], 0.0);
  3381. }
  3382.  
  3383. private void Blind(final EntityDamageByEntityEvent event, final int level) {
  3384. ((LivingEntity)event.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20 * level + 40, level - 1));
  3385. }
  3386.  
  3387. private void BloodLink(final Player player) {
  3388. final int randomhealth = this.random.nextInt(2) + 1;
  3389. if (player.getHealth() + randomhealth <= player.getMaxHealth()) {
  3390. player.setHealth(player.getHealth() + randomhealth);
  3391. }
  3392. this.sendStringListMessage(player.getUniqueId(), this.enchantmessages[4], randomhealth);
  3393. }
  3394.  
  3395. private void Cactus(final LivingEntity damager, final int level) {
  3396. damager.damage((double)level);
  3397. }
  3398.  
  3399. private void Cleave(final Player damager, final LivingEntity victim, final int level, final EntityDamageByEntityEvent event) {
  3400. this.getAndPlaySound(damager, damager.getLocation(), "enchants.Cleave", true);
  3401. final String[] area = this.enchantments.getString("Cleave.area").replace("level", new StringBuilder().append(level).toString()).replace("\\s", "").replace(" ", "").split("\\:");
  3402. for (final Entity entity : victim.getNearbyEntities((double)this.evaluate(area[0]), (double)this.evaluate(area[1]), (double)this.evaluate(area[2]))) {
  3403. if ((!(entity instanceof Player) && entity instanceof Damageable) || (entity instanceof Player && this.fapi.relationIsEnemyOrNull(damager, (Player)entity))) {
  3404. ((Damageable)entity).damage(event.getFinalDamage() * 0.25);
  3405. if (!this.getItemInHand(damager).getItemMeta().hasEnchant(Enchantment.FIRE_ASPECT) || this.random.nextInt(100) > this.enchantments.getInt("Cleave.fire-aspect")) {
  3406. continue;
  3407. }
  3408. entity.setFireTicks(10 * level);
  3409. }
  3410. }
  3411. }
  3412.  
  3413. private void Commander(final Player player, final int level) {
  3414. player.getWorld().playEffect(new Location(player.getWorld(), player.getEyeLocation().getX(), player.getEyeLocation().getY() + 0.5, player.getEyeLocation().getZ()), Effect.STEP_SOUND, (Object)Material.DIAMOND_BLOCK);
  3415. final String[] string = this.enchantments.getString("Commander.area").toLowerCase().replace("level", new StringBuilder().append(level).toString()).replace(" ", "").split("\\:");
  3416. for (final Entity entity : player.getNearbyEntities((double)this.evaluate(string[0]), (double)this.evaluate(string[1]), (double)this.evaluate(string[2]))) {
  3417. if (entity instanceof Player && this.fapi.relationIsAlly(player, (Player)entity)) {
  3418. this.givePotionEffects(null, (Player)entity, "Commander", level);
  3419. }
  3420. }
  3421. }
  3422.  
  3423. private void Confusion(final Player victim, final int level) {
  3424. this.givePotionEffects(null, victim, "Confusion", level);
  3425. }
  3426.  
  3427. private void Cowification(final EntityShootBowEvent event) {
  3428. if (event.getForce() == 1.0f && event.getEntity() instanceof Player) {
  3429. event.getProjectile().setCustomName("CowificationArrow");
  3430. event.getProjectile().setCustomNameVisible(false);
  3431. final Cow cow = (Cow)event.getProjectile().getWorld().spawn(event.getProjectile().getLocation().add(0.0, 1.25, 0.0), (Class)Cow.class);
  3432. cow.setAgeLock(true);
  3433. cow.setVelocity(event.getProjectile().getVelocity());
  3434. cow.setCustomName("CowificationCow");
  3435. cow.setCustomNameVisible(false);
  3436. }
  3437. }
  3438.  
  3439. private void CreeperArmor(final EntityDamageByEntityEvent event, final Player victim, final int level) {
  3440. event.setDamage(event.getDamage() / level);
  3441. event.setCancelled(true);
  3442. }
  3443.  
  3444. private void Curse(final Player victim, final int level) {
  3445. this.givePotionEffects((LivingEntity)victim, null, "Curse", level);
  3446. }
  3447.  
  3448. private void Deathbringer(final Player victim, final int level) {
  3449. this.givePotionEffects(null, victim, "Deathbringer", level);
  3450. }
  3451.  
  3452. private void DeathGod(final EntityDamageByEntityEvent event, final int level) {
  3453. final Player victim = (Player)event.getEntity();
  3454. if (victim.getHealth() <= level + 4) {
  3455. event.setDamage(0.0);
  3456. victim.setHealth(victim.getHealth() + 5.0);
  3457. }
  3458. }
  3459.  
  3460. @EventHandler
  3461. private void playerDeathEvent(final PlayerDeathEvent event) {
  3462. if (this.bowsp.contains(event.getEntity())) {
  3463. for (int i = 0; i < this.bowsp.size(); ++i) {
  3464. if (this.bowsp.get(i).equals(event.getEntity())) {
  3465. this.bowsp.remove(i);
  3466. }
  3467. this.bows.remove(i);
  3468. }
  3469. }
  3470. if (this.soulmode.contains(event.getEntity().getUniqueId())) {
  3471. this.soulmode.remove(event.getEntity().getUniqueId());
  3472. }
  3473. if (this.divineimmolation.contains(event.getEntity().getUniqueId())) {
  3474. this.divineimmolation.remove(event.getEntity().getUniqueId());
  3475. }
  3476. if (event.getEntity().getKiller() instanceof Player && this.getItemInHand(event.getEntity().getKiller()) != null && this.getItemInHand(event.getEntity().getKiller()).hasItemMeta() && this.getItemInHand(event.getEntity().getKiller()).getItemMeta().hasLore()) {
  3477. this.item = this.getItemInHand(event.getEntity().getKiller());
  3478. for (final String enchant : this.getEnchantmentsOnItem(this.item)) {
  3479. final String OEN = enchant.split(" ")[0];
  3480. if (OEN.equals("Decapitation") || OEN.equals("Lifebloom")) {
  3481. final int level = Integer.parseInt(enchant.split(" ")[1]);
  3482. final int chance = this.getProckChance(OEN, level, event.getEntity());
  3483. if (this.random.nextInt(100) > chance) {
  3484. continue;
  3485. }
  3486. if (OEN.equals("Decapitation") || OEN.equals("Headless")) {
  3487. this.DecapitationHeadless(event.getEntity());
  3488. }
  3489. else {
  3490. if (!OEN.equals("Lifebloom")) {
  3491. continue;
  3492. }
  3493. this.Lifebloom(event.getEntity(), level);
  3494. }
  3495. }
  3496. }
  3497. }
  3498. }
  3499.  
  3500. private void DecapitationHeadless(final Player victim) {
  3501. this.item = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
  3502. final SkullMeta skullMeta = (SkullMeta)this.item.getItemMeta();
  3503. skullMeta.setOwner(victim.getName());
  3504. this.item.setItemMeta((ItemMeta)skullMeta);
  3505. victim.getWorld().dropItem(victim.getLocation(), this.item);
  3506. }
  3507.  
  3508. private void DeepWounds(final EntityDamageByEntityEvent event, final Player victim, final int level) {
  3509. this.givePotionEffects(null, victim, "DeepWounds", level);
  3510. }
  3511.  
  3512. private void Demonforged(final Player victim, final int level, final int chance) {
  3513. ItemStack[] armorContents;
  3514. for (int length = (armorContents = victim.getInventory().getArmorContents()).length, i = 0; i < length; ++i) {
  3515. final ItemStack item = armorContents[i];
  3516. if (item != null) {
  3517. item.setDurability((short)(item.getDurability() - Math.subtractExact(chance, 9)));
  3518. }
  3519. }
  3520. this.getAndPlaySound(victim, victim.getLocation(), "enchants.Demonforged", false);
  3521. }
  3522.  
  3523. private void Detonate(final BlockBreakEvent event, final Player player, Material material) {
  3524. for (int i = 1; i <= 7; ++i) {
  3525. Location loc = new Location(event.getPlayer().getWorld(), 0.0, 0.0, 0.0);
  3526. if (i == 1) {
  3527. material = event.getBlock().getType();
  3528. loc = event.getBlock().getLocation();
  3529. }
  3530. else if (i == 2) {
  3531. material = event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().getBlockX(), event.getBlock().getLocation().getBlockY() + 1, event.getBlock().getLocation().getBlockZ()).getType();
  3532. loc = new Location(event.getBlock().getWorld(), (double)event.getBlock().getLocation().getBlockX(), (double)(event.getBlock().getLocation().getBlockY() + 1), (double)event.getBlock().getLocation().getBlockZ());
  3533. }
  3534. else if (i == 3) {
  3535. material = event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().getBlockX(), event.getBlock().getLocation().getBlockY() - 1, event.getBlock().getLocation().getBlockZ()).getType();
  3536. loc = new Location(event.getBlock().getWorld(), (double)event.getBlock().getLocation().getBlockX(), (double)(event.getBlock().getLocation().getBlockY() - 1), (double)event.getBlock().getLocation().getBlockZ());
  3537. }
  3538. else if (i == 4) {
  3539. material = event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().getBlockX() + 1, event.getBlock().getLocation().getBlockY(), event.getBlock().getLocation().getBlockZ()).getType();
  3540. loc = new Location(event.getBlock().getWorld(), (double)(event.getBlock().getLocation().getBlockX() + 1), (double)event.getBlock().getLocation().getBlockY(), (double)event.getBlock().getLocation().getBlockZ());
  3541. }
  3542. else if (i == 5) {
  3543. material = event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().getBlockX() - 1, event.getBlock().getLocation().getBlockY(), event.getBlock().getLocation().getBlockZ()).getType();
  3544. loc = new Location(event.getBlock().getWorld(), (double)(event.getBlock().getLocation().getBlockX() - 1), (double)event.getBlock().getLocation().getBlockY(), (double)event.getBlock().getLocation().getBlockZ());
  3545. }
  3546. else if (i == 6) {
  3547. material = event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().getBlockX(), event.getBlock().getLocation().getBlockY(), event.getBlock().getLocation().getBlockZ() + 1).getType();
  3548. loc = new Location(event.getBlock().getWorld(), (double)event.getBlock().getLocation().getBlockX(), (double)event.getBlock().getLocation().getBlockY(), (double)(event.getBlock().getLocation().getBlockZ() + 1));
  3549. }
  3550. else if (i == 7) {
  3551. material = event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().getBlockX(), event.getBlock().getLocation().getBlockY(), event.getBlock().getLocation().getBlockZ() - 1).getType();
  3552. loc = new Location(event.getBlock().getWorld(), (double)event.getBlock().getLocation().getBlockX(), (double)event.getBlock().getLocation().getBlockY(), (double)(event.getBlock().getLocation().getBlockZ() - 1));
  3553. }
  3554. if (this.detonate.contains(material.name())) {
  3555. return;
  3556. }
  3557. loc.getWorld().getBlockAt(loc).breakNaturally();
  3558. loc.getWorld().playEffect(event.getBlock().getLocation(), Effect.EXPLOSION_LARGE, 1);
  3559. this.getAndPlaySound(player, event.getBlock().getLocation(), "enchants.Detonate", true);
  3560. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "execute " + event.getPlayer().getName() + " ~ ~ ~ particle flame " + loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ() + " 0.25 0.5 0.25 0 25");
  3561. }
  3562. }
  3563.  
  3564. private void DimensionRift(final Entity entity, final int level) {
  3565. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3566. @Override
  3567. public void run() {
  3568. final Location loc = new Location(entity.getWorld(), (double)entity.getLocation().getBlockX(), (double)(entity.getLocation().getBlockY() - 1), (double)entity.getLocation().getBlockZ());
  3569. final Location loc2 = new Location(entity.getWorld(), (double)entity.getLocation().getBlockX(), (double)entity.getLocation().getBlockY(), (double)entity.getLocation().getBlockZ());
  3570. final Material prev = entity.getWorld().getBlockAt(loc).getType();
  3571. final Material prev2 = entity.getWorld().getBlockAt(loc2).getType();
  3572. boolean did = false;
  3573. if (CustomEnchantments.this.random.nextInt(100) <= CustomEnchantments.this.doubles[13]) {
  3574. did = true;
  3575. }
  3576. entity.getWorld().getBlockAt(loc).setType(Material.SOUL_SAND);
  3577. if (did) {
  3578. entity.getWorld().getBlockAt(loc2).setType(Material.WEB);
  3579. }
  3580. final boolean o = did;
  3581. Bukkit.getScheduler().scheduleSyncDelayedTask(CustomEnchantments.this.randompackage, (Runnable)new Runnable() {
  3582. @Override
  3583. public void run() {
  3584. entity.getWorld().getBlockAt(loc).setType(Material.AIR);
  3585. entity.getWorld().getBlockAt(loc).setType(prev);
  3586. if (o) {
  3587. entity.getWorld().getBlockAt(loc2).setType(Material.AIR);
  3588. entity.getWorld().getBlockAt(loc2).setType(prev2);
  3589. }
  3590. }
  3591. }, (long)(int)(20.0 * CustomEnchantments.this.doubles[14]));
  3592. }
  3593. }, 20L);
  3594. }
  3595.  
  3596. private void Diminish(final EntityDamageByEntityEvent event) {
  3597. }
  3598.  
  3599. private void Disarmor(final Player victim) {
  3600. final int randomarmor = this.random.nextInt(4);
  3601. if (randomarmor == 0 && victim.getInventory().getHelmet() != null && !victim.getInventory().getHelmet().getType().equals((Object)Material.AIR)) {
  3602. this.item = victim.getInventory().getHelmet();
  3603. victim.getInventory().setHelmet(new ItemStack(Material.AIR));
  3604. }
  3605. else if (randomarmor == 1 && victim.getInventory().getChestplate() != null && !victim.getInventory().getChestplate().getType().equals((Object)Material.AIR)) {
  3606. this.item = victim.getInventory().getChestplate();
  3607. victim.getInventory().setChestplate(new ItemStack(Material.AIR));
  3608. }
  3609. else if (randomarmor == 2 && victim.getInventory().getLeggings() != null && !victim.getInventory().getLeggings().getType().equals((Object)Material.AIR)) {
  3610. this.item = victim.getInventory().getLeggings();
  3611. victim.getInventory().setLeggings(new ItemStack(Material.AIR));
  3612. }
  3613. else {
  3614. if (randomarmor != 3 || victim.getInventory().getBoots() == null || victim.getInventory().getBoots().getType().equals((Object)Material.AIR)) {
  3615. return;
  3616. }
  3617. this.item = victim.getInventory().getBoots();
  3618. victim.getInventory().setBoots(new ItemStack(Material.AIR));
  3619. }
  3620. if (this.item.hasItemMeta() && this.item.getItemMeta().hasLore()) {
  3621. for (final String enchant : this.getEnchantmentsOnItem(this.item)) {
  3622. final String OEN = enchant.split(" ")[0];
  3623. if (this.potioneffectEnchants.contains(OEN)) {
  3624. this.potionEffects(victim, OEN, true);
  3625. }
  3626. }
  3627. }
  3628. this.getAndPlaySound(victim, victim.getLocation(), "enchants.Disarmor", false);
  3629. this.sendStringListMessage(victim.getUniqueId(), this.enchantmessages[5], 0.0);
  3630. this.giveItem(victim, this.item);
  3631. }
  3632.  
  3633. private void Dodge(final Player victim, final EntityDamageByEntityEvent event) {
  3634. event.setCancelled(true);
  3635. this.sendStringListMessage(victim.getUniqueId(), this.enchantmessages[6], 0.0);
  3636. this.getAndPlaySound(victim, victim.getLocation(), "enchants.Dodge", true);
  3637. }
  3638.  
  3639. private void Dominate(final EntityDamageByEntityEvent event, final int level) {
  3640. this.dominate.add(event.getEntity().getUniqueId());
  3641. final int j = this.dominatee.size();
  3642. this.dominatee.add(level);
  3643. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3644. @Override
  3645. public void run() {
  3646. CustomEnchantments.this.dominate.remove(event.getEntity().getUniqueId());
  3647. CustomEnchantments.this.dominatee.remove(j);
  3648. }
  3649. }, (long)(20 * level * this.doubles[7]));
  3650. }
  3651.  
  3652. private void EagleEye(final Player victim) {
  3653. final short r = (short)(1 + this.random.nextInt((int)(Object)this.doubles[8] - 1));
  3654. ItemStack[] armorContents;
  3655. for (int length = (armorContents = victim.getInventory().getArmorContents()).length, i = 0; i < length; ++i) {
  3656. final ItemStack is = armorContents[i];
  3657. if (is != null) {
  3658. is.setDurability((short)(is.getDurability() + r));
  3659. }
  3660. }
  3661. }
  3662.  
  3663. private void EnderShift(final Player victim, final int level) {
  3664. this.givePotionEffects(null, victim, "EnderShift", level);
  3665. }
  3666.  
  3667. private void Enlighted(final Player victim) {
  3668. if (victim.getHealth() + 2.0 <= victim.getMaxHealth()) {
  3669. victim.setHealth(victim.getHealth() + 2.0);
  3670. }
  3671. }
  3672.  
  3673. @EventHandler
  3674. private void EnderWalker(final EntityDamageEvent event) {
  3675. if (event.isCancelled() || !(event.getEntity() instanceof Player) || (!event.getCause().equals((Object)EntityDamageEvent.DamageCause.POISON) && !event.getCause().equals((Object)EntityDamageEvent.DamageCause.WITHER))) {
  3676. return;
  3677. }
  3678. final Player player = (Player)event.getEntity();
  3679. if (player.getInventory().getBoots() != null) {
  3680. for (final String enchant : this.getEnchantmentsOnItem(player.getInventory().getBoots())) {
  3681. if (enchant.split(" ")[0].equals("EnderWalker")) {
  3682. final int level = Integer.parseInt(enchant.split(" ")[1]);
  3683. event.setCancelled(true);
  3684. if (this.random.nextInt(100) > this.getProckChance("EnderWalker", level, player) || player.getHealth() + level > player.getMaxHealth()) {
  3685. continue;
  3686. }
  3687. player.setHealth(player.getHealth() + level);
  3688. }
  3689. }
  3690. }
  3691. }
  3692.  
  3693. private void Enrage(final EntityDamageByEntityEvent event, final Player damager, final int level) {
  3694. final double multiplier = (damager.getMaxHealth() - damager.getHealth()) / 3.0;
  3695. if (multiplier == 0.0) {
  3696. return;
  3697. }
  3698. if (multiplier < 1.0) {
  3699. event.setDamage(event.getDamage() * (1.0 + multiplier));
  3700. }
  3701. else {
  3702. event.setDamage(event.getDamage() * multiplier / 2.0);
  3703. }
  3704. }
  3705.  
  3706. private void Epicness(final Player victim, final int level) {
  3707. if (level == 1) {
  3708. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "execute " + victim.getName() + " ~ ~ ~ particle largesmoke " + victim.getLocation().getX() + " " + victim.getLocation().getY() + " " + victim.getLocation().getZ() + " 0.5 1 0.5 1 25 1");
  3709. }
  3710. else if (level == 2) {
  3711. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "execute " + victim.getName() + " ~ ~ ~ particle magicCrit " + victim.getLocation().getX() + " " + victim.getLocation().getY() + " " + victim.getLocation().getZ() + " 0.5 1 0.5 1 25 1");
  3712. }
  3713. else if (level == 3) {
  3714. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "execute " + victim.getName() + " ~ ~ ~ particle cloud " + victim.getLocation().getX() + " " + victim.getLocation().getY() + " " + victim.getLocation().getZ() + " 0.5 1 0.5 1 25 1");
  3715. }
  3716. }
  3717.  
  3718. private void Execute(final Player player, final int level) {
  3719. this.givePotionEffects((LivingEntity)player, null, "Execute", level);
  3720. }
  3721.  
  3722. private void Experience(final BlockBreakEvent event, final Player player, final int level) {
  3723. int mulitplier = this.random.nextInt(level + 1);
  3724. if (mulitplier == 0) {
  3725. mulitplier = 1;
  3726. }
  3727. event.setExpToDrop(event.getExpToDrop() * mulitplier);
  3728. }
  3729.  
  3730. private void Explosive(final Location location, final Projectile proj) {
  3731. location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), 2.0f, false, false);
  3732. proj.remove();
  3733. }
  3734.  
  3735. private void Farcast(final LivingEntity damager, final int level) {
  3736. final double knockback = level * 0.25;
  3737. damager.setVelocity(new Vector(-damager.getEyeLocation().getDirection().getX() + knockback, 0.0, -damager.getEyeLocation().getDirection().getZ() + knockback));
  3738. }
  3739.  
  3740. private void Featherweight(final Player player, final int level) {
  3741. this.givePotionEffects((LivingEntity)player, null, "Featherweight", level);
  3742. }
  3743.  
  3744. private void Frozen(final Player victim, final int level) {
  3745. this.givePotionEffects(null, victim, "Frozen", level);
  3746. }
  3747.  
  3748. private void Greatsword(final EntityDamageByEntityEvent event, final Player victim, final int level) {
  3749. final double damage = event.getDamage() * (1.0 + level * 0.15);
  3750. if (this.getItemInHand(victim) != null && this.getItemInHand(victim).getType().equals((Object)Material.BOW)) {
  3751. if (victim.getHealth() - damage > 0.0) {
  3752. event.setDamage(damage);
  3753. }
  3754. else {
  3755. victim.setHealth(0.0);
  3756. }
  3757. }
  3758. }
  3759.  
  3760. private void Guardians(final EntityDamageByEntityEvent event, final Player victim, final int level) {
  3761. final IronGolem ig = (IronGolem)victim.getWorld().spawnEntity(victim.getLocation(), EntityType.IRON_GOLEM);
  3762. ig.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 99999, 4, false));
  3763. ig.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 99999, 4, false));
  3764. ig.setCustomName(this.guardiansname.replace("{PLAYER}", victim.getName()));
  3765. if (event.getDamager() instanceof LivingEntity) {
  3766. ig.setTarget((LivingEntity)event.getDamager());
  3767. }
  3768. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3769. @Override
  3770. public void run() {
  3771. if (!ig.isDead()) {
  3772. ig.remove();
  3773. }
  3774. }
  3775. }, 320L);
  3776. }
  3777.  
  3778. @EventHandler
  3779. private void HardenedReforged(final PlayerItemDamageEvent event) {
  3780. if (!event.isCancelled() && event.getItem() != null && event.getItem().hasItemMeta() && event.getItem().getItemMeta().hasLore()) {
  3781. for (final String enchant : this.getEnchantmentsOnItem(event.getItem())) {
  3782. final String OEN = enchant.split(" ")[0];
  3783. if ((OEN.equals("Hardened") || OEN.equals("Reforged")) && this.random.nextInt(100) <= this.getProckChance(OEN, Integer.parseInt(enchant.split(" ")[1]), event.getPlayer())) {
  3784. event.setCancelled(true);
  3785. }
  3786. }
  3787. }
  3788. }
  3789.  
  3790. private void Haste(final PlayerInteractEvent event, final int level) {
  3791. this.givePotionEffects((LivingEntity)event.getPlayer(), null, "Haste", level);
  3792. }
  3793.  
  3794. private void Heavy(final EntityDamageByEntityEvent event, final Player victim) {
  3795. double percent = 0.02;
  3796. ItemStack[] armorContents;
  3797. for (int length = (armorContents = victim.getInventory().getArmorContents()).length, i = 0; i < length; ++i) {
  3798. final ItemStack item = armorContents[i];
  3799. for (final String enchant : this.getEnchantmentsOnItem(item)) {
  3800. if (enchant.split(" ")[0].equals("Heavy")) {
  3801. percent += 0.02 * Integer.parseInt(enchant.split(" ")[1]);
  3802. }
  3803. }
  3804. }
  3805. event.setDamage(event.getDamage() * (1.0 - percent));
  3806. this.getAndPlaySound(victim, victim.getLocation(), "enchants.Heavy", true);
  3807. }
  3808.  
  3809. private void Hijack(final IronGolem g, final Player player, final Player gOwner) {
  3810. if (player.getName().equalsIgnoreCase(gOwner.getName())) {
  3811. return;
  3812. }
  3813. final IronGolem ig = (IronGolem)g.getWorld().spawn(g.getLocation(), (Class)IronGolem.class);
  3814. g.remove();
  3815. ig.setTarget((LivingEntity)gOwner);
  3816. ig.setCustomName(this.guardiansname.replace("{PLAYER}", player.getName()));
  3817. ig.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 99999, 1, false));
  3818. ig.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 99999, 1, false));
  3819. }
  3820.  
  3821. private void Hellfire(final Projectile proj, final Player player, final int level) {
  3822. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "execute " + player.getName() + " " + proj.getLocation().getX() + " " + proj.getLocation().getY() + " " + proj.getLocation().getZ() + " particle flame " + proj.getLocation().getX() + " " + (proj.getLocation().getY() + 1.0) + " " + proj.getLocation().getZ() + " 2.5 1 2.5 0 400 0");
  3823. proj.remove();
  3824. for (final Entity entity : player.getNearbyEntities(5.0, 4.0, 5.0)) {
  3825. if (!(entity instanceof Player) || (entity instanceof Player && this.fapi.relationIsEnemyOrNull(player, (Player)entity))) {
  3826. entity.setFireTicks(level * 40);
  3827. }
  3828. }
  3829. }
  3830.  
  3831. private void IceAspect(final Player victim, final int level) {
  3832. this.givePotionEffects(null, victim, "IceAspect", level);
  3833. victim.getWorld().playEffect(victim.getEyeLocation(), Effect.STEP_SOUND, (Object)Material.ICE);
  3834. }
  3835.  
  3836. private void IceFreeze(final Player victim, final int level) {
  3837. final float walkspeed = victim.getWalkSpeed();
  3838. victim.setWalkSpeed(0.0f);
  3839. Bukkit.getScheduler().scheduleSyncDelayedTask(RandomPackage.getPlugin, (Runnable)new Runnable() {
  3840. @Override
  3841. public void run() {
  3842. victim.setWalkSpeed(walkspeed);
  3843. }
  3844. }, (long)(int)(20.0 * this.doubles[9]));
  3845. }
  3846.  
  3847. private void Implants(final Player player) {
  3848. if (player.getFoodLevel() != 20) {
  3849. player.setFoodLevel(player.getFoodLevel() + 1);
  3850. }
  3851. if (this.random.nextInt(100) <= 2 && player.getHealth() + 1.0 <= player.getMaxHealth()) {
  3852. player.setHealth(player.getHealth() + 1.0);
  3853. }
  3854. }
  3855.  
  3856. @EventHandler(priority = EventPriority.HIGHEST)
  3857. private void Inquisitive(final EntityDeathEvent event) {
  3858. if (event.getEntity() instanceof LivingEntity && !(event.getEntity() instanceof Player)) {
  3859. if (event.getEntity().getKiller() instanceof Player && this.getItemInHand(event.getEntity().getKiller()) != null) {
  3860. this.item = this.getItemInHand(event.getEntity().getKiller());
  3861. if (event.getEntity().getCustomName() != null && ((event.getEntityType().equals((Object)EntityType.IRON_GOLEM) && ChatColor.stripColor(event.getEntity().getCustomName()).endsWith(ChatColor.stripColor(this.guardiansname.replace("{PLAYER}", "")))) || (event.getEntityType().equals((Object)EntityType.ZOMBIE) && ChatColor.stripColor(event.getEntity().getCustomName()).endsWith(ChatColor.stripColor(this.undeadrusename.replace("{PLAYER}", "")))) || (event.getEntityType().equals((Object)EntityType.BLAZE) && ChatColor.stripColor(event.getEntity().getCustomName()).endsWith(ChatColor.stripColor(this.spiritsname.replace("{PLAYER}", "")))))) {
  3862. event.setDroppedExp(0);
  3863. event.getDrops().clear();
  3864. return;
  3865. }
  3866. if (event.getEntity().getKiller() instanceof Player && this.item != null && this.mobRage.contains(event.getEntity().getKiller().getName())) {
  3867. event.getEntity().setVelocity(new Vector(event.getEntity().getKiller().getLocation().getDirection().getX() * 0.45, 0.25, event.getEntity().getKiller().getLocation().getDirection().getZ() * 0.45));
  3868. if (event.getEntity().getNearbyEntities(0.0, 0.0, 0.0).size() >= 1) {
  3869. for (final Entity entity : event.getEntity().getNearbyEntities(0.0, 0.0, 0.0)) {
  3870. if (entity.getType().equals((Object)event.getEntity().getType())) {
  3871. entity.setVelocity(new Vector(-event.getEntity().getKiller().getLocation().getDirection().getX() * 0.25, 0.0, -event.getEntity().getKiller().getLocation().getDirection().getZ() * 0.25));
  3872. }
  3873. }
  3874. }
  3875. }
  3876. if (this.item.hasItemMeta() && this.item.getItemMeta().hasLore()) {
  3877. for (final String enchant : this.getEnchantmentsOnItem(this.item)) {
  3878. final String OEN = enchant.split(" ")[0];
  3879. final int level = Integer.parseInt(enchant.split(" ")[1]);
  3880. final int chance = this.getProckChance(OEN, level, event.getEntity().getKiller());
  3881. if (this.random.nextInt(100) <= chance) {
  3882. if (OEN.equals("Inquisitive")) {
  3883. String equ = null;
  3884. if (level == 1) {
  3885. equ = this.enchantstrings[0];
  3886. }
  3887. else {
  3888. equ = this.enchantstrings[1];
  3889. }
  3890. equ = equ.replace(" ", "").replace("xp", new StringBuilder().append(event.getDroppedExp()).toString()).replace("level", new StringBuilder().append(level).toString());
  3891. event.setDroppedExp(this.getProckChance(equ, level, event.getEntity().getKiller()));
  3892. }
  3893. else {
  3894. if (!OEN.equals("MasterInquisitive")) {
  3895. continue;
  3896. }
  3897. String equ = null;
  3898. if (level == 1) {
  3899. equ = this.enchantstrings[2];
  3900. }
  3901. else {
  3902. equ = this.enchantstrings[3];
  3903. }
  3904. equ = equ.replace(" ", "").replace("xp", new StringBuilder().append(event.getDroppedExp()).toString()).replace("level", new StringBuilder().append(level).toString());
  3905. event.setDroppedExp(this.getProckChance(equ, level, event.getEntity().getKiller()));
  3906. }
  3907. }
  3908. }
  3909. }
  3910. }
  3911. }
  3912. }
  3913.  
  3914. private void Insanity(final Player damager, final int level, final Player victim, final EntityDamageByEntityEvent event) {
  3915. if (this.getItemInHand(victim) != null && this.getItemInHand(victim).getType().name().endsWith("_SWORD")) {
  3916. final String damage = this.enchantments.getString("Insanity.damage").replace("damage", new StringBuilder().append(event.getDamage()).toString()).replace("level", new StringBuilder().append(level).toString());
  3917. event.setDamage((double)this.evaluate(damage));
  3918. this.getAndPlaySound(damager, damager.getLocation(), "enchants.Insanity", false);
  3919. }
  3920. }
  3921.  
  3922. private void Insomnia(final Player player, final int level, final EntityDamageByEntityEvent event) {
  3923. this.givePotionEffects((LivingEntity)player, null, "Insomnia", level);
  3924. if (this.random.nextInt(101) <= 25) {
  3925. event.setDamage(event.getDamage() * 2.0);
  3926. }
  3927. }
  3928.  
  3929. private void Inversion(final EntityDamageByEntityEvent event, final Player victim, final int level) {
  3930. event.setDamage(0.0);
  3931. final int amount = this.random.nextInt(3) + 1;
  3932. if (victim.getHealth() + amount <= victim.getMaxHealth()) {
  3933. victim.setHealth(victim.getHealth() + amount);
  3934. }
  3935. for (final String string : this.messages.getStringList("enchants.inversion")) {
  3936. victim.sendMessage(ChatColor.translateAlternateColorCodes('&', string.replace("{AMOUNT}", new StringBuilder().append(amount).toString())));
  3937. }
  3938. }
  3939.  
  3940. private void Leadership(final EntityDamageByEntityEvent event, final int level) {
  3941. int nearbyallies = 0;
  3942. for (final Entity entity : event.getDamager().getNearbyEntities((double)this.doubles[11], (double)this.doubles[11], (double)this.doubles[11])) {
  3943. if (entity instanceof Player && this.fapi.relationIsAlly((Player)event.getDamager(), (Player)entity)) {
  3944. ++nearbyallies;
  3945. }
  3946. }
  3947. event.setDamage(event.getDamage() * (1.0 + this.doubles[12] * nearbyallies));
  3948. }
  3949.  
  3950. private void Lifebloom(final Player victim, final int level) {
  3951. victim.playEffect(victim.getLocation(), Effect.STEP_SOUND, (Object)Material.EMERALD_BLOCK);
  3952. this.getAndPlaySound(victim, victim.getLocation(), "enchants.Lifebloom", true);
  3953. final int area = this.evaluate(this.enchantments.getString("Lifebloom.area").replace("level", new StringBuilder().append(level).toString()));
  3954. for (final Entity entity : victim.getNearbyEntities((double)area, (double)area, (double)area)) {
  3955. if ((entity instanceof Player && this.fapi.relationIsAlly(victim, (Player)entity)) || (entity instanceof Player && this.fapi.relationIsMember(victim, (Player)entity))) {
  3956. ((Player)entity).setHealth(((Player)entity).getMaxHealth());
  3957. }
  3958. }
  3959. }
  3960.  
  3961. private void Lifesteal(final EntityDamageByEntityEvent event, final Player player) {
  3962. if (player.getHealth() + 1.0 <= 20.0) {
  3963. player.setHealth(player.getHealth() + 1.0);
  3964. }
  3965. if (((LivingEntity)event.getEntity()).getHealth() - 1.0 > 0.0) {
  3966. ((LivingEntity)event.getEntity()).setHealth(((LivingEntity)event.getEntity()).getHealth() - 1.0);
  3967. }
  3968. this.getAndPlaySound(player, player.getLocation(), "enchants.Lifesteal", true);
  3969. }
  3970.  
  3971. private void Lightning(final Location location, final Projectile proj) {
  3972. proj.getWorld().strikeLightning(location);
  3973. proj.remove();
  3974. }
  3975.  
  3976. private void Marksman(final EntityDamageByEntityEvent event, final double damage) {
  3977. event.setDamage(event.getDamage() + damage);
  3978. }
  3979.  
  3980. private void Molten(final LivingEntity damager, final int level) {
  3981. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  3982. @Override
  3983. public void run() {
  3984. damager.setFireTicks(40 * level + 60);
  3985. }
  3986. }, 1L);
  3987. }
  3988.  
  3989. private void Obliterate(final EntityDamageByEntityEvent event, final int level) {
  3990. final double multiplier = level + 0.25;
  3991. event.getEntity().setVelocity(new Vector(-event.getEntity().getLocation().getDirection().getX() * multiplier, event.getEntity().getVelocity().getY(), -event.getEntity().getLocation().getDirection().getZ() * multiplier));
  3992. }
  3993.  
  3994. private void ObsidianDestroyer(final PlayerInteractEvent event, final int level) {
  3995. if (event.getClickedBlock().getType().equals((Object)Material.OBSIDIAN)) {
  3996. event.getClickedBlock().breakNaturally();
  3997. event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, (Object)Material.OBSIDIAN);
  3998. }
  3999. }
  4000.  
  4001. private void Oxygenate(final Player player) {
  4002. if (player.getRemainingAir() + 40 <= 300) {
  4003. player.setRemainingAir(player.getRemainingAir() + 40);
  4004. }
  4005. }
  4006.  
  4007. private void Paralyze(final Player victim, final int level) {
  4008. victim.getWorld().strikeLightning(victim.getLocation());
  4009. if (this.random.nextInt(100) <= level * 15) {
  4010. this.givePotionEffects(null, victim, "Paralyze", level);
  4011. }
  4012. }
  4013.  
  4014. private void Piercing(final EntityDamageByEntityEvent event, final int level) {
  4015. event.setDamage(event.getFinalDamage() * (1.0 + level * 0.25));
  4016. }
  4017.  
  4018. private void PlanetaryDeathbringer(final EntityDamageByEntityEvent event) {
  4019. event.setDamage(event.getDamage() * this.doubles[0]);
  4020. }
  4021.  
  4022. private void Poison(final LivingEntity victim, final int level) {
  4023. victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 40 * level + 40, level - 1));
  4024. }
  4025.  
  4026. private void Poisoned(final LivingEntity damager, final int level) {
  4027. damager.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 40 * level + 40, level - 1));
  4028. }
  4029.  
  4030. private void Protection(final Player player, final int level) {
  4031. final String[] string = this.enchantments.getString("Protection.area").toLowerCase().replace(" ", "").replace("level", new StringBuilder().append(level).toString()).split("\\:");
  4032. for (final Entity entity : player.getNearbyEntities((double)this.evaluate(string[0]), (double)this.evaluate(string[1]), (double)this.evaluate(string[2]))) {
  4033. if (entity instanceof Player && this.fapi.relationIsAlly(player, (Player)entity)) {
  4034. ((Player)entity).addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 40 * level, level / 2));
  4035. ((Player)entity).addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 10 * level, 1));
  4036. }
  4037. }
  4038. }
  4039.  
  4040. private void Pummel(final Player damager, final Player victim, final int level) {
  4041. this.givePotionEffects(null, victim, "Pummel", level);
  4042. final String[] string = this.enchantments.getString("Pummel.area").replace(" ", "").toLowerCase().replace("level", new StringBuilder().append(level).toString()).split("\\:");
  4043. for (final Entity entity : victim.getNearbyEntities((double)this.evaluate(string[0]), (double)this.evaluate(string[1]), (double)this.evaluate(string[2]))) {
  4044. if (entity instanceof Player && this.fapi.relationIsEnemyOrNull(damager, victim)) {
  4045. this.givePotionEffects(null, (Player)entity, "Pummel", level);
  4046. }
  4047. }
  4048. }
  4049.  
  4050. private void Ragdoll(final Player victim) {
  4051. victim.setVelocity(victim.getLocation().getDirection().multiply(-this.random.nextDouble() - 0.5));
  4052. }
  4053.  
  4054. private void Rage(final EntityDamageByEntityEvent event, final Player damager, final int level) {
  4055. final LivingEntity entity = (LivingEntity)event.getEntity();
  4056. double multiplier = 1.0;
  4057. if ((entity instanceof Player && this.enchantments.getBoolean("Rage.player-particles")) || (!(entity instanceof Player) && this.enchantments.getBoolean("Rage.mob-particles"))) {
  4058. entity.getWorld().playEffect(entity.getLocation(), Effect.STEP_SOUND, (Object)Material.REDSTONE_BLOCK);
  4059. entity.getWorld().playEffect(entity.getEyeLocation(), Effect.STEP_SOUND, (Object)Material.REDSTONE_BLOCK);
  4060. }
  4061. ArrayList<String> type = null;
  4062. if (entity instanceof Player) {
  4063. type = this.playerRage;
  4064. }
  4065. else {
  4066. type = this.mobRage;
  4067. }
  4068. type.add(damager.getName());
  4069. for (final String string : type) {
  4070. if (string.equals(damager.getName()) && multiplier + 0.111 <= 1.0 + level * 0.111) {
  4071. multiplier += 0.111;
  4072. }
  4073. }
  4074. entity.setVelocity(new Vector(-event.getDamager().getLocation().getDirection().getX() * 0.35, 0.0, -event.getDamager().getLocation().getDirection().getZ() * 0.35));
  4075. event.setDamage(event.getDamage() * multiplier);
  4076. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  4077. @Override
  4078. public void run() {
  4079. CustomEnchantments.this.playerRage.remove(damager.getName());
  4080. CustomEnchantments.this.mobRage.remove(damager.getName());
  4081. }
  4082. }, 80L);
  4083. }
  4084.  
  4085. private void Ravenous(final Player player, final int level) {
  4086. this.givePotionEffects(null, player, "Ravenous", level);
  4087. }
  4088.  
  4089. private void RocketEscape(final Player victim, final int level) {
  4090. if (victim.getHealth() <= level * 2 + 4) {
  4091. this.givePotionEffects(null, victim, "RocketEscape", level);
  4092. }
  4093. }
  4094.  
  4095. private void Shackle(final EntityDamageByEntityEvent event, final int level) {
  4096. if (level <= 3 || (level == 2 && !event.getEntity().getType().equals((Object)EntityType.MAGMA_CUBE)) || (level == 1 && !event.getEntity().getType().equals((Object)EntityType.BLAZE) && !event.getEntity().getType().equals((Object)EntityType.MAGMA_CUBE))) {
  4097. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  4098. @Override
  4099. public void run() {
  4100. event.getEntity().setVelocity(new Vector(-(event.getDamager().getLocation().getDirection().getX() * 0.25), 0.0, -(event.getDamager().getLocation().getDirection().getZ() * 0.25)));
  4101. }
  4102. }, 1L);
  4103. }
  4104. }
  4105.  
  4106. private void Shockwave(final Player damager, final int level) {
  4107. damager.setVelocity(new Vector(-damager.getLocation().getDirection().getX() * 3.0, damager.getVelocity().getY(), -damager.getLocation().getDirection().getZ() * 3.0));
  4108. }
  4109.  
  4110. private void Silence(final Player victim, final int level) {
  4111. final Collection<PotionEffect> pes = (Collection<PotionEffect>)victim.getActivePotionEffects();
  4112. final Collection<PotionEffect> potioneffects = (Collection<PotionEffect>)victim.getActivePotionEffects();
  4113. for (final PotionEffect pe : pes) {
  4114. victim.removePotionEffect(pe.getType());
  4115. }
  4116. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  4117. @Override
  4118. public void run() {
  4119. for (final PotionEffect pe : potioneffects) {
  4120. victim.addPotionEffect(pe);
  4121. }
  4122. }
  4123. }, (long)(20 * level));
  4124. }
  4125.  
  4126. private void SkillSwipe(final Player victim, final Player damager, final int level) {
  4127. final int taken_xp = (this.random.nextInt(10) + 1) * level;
  4128. if (victim.getTotalExperience() >= taken_xp) {
  4129. final int remaining_xp = this.getTotalExperience(victim) - taken_xp;
  4130. this.setTotalExperience(victim, remaining_xp);
  4131. this.setTotalExperience(damager, this.getTotalExperience(damager) + taken_xp);
  4132. }
  4133. }
  4134.  
  4135. private void SmokeBomb(final LivingEntity damager, final int level) {
  4136. damager.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20 * level + 100, level - 1));
  4137. }
  4138.  
  4139. private void Snare(final Player victim, final int level) {
  4140. this.givePotionEffects(null, victim, "Snare", level);
  4141. }
  4142.  
  4143. private void Sniper(final EntityDamageByEntityEvent event, final Player damager, final Player victim, final int level) {
  4144. if (event.getDamager().getLocation().getY() > victim.getLocation().getY()) {
  4145. double multiplier = 1.0;
  4146. for (int i = 1; i <= level; ++i) {
  4147. multiplier += 0.5;
  4148. }
  4149. final double damage = event.getFinalDamage() * multiplier;
  4150. event.setDamage(0.0);
  4151. if (victim.getHealth() - damage <= 0.0) {
  4152. victim.setHealth(0.0);
  4153. }
  4154. else {
  4155. victim.setHealth(victim.getHealth() - damage);
  4156. }
  4157. this.getAndPlaySound(damager, damager.getLocation(), "enchants.Sniper", false);
  4158. this.sendStringListMessage(damager.getUniqueId(), this.enchantmessages[13], 0.0);
  4159. }
  4160. }
  4161.  
  4162. private void SpiritLink(final Player victim, final int level) {
  4163. final String[] string = this.enchantments.getString("SpiritLink.area").toLowerCase().replace(" ", "").replace("level", new StringBuilder().append(level).toString()).split("\\:");
  4164. for (final Entity entity : victim.getNearbyEntities((double)this.evaluate(string[0]), (double)this.evaluate(string[1]), (double)this.evaluate(string[2]))) {
  4165. if ((entity instanceof Player && this.fapi.relationIsAlly(victim, (Player)entity)) || (entity instanceof Player && this.fapi.relationIsMember(victim, (Player)entity))) {
  4166. final Player nearbyplayer = (Player)entity;
  4167. if (nearbyplayer.getHealth() + 1.0 > nearbyplayer.getMaxHealth()) {
  4168. continue;
  4169. }
  4170. nearbyplayer.setHealth(nearbyplayer.getHealth() + 1.0);
  4171. }
  4172. }
  4173. }
  4174.  
  4175. private void Spirits(final Player victim, final int level) {
  4176. this.getAndPlaySound(victim, victim.getLocation(), "enchants.Spirits", true);
  4177. for (final Entity entity : victim.getNearbyEntities((double)(level + level / 2), (double)(level + level / 2), (double)(level + level / 2))) {
  4178. if (entity instanceof Player && this.fapi.relationIsAlly(victim, (Player)entity)) {
  4179. this.givePotionEffects(null, (Player)entity, "Spirits", level);
  4180. }
  4181. }
  4182. for (int i = 1; i <= level; ++i) {
  4183. final Blaze blaze = (Blaze)victim.getWorld().spawnEntity(victim.getLocation(), EntityType.BLAZE);
  4184. blaze.setCustomName(this.spiritsname.replace("{PLAYER}", victim.getName()));
  4185. blaze.setCanPickupItems(false);
  4186. blaze.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 99999, level));
  4187. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  4188. @Override
  4189. public void run() {
  4190. blaze.remove();
  4191. }
  4192. }, 300L);
  4193. }
  4194. }
  4195.  
  4196. private void Stormcaller(final LivingEntity damager) {
  4197. damager.getWorld().strikeLightning(damager.getLocation());
  4198. }
  4199.  
  4200. private void Tank(final Player victim, final Player damager, final int level, final EntityDamageByEntityEvent event) {
  4201. if (this.getItemInHand(damager) == null || !this.getItemInHand(damager).getType().name().endsWith("_AXE")) {
  4202. return;
  4203. }
  4204. double dividedDamage = 0.0;
  4205. ItemStack[] armorContents;
  4206. for (int length = (armorContents = victim.getInventory().getArmorContents()).length, i = 0; i < length; ++i) {
  4207. final ItemStack item = armorContents[i];
  4208. for (final String enchant : this.getEnchantmentsOnItem(item)) {
  4209. if (enchant.split(" ")[0].equals("Tank")) {
  4210. dividedDamage += 1.85 * level;
  4211. }
  4212. }
  4213. }
  4214. event.setDamage(event.getDamage() / dividedDamage);
  4215. }
  4216.  
  4217. private void Teleportation(final Projectile proj, final Player player1, final Player player2) {
  4218. player1.teleport(player2.getLocation());
  4219. proj.remove();
  4220. }
  4221.  
  4222. private void ThunderingBlow(final EntityDamageByEntityEvent event, final int level) {
  4223. for (int i = 1; i <= 3; ++i) {
  4224. event.getEntity().getWorld().strikeLightning(event.getEntity().getLocation());
  4225. }
  4226. }
  4227.  
  4228. private void Trap(final Player victim, final int level) {
  4229. this.givePotionEffects(null, victim, "Trap", level);
  4230. }
  4231.  
  4232. private void Trickster(final Player victim) {
  4233. final Location location = victim.getLocation();
  4234. if (victim.getLocation().getYaw() >= 0.0f) {
  4235. location.setYaw(victim.getLocation().getYaw() - 180.0f);
  4236. }
  4237. else {
  4238. location.setYaw(victim.getLocation().getYaw() + 180.0f);
  4239. }
  4240. victim.teleport(location);
  4241. }
  4242.  
  4243. private void UndeadRuse(final Player victim, final int level, final LivingEntity damager) {
  4244. for (int i = 1; i <= level; ++i) {
  4245. final Zombie zombie = (Zombie)victim.getWorld().spawnEntity(victim.getLocation(), EntityType.ZOMBIE);
  4246. zombie.setCustomName(this.undeadrusename.replace("{PLAYER}", victim.getName()));
  4247. zombie.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 99999, 3));
  4248. zombie.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 99999, 1));
  4249. zombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 99999, 1));
  4250. zombie.setCanPickupItems(false);
  4251. zombie.setTarget(damager);
  4252. Bukkit.getScheduler().scheduleSyncDelayedTask(this.randompackage, (Runnable)new Runnable() {
  4253. @Override
  4254. public void run() {
  4255. if (!zombie.isDead()) {
  4256. zombie.remove();
  4257. }
  4258. }
  4259. }, 400L);
  4260. }
  4261. }
  4262.  
  4263. private void Valor(final EntityDamageByEntityEvent event, final int level) {
  4264. event.setDamage(0.045 * level);
  4265. }
  4266.  
  4267. private void Vampire(final EntityDamageByEntityEvent event, final Player damager) {
  4268. if (damager.getHealth() + event.getDamage() / 2.0 > damager.getMaxHealth()) {
  4269. damager.setHealth(damager.getMaxHealth());
  4270. return;
  4271. }
  4272. damager.setHealth(damager.getHealth() + event.getDamage() / 2.0);
  4273. }
  4274.  
  4275. private void Voodoo(final LivingEntity damager, final int level) {
  4276. damager.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 40 * level + 40, level - 1));
  4277. }
  4278.  
  4279. private void Wither(final LivingEntity damager, final int level) {
  4280. damager.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 40 * level + 40, level - 1));
  4281. }
  4282.  
  4283. private void playParticle(final Player player, final int PARTICLE) {
  4284. final String particle = this.particlelist[PARTICLE];
  4285. final String particlelocation = this.particleloc[PARTICLE];
  4286. Location loc = null;
  4287. if (particlelocation.equals("EYE_LOCATION")) {
  4288. loc = player.getEyeLocation();
  4289. }
  4290. else if (particlelocation.equals("LOCATION")) {
  4291. loc = player.getLocation();
  4292. }
  4293. int count = 1;
  4294. if (particle.contains("count=")) {
  4295. count = Integer.parseInt(particle.split("\\=")[1]);
  4296. }
  4297. for (int i = 1; i <= count; ++i) {
  4298. player.playEffect(loc, Effect.valueOf(particle), 1);
  4299. }
  4300. }
  4301.  
  4302. static /* synthetic */ void access$3(final CustomEnchantments customEnchantments, final ItemStack item) {
  4303. customEnchantments.item = item;
  4304. }
  4305.  
  4306. public enum RandomPackageEnchants
  4307. {
  4308. Aegis("Aegis", 0),
  4309. Angelic("Angelic", 1),
  4310. AntiGank("AntiGank", 2),
  4311. AntiGravity("AntiGravity", 3),
  4312. Aquatic("Aquatic", 4),
  4313. Armored("Armored", 5),
  4314. ArrowBreak("ArrowBreak", 6),
  4315. ArrowDeflect("ArrowDeflect", 7),
  4316. ArrowLifesteal("ArrowLifesteal", 8),
  4317. Assassin("Assassin", 9),
  4318. AutoSmelt("AutoSmelt", 10),
  4319. Barbarian("Barbarian", 11),
  4320. Berserk("Berserk", 12),
  4321. Blacksmith("Blacksmith", 13),
  4322. Bleed("Bleed", 14),
  4323. Blessed("Blessed", 15),
  4324. Blind("Blind", 16),
  4325. Block("Block", 17),
  4326. BloodLink("BloodLink", 18),
  4327. BloodLust("BloodLust", 19),
  4328. Cactus("Cactus", 20),
  4329. Clarity("Clarity", 21),
  4330. Cleave("Cleave", 22),
  4331. Commander("Commander", 23),
  4332. Confusion("Confusion", 24),
  4333. Cowification("Cowification", 25),
  4334. CreeperArmor("CreeperArmor", 26),
  4335. Curse("Curse", 27),
  4336. Deathbringer("Deathbringer", 28),
  4337. DeathGod("DeathGod", 29),
  4338. Decapitation("Decapitation", 30),
  4339. DeepWounds("DeepWounds", 31),
  4340. Demonforged("Demonforged", 32),
  4341. Destruction("Destruction", 33),
  4342. Detonate("Detonate", 34),
  4343. Devour("Devour", 35),
  4344. DimensionRift("DimensionRift", 36),
  4345. Diminish("Diminish", 37),
  4346. Disarmor("Disarmor", 38),
  4347. Disintegrate("Disintegrate", 39),
  4348. DivineEnlighted("DivineEnlighted", 40),
  4349. DivineImmolation("DivineImmolation", 41),
  4350. Dodge("Dodge", 42),
  4351. Dominate("Dominate", 43),
  4352. DoubleStrike("DoubleStrike", 44),
  4353. Drunk("Drunk", 45),
  4354. EagleEye("EagleEye", 46),
  4355. EnderShift("EnderShift", 47),
  4356. EnderWalker("EnderWalker", 48),
  4357. Enlighted("Enlighted", 49),
  4358. Enrage("Enrage", 50),
  4359. Epicness("Epicness", 51),
  4360. Execute("Execute", 52),
  4361. Experience("Experience", 53),
  4362. Explosive("Explosive", 54),
  4363. Farcast("Farcast", 55),
  4364. Featherweight("Featherweight", 56),
  4365. Frozen("Frozen", 57),
  4366. Fuse("Fuse", 58),
  4367. Gears("Gears", 59),
  4368. Ghost("Ghost", 60),
  4369. Glowing("Glowing", 61),
  4370. GodlyOverload("GodlyOverload", 62),
  4371. Greatsword("Greatsword", 63),
  4372. Guardians("Guardians", 64),
  4373. Hardened("Hardened", 65),
  4374. Haste("Haste", 66),
  4375. Headless("Headless", 67),
  4376. Healing("Healing", 68),
  4377. Heavy("Heavy", 69),
  4378. Hellfire("Hellfire", 70),
  4379. Hijack("Hijack", 71),
  4380. IceAspect("IceAspect", 72),
  4381. IceFreeze("IceFreeze", 73),
  4382. Immortal("Immortal", 74),
  4383. Implants("Implants", 75),
  4384. Infernal("Infernal", 76),
  4385. Inquisitive("Inquisitive", 77),
  4386. Insanity("Insanity", 78),
  4387. Insomnia("Insomnia", 79),
  4388. Inversion("Inversion", 80),
  4389. KillAura("KillAura", 81),
  4390. Leadership("Leadership", 82),
  4391. Lifebloom("Lifebloom", 83),
  4392. Lifesteal("Lifesteal", 84),
  4393. Lightning("Lightning", 85),
  4394. Longbow("Longbow", 86),
  4395. Lucky("Lucky", 87),
  4396. Marksman("Marksman", 88),
  4397. MasterInquisitive("MasterInquisitive", 89),
  4398. Metaphysical("Metaphysical", 90),
  4399. Molten("Molten", 91),
  4400. NaturesWrath("NaturesWrath", 92),
  4401. Nimble("Nimble", 93),
  4402. Nutrition("Nutrition", 94),
  4403. Obliterate("Obliterate", 95),
  4404. ObsidianDestroyer("ObsidianDestroyer", 96),
  4405. Obsidianshield("Obsidianshield", 97),
  4406. Overload("Overload", 98),
  4407. Oxygenate("Oxygenate", 99),
  4408. Pacify("Pacify", 100),
  4409. Paradox("Paradox", 101),
  4410. Paralyze("Paralyze", 102),
  4411. Phoenix("Phoenix", 103),
  4412. Piercing("Piercing", 104),
  4413. PlagueCarrier("PlagueCarrier", 105),
  4414. PlanetaryDeathbringer("PlanetaryDeathbringer", 106),
  4415. Poison("Poison", 107),
  4416. Poisoned("Poisoned", 108),
  4417. Protection("Protection", 109),
  4418. Pummel("Pummel", 110),
  4419. Ragdoll("Ragdoll", 111),
  4420. Rage("Rage", 112),
  4421. Ravenous("Ravenous", 113),
  4422. Reforged("Reforged", 114),
  4423. RepairGuard("RepairGuard", 115),
  4424. Resilience("Resilience", 116),
  4425. RocketEscape("RocketEscape", 117),
  4426. SelfDestruct("SelfDestruct", 118),
  4427. Shackle("Shackle", 119),
  4428. Shockwave("Shockwave", 120),
  4429. Silence("Silence", 121),
  4430. SkillSwipe("SkillSwipe", 122),
  4431. Skilling("Skilling", 123),
  4432. SmokeBomb("SmokeBomb", 124),
  4433. Snare("Snare", 125),
  4434. Sniper("Sniper", 126),
  4435. Solitude("Solitude", 127),
  4436. SoulTrap("SoulTrap", 128),
  4437. SpiritLink("SpiritLink", 129),
  4438. Spirits("Spirits", 130),
  4439. Springs("Springs", 131),
  4440. Sticky("Sticky", 132),
  4441. Stormcaller("Stormcaller", 133),
  4442. Tank("Tank", 134),
  4443. TargetTracking("TargetTracking", 135),
  4444. Teleblock("Teleblock", 136),
  4445. Telepathy("Telepathy", 137),
  4446. Teleportation("Teleportation", 138),
  4447. ThunderingBlow("ThunderingBlow", 139),
  4448. Training("Training", 140),
  4449. Trap("Trap", 141),
  4450. Trickster("Trickster", 142),
  4451. UndeadRuse("UndeadRuse", 143),
  4452. Unfocus("Unfocus", 144),
  4453. Valor("Valor", 145),
  4454. Vampire("Vampire", 146),
  4455. Venom("Venom", 147),
  4456. Virus("Virus", 148),
  4457. Voodoo("Voodoo", 149),
  4458. Wither("Wither", 150);
  4459.  
  4460. private RandomPackageEnchants(final String s, final int n) {
  4461. }
  4462. }
  4463. }
Advertisement
Add Comment
Please, Sign In to add comment