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