mcMMO/src/main/java/com/gmail/nossr50/util/ItemUtils.java

680 lines
18 KiB
Java
Raw Normal View History

Squashed commit of the following: commit cb3e057dee1f2b29838ab654a526baac1baab7d6 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:43:57 2013 -0500 1.4.00 release commit 4f9628d2e4cde31c8946e9a911ee6f10e1fb6b35 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:07:30 2013 -0500 \r -> \n commit b2ca22e0477c747143b0f08a28a096967ee6ffd7 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:53:56 2013 -0500 Commented-out code shouldn't be done like that. commit 92f131712cc671e3e616c14a22e22769ef6d6d0b Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:45:36 2013 -0500 More things we missed. commit 408b03766f6261a03a862a1ab7f5835772feda4a Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 23:20:13 2013 -0500 Format: util through spout and backup lib commit d6bd2c29bbb51bee3607247468cfe145d4f38c9e Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:50:08 2013 -0500 The things we missed the first time through... commit 393f0b889aa1b7011ee81ee7b15413d8824b8cfb Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:05:29 2013 -0500 Formatting: Skills commit c097a6e188a7b760dd1b4389ed81dca417146b16 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:30:12 2013 -0500 Organize imports. commit 34c3e74be7eb5f983f21d969e30155c5d82c01c1 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:45 2013 -0500 Fixed a missing fallthrough comment from ChatCommand commit b4a76c9f022a2fd98bdd8f083accfea03becfd71 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:36 2013 -0500 Formatting: datatypes.* through events.* commit 3e57dd41d3265a7c8106c7eb026df926770a4d15 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:56:15 2013 -0500 Fix issue with bad rebase commit e8c8e06b2971555b7334e49128257e3af6f36892 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 17:35:32 2013 -0500 Formatting: DatabaseManager, LeaderboardManager, DatabaseUpdateType, and PlayerStat commit 13ecf1cc41f377a12991e357ac10abdcda24d6de Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:31:43 2013 -0500 Format: listeners.* through runnables.* commit 71686e3c0d96c2dcf25442b91703fadda1ea3bb0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:13:57 2013 -0500 Format PartyLockCommand commit d50abed10bf94e1a88df3dc5cc07c259aea920ea Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 16:54:08 2013 -0500 Format: base through config.* commit 7004823eeebbae5be7728bf9cafc3b04e57b64cf Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:21:40 2013 -0500 Example of using spaces to align like things commit 534190cfe2481e466fe459d65628550458cc2993 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:12:19 2013 -0500 Capitalization commit 5b61d3ba4c8d81e6f358b0cf4f460abfe9798414 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:07:43 2013 -0500 Updated readme, added standards.md commit 5ec0df70fb82c527420a2f437f27f31bd758f884 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 14:42:16 2013 -0500 Markdown was here, Creole is a loser commit 70d557c59d086b6a5fb5e0e63c0c1d8eb4c8d19c Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 13:46:24 2013 -0500 Move MCStats shading to .metrics.mcstats commit eb9d67e66b1659d6abd2397ecf403343cfeffdda Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 13:37:37 2013 -0500 Move ALL the packages! commit 8ffa9e7b75417b6c7f158613d4b4ffb783dcf2d0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 12:37:12 2013 -0500 /r/n -> /n
2013-03-01 06:52:01 +01:00
package com.gmail.nossr50.util;
import java.util.List;
import org.bukkit.ChatColor;
Squashed commit of the following: commit cb3e057dee1f2b29838ab654a526baac1baab7d6 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:43:57 2013 -0500 1.4.00 release commit 4f9628d2e4cde31c8946e9a911ee6f10e1fb6b35 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:07:30 2013 -0500 \r -> \n commit b2ca22e0477c747143b0f08a28a096967ee6ffd7 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:53:56 2013 -0500 Commented-out code shouldn't be done like that. commit 92f131712cc671e3e616c14a22e22769ef6d6d0b Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:45:36 2013 -0500 More things we missed. commit 408b03766f6261a03a862a1ab7f5835772feda4a Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 23:20:13 2013 -0500 Format: util through spout and backup lib commit d6bd2c29bbb51bee3607247468cfe145d4f38c9e Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:50:08 2013 -0500 The things we missed the first time through... commit 393f0b889aa1b7011ee81ee7b15413d8824b8cfb Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:05:29 2013 -0500 Formatting: Skills commit c097a6e188a7b760dd1b4389ed81dca417146b16 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:30:12 2013 -0500 Organize imports. commit 34c3e74be7eb5f983f21d969e30155c5d82c01c1 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:45 2013 -0500 Fixed a missing fallthrough comment from ChatCommand commit b4a76c9f022a2fd98bdd8f083accfea03becfd71 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:36 2013 -0500 Formatting: datatypes.* through events.* commit 3e57dd41d3265a7c8106c7eb026df926770a4d15 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:56:15 2013 -0500 Fix issue with bad rebase commit e8c8e06b2971555b7334e49128257e3af6f36892 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 17:35:32 2013 -0500 Formatting: DatabaseManager, LeaderboardManager, DatabaseUpdateType, and PlayerStat commit 13ecf1cc41f377a12991e357ac10abdcda24d6de Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:31:43 2013 -0500 Format: listeners.* through runnables.* commit 71686e3c0d96c2dcf25442b91703fadda1ea3bb0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:13:57 2013 -0500 Format PartyLockCommand commit d50abed10bf94e1a88df3dc5cc07c259aea920ea Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 16:54:08 2013 -0500 Format: base through config.* commit 7004823eeebbae5be7728bf9cafc3b04e57b64cf Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:21:40 2013 -0500 Example of using spaces to align like things commit 534190cfe2481e466fe459d65628550458cc2993 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:12:19 2013 -0500 Capitalization commit 5b61d3ba4c8d81e6f358b0cf4f460abfe9798414 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:07:43 2013 -0500 Updated readme, added standards.md commit 5ec0df70fb82c527420a2f437f27f31bd758f884 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 14:42:16 2013 -0500 Markdown was here, Creole is a loser commit 70d557c59d086b6a5fb5e0e63c0c1d8eb4c8d19c Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 13:46:24 2013 -0500 Move MCStats shading to .metrics.mcstats commit eb9d67e66b1659d6abd2397ecf403343cfeffdda Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 13:37:37 2013 -0500 Move ALL the packages! commit 8ffa9e7b75417b6c7f158613d4b4ffb783dcf2d0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 12:37:12 2013 -0500 /r/n -> /n
2013-03-01 06:52:01 +01:00
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
Squashed commit of the following: commit cb3e057dee1f2b29838ab654a526baac1baab7d6 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:43:57 2013 -0500 1.4.00 release commit 4f9628d2e4cde31c8946e9a911ee6f10e1fb6b35 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:07:30 2013 -0500 \r -> \n commit b2ca22e0477c747143b0f08a28a096967ee6ffd7 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:53:56 2013 -0500 Commented-out code shouldn't be done like that. commit 92f131712cc671e3e616c14a22e22769ef6d6d0b Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:45:36 2013 -0500 More things we missed. commit 408b03766f6261a03a862a1ab7f5835772feda4a Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 23:20:13 2013 -0500 Format: util through spout and backup lib commit d6bd2c29bbb51bee3607247468cfe145d4f38c9e Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:50:08 2013 -0500 The things we missed the first time through... commit 393f0b889aa1b7011ee81ee7b15413d8824b8cfb Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:05:29 2013 -0500 Formatting: Skills commit c097a6e188a7b760dd1b4389ed81dca417146b16 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:30:12 2013 -0500 Organize imports. commit 34c3e74be7eb5f983f21d969e30155c5d82c01c1 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:45 2013 -0500 Fixed a missing fallthrough comment from ChatCommand commit b4a76c9f022a2fd98bdd8f083accfea03becfd71 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:36 2013 -0500 Formatting: datatypes.* through events.* commit 3e57dd41d3265a7c8106c7eb026df926770a4d15 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:56:15 2013 -0500 Fix issue with bad rebase commit e8c8e06b2971555b7334e49128257e3af6f36892 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 17:35:32 2013 -0500 Formatting: DatabaseManager, LeaderboardManager, DatabaseUpdateType, and PlayerStat commit 13ecf1cc41f377a12991e357ac10abdcda24d6de Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:31:43 2013 -0500 Format: listeners.* through runnables.* commit 71686e3c0d96c2dcf25442b91703fadda1ea3bb0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:13:57 2013 -0500 Format PartyLockCommand commit d50abed10bf94e1a88df3dc5cc07c259aea920ea Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 16:54:08 2013 -0500 Format: base through config.* commit 7004823eeebbae5be7728bf9cafc3b04e57b64cf Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:21:40 2013 -0500 Example of using spaces to align like things commit 534190cfe2481e466fe459d65628550458cc2993 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:12:19 2013 -0500 Capitalization commit 5b61d3ba4c8d81e6f358b0cf4f460abfe9798414 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:07:43 2013 -0500 Updated readme, added standards.md commit 5ec0df70fb82c527420a2f437f27f31bd758f884 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 14:42:16 2013 -0500 Markdown was here, Creole is a loser commit 70d557c59d086b6a5fb5e0e63c0c1d8eb4c8d19c Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 13:46:24 2013 -0500 Move MCStats shading to .metrics.mcstats commit eb9d67e66b1659d6abd2397ecf403343cfeffdda Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 13:37:37 2013 -0500 Move ALL the packages! commit 8ffa9e7b75417b6c7f158613d4b4ffb783dcf2d0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 12:37:12 2013 -0500 /r/n -> /n
2013-03-01 06:52:01 +01:00
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.api.SpoutToolsAPI;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.mods.CustomArmorConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
public class ItemUtils {
private static Config configInstance = Config.getInstance();
private static boolean customToolsEnabled = configInstance.getToolModsEnabled();
private static boolean customArmorEnabled = configInstance.getArmorModsEnabled();
/**
* Checks if the item is a sword.
*
* @param is Item to check
* @return true if the item is a sword, false otherwise
*/
public static boolean isSword(ItemStack is) {
switch (is.getType()) {
case DIAMOND_SWORD:
case GOLD_SWORD:
case IRON_SWORD:
case STONE_SWORD:
case WOOD_SWORD:
return true;
default:
if (customToolsEnabled && CustomToolConfig.getInstance().customSwordIDs.contains(is.getTypeId())) {
return true;
}
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutSwords.contains(is)) {
return true;
}
else {
return false;
}
}
}
/**
* Checks if the item is a hoe.
*
* @param is Item to check
* @return true if the item is a hoe, false otherwise
*/
public static boolean isHoe(ItemStack is) {
switch (is.getType()) {
case DIAMOND_HOE:
case GOLD_HOE:
case IRON_HOE:
case STONE_HOE:
case WOOD_HOE:
return true;
default:
if (customToolsEnabled && CustomToolConfig.getInstance().customHoeIDs.contains(is.getTypeId())) {
return true;
}
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutHoes.contains(is)) {
return true;
}
else {
return false;
}
}
}
/**
* Checks if the item is a shovel.
*
* @param is Item to check
* @return true if the item is a shovel, false otherwise
*/
public static boolean isShovel(ItemStack is) {
switch (is.getType()) {
case DIAMOND_SPADE:
case GOLD_SPADE:
case IRON_SPADE:
case STONE_SPADE:
case WOOD_SPADE:
return true;
default:
if (customToolsEnabled && CustomToolConfig.getInstance().customShovelIDs.contains(is.getTypeId())) {
return true;
}
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutShovels.contains(is)) {
return true;
}
else {
return false;
}
}
}
/**
* Checks if the item is an axe.
*
* @param is Item to check
* @return true if the item is an axe, false otherwise
*/
public static boolean isAxe(ItemStack is) {
switch (is.getType()) {
case DIAMOND_AXE:
case GOLD_AXE:
case IRON_AXE:
case STONE_AXE:
case WOOD_AXE:
return true;
default:
if (customToolsEnabled && CustomToolConfig.getInstance().customAxeIDs.contains(is.getTypeId())) {
return true;
}
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutAxes.contains(is)) {
return true;
}
else {
return false;
}
}
}
/**
* Checks if the item is a pickaxe.
*
* @param is Item to check
* @return true if the item is a pickaxe, false otherwise
*/
public static boolean isPickaxe(ItemStack is) {
switch (is.getType()) {
case DIAMOND_PICKAXE:
case GOLD_PICKAXE:
case IRON_PICKAXE:
case STONE_PICKAXE:
case WOOD_PICKAXE:
return true;
default:
if (customToolsEnabled && CustomToolConfig.getInstance().customPickaxeIDs.contains(is.getTypeId())) {
return true;
}
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutPickaxes.contains(is)) {
return true;
}
else {
return false;
}
}
}
/**
* Checks if the item is a helmet.
*
* @param is Item to check
* @return true if the item is a helmet, false otherwise
*/
public static boolean isHelmet(ItemStack is) {
switch (is.getType()) {
case DIAMOND_HELMET:
case GOLD_HELMET:
case IRON_HELMET:
case LEATHER_HELMET:
return true;
default:
if (customArmorEnabled && CustomArmorConfig.getInstance().customHelmetIDs.contains(is.getTypeId())) {
return true;
}
return false;
}
}
/**
* Checks if the item is a chestplate.
*
* @param is Item to check
* @return true if the item is a chestplate, false otherwise
*/
public static boolean isChestplate(ItemStack is) {
switch (is.getType()) {
case DIAMOND_CHESTPLATE:
case GOLD_CHESTPLATE:
case IRON_CHESTPLATE:
case LEATHER_CHESTPLATE:
return true;
default:
if (customArmorEnabled && CustomArmorConfig.getInstance().customChestplateIDs.contains(is.getTypeId())) {
return true;
}
return false;
}
}
/**
* Checks if the item is a pair of pants.
*
* @param is Item to check
* @return true if the item is a pair of pants, false otherwise
*/
public static boolean isLeggings(ItemStack is) {
switch (is.getType()) {
case DIAMOND_LEGGINGS:
case GOLD_LEGGINGS:
case IRON_LEGGINGS:
case LEATHER_LEGGINGS:
return true;
default:
if (customArmorEnabled && CustomArmorConfig.getInstance().customLeggingIDs.contains(is.getTypeId())) {
return true;
}
return false;
}
}
/**
* Checks if the item is a pair of boots.
*
* @param is Item to check
* @return true if the item is a pair of boots, false otherwise
*/
public static boolean isBoots(ItemStack is) {
switch (is.getType()) {
case DIAMOND_BOOTS:
case GOLD_BOOTS:
case IRON_BOOTS:
case LEATHER_BOOTS:
return true;
default:
if (customArmorEnabled && CustomArmorConfig.getInstance().customBootIDs.contains(is.getTypeId())) {
return true;
}
return false;
}
}
/**
* Checks to see if an item is a wearable armor piece.
*
* @param is Item to check
* @return true if the item is armor, false otherwise
*/
public static boolean isArmor(ItemStack is) {
return isHelmet(is) || isChestplate(is) || isLeggings(is) || isBoots(is);
}
/**
* Checks to see if an item is a wearable armor piece.
*
* @param is Item to check
* @return true if the item is armor, false otherwise
*/
public static boolean isMinecraftArmor(ItemStack is) {
return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
Squashed commit of the following: commit cb3e057dee1f2b29838ab654a526baac1baab7d6 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:43:57 2013 -0500 1.4.00 release commit 4f9628d2e4cde31c8946e9a911ee6f10e1fb6b35 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:07:30 2013 -0500 \r -> \n commit b2ca22e0477c747143b0f08a28a096967ee6ffd7 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:53:56 2013 -0500 Commented-out code shouldn't be done like that. commit 92f131712cc671e3e616c14a22e22769ef6d6d0b Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:45:36 2013 -0500 More things we missed. commit 408b03766f6261a03a862a1ab7f5835772feda4a Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 23:20:13 2013 -0500 Format: util through spout and backup lib commit d6bd2c29bbb51bee3607247468cfe145d4f38c9e Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:50:08 2013 -0500 The things we missed the first time through... commit 393f0b889aa1b7011ee81ee7b15413d8824b8cfb Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:05:29 2013 -0500 Formatting: Skills commit c097a6e188a7b760dd1b4389ed81dca417146b16 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:30:12 2013 -0500 Organize imports. commit 34c3e74be7eb5f983f21d969e30155c5d82c01c1 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:45 2013 -0500 Fixed a missing fallthrough comment from ChatCommand commit b4a76c9f022a2fd98bdd8f083accfea03becfd71 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:36 2013 -0500 Formatting: datatypes.* through events.* commit 3e57dd41d3265a7c8106c7eb026df926770a4d15 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:56:15 2013 -0500 Fix issue with bad rebase commit e8c8e06b2971555b7334e49128257e3af6f36892 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 17:35:32 2013 -0500 Formatting: DatabaseManager, LeaderboardManager, DatabaseUpdateType, and PlayerStat commit 13ecf1cc41f377a12991e357ac10abdcda24d6de Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:31:43 2013 -0500 Format: listeners.* through runnables.* commit 71686e3c0d96c2dcf25442b91703fadda1ea3bb0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:13:57 2013 -0500 Format PartyLockCommand commit d50abed10bf94e1a88df3dc5cc07c259aea920ea Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 16:54:08 2013 -0500 Format: base through config.* commit 7004823eeebbae5be7728bf9cafc3b04e57b64cf Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:21:40 2013 -0500 Example of using spaces to align like things commit 534190cfe2481e466fe459d65628550458cc2993 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:12:19 2013 -0500 Capitalization commit 5b61d3ba4c8d81e6f358b0cf4f460abfe9798414 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:07:43 2013 -0500 Updated readme, added standards.md commit 5ec0df70fb82c527420a2f437f27f31bd758f884 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 14:42:16 2013 -0500 Markdown was here, Creole is a loser commit 70d557c59d086b6a5fb5e0e63c0c1d8eb4c8d19c Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 13:46:24 2013 -0500 Move MCStats shading to .metrics.mcstats commit eb9d67e66b1659d6abd2397ecf403343cfeffdda Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 13:37:37 2013 -0500 Move ALL the packages! commit 8ffa9e7b75417b6c7f158613d4b4ffb783dcf2d0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 12:37:12 2013 -0500 /r/n -> /n
2013-03-01 06:52:01 +01:00
}
/**
* Checks to see if an item is a leather armor piece.
*
* @param is Item to check
* @return true if the item is leather armor, false otherwise
*/
public static boolean isLeatherArmor(ItemStack is) {
switch (is.getType()) {
case LEATHER_BOOTS:
case LEATHER_CHESTPLATE:
case LEATHER_HELMET:
case LEATHER_LEGGINGS:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is a gold armor piece.
*
* @param is Item to check
* @return true if the item is gold armor, false otherwise
*/
public static boolean isGoldArmor(ItemStack is) {
switch (is.getType()) {
case GOLD_BOOTS:
case GOLD_CHESTPLATE:
case GOLD_HELMET:
case GOLD_LEGGINGS:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is an iron armor piece.
*
* @param is Item to check
* @return true if the item is iron armor, false otherwise
*/
public static boolean isIronArmor(ItemStack is) {
switch (is.getType()) {
case IRON_BOOTS:
case IRON_CHESTPLATE:
case IRON_HELMET:
case IRON_LEGGINGS:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is a diamond armor piece.
*
* @param is Item to check
* @return true if the item is diamond armor, false otherwise
*/
public static boolean isDiamondArmor(ItemStack is) {
switch (is.getType()) {
case DIAMOND_BOOTS:
case DIAMOND_CHESTPLATE:
case DIAMOND_HELMET:
case DIAMOND_LEGGINGS:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is a tool.
*
* @param is Item to check
* @return true if the item is a tool, false otherwise
*/
public static boolean isMinecraftTool(ItemStack is) {
return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || isStringTool(is);
}
/**
* Checks to see if an item is a stone tool.
*
* @param is Item to check
* @return true if the item is a stone tool, false otherwise
*/
public static boolean isStoneTool(ItemStack is) {
switch (is.getType()) {
case STONE_AXE:
case STONE_HOE:
case STONE_PICKAXE:
case STONE_SPADE:
case STONE_SWORD:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is a wooden tool.
*
* @param is Item to check
* @return true if the item is a wooden tool, false otherwise
*/
public static boolean isWoodTool(ItemStack is) {
switch (is.getType()) {
case WOOD_AXE:
case WOOD_HOE:
case WOOD_PICKAXE:
case WOOD_SPADE:
case WOOD_SWORD:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is a string tool.
*
* @param is Item to check
* @return true if the item is a string tool, false otherwise
*/
public static boolean isStringTool(ItemStack is) {
switch (is.getType()) {
case BOW:
case CARROT_STICK:
case FISHING_ROD:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is a gold tool.
*
* @param is Item to check
* @return true if the item is a stone tool, false otherwise
*/
public static boolean isGoldTool(ItemStack is) {
switch (is.getType()) {
case GOLD_AXE:
case GOLD_HOE:
case GOLD_PICKAXE:
case GOLD_SPADE:
case GOLD_SWORD:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is an iron tool.
*
* @param is Item to check
* @return true if the item is an iron tool, false otherwise
*/
public static boolean isIronTool(ItemStack is) {
switch (is.getType()) {
case BUCKET:
case FLINT_AND_STEEL:
case IRON_AXE:
case IRON_HOE:
case IRON_PICKAXE:
case IRON_SPADE:
case IRON_SWORD:
case SHEARS:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is a diamond tool.
*
* @param is Item to check
* @return true if the item is a diamond tool, false otherwise
*/
public static boolean isDiamondTool(ItemStack is) {
switch (is.getType()) {
case DIAMOND_AXE:
case DIAMOND_HOE:
case DIAMOND_PICKAXE:
case DIAMOND_SPADE:
case DIAMOND_SWORD:
return true;
default:
return false;
}
}
/**
* Checks to see if an item is enchantable.
*
* @param is Item to check
* @return true if the item is enchantable, false otherwise
*/
public static boolean isEnchantable(ItemStack is) {
Material type = is.getType();
return isArmor(is) || isSword(is) || isAxe(is) || isShovel(is) || isPickaxe(is) || type == Material.SHEARS || type == Material.FISHING_ROD || type == Material.CARROT_STICK || type == Material.FLINT_AND_STEEL || type == Material.BOW;
}
public static boolean isSmeltable(ItemStack itemStack) {
switch (itemStack.getType()) {
case COAL_ORE:
case DIAMOND_ORE:
case GLOWING_REDSTONE_ORE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
case EMERALD_ORE:
return true;
default:
return false;
}
}
public static boolean isSmelted(ItemStack itemStack) {
switch (itemStack.getType()) {
case COAL:
case DIAMOND:
case REDSTONE:
case GOLD_INGOT:
case IRON_INGOT:
case EMERALD:
return true;
case INK_SACK:
if (itemStack.getData().getData() == DyeColor.BLUE.getDyeData()) {
return true;
}
return false;
default:
return false;
}
}
/**
* Check if an item is sharable.
*
* @param item Item that will get shared
* @return True if the item can be shared.
*/
public static boolean isShareable(ItemStack is) {
return isMiningDrop(is) || isWoodcuttingDrop(is) || isMobDrop(is) || isHerbalismDrop(is);
}
/**
* Checks to see if an item is a mining drop.
*
* @param is Item to check
* @return true if the item is a mining drop, false otherwise
*/
public static boolean isMiningDrop(ItemStack is) {
switch (is.getType()) {
case COAL:
case COAL_ORE:
case DIAMOND:
case DIAMOND_ORE:
case EMERALD:
case EMERALD_ORE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
case REDSTONE:
case GLOWSTONE_DUST:
return true;
case INK_SACK:
if (is.getData().getData() == DyeColor.BLUE.getDyeData()) {
return true;
}
return false;
default:
return false;
}
}
public static boolean isHerbalismDrop(ItemStack is) {
switch (is.getType()) {
case WHEAT:
case SEEDS:
case CARROT:
case POTATO:
case COCOA:
case NETHER_WARTS:
case BROWN_MUSHROOM:
case RED_MUSHROOM:
case RED_ROSE:
case YELLOW_FLOWER:
case CACTUS:
case SUGAR_CANE:
case MELON:
case PUMPKIN:
case WATER_LILY:
case VINE:
return true;
case INK_SACK:
return is.getData().getData() == DyeColor.BROWN.getDyeData();
default:
return false;
}
}
public static boolean isMobDrop(ItemStack is) {
switch (is.getType()) {
case STRING:
case FEATHER:
case RAW_CHICKEN:
case COOKED_CHICKEN:
case LEATHER:
case RAW_BEEF:
case COOKED_BEEF:
case PORK:
case GRILLED_PORK:
case WOOL:
case RED_ROSE:
case IRON_INGOT:
case SNOW_BALL:
case BLAZE_ROD:
case SPIDER_EYE:
case SULPHUR:
case ENDER_PEARL:
case GHAST_TEAR:
case MAGMA_CREAM:
case BONE:
case ARROW:
case SLIME_BALL:
case NETHER_STAR:
case COAL:
case ROTTEN_FLESH:
case GOLD_NUGGET:
case EGG:
return true;
default:
return false;
}
}
public static boolean isWoodcuttingDrop(ItemStack is) {
switch (is.getType()) {
case LOG:
case LEAVES:
case SAPLING:
case APPLE:
return true;
default:
return false;
}
}
public static boolean isMcMMOItem(ItemStack is) {
2013-03-09 04:20:26 +01:00
if (!is.hasItemMeta()) {
return false;
}
ItemMeta itemMeta = is.getItemMeta();
if (itemMeta.hasLore()) {
List<String> itemLore = itemMeta.getLore();
if (itemLore.contains("mcMMO Item")) {
return true;
}
}
return false;
}
public static boolean isChimaeraWing(ItemStack is) {
if (!isMcMMOItem(is)) {
return false;
}
ItemMeta itemMeta = is.getItemMeta();
if (itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + "Chimaera Wing")) { //TODO Get localized name
return true;
}
return false;
}
Squashed commit of the following: commit cb3e057dee1f2b29838ab654a526baac1baab7d6 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:43:57 2013 -0500 1.4.00 release commit 4f9628d2e4cde31c8946e9a911ee6f10e1fb6b35 Author: NuclearW <incongruency@gmail.com> Date: Fri Mar 1 00:07:30 2013 -0500 \r -> \n commit b2ca22e0477c747143b0f08a28a096967ee6ffd7 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:53:56 2013 -0500 Commented-out code shouldn't be done like that. commit 92f131712cc671e3e616c14a22e22769ef6d6d0b Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 23:45:36 2013 -0500 More things we missed. commit 408b03766f6261a03a862a1ab7f5835772feda4a Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 23:20:13 2013 -0500 Format: util through spout and backup lib commit d6bd2c29bbb51bee3607247468cfe145d4f38c9e Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:50:08 2013 -0500 The things we missed the first time through... commit 393f0b889aa1b7011ee81ee7b15413d8824b8cfb Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 22:05:29 2013 -0500 Formatting: Skills commit c097a6e188a7b760dd1b4389ed81dca417146b16 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:30:12 2013 -0500 Organize imports. commit 34c3e74be7eb5f983f21d969e30155c5d82c01c1 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:45 2013 -0500 Fixed a missing fallthrough comment from ChatCommand commit b4a76c9f022a2fd98bdd8f083accfea03becfd71 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 19:09:36 2013 -0500 Formatting: datatypes.* through events.* commit 3e57dd41d3265a7c8106c7eb026df926770a4d15 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:56:15 2013 -0500 Fix issue with bad rebase commit e8c8e06b2971555b7334e49128257e3af6f36892 Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 17:35:32 2013 -0500 Formatting: DatabaseManager, LeaderboardManager, DatabaseUpdateType, and PlayerStat commit 13ecf1cc41f377a12991e357ac10abdcda24d6de Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:31:43 2013 -0500 Format: listeners.* through runnables.* commit 71686e3c0d96c2dcf25442b91703fadda1ea3bb0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 17:13:57 2013 -0500 Format PartyLockCommand commit d50abed10bf94e1a88df3dc5cc07c259aea920ea Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 16:54:08 2013 -0500 Format: base through config.* commit 7004823eeebbae5be7728bf9cafc3b04e57b64cf Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:21:40 2013 -0500 Example of using spaces to align like things commit 534190cfe2481e466fe459d65628550458cc2993 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:12:19 2013 -0500 Capitalization commit 5b61d3ba4c8d81e6f358b0cf4f460abfe9798414 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 15:07:43 2013 -0500 Updated readme, added standards.md commit 5ec0df70fb82c527420a2f437f27f31bd758f884 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 14:42:16 2013 -0500 Markdown was here, Creole is a loser commit 70d557c59d086b6a5fb5e0e63c0c1d8eb4c8d19c Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 13:46:24 2013 -0500 Move MCStats shading to .metrics.mcstats commit eb9d67e66b1659d6abd2397ecf403343cfeffdda Author: GJ <gjmcferrin@gmail.com> Date: Thu Feb 28 13:37:37 2013 -0500 Move ALL the packages! commit 8ffa9e7b75417b6c7f158613d4b4ffb783dcf2d0 Author: NuclearW <incongruency@gmail.com> Date: Thu Feb 28 12:37:12 2013 -0500 /r/n -> /n
2013-03-01 06:52:01 +01:00
}