ItemTools.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854
  1. package com.gmail.nossr50.util;
  2. import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
  3. import com.gmail.nossr50.datatypes.skills.ItemType;
  4. import com.gmail.nossr50.mcMMO;
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.Material;
  7. import org.bukkit.inventory.FurnaceRecipe;
  8. import org.bukkit.inventory.ItemStack;
  9. import org.bukkit.inventory.Recipe;
  10. import org.bukkit.inventory.meta.ItemMeta;
  11. import java.util.ArrayList;
  12. import java.util.List;
  13. public final class ItemTools {
  14. private final mcMMO pluginRef;
  15. public ItemTools(mcMMO pluginRef) {
  16. this.pluginRef = pluginRef;
  17. }
  18. public ArrayList<String> getRepairItemMaterials(List<Material> repairItemList) {
  19. ArrayList<String> repairMaterialList = new ArrayList<>();
  20. for (Material m : repairItemList) {
  21. repairMaterialList.add(m.getKey().toString());
  22. }
  23. return repairMaterialList;
  24. }
  25. public ArrayList<Material> matchMaterials(List<String> ItemBlockRegistryKeyList) {
  26. ArrayList<Material> matchedMaterials = new ArrayList<>();
  27. for (String s : ItemBlockRegistryKeyList) {
  28. matchedMaterials.add(Material.matchMaterial(s));
  29. }
  30. return matchedMaterials;
  31. }
  32. /**
  33. * Determines the item type, currently used for repairables/salvageables
  34. *
  35. * @param material target material
  36. * @return the matching ItemType returns OTHER if no match
  37. */
  38. public ItemType determineItemType(Material material) {
  39. if (isMinecraftTool(new ItemStack(material))) {
  40. return ItemType.TOOL;
  41. } else if (isArmor(new ItemStack((material)))) {
  42. return ItemType.ARMOR;
  43. } else {
  44. return ItemType.OTHER;
  45. }
  46. }
  47. /**
  48. * Determines the material category, currently used for repairables/salvageables
  49. *
  50. * @param material target material
  51. * @return the matching ItemMaterialCategory, return OTHER if no match
  52. */
  53. public ItemMaterialCategory determineMaterialType(Material material) {
  54. switch (material) {
  55. case STRING:
  56. return ItemMaterialCategory.STRING;
  57. case LEATHER:
  58. return ItemMaterialCategory.LEATHER;
  59. case ACACIA_PLANKS:
  60. case BIRCH_PLANKS:
  61. case DARK_OAK_PLANKS:
  62. case JUNGLE_PLANKS:
  63. case OAK_PLANKS:
  64. case SPRUCE_PLANKS:
  65. return ItemMaterialCategory.WOOD;
  66. case STONE:
  67. return ItemMaterialCategory.STONE;
  68. case IRON_INGOT:
  69. return ItemMaterialCategory.IRON;
  70. case GOLD_INGOT:
  71. return ItemMaterialCategory.GOLD;
  72. case DIAMOND:
  73. return ItemMaterialCategory.DIAMOND;
  74. default:
  75. return ItemMaterialCategory.OTHER;
  76. }
  77. }
  78. /**
  79. * Checks if the item is a bow.
  80. *
  81. * @param item Item to check
  82. * @return true if the item is a bow, false otherwise
  83. */
  84. public boolean isBow(ItemStack item) {
  85. Material type = item.getType();
  86. switch (type) {
  87. case BOW:
  88. return true;
  89. default:
  90. return false;
  91. //return mcMMO.getModManager().isCustomBow(type);
  92. }
  93. }
  94. /**
  95. * Checks if the item is a sword.
  96. *
  97. * @param item Item to check
  98. * @return true if the item is a sword, false otherwise
  99. */
  100. public boolean isSword(ItemStack item) {
  101. Material type = item.getType();
  102. switch (type) {
  103. case DIAMOND_SWORD:
  104. case GOLDEN_SWORD:
  105. case IRON_SWORD:
  106. case STONE_SWORD:
  107. case WOODEN_SWORD:
  108. return true;
  109. default:
  110. return false;
  111. //return mcMMO.getModManager().isCustomSword(type);
  112. }
  113. }
  114. /**
  115. * Checks if the item is a hoe.
  116. *
  117. * @param item Item to check
  118. * @return true if the item is a hoe, false otherwise
  119. */
  120. public boolean isHoe(ItemStack item) {
  121. Material type = item.getType();
  122. switch (type) {
  123. case DIAMOND_HOE:
  124. case GOLDEN_HOE:
  125. case IRON_HOE:
  126. case STONE_HOE:
  127. case WOODEN_HOE:
  128. return true;
  129. default:
  130. return false;
  131. //return mcMMO.getModManager().isCustomHoe(type);
  132. }
  133. }
  134. /**
  135. * Checks if the item is a shovel.
  136. *
  137. * @param item Item to check
  138. * @return true if the item is a shovel, false otherwise
  139. */
  140. public boolean isShovel(ItemStack item) {
  141. Material type = item.getType();
  142. switch (type) {
  143. case DIAMOND_SHOVEL:
  144. case GOLDEN_SHOVEL:
  145. case IRON_SHOVEL:
  146. case STONE_SHOVEL:
  147. case WOODEN_SHOVEL:
  148. return true;
  149. default:
  150. return false;
  151. //return mcMMO.getModManager().isCustomShovel(type);
  152. }
  153. }
  154. /**
  155. * Checks if the item is an axe.
  156. *
  157. * @param item Item to check
  158. * @return true if the item is an axe, false otherwise
  159. */
  160. public boolean isAxe(ItemStack item) {
  161. Material type = item.getType();
  162. switch (type) {
  163. case DIAMOND_AXE:
  164. case GOLDEN_AXE:
  165. case IRON_AXE:
  166. case STONE_AXE:
  167. case WOODEN_AXE:
  168. return true;
  169. default:
  170. return false;
  171. //return mcMMO.getModManager().isCustomAxe(type);
  172. }
  173. }
  174. /**
  175. * Checks if the item is a pickaxe.
  176. *
  177. * @param item Item to check
  178. * @return true if the item is a pickaxe, false otherwise
  179. */
  180. public boolean isPickaxe(ItemStack item) {
  181. Material type = item.getType();
  182. switch (type) {
  183. case DIAMOND_PICKAXE:
  184. case GOLDEN_PICKAXE:
  185. case IRON_PICKAXE:
  186. case STONE_PICKAXE:
  187. case WOODEN_PICKAXE:
  188. return true;
  189. default:
  190. return false;
  191. //return mcMMO.getModManager().isCustomPickaxe(type);
  192. }
  193. }
  194. /**
  195. * Checks if the item counts as unarmed.
  196. *
  197. * @param item Item to check
  198. * @return true if the item counts as unarmed, false otherwise
  199. */
  200. public boolean isUnarmed(ItemStack item) {
  201. if (pluginRef.getConfigManager().getConfigUnarmed().doItemsCountAsUnarmed()) {
  202. return !isMinecraftTool(item);
  203. }
  204. return item.getType() == Material.AIR;
  205. }
  206. /**
  207. * Checks if the item is a helmet.
  208. *
  209. * @param item Item to check
  210. * @return true if the item is a helmet, false otherwise
  211. */
  212. public boolean isHelmet(ItemStack item) {
  213. Material type = item.getType();
  214. switch (type) {
  215. case DIAMOND_HELMET:
  216. case GOLDEN_HELMET:
  217. case IRON_HELMET:
  218. case CHAINMAIL_HELMET:
  219. case LEATHER_HELMET:
  220. return true;
  221. default:
  222. return false;
  223. //return mcMMO.getModManager().isCustomHelmet(type);
  224. }
  225. }
  226. /**
  227. * Checks if the item is a chestplate.
  228. *
  229. * @param item Item to check
  230. * @return true if the item is a chestplate, false otherwise
  231. */
  232. public boolean isChestplate(ItemStack item) {
  233. Material type = item.getType();
  234. switch (type) {
  235. case DIAMOND_CHESTPLATE:
  236. case GOLDEN_CHESTPLATE:
  237. case IRON_CHESTPLATE:
  238. case CHAINMAIL_CHESTPLATE:
  239. case LEATHER_CHESTPLATE:
  240. return true;
  241. default:
  242. return false;
  243. //return mcMMO.getModManager().isCustomChestplate(type);
  244. }
  245. }
  246. /**
  247. * Checks if the item is a pair of pants.
  248. *
  249. * @param item Item to check
  250. * @return true if the item is a pair of pants, false otherwise
  251. */
  252. public boolean isLeggings(ItemStack item) {
  253. Material type = item.getType();
  254. switch (type) {
  255. case DIAMOND_LEGGINGS:
  256. case GOLDEN_LEGGINGS:
  257. case IRON_LEGGINGS:
  258. case CHAINMAIL_LEGGINGS:
  259. case LEATHER_LEGGINGS:
  260. return true;
  261. default:
  262. return false;
  263. //return mcMMO.getModManager().isCustomLeggings(type);
  264. }
  265. }
  266. /**
  267. * Checks if the item is a pair of boots.
  268. *
  269. * @param item Item to check
  270. * @return true if the item is a pair of boots, false otherwise
  271. */
  272. public boolean isBoots(ItemStack item) {
  273. Material type = item.getType();
  274. switch (type) {
  275. case DIAMOND_BOOTS:
  276. case GOLDEN_BOOTS:
  277. case IRON_BOOTS:
  278. case CHAINMAIL_BOOTS:
  279. case LEATHER_BOOTS:
  280. return true;
  281. default:
  282. return false;
  283. //return mcMMO.getModManager().isCustomBoots(type);
  284. }
  285. }
  286. /**
  287. * Checks to see if an item is a wearable armor piece.
  288. *
  289. * @param item Item to check
  290. * @return true if the item is armor, false otherwise
  291. */
  292. public boolean isArmor(ItemStack item) {
  293. return isHelmet(item) || isChestplate(item) || isLeggings(item) || isBoots(item);
  294. }
  295. /**
  296. * Checks to see if an item is a wearable *vanilla* armor piece.
  297. *
  298. * @param item Item to check
  299. * @return true if the item is armor, false otherwise
  300. */
  301. public boolean isMinecraftArmor(ItemStack item) {
  302. return isLeatherArmor(item) || isGoldArmor(item) || isIronArmor(item) || isDiamondArmor(item) || isChainmailArmor(item);
  303. }
  304. /**
  305. * Checks to see if an item is a leather armor piece.
  306. *
  307. * @param item Item to check
  308. * @return true if the item is leather armor, false otherwise
  309. */
  310. public boolean isLeatherArmor(ItemStack item) {
  311. switch (item.getType()) {
  312. case LEATHER_BOOTS:
  313. case LEATHER_CHESTPLATE:
  314. case LEATHER_HELMET:
  315. case LEATHER_LEGGINGS:
  316. return true;
  317. default:
  318. return false;
  319. }
  320. }
  321. /**
  322. * Checks to see if an item is a gold armor piece.
  323. *
  324. * @param item Item to check
  325. * @return true if the item is gold armor, false otherwise
  326. */
  327. public boolean isGoldArmor(ItemStack item) {
  328. switch (item.getType()) {
  329. case GOLDEN_BOOTS:
  330. case GOLDEN_CHESTPLATE:
  331. case GOLDEN_HELMET:
  332. case GOLDEN_LEGGINGS:
  333. return true;
  334. default:
  335. return false;
  336. }
  337. }
  338. /**
  339. * Checks to see if an item is an iron armor piece.
  340. *
  341. * @param item Item to check
  342. * @return true if the item is iron armor, false otherwise
  343. */
  344. public boolean isIronArmor(ItemStack item) {
  345. switch (item.getType()) {
  346. case IRON_BOOTS:
  347. case IRON_CHESTPLATE:
  348. case IRON_HELMET:
  349. case IRON_LEGGINGS:
  350. return true;
  351. default:
  352. return false;
  353. }
  354. }
  355. /**
  356. * Checks to see if an item is a diamond armor piece.
  357. *
  358. * @param item Item to check
  359. * @return true if the item is diamond armor, false otherwise
  360. */
  361. public boolean isDiamondArmor(ItemStack item) {
  362. switch (item.getType()) {
  363. case DIAMOND_BOOTS:
  364. case DIAMOND_CHESTPLATE:
  365. case DIAMOND_HELMET:
  366. case DIAMOND_LEGGINGS:
  367. return true;
  368. default:
  369. return false;
  370. }
  371. }
  372. /**
  373. * Checks to see if an item is a chainmail armor piece.
  374. *
  375. * @param item Item to check
  376. * @return true if the item is chainmail armor, false otherwise
  377. */
  378. public boolean isChainmailArmor(ItemStack item) {
  379. switch (item.getType()) {
  380. case CHAINMAIL_BOOTS:
  381. case CHAINMAIL_CHESTPLATE:
  382. case CHAINMAIL_HELMET:
  383. case CHAINMAIL_LEGGINGS:
  384. return true;
  385. default:
  386. return false;
  387. }
  388. }
  389. /**
  390. * Checks to see if an item is a *vanilla* tool.
  391. *
  392. * @param item Item to check
  393. * @return true if the item is a tool, false otherwise
  394. */
  395. public boolean isMinecraftTool(ItemStack item) {
  396. return isStoneTool(item) || isWoodTool(item) || isGoldTool(item) || isIronTool(item) || isDiamondTool(item) || isStringTool(item) || item.getType() == Material.TRIDENT;
  397. }
  398. /**
  399. * Checks to see if an item is a stone tool.
  400. *
  401. * @param item Item to check
  402. * @return true if the item is a stone tool, false otherwise
  403. */
  404. public boolean isStoneTool(ItemStack item) {
  405. switch (item.getType()) {
  406. case STONE_AXE:
  407. case STONE_HOE:
  408. case STONE_PICKAXE:
  409. case STONE_SHOVEL:
  410. case STONE_SWORD:
  411. return true;
  412. default:
  413. return false;
  414. }
  415. }
  416. /**
  417. * Checks to see if an item is a wooden tool.
  418. *
  419. * @param item Item to check
  420. * @return true if the item is a wooden tool, false otherwise
  421. */
  422. public boolean isWoodTool(ItemStack item) {
  423. switch (item.getType()) {
  424. case WOODEN_AXE:
  425. case WOODEN_HOE:
  426. case WOODEN_PICKAXE:
  427. case WOODEN_SHOVEL:
  428. case WOODEN_SWORD:
  429. return true;
  430. default:
  431. return false;
  432. }
  433. }
  434. /**
  435. * Checks to see if an item is a wooden tool.
  436. *
  437. * @param material Material to check
  438. * @return true if the item is a wooden tool, false otherwise
  439. */
  440. public boolean isWoodTool(Material material) {
  441. switch (material) {
  442. case WOODEN_AXE:
  443. case WOODEN_HOE:
  444. case WOODEN_PICKAXE:
  445. case WOODEN_SHOVEL:
  446. case WOODEN_SWORD:
  447. return true;
  448. default:
  449. return false;
  450. }
  451. }
  452. /**
  453. * Checks to see if an item is a string tool.
  454. *
  455. * @param item Item to check
  456. * @return true if the item is a string tool, false otherwise
  457. */
  458. public boolean isStringTool(ItemStack item) {
  459. switch (item.getType()) {
  460. case BOW:
  461. case CARROT_ON_A_STICK:
  462. case FISHING_ROD:
  463. return true;
  464. default:
  465. return false;
  466. }
  467. }
  468. /**
  469. * Checks to see if an item is a gold tool.
  470. *
  471. * @param item Item to check
  472. * @return true if the item is a stone tool, false otherwise
  473. */
  474. public boolean isGoldTool(ItemStack item) {
  475. switch (item.getType()) {
  476. case GOLDEN_AXE:
  477. case GOLDEN_HOE:
  478. case GOLDEN_PICKAXE:
  479. case GOLDEN_SHOVEL:
  480. case GOLDEN_SWORD:
  481. return true;
  482. default:
  483. return false;
  484. }
  485. }
  486. /**
  487. * Checks to see if an item is an iron tool.
  488. *
  489. * @param item Item to check
  490. * @return true if the item is an iron tool, false otherwise
  491. */
  492. public boolean isIronTool(ItemStack item) {
  493. switch (item.getType()) {
  494. case BUCKET:
  495. case FLINT_AND_STEEL:
  496. case IRON_AXE:
  497. case IRON_HOE:
  498. case IRON_PICKAXE:
  499. case IRON_SHOVEL:
  500. case IRON_SWORD:
  501. case SHEARS:
  502. return true;
  503. default:
  504. return false;
  505. }
  506. }
  507. /**
  508. * Checks to see if an item is a diamond tool.
  509. *
  510. * @param item Item to check
  511. * @return true if the item is a diamond tool, false otherwise
  512. */
  513. public boolean isDiamondTool(ItemStack item) {
  514. switch (item.getType()) {
  515. case DIAMOND_AXE:
  516. case DIAMOND_HOE:
  517. case DIAMOND_PICKAXE:
  518. case DIAMOND_SHOVEL:
  519. case DIAMOND_SWORD:
  520. return true;
  521. default:
  522. return false;
  523. }
  524. }
  525. /**
  526. * Checks to see if an item is enchantable.
  527. *
  528. * @param item Item to check
  529. * @return true if the item is enchantable, false otherwise
  530. */
  531. public boolean isEnchantable(ItemStack item) {
  532. switch (item.getType()) {
  533. case ENCHANTED_BOOK:
  534. case SHEARS:
  535. case FISHING_ROD:
  536. case CARROT_ON_A_STICK:
  537. case FLINT_AND_STEEL:
  538. case TRIDENT:
  539. return true;
  540. default:
  541. return isArmor(item) || isSword(item) || isAxe(item) || isShovel(item) || isPickaxe(item) || isBow(item);
  542. }
  543. }
  544. public boolean isSmeltable(ItemStack item) {
  545. return item != null && item.getType().isBlock() && MaterialUtils.isOre(item.getType());
  546. }
  547. public boolean isSmelted(ItemStack item) {
  548. if (item == null) {
  549. return false;
  550. }
  551. for (Recipe recipe : pluginRef.getServer().getRecipesFor(item)) {
  552. if (recipe instanceof FurnaceRecipe
  553. && ((FurnaceRecipe) recipe).getInput().getType().isBlock()
  554. && MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getType())) {
  555. return true;
  556. }
  557. }
  558. return false;
  559. }
  560. /**
  561. * Check if an item is sharable.
  562. *
  563. * @param item Item that will get shared
  564. * @return True if the item can be shared.
  565. */
  566. public boolean isSharable(ItemStack item) {
  567. if (item == null || item.getType() == Material.AIR) {
  568. return false;
  569. }
  570. return isMiningDrop(item) || isWoodcuttingDrop(item) || isMobDrop(item) || isHerbalismDrop(item) || isMiscDrop(item);
  571. }
  572. /**
  573. * Checks to see if an item is a mining drop.
  574. *
  575. * @param item Item to check
  576. * @return true if the item is a mining drop, false otherwise
  577. */
  578. public boolean isMiningDrop(ItemStack item) {
  579. //TODO: 1.14 This needs to be updated
  580. switch (item.getType()) {
  581. case COAL:
  582. case COAL_ORE:
  583. case DIAMOND:
  584. case DIAMOND_ORE:
  585. case EMERALD:
  586. case EMERALD_ORE:
  587. case GOLD_ORE:
  588. case IRON_ORE:
  589. case LAPIS_ORE:
  590. case REDSTONE_ORE: // Should we also have Glowing Redstone Ore here?
  591. case REDSTONE:
  592. case GLOWSTONE_DUST: // Should we also have Glowstone here?
  593. case QUARTZ:
  594. case NETHER_QUARTZ_ORE:
  595. case LAPIS_LAZULI:
  596. return true;
  597. default:
  598. return false;
  599. }
  600. }
  601. /**
  602. * Checks to see if an item is a herbalism drop.
  603. *
  604. * @param item Item to check
  605. * @return true if the item is a herbalism drop, false otherwise
  606. */
  607. public boolean isHerbalismDrop(ItemStack item) {
  608. //TODO: 1.14 This needs to be updated
  609. switch (item.getType()) {
  610. case WHEAT:
  611. case WHEAT_SEEDS:
  612. case CARROT:
  613. case CHORUS_FRUIT:
  614. case CHORUS_FLOWER:
  615. case POTATO:
  616. case BEETROOT:
  617. case BEETROOT_SEEDS:
  618. case NETHER_WART:
  619. case BROWN_MUSHROOM:
  620. case RED_MUSHROOM:
  621. case ROSE_BUSH:
  622. case DANDELION:
  623. case CACTUS:
  624. case SUGAR_CANE:
  625. case MELON:
  626. case MELON_SEEDS:
  627. case PUMPKIN:
  628. case PUMPKIN_SEEDS:
  629. case LILY_PAD:
  630. case VINE:
  631. case TALL_GRASS:
  632. case COCOA_BEANS:
  633. return true;
  634. default:
  635. return false;
  636. }
  637. }
  638. /**
  639. * Checks to see if an item is a mob drop.
  640. *
  641. * @param item Item to check
  642. * @return true if the item is a mob drop, false otherwise
  643. */
  644. public boolean isMobDrop(ItemStack item) {
  645. //TODO: 1.14 This needs to be updated
  646. switch (item.getType()) {
  647. case STRING:
  648. case FEATHER:
  649. case CHICKEN:
  650. case COOKED_CHICKEN:
  651. case LEATHER:
  652. case BEEF:
  653. case COOKED_BEEF:
  654. case PORKCHOP:
  655. case COOKED_PORKCHOP:
  656. case WHITE_WOOL:
  657. case BLACK_WOOL:
  658. case BLUE_WOOL:
  659. case BROWN_WOOL:
  660. case CYAN_WOOL:
  661. case GRAY_WOOL:
  662. case GREEN_WOOL:
  663. case LIGHT_BLUE_WOOL:
  664. case LIGHT_GRAY_WOOL:
  665. case LIME_WOOL:
  666. case MAGENTA_WOOL:
  667. case ORANGE_WOOL:
  668. case PINK_WOOL:
  669. case PURPLE_WOOL:
  670. case RED_WOOL:
  671. case YELLOW_WOOL:
  672. case IRON_INGOT:
  673. case SNOWBALL:
  674. case BLAZE_ROD:
  675. case SPIDER_EYE:
  676. case GUNPOWDER:
  677. case ENDER_PEARL:
  678. case GHAST_TEAR:
  679. case MAGMA_CREAM:
  680. case BONE:
  681. case ARROW:
  682. case SLIME_BALL:
  683. case NETHER_STAR:
  684. case ROTTEN_FLESH:
  685. case GOLD_NUGGET:
  686. case EGG:
  687. case ROSE_BUSH:
  688. case COAL:
  689. return true;
  690. default:
  691. return false;
  692. }
  693. }
  694. /**
  695. * Checks to see if an item is a woodcutting drop.
  696. *
  697. * @param item Item to check
  698. * @return true if the item is a woodcutting drop, false otherwise
  699. */
  700. public boolean isWoodcuttingDrop(ItemStack item) {
  701. switch (item.getType()) {
  702. case ACACIA_LOG:
  703. case BIRCH_LOG:
  704. case DARK_OAK_LOG:
  705. case JUNGLE_LOG:
  706. case OAK_LOG:
  707. case SPRUCE_LOG:
  708. case STRIPPED_ACACIA_LOG:
  709. case STRIPPED_BIRCH_LOG:
  710. case STRIPPED_DARK_OAK_LOG:
  711. case STRIPPED_JUNGLE_LOG:
  712. case STRIPPED_OAK_LOG:
  713. case STRIPPED_SPRUCE_LOG:
  714. case ACACIA_SAPLING:
  715. case SPRUCE_SAPLING:
  716. case BIRCH_SAPLING:
  717. case DARK_OAK_SAPLING:
  718. case JUNGLE_SAPLING:
  719. case OAK_SAPLING:
  720. case ACACIA_LEAVES:
  721. case BIRCH_LEAVES:
  722. case DARK_OAK_LEAVES:
  723. case JUNGLE_LEAVES:
  724. case OAK_LEAVES:
  725. case SPRUCE_LEAVES:
  726. case APPLE:
  727. return true;
  728. default:
  729. return false;
  730. }
  731. }
  732. /**
  733. * Checks to see if an item is a miscellaneous drop. These items are read from the config file
  734. *
  735. * @param item Item to check
  736. * @return true if the item is a miscellaneous drop, false otherwise
  737. */
  738. public boolean isMiscDrop(ItemStack item) {
  739. return pluginRef.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(item.getType()) != null;
  740. }
  741. public boolean isMcMMOItem(ItemStack item) {
  742. if (!item.hasItemMeta()) {
  743. return false;
  744. }
  745. ItemMeta itemMeta = item.getItemMeta();
  746. return itemMeta.hasLore() && itemMeta.getLore().contains("mcMMO Item");
  747. }
  748. public boolean isChimaeraWing(ItemStack item) {
  749. if (!isMcMMOItem(item)) {
  750. return false;
  751. }
  752. ItemMeta itemMeta = item.getItemMeta();
  753. return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + pluginRef.getLocaleManager().getString("Item.ChimaeraWing.Name"));
  754. }
  755. }