mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Remove Static Abuse - ItemUtils -> ItemTools
This commit is contained in:
parent
05f289e6e6
commit
250753c064
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -37,22 +36,22 @@ public enum ToolType {
|
||||
public boolean inHand(ItemStack itemStack) {
|
||||
switch (this) {
|
||||
case AXE:
|
||||
return ItemUtils.isAxe(itemStack);
|
||||
return pluginRef.getItemTools().isAxe(itemStack);
|
||||
|
||||
case FISTS:
|
||||
return itemStack.getType() == Material.AIR;
|
||||
|
||||
case HOE:
|
||||
return ItemUtils.isHoe(itemStack);
|
||||
return pluginRef.getItemTools().isHoe(itemStack);
|
||||
|
||||
case PICKAXE:
|
||||
return ItemUtils.isPickaxe(itemStack);
|
||||
return pluginRef.getItemTools().isPickaxe(itemStack);
|
||||
|
||||
case SHOVEL:
|
||||
return ItemUtils.isShovel(itemStack);
|
||||
return pluginRef.getItemTools().isShovel(itemStack);
|
||||
|
||||
case SWORD:
|
||||
return ItemUtils.isSword(itemStack);
|
||||
return pluginRef.getItemTools().isSword(itemStack);
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.datatypes.skills.behaviours;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -24,7 +23,7 @@ public class AxesBehaviour {
|
||||
|
||||
public boolean hasArmor(LivingEntity target) {
|
||||
for (ItemStack itemStack : target.getEquipment().getArmorContents()) {
|
||||
if (itemStack != null && ItemUtils.isArmor(itemStack)) {
|
||||
if (itemStack != null && pluginRef.getItemTools().isArmor(itemStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.core.MetadataConstants;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -32,7 +31,7 @@ public class MiningBehaviour {
|
||||
|
||||
public MiningBehaviour(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
this.detonators = ItemUtils.matchMaterials(pluginRef.getConfigManager().getConfigMining().getDetonators());
|
||||
this.detonators = pluginRef.getItemTools().matchMaterials(pluginRef.getConfigManager().getConfigMining().getDetonators());
|
||||
}
|
||||
|
||||
public double getBlastRadiusModifier(int rank) {
|
||||
|
@ -13,7 +13,6 @@ import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
@ -297,13 +296,13 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
else if (pluginRef.getBlockTools().affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.MINING, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
else if (pluginRef.getBlockTools().affectedBySuperBreaker(blockState) && pluginRef.getItemTools().isPickaxe(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.MINING, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
}
|
||||
|
||||
/* WOOD CUTTING */
|
||||
else if (pluginRef.getBlockTools().isLog(blockState) && ItemUtils.isAxe(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.WOODCUTTING, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
else if (pluginRef.getBlockTools().isLog(blockState) && pluginRef.getItemTools().isAxe(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.WOODCUTTING, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||
woodcuttingManager.processTreeFeller(blockState);
|
||||
@ -313,7 +312,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
else if (pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.EXCAVATION, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
else if (pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) && pluginRef.getItemTools().isShovel(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.EXCAVATION, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
||||
excavationManager.excavationBlockCheck(blockState);
|
||||
|
||||
@ -366,7 +365,7 @@ public class BlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ItemUtils.isSword(heldItem)) {
|
||||
if (pluginRef.getItemTools().isSword(heldItem)) {
|
||||
HerbalismManager herbalismManager = pluginRef.getUserManager().getPlayer(player).getHerbalismManager();
|
||||
|
||||
if (herbalismManager.canUseHylianLuck()) {
|
||||
@ -434,13 +433,13 @@ public class BlockListener implements Listener {
|
||||
if (pluginRef.getBlockTools().canActivateAbilities(blockState)) {
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (pluginRef.getBlockTools().affectedByGreenTerra(blockState) || pluginRef.getBlockTools().canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && pluginRef.getItemTools().isHoe(heldItem) && (pluginRef.getBlockTools().affectedByGreenTerra(blockState) || pluginRef.getBlockTools().canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.HERBALISM);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && pluginRef.getBlockTools().isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && pluginRef.getItemTools().isAxe(heldItem) && pluginRef.getBlockTools().isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.WOODCUTTING);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && pluginRef.getBlockTools().affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && pluginRef.getItemTools().isPickaxe(heldItem) && pluginRef.getBlockTools().affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.MINING);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && pluginRef.getItemTools().isShovel(heldItem) && pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.EXCAVATION);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || pluginRef.getBlockTools().affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.player.PlayerUpdateInventoryTask;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import org.bukkit.block.Block;
|
||||
@ -88,7 +87,7 @@ public class InventoryListener implements Listener {
|
||||
BlockState furnaceState = furnaceBlock.getState();
|
||||
ItemStack smelting = furnaceState instanceof Furnace ? ((Furnace) furnaceState).getInventory().getSmelting() : null;
|
||||
|
||||
if (!ItemUtils.isSmeltable(smelting)) {
|
||||
if (!pluginRef.getItemTools().isSmeltable(smelting)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -121,7 +120,7 @@ public class InventoryListener implements Listener {
|
||||
Block furnaceBlock = event.getBlock();
|
||||
ItemStack smelting = event.getSource();
|
||||
|
||||
if (!ItemUtils.isSmeltable(smelting)) {
|
||||
if (!pluginRef.getItemTools().isSmeltable(smelting)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -153,7 +152,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
Block furnaceBlock = event.getBlock();
|
||||
|
||||
if (!ItemUtils.isSmelted(new ItemStack(event.getItemType(), event.getItemAmount()))) {
|
||||
if (!pluginRef.getItemTools().isSmelted(new ItemStack(event.getItemType(), event.getItemAmount()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -461,7 +460,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
ItemStack result = event.getRecipe().getResult();
|
||||
|
||||
if (!ItemUtils.isMcMMOItem(result)) {
|
||||
if (!pluginRef.getItemTools().isMcMMOItem(result)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ public class PlayerListener implements Listener {
|
||||
Item drop = event.getItemDrop();
|
||||
ItemStack dropStack = drop.getItemStack();
|
||||
|
||||
if (ItemUtils.isSharable(dropStack)) {
|
||||
if (pluginRef.getItemTools().isSharable(dropStack)) {
|
||||
drop.setMetadata(MetadataConstants.DROPPED_ITEM_TRACKING_METAKEY, MetadataConstants.metadataValue);
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
|
||||
if (!drop.hasMetadata(MetadataConstants.DROPPED_ITEM_TRACKING_METAKEY) && mcMMOPlayer.inParty() && ItemUtils.isSharable(dropStack)) {
|
||||
if (!drop.hasMetadata(MetadataConstants.DROPPED_ITEM_TRACKING_METAKEY) && mcMMOPlayer.inParty() && pluginRef.getItemTools().isSharable(dropStack)) {
|
||||
event.setCancelled(mcMMOPlayer.getParty().getShareHandler().handleItemShare(drop, mcMMOPlayer));
|
||||
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
|
||||
|
@ -95,6 +95,7 @@ public class mcMMO extends JavaPlugin {
|
||||
private MaterialMapStore materialMapStore;
|
||||
private RandomChanceTools randomChanceTools;
|
||||
private RankTools rankTools;
|
||||
private ItemTools itemTools;
|
||||
|
||||
/* Never-Ending tasks */
|
||||
private BleedTimerTask bleedTimerTask;
|
||||
@ -258,6 +259,9 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
//Init Block Tools
|
||||
blockTools = new BlockTools(this);
|
||||
|
||||
//Init Item Tools
|
||||
itemTools = new ItemTools(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -777,4 +781,8 @@ public class mcMMO extends JavaPlugin {
|
||||
public BlockTools getBlockTools() {
|
||||
return blockTools;
|
||||
}
|
||||
|
||||
public ItemTools getItemTools() {
|
||||
return itemTools;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Item;
|
||||
@ -159,13 +158,13 @@ public final class ShareHandler {
|
||||
}
|
||||
|
||||
public ItemShareType getShareType(ItemStack itemStack) {
|
||||
if (ItemUtils.isMobDrop(itemStack)) {
|
||||
if (pluginRef.getItemTools().isMobDrop(itemStack)) {
|
||||
return ItemShareType.LOOT;
|
||||
} else if (ItemUtils.isMiningDrop(itemStack)) {
|
||||
} else if (pluginRef.getItemTools().isMiningDrop(itemStack)) {
|
||||
return ItemShareType.MINING;
|
||||
} else if (ItemUtils.isHerbalismDrop(itemStack)) {
|
||||
} else if (pluginRef.getItemTools().isHerbalismDrop(itemStack)) {
|
||||
return ItemShareType.HERBALISM;
|
||||
} else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
|
||||
} else if (pluginRef.getItemTools().isWoodcuttingDrop(itemStack)) {
|
||||
return ItemShareType.WOODCUTTING;
|
||||
} else if (pluginRef.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(itemStack.getType()) != null) {
|
||||
return ItemShareType.MISC;
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.runnables.items;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ChimaeraWing;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -37,7 +36,7 @@ public class ChimaeraWingWarmup extends BukkitRunnable {
|
||||
|
||||
ItemStack inHand = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (!ItemUtils.isChimaeraWing(inHand) || inHand.getAmount() < pluginRef.getConfigManager().getConfigItems().getChimaeraWingUseCost()) {
|
||||
if (!pluginRef.getItemTools().isChimaeraWing(inHand) || inHand.getAmount() < pluginRef.getConfigManager().getConfigItems().getChimaeraWingUseCost()) {
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Skills.NeedMore", pluginRef.getLocaleManager().getString("Item.ChimaeraWing.Name")));
|
||||
return;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.datatypes.skills.behaviours.AxesBehaviour;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
@ -120,7 +119,7 @@ public class AxesManager extends SkillManager {
|
||||
double durabilityDamage = getImpactDurabilityDamage();
|
||||
|
||||
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||
if (armor != null && ItemUtils.isArmor(armor)) {
|
||||
if (armor != null && pluginRef.getItemTools().isArmor(armor)) {
|
||||
if (pluginRef.getRandomChanceTools().isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_ARMOR_IMPACT, getPlayer())) {
|
||||
pluginRef.getSkillTools().handleDurabilityChange(armor, durabilityDamage, 1);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
@ -287,7 +286,7 @@ public class FishingManager extends SkillManager {
|
||||
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
|
||||
if (isMagicHunterEnabled()
|
||||
&& ItemUtils.isEnchantable(treasureDrop)) {
|
||||
&& pluginRef.getItemTools().isEnchantable(treasureDrop)) {
|
||||
enchants = handleMagicHunter(treasureDrop);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
@ -329,7 +328,7 @@ public class HerbalismManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ItemUtils.isHoe(getPlayer().getInventory().getItemInMainHand())) {
|
||||
if (!pluginRef.getItemTools().isHoe(getPlayer().getInventory().getItemInMainHand())) {
|
||||
if (!playerInventory.containsAtLeast(seedStack, 1)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.salvage.salvageables;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import org.bukkit.Material;
|
||||
|
||||
/**
|
||||
@ -28,8 +27,8 @@ public class Salvageable {
|
||||
public Salvageable(Material itemMaterial, Material salvagedItemMaterial, int minimumLevel, int maximumQuantity) {
|
||||
this.itemMaterial = itemMaterial;
|
||||
this.salvagedItemMaterial = salvagedItemMaterial;
|
||||
this.salvageItemType = ItemUtils.determineItemType(itemMaterial);
|
||||
this.salvageItemMaterialCategory = ItemUtils.determineMaterialType(salvagedItemMaterial);
|
||||
this.salvageItemType = pluginRef.getItemTools().determineItemType(itemMaterial);
|
||||
this.salvageItemMaterialCategory = pluginRef.getItemTools().determineMaterialType(salvagedItemMaterial);
|
||||
this.minimumLevel = Math.max(0, minimumLevel);
|
||||
this.maximumQuantity = Math.max(1, maximumQuantity);
|
||||
this.maximumDurability = itemMaterial.getMaxDurability();
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -91,11 +90,11 @@ public class SwordsManager extends SkillManager {
|
||||
}
|
||||
|
||||
public int getToolTier(ItemStack itemStack) {
|
||||
if (ItemUtils.isDiamondTool(itemStack))
|
||||
if (pluginRef.getItemTools().isDiamondTool(itemStack))
|
||||
return 4;
|
||||
else if (ItemUtils.isIronTool(itemStack) || ItemUtils.isGoldTool(itemStack))
|
||||
else if (pluginRef.getItemTools().isIronTool(itemStack) || pluginRef.getItemTools().isGoldTool(itemStack))
|
||||
return 3;
|
||||
else if (ItemUtils.isStoneTool(itemStack))
|
||||
else if (pluginRef.getItemTools().isStoneTool(itemStack))
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
@ -54,7 +53,7 @@ public class UnarmedManager extends SkillManager {
|
||||
|
||||
Player player = getPlayer();
|
||||
|
||||
return ItemUtils.isUnarmed(player.getInventory().getItemInMainHand()) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
return pluginRef.getItemTools().isUnarmed(player.getInventory().getItemInMainHand()) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
}
|
||||
|
||||
public boolean canUseBlockCracker() {
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.behaviours.WoodcuttingBehaviour;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
@ -39,12 +38,12 @@ public class WoodcuttingManager extends SkillManager {
|
||||
public boolean canUseLeafBlower(ItemStack heldItem) {
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.WOODCUTTING_LEAF_BLOWER)
|
||||
&& pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.WOODCUTTING_LEAF_BLOWER)
|
||||
&& ItemUtils.isAxe(heldItem);
|
||||
&& pluginRef.getItemTools().isAxe(heldItem);
|
||||
}
|
||||
|
||||
public boolean canUseTreeFeller(ItemStack heldItem) {
|
||||
return mcMMOPlayer.getAbilityMode(SuperAbilityType.TREE_FELLER)
|
||||
&& ItemUtils.isAxe(heldItem);
|
||||
&& pluginRef.getItemTools().isAxe(heldItem);
|
||||
}
|
||||
|
||||
public boolean canGetDoubleDrops() {
|
||||
|
@ -32,7 +32,7 @@ public final class ChimaeraWing {
|
||||
public void activationCheck() {
|
||||
ItemStack inHand = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (!ItemUtils.isChimaeraWing(inHand)) {
|
||||
if (!pluginRef.getItemTools().isChimaeraWing(inHand)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.FurnaceRecipe;
|
||||
@ -12,11 +13,14 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class ItemUtils {
|
||||
private ItemUtils() {
|
||||
public final class ItemTools {
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public ItemTools(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
public static ArrayList<String> getRepairItemMaterials(List<Material> repairItemList) {
|
||||
public ArrayList<String> getRepairItemMaterials(List<Material> repairItemList) {
|
||||
ArrayList<String> repairMaterialList = new ArrayList<>();
|
||||
|
||||
for (Material m : repairItemList) {
|
||||
@ -26,7 +30,7 @@ public final class ItemUtils {
|
||||
return repairMaterialList;
|
||||
}
|
||||
|
||||
public static ArrayList<Material> matchMaterials(List<String> ItemBlockRegistryKeyList) {
|
||||
public ArrayList<Material> matchMaterials(List<String> ItemBlockRegistryKeyList) {
|
||||
ArrayList<Material> matchedMaterials = new ArrayList<>();
|
||||
|
||||
for (String s : ItemBlockRegistryKeyList) {
|
||||
@ -42,10 +46,10 @@ public final class ItemUtils {
|
||||
* @param material target material
|
||||
* @return the matching ItemType returns OTHER if no match
|
||||
*/
|
||||
public static ItemType determineItemType(Material material) {
|
||||
if (ItemUtils.isMinecraftTool(new ItemStack(material))) {
|
||||
public ItemType determineItemType(Material material) {
|
||||
if (isMinecraftTool(new ItemStack(material))) {
|
||||
return ItemType.TOOL;
|
||||
} else if (ItemUtils.isArmor(new ItemStack((material)))) {
|
||||
} else if (isArmor(new ItemStack((material)))) {
|
||||
return ItemType.ARMOR;
|
||||
} else {
|
||||
return ItemType.OTHER;
|
||||
@ -58,7 +62,7 @@ public final class ItemUtils {
|
||||
* @param material target material
|
||||
* @return the matching ItemMaterialCategory, return OTHER if no match
|
||||
*/
|
||||
public static ItemMaterialCategory determineMaterialType(Material material) {
|
||||
public ItemMaterialCategory determineMaterialType(Material material) {
|
||||
switch (material) {
|
||||
case STRING:
|
||||
return ItemMaterialCategory.STRING;
|
||||
@ -97,7 +101,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a bow, false otherwise
|
||||
*/
|
||||
public static boolean isBow(ItemStack item) {
|
||||
public boolean isBow(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -116,7 +120,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a sword, false otherwise
|
||||
*/
|
||||
public static boolean isSword(ItemStack item) {
|
||||
public boolean isSword(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -139,7 +143,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a hoe, false otherwise
|
||||
*/
|
||||
public static boolean isHoe(ItemStack item) {
|
||||
public boolean isHoe(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -162,7 +166,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a shovel, false otherwise
|
||||
*/
|
||||
public static boolean isShovel(ItemStack item) {
|
||||
public boolean isShovel(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -185,7 +189,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is an axe, false otherwise
|
||||
*/
|
||||
public static boolean isAxe(ItemStack item) {
|
||||
public boolean isAxe(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -208,7 +212,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a pickaxe, false otherwise
|
||||
*/
|
||||
public static boolean isPickaxe(ItemStack item) {
|
||||
public boolean isPickaxe(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -231,7 +235,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item counts as unarmed, false otherwise
|
||||
*/
|
||||
public static boolean isUnarmed(ItemStack item) {
|
||||
public boolean isUnarmed(ItemStack item) {
|
||||
if (pluginRef.getConfigManager().getConfigUnarmed().doItemsCountAsUnarmed()) {
|
||||
return !isMinecraftTool(item);
|
||||
}
|
||||
@ -245,7 +249,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a helmet, false otherwise
|
||||
*/
|
||||
public static boolean isHelmet(ItemStack item) {
|
||||
public boolean isHelmet(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -268,7 +272,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a chestplate, false otherwise
|
||||
*/
|
||||
public static boolean isChestplate(ItemStack item) {
|
||||
public boolean isChestplate(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -291,7 +295,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a pair of pants, false otherwise
|
||||
*/
|
||||
public static boolean isLeggings(ItemStack item) {
|
||||
public boolean isLeggings(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -314,7 +318,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a pair of boots, false otherwise
|
||||
*/
|
||||
public static boolean isBoots(ItemStack item) {
|
||||
public boolean isBoots(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
@ -337,7 +341,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is armor, false otherwise
|
||||
*/
|
||||
public static boolean isArmor(ItemStack item) {
|
||||
public boolean isArmor(ItemStack item) {
|
||||
return isHelmet(item) || isChestplate(item) || isLeggings(item) || isBoots(item);
|
||||
}
|
||||
|
||||
@ -347,7 +351,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is armor, false otherwise
|
||||
*/
|
||||
public static boolean isMinecraftArmor(ItemStack item) {
|
||||
public boolean isMinecraftArmor(ItemStack item) {
|
||||
return isLeatherArmor(item) || isGoldArmor(item) || isIronArmor(item) || isDiamondArmor(item) || isChainmailArmor(item);
|
||||
}
|
||||
|
||||
@ -357,7 +361,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is leather armor, false otherwise
|
||||
*/
|
||||
public static boolean isLeatherArmor(ItemStack item) {
|
||||
public boolean isLeatherArmor(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case LEATHER_BOOTS:
|
||||
case LEATHER_CHESTPLATE:
|
||||
@ -376,7 +380,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is gold armor, false otherwise
|
||||
*/
|
||||
public static boolean isGoldArmor(ItemStack item) {
|
||||
public boolean isGoldArmor(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case GOLDEN_BOOTS:
|
||||
case GOLDEN_CHESTPLATE:
|
||||
@ -395,7 +399,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is iron armor, false otherwise
|
||||
*/
|
||||
public static boolean isIronArmor(ItemStack item) {
|
||||
public boolean isIronArmor(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case IRON_BOOTS:
|
||||
case IRON_CHESTPLATE:
|
||||
@ -414,7 +418,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is diamond armor, false otherwise
|
||||
*/
|
||||
public static boolean isDiamondArmor(ItemStack item) {
|
||||
public boolean isDiamondArmor(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case DIAMOND_BOOTS:
|
||||
case DIAMOND_CHESTPLATE:
|
||||
@ -433,7 +437,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is chainmail armor, false otherwise
|
||||
*/
|
||||
public static boolean isChainmailArmor(ItemStack item) {
|
||||
public boolean isChainmailArmor(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case CHAINMAIL_BOOTS:
|
||||
case CHAINMAIL_CHESTPLATE:
|
||||
@ -452,7 +456,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a tool, false otherwise
|
||||
*/
|
||||
public static boolean isMinecraftTool(ItemStack item) {
|
||||
public boolean isMinecraftTool(ItemStack item) {
|
||||
return isStoneTool(item) || isWoodTool(item) || isGoldTool(item) || isIronTool(item) || isDiamondTool(item) || isStringTool(item) || item.getType() == Material.TRIDENT;
|
||||
}
|
||||
|
||||
@ -462,7 +466,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a stone tool, false otherwise
|
||||
*/
|
||||
public static boolean isStoneTool(ItemStack item) {
|
||||
public boolean isStoneTool(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case STONE_AXE:
|
||||
case STONE_HOE:
|
||||
@ -482,7 +486,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a wooden tool, false otherwise
|
||||
*/
|
||||
public static boolean isWoodTool(ItemStack item) {
|
||||
public boolean isWoodTool(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case WOODEN_AXE:
|
||||
case WOODEN_HOE:
|
||||
@ -502,7 +506,7 @@ public final class ItemUtils {
|
||||
* @param material Material to check
|
||||
* @return true if the item is a wooden tool, false otherwise
|
||||
*/
|
||||
public static boolean isWoodTool(Material material) {
|
||||
public boolean isWoodTool(Material material) {
|
||||
switch (material) {
|
||||
case WOODEN_AXE:
|
||||
case WOODEN_HOE:
|
||||
@ -522,7 +526,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a string tool, false otherwise
|
||||
*/
|
||||
public static boolean isStringTool(ItemStack item) {
|
||||
public boolean isStringTool(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case BOW:
|
||||
case CARROT_ON_A_STICK:
|
||||
@ -540,7 +544,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a stone tool, false otherwise
|
||||
*/
|
||||
public static boolean isGoldTool(ItemStack item) {
|
||||
public boolean isGoldTool(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case GOLDEN_AXE:
|
||||
case GOLDEN_HOE:
|
||||
@ -560,7 +564,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is an iron tool, false otherwise
|
||||
*/
|
||||
public static boolean isIronTool(ItemStack item) {
|
||||
public boolean isIronTool(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case BUCKET:
|
||||
case FLINT_AND_STEEL:
|
||||
@ -583,7 +587,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a diamond tool, false otherwise
|
||||
*/
|
||||
public static boolean isDiamondTool(ItemStack item) {
|
||||
public boolean isDiamondTool(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case DIAMOND_AXE:
|
||||
case DIAMOND_HOE:
|
||||
@ -603,7 +607,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is enchantable, false otherwise
|
||||
*/
|
||||
public static boolean isEnchantable(ItemStack item) {
|
||||
public boolean isEnchantable(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case ENCHANTED_BOOK:
|
||||
case SHEARS:
|
||||
@ -618,11 +622,11 @@ public final class ItemUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSmeltable(ItemStack item) {
|
||||
public boolean isSmeltable(ItemStack item) {
|
||||
return item != null && item.getType().isBlock() && MaterialUtils.isOre(item.getType());
|
||||
}
|
||||
|
||||
public static boolean isSmelted(ItemStack item) {
|
||||
public boolean isSmelted(ItemStack item) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
@ -644,7 +648,7 @@ public final class ItemUtils {
|
||||
* @param item Item that will get shared
|
||||
* @return True if the item can be shared.
|
||||
*/
|
||||
public static boolean isSharable(ItemStack item) {
|
||||
public boolean isSharable(ItemStack item) {
|
||||
if (item == null || item.getType() == Material.AIR) {
|
||||
return false;
|
||||
}
|
||||
@ -658,7 +662,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a mining drop, false otherwise
|
||||
*/
|
||||
public static boolean isMiningDrop(ItemStack item) {
|
||||
public boolean isMiningDrop(ItemStack item) {
|
||||
//TODO: 1.14 This needs to be updated
|
||||
switch (item.getType()) {
|
||||
case COAL:
|
||||
@ -689,7 +693,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a herbalism drop, false otherwise
|
||||
*/
|
||||
public static boolean isHerbalismDrop(ItemStack item) {
|
||||
public boolean isHerbalismDrop(ItemStack item) {
|
||||
//TODO: 1.14 This needs to be updated
|
||||
switch (item.getType()) {
|
||||
case WHEAT:
|
||||
@ -728,7 +732,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a mob drop, false otherwise
|
||||
*/
|
||||
public static boolean isMobDrop(ItemStack item) {
|
||||
public boolean isMobDrop(ItemStack item) {
|
||||
//TODO: 1.14 This needs to be updated
|
||||
switch (item.getType()) {
|
||||
case STRING:
|
||||
@ -786,7 +790,7 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a woodcutting drop, false otherwise
|
||||
*/
|
||||
public static boolean isWoodcuttingDrop(ItemStack item) {
|
||||
public boolean isWoodcuttingDrop(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case ACACIA_LOG:
|
||||
case BIRCH_LOG:
|
||||
@ -826,11 +830,11 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a miscellaneous drop, false otherwise
|
||||
*/
|
||||
public static boolean isMiscDrop(ItemStack item) {
|
||||
public boolean isMiscDrop(ItemStack item) {
|
||||
return pluginRef.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(item.getType()) != null;
|
||||
}
|
||||
|
||||
public static boolean isMcMMOItem(ItemStack item) {
|
||||
public boolean isMcMMOItem(ItemStack item) {
|
||||
if (!item.hasItemMeta()) {
|
||||
return false;
|
||||
}
|
||||
@ -839,7 +843,7 @@ public final class ItemUtils {
|
||||
return itemMeta.hasLore() && itemMeta.getLore().contains("mcMMO Item");
|
||||
}
|
||||
|
||||
public static boolean isChimaeraWing(ItemStack item) {
|
||||
public boolean isChimaeraWing(ItemStack item) {
|
||||
if (!isMcMMOItem(item)) {
|
||||
return false;
|
||||
}
|
@ -19,7 +19,6 @@ import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@ -263,7 +262,7 @@ public final class CombatTools {
|
||||
event.setDamage(acrobaticsManager.dodgeCheck(event.getDamage()));
|
||||
}
|
||||
|
||||
if (ItemUtils.isSword(player.getInventory().getItemInMainHand())) {
|
||||
if (pluginRef.getItemTools().isSword(player.getInventory().getItemInMainHand())) {
|
||||
if (!pluginRef.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.SWORDS, target)) {
|
||||
return;
|
||||
}
|
||||
@ -301,7 +300,7 @@ public final class CombatTools {
|
||||
}
|
||||
}
|
||||
|
||||
if (ItemUtils.isSword(heldItem)) {
|
||||
if (pluginRef.getItemTools().isSword(heldItem)) {
|
||||
if (!pluginRef.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.SWORDS, target)) {
|
||||
return;
|
||||
}
|
||||
@ -309,7 +308,7 @@ public final class CombatTools {
|
||||
if (pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.SWORDS, player)) {
|
||||
processSwordCombat(target, player, event);
|
||||
}
|
||||
} else if (ItemUtils.isAxe(heldItem)) {
|
||||
} else if (pluginRef.getItemTools().isAxe(heldItem)) {
|
||||
if (!pluginRef.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.AXES, target)) {
|
||||
return;
|
||||
}
|
||||
@ -317,7 +316,7 @@ public final class CombatTools {
|
||||
if (pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.AXES, player)) {
|
||||
processAxeCombat(target, player, event);
|
||||
}
|
||||
} else if (ItemUtils.isUnarmed(heldItem)) {
|
||||
} else if (pluginRef.getItemTools().isUnarmed(heldItem)) {
|
||||
if (!pluginRef.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.UNARMED, target)) {
|
||||
return;
|
||||
}
|
||||
@ -784,15 +783,15 @@ public final class CombatTools {
|
||||
private int getTier(ItemStack inHand) {
|
||||
int tier = 0;
|
||||
|
||||
if (ItemUtils.isWoodTool(inHand)) {
|
||||
if (pluginRef.getItemTools().isWoodTool(inHand)) {
|
||||
tier = 1;
|
||||
} else if (ItemUtils.isStoneTool(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isStoneTool(inHand)) {
|
||||
tier = 2;
|
||||
} else if (ItemUtils.isIronTool(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isIronTool(inHand)) {
|
||||
tier = 3;
|
||||
} else if (ItemUtils.isGoldTool(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isGoldTool(inHand)) {
|
||||
tier = 1;
|
||||
} else if (ItemUtils.isDiamondTool(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isDiamondTool(inHand)) {
|
||||
tier = 4;
|
||||
}
|
||||
/*else if (mcMMO.getModManager().isCustomTool(inHand)) {
|
||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
@ -400,7 +399,7 @@ public class SkillTools {
|
||||
}
|
||||
|
||||
public void removeAbilityBuff(ItemStack item) {
|
||||
if (item == null || item.getType() == Material.AIR || (!ItemUtils.isPickaxe(item) && !ItemUtils.isShovel(item)) || !item.containsEnchantment(Enchantment.DIG_SPEED)) {
|
||||
if (item == null || item.getType() == Material.AIR || (!pluginRef.getItemTools().isPickaxe(item) && !pluginRef.getItemTools().isShovel(item)) || !item.containsEnchantment(Enchantment.DIG_SPEED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -458,19 +457,19 @@ public class SkillTools {
|
||||
}
|
||||
|
||||
protected Material getRepairAndSalvageItem(ItemStack inHand) {
|
||||
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
if (pluginRef.getItemTools().isDiamondTool(inHand) || pluginRef.getItemTools().isDiamondArmor(inHand)) {
|
||||
return Material.DIAMOND;
|
||||
} else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isGoldTool(inHand) || pluginRef.getItemTools().isGoldArmor(inHand)) {
|
||||
return Material.GOLD_INGOT;
|
||||
} else if (ItemUtils.isIronTool(inHand) || ItemUtils.isIronArmor(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isIronTool(inHand) || pluginRef.getItemTools().isIronArmor(inHand)) {
|
||||
return Material.IRON_INGOT;
|
||||
} else if (ItemUtils.isStoneTool(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isStoneTool(inHand)) {
|
||||
return Material.COBBLESTONE;
|
||||
} else if (ItemUtils.isWoodTool(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isWoodTool(inHand)) {
|
||||
return Material.OAK_WOOD;
|
||||
} else if (ItemUtils.isLeatherArmor(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isLeatherArmor(inHand)) {
|
||||
return Material.LEATHER;
|
||||
} else if (ItemUtils.isStringTool(inHand)) {
|
||||
} else if (pluginRef.getItemTools().isStringTool(inHand)) {
|
||||
return Material.STRING;
|
||||
} else {
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user