Fleshing out the abstraction

This commit is contained in:
nossr50 2019-02-13 08:40:13 -08:00
parent 84353de71d
commit 4461cfacd2
29 changed files with 306 additions and 110 deletions

View File

@ -57,7 +57,7 @@ public class FishingCommand extends SkillCommand {
if (canTreasureHunt) {
lootTier = fishingManager.getLootTier();
// Item drop rates
// ItemStack drop rates
commonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.COMMON) / 100.0);
uncommonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.UNCOMMON) / 100.0);
rareTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RARE) / 100.0);

View File

@ -1,5 +1,5 @@
#
# Item Weights configuration
# ItemStack Weights configuration
#
# This file is used to determine the value of an item. This will only
# happen when users are sharing items in a party using the EQUAL item share mode.
@ -27,7 +27,7 @@ Item_Weights:
Coal: 10
Coal_Ore: 10
# Item weights for armor and tools
# ItemStack weights for armor and tools
Diamond_Sword: 150
Diamond_Shovel: 150
Diamond_Pickaxe: 150

View File

@ -2,6 +2,17 @@ package com.gmail.nossr50.core;
import com.gmail.nossr50.core.mcmmo.plugin.Plugin;
import java.util.logging.Logger;
public class McmmoCore {
public static Plugin p;
/**
* Returns our Logger
* @return the logger
*/
public static Logger getLogger()
{
}
}

View File

@ -0,0 +1,7 @@
This file is just going to take note of all the caveats of mcMMO code as I abstract out bukkit
1) In several places mcMMO is disabling itself, pretty sure this is not a good idea and this should be changed
eg: in McMMOPlayer, and when loading configs and finding bad vlaues
2) mcMMO uses a a global reference of its Plugin class for Bukkit in order to schedule tasks

View File

@ -39,7 +39,7 @@ public class RepairConfig extends ConfigLoader {
// Validate all the things!
List<String> reason = new ArrayList<String>();
// Item Material
// ItemStack Material
Material itemMaterial = Material.matchMaterial(key);
if (itemMaterial == null) {
@ -95,7 +95,7 @@ public class RepairConfig extends ConfigLoader {
reason.add("Maximum durability of " + key + " must be greater than 0!");
}
// Item Type
// ItemStack Type
ItemType repairItemType = ItemType.OTHER;
String repairItemTypeString = config.getString("Repairables." + key + ".ItemType", "OTHER");

View File

@ -34,7 +34,7 @@ public class SalvageConfig extends ConfigLoader {
// Validate all the things!
List<String> reason = new ArrayList<String>();
// Item Material
// ItemStack Material
Material itemMaterial = Material.matchMaterial(key);
if (itemMaterial == null) {
@ -82,7 +82,7 @@ public class SalvageConfig extends ConfigLoader {
// Maximum Durability
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Salvageables." + key + ".MaximumDurability"));
// Item Type
// ItemStack Type
ItemType salvageItemType = ItemType.OTHER;
String salvageItemTypeString = config.getString("Salvageables." + key + ".ItemType", "OTHER");

View File

@ -15,6 +15,7 @@ import com.gmail.nossr50.core.datatypes.party.Party;
import com.gmail.nossr50.core.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.core.locale.LocaleLoader;
import com.gmail.nossr50.core.mcmmo.entity.Player;
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
import com.gmail.nossr50.core.mcmmo.meta.Metadata;
import com.gmail.nossr50.core.mcmmo.meta.MetadataDefinitions;
import com.gmail.nossr50.core.mcmmo.world.Location;
@ -133,7 +134,7 @@ public class McMMOPlayer {
experienceBarManager.hideExperienceBar(primarySkillType);
}*/
public void processPostXpEvent(XPGainReason xpGainReason, PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource) {
public void processPostXpEvent(XPGainReason xpGainReason, PrimarySkillType primarySkillType, XPGainSource xpGainSource) {
//Updates from Party sources
if (xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
return;
@ -142,21 +143,21 @@ public class McMMOPlayer {
if (xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
return;
updateXPBar(primarySkillType, plugin);
updateXPBar(primarySkillType);
}
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel) {
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, skillLevel);
public void processUnlockNotifications(PrimarySkillType primarySkillType, int skillLevel) {
RankUtils.executeSkillUnlockNotifications(primarySkillType, skillLevel);
}
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin) {
public void updateXPBar(PrimarySkillType primarySkillType) {
//Skill Unlock Notifications
if (primarySkillType.isChildSkill())
return;
//XP BAR UPDATES
experienceBarManager.updateExperienceBar(primarySkillType, plugin);
experienceBarManager.updateExperienceBar(primarySkillType);
}
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType) {

View File

@ -0,0 +1,33 @@
package com.gmail.nossr50.core.mcmmo.colors;
/**
* Represents special formatting codes in Minecraft
*
* Some of them apply colors, some of them apply stylized effects to the text.
*/
public enum ChatColor {
BLACK,
DARK_BLUE,
DARK_GREEN,
DARK_AQUA,
DARK_RED,
DARK_PURPLE,
GOLD,
GRAY,
DARK_GRAY,
BLUE,
GREEN,
AQUA,
RED,
LIGHT_PURPLE,
YELLOW,
WHITE,
OBFUSCATED,
BOLD,
STRIKETHROUGH,
UNDERLINE,
ITALIC,
RESET;
static final String formattingCharacter = "§";
}

View File

@ -0,0 +1,30 @@
package com.gmail.nossr50.core.mcmmo.colors;
/**
* Colors used by MC for non-chat purposes
*/
public enum Color {
AQUA,
BLACK,
BLUE,
FUCHSIA,
GRAY,
GREEN,
LIME,
MAROON,
NAVY,
OLIVE,
ORANGE,
PURPLE,
RED,
SILVER,
TEAL,
WHITE,
YELLOW;
Color fromRGB(int r, int g, int b)
{
}
}

View File

@ -2,11 +2,13 @@ package com.gmail.nossr50.core.mcmmo.entity;
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.core.mcmmo.Nameable;
import com.gmail.nossr50.core.mcmmo.inventory.InventoryHolder;
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
/**
* Players
*/
public interface Player extends Living, Nameable {
public interface Player extends Living, Nameable, InventoryHolder {
/**
* Players are not always online
@ -21,4 +23,10 @@ public interface Player extends Living, Nameable {
* @return the associated McMMOPlayer, can be null
*/
McMMOPlayer getMcMMOPlayer();
/**
* Gets the item in the main hand of this player
* @return the item in the main hand
*/
ItemStack getItemInMainHand();
}

View File

@ -0,0 +1,8 @@
package com.gmail.nossr50.core.mcmmo.entity;
/**
* Represents an entity that can be tamed
*/
public interface Tameable extends Living {
}

View File

@ -0,0 +1,17 @@
package com.gmail.nossr50.core.mcmmo.inventory;
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
public interface Inventory {
/**
* Grab the entire Inventory
* @return this inventory
*/
ItemStack[] getInventory();
/**
* Sets the inventory
* @param inventory new inventory
*/
void setInventory(ItemStack[] inventory);
}

View File

@ -0,0 +1,12 @@
package com.gmail.nossr50.core.mcmmo.inventory;
/**
* Represents something that has an inventory
*/
public interface InventoryHolder {
/**
* Gets the inventory for this entity
* @return this inventory
*/
Inventory getInventory();
}

View File

@ -0,0 +1,10 @@
package com.gmail.nossr50.core.mcmmo.inventory;
/**
* Definitions for item types
*
* items prefixed with LEGACY are items that are removed from current versions of the game
*/
public enum ItemType {
AIR,
}

View File

@ -0,0 +1,59 @@
package com.gmail.nossr50.core.mcmmo.item;
import com.gmail.nossr50.core.mcmmo.nbt.NBT;
import java.util.ArrayList;
/**
* Represents an ItemStack in Minecraft
*/
public interface ItemStack {
/**
* The maximum amount of this item allowed in a stack
* @return the maximum stack size of the item
*/
int getMaxStackSize();
/**
* The current amount of items in this stack
* @return the amount of items
*/
int getAmount();
/**
* Replaces the lore on an item stack
* @param replacementLore the new lore for this item
*/
void setItemLore(ArrayList<String> replacementLore);
/**
* Unlocalized name of this item
* @return the unlocalized name of this item (english)
*/
String getUnlocalizedName();
/**
* The maximum amount of damage this item can take before it breaks
* @return the maximum damage allowed on this item
*/
int getMaxDamage();
/**
* The id of this item
* @return this item's id
*/
int getItemId();
/**
* Returns the cooldown for an item
* @return this item's cooldown
*/
int getCoolDown();
/**
* Returns the compound NBT data for this item
* @return this item's NBT data
*/
NBT getNBT();
}

View File

@ -0,0 +1,7 @@
package com.gmail.nossr50.core.mcmmo.nbt;
/**
* Represents compound NBT Data
*/
public interface NBT {
}

View File

@ -58,7 +58,7 @@ public final class ShareHandler {
/**
* Distribute Items amongst party members.
*
* @param drop Item that will get shared
* @param drop ItemStack that will get shared
* @param mcMMOPlayer Player who picked up the item
* @return True if the item has been shared
*/

View File

@ -1,30 +1,31 @@
package com.gmail.nossr50.core.skills;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.core.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
import com.gmail.nossr50.skills.archery.ArcheryManager;
import com.gmail.nossr50.skills.axes.AxesManager;
import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.repair.RepairManager;
import com.gmail.nossr50.skills.salvage.SalvageManager;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.skills.swords.SwordsManager;
import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.core.config.experience.ExperienceConfig;
import com.gmail.nossr50.core.locale.LocaleLoader;
import com.gmail.nossr50.core.mcmmo.colors.Color;
import com.gmail.nossr50.core.mcmmo.entity.Entity;
import com.gmail.nossr50.core.mcmmo.entity.Player;
import com.gmail.nossr50.core.skills.child.salvage.SalvageManager;
import com.gmail.nossr50.core.skills.child.smelting.SmeltingManager;
import com.gmail.nossr50.core.skills.primary.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.core.skills.primary.alchemy.AlchemyManager;
import com.gmail.nossr50.core.skills.primary.archery.ArcheryManager;
import com.gmail.nossr50.core.skills.primary.axes.AxesManager;
import com.gmail.nossr50.core.skills.primary.excavation.ExcavationManager;
import com.gmail.nossr50.core.skills.primary.fishing.FishingManager;
import com.gmail.nossr50.core.skills.primary.herbalism.HerbalismManager;
import com.gmail.nossr50.core.skills.primary.mining.MiningManager;
import com.gmail.nossr50.core.skills.primary.repair.RepairManager;
import com.gmail.nossr50.core.skills.primary.swords.SwordsManager;
import com.gmail.nossr50.core.skills.primary.taming.TamingManager;
import com.gmail.nossr50.core.skills.primary.unarmed.UnarmedManager;
import com.gmail.nossr50.core.skills.primary.woodcutting.WoodcuttingManager;
import com.gmail.nossr50.core.util.Permissions;
import com.gmail.nossr50.core.util.StringUtils;
import com.gmail.nossr50.core.util.skills.ParticleEffectUtils;
import com.gmail.nossr50.core.util.skills.RankUtils;
import com.google.common.collect.ImmutableList;
import org.bukkit.Color;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;

View File

@ -3,9 +3,9 @@ package com.gmail.nossr50.core.skills;
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import com.gmail.nossr50.core.mcmmo.entity.Entity;
import com.gmail.nossr50.core.mcmmo.entity.Living;
import com.gmail.nossr50.core.mcmmo.entity.Player;
public abstract class SkillManager {
protected McMMOPlayer mcMMOPlayer;
@ -47,7 +47,7 @@ public abstract class SkillManager {
mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, xpGainSource);
}
public XPGainReason getXPGainReason(LivingEntity target, Entity damager) {
public XPGainReason getXPGainReason(Living target, Entity damager) {
return (damager instanceof Player && target instanceof Player) ? XPGainReason.PVP : XPGainReason.PVE;
}
}

View File

@ -31,7 +31,7 @@ public interface SalvageableManager {
/**
* Checks if an item is salvageable
*
* @param itemStack Item to check if salvageable
* @param itemStack ItemStack to check if salvageable
* @return true if salvageable, false if not
*/
public boolean isSalvageable(ItemStack itemStack);

View File

@ -5,28 +5,23 @@ import com.gmail.nossr50.core.config.Config;
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.core.mcmmo.block.BlockState;
import com.gmail.nossr50.core.mcmmo.entity.Player;
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
import com.gmail.nossr50.core.runnables.skills.AbilityCooldownTask;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.core.skills.SkillManager;
import com.gmail.nossr50.core.skills.SubSkillType;
import com.gmail.nossr50.core.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.core.util.BlockUtils;
import com.gmail.nossr50.core.util.EventUtils;
import com.gmail.nossr50.core.util.Misc;
import com.gmail.nossr50.core.util.Permissions;
import com.gmail.nossr50.core.util.player.NotificationManager;
import com.gmail.nossr50.core.util.random.RandomChanceUtil;
import com.gmail.nossr50.core.util.skills.RankUtils;
import com.gmail.nossr50.core.util.skills.SkillActivationType;
import com.gmail.nossr50.core.util.skills.SkillUtils;
import java.util.ArrayList;
import java.util.List;
@ -58,7 +53,7 @@ public class MiningManager extends SkillManager {
public boolean canDetonate() {
Player player = getPlayer();
return canUseBlastMining() && player.isSneaking() && player.getInventory().getItemInMainHand().getType() == BlastMining.detonator && Permissions.remoteDetonation(player);
return canUseBlastMining() && player.isSneaking() && player.getItemInMainHand().getType() == BlastMining.detonator && Permissions.remoteDetonation(player);
}
public boolean canUseBlastMining() {

View File

@ -298,7 +298,7 @@ public class RepairManager extends SkillManager {
/**
* Handles removing & downgrading enchants.
*
* @param item Item being repaired
* @param item ItemStack being repaired
*/
private void addEnchants(ItemStack item) {
Player player = getPlayer();

View File

@ -31,7 +31,7 @@ public interface RepairableManager {
/**
* Checks if an item is repairable
*
* @param itemStack Item to check if repairable
* @param itemStack ItemStack to check if repairable
* @return true if repairable, false if not
*/
public boolean isRepairable(ItemStack itemStack);

View File

@ -59,7 +59,7 @@ public class Unarmed {
}
if (amount <= 0)
event.getItem().remove(); //Cleanup Item
event.getItem().remove(); //Cleanup ItemStack
else
event.getItem().getItemStack().setAmount(amount);

View File

@ -18,7 +18,7 @@ public final class ItemUtils {
/**
* Checks if the item is a bow.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a bow, false otherwise
*/
public static boolean isBow(ItemStack item) {
@ -36,7 +36,7 @@ public final class ItemUtils {
/**
* Checks if the item is a sword.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a sword, false otherwise
*/
public static boolean isSword(ItemStack item) {
@ -58,7 +58,7 @@ public final class ItemUtils {
/**
* Checks if the item is a hoe.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a hoe, false otherwise
*/
public static boolean isHoe(ItemStack item) {
@ -80,7 +80,7 @@ public final class ItemUtils {
/**
* Checks if the item is a shovel.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a shovel, false otherwise
*/
public static boolean isShovel(ItemStack item) {
@ -102,7 +102,7 @@ public final class ItemUtils {
/**
* Checks if the item is an axe.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is an axe, false otherwise
*/
public static boolean isAxe(ItemStack item) {
@ -124,7 +124,7 @@ public final class ItemUtils {
/**
* Checks if the item is a pickaxe.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a pickaxe, false otherwise
*/
public static boolean isPickaxe(ItemStack item) {
@ -146,7 +146,7 @@ public final class ItemUtils {
/**
* Checks if the item counts as unarmed.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item counts as unarmed, false otherwise
*/
public static boolean isUnarmed(ItemStack item) {
@ -160,7 +160,7 @@ public final class ItemUtils {
/**
* Checks if the item is a helmet.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a helmet, false otherwise
*/
public static boolean isHelmet(ItemStack item) {
@ -182,7 +182,7 @@ public final class ItemUtils {
/**
* Checks if the item is a chestplate.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a chestplate, false otherwise
*/
public static boolean isChestplate(ItemStack item) {
@ -204,7 +204,7 @@ public final class ItemUtils {
/**
* Checks if the item is a pair of pants.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a pair of pants, false otherwise
*/
public static boolean isLeggings(ItemStack item) {
@ -226,7 +226,7 @@ public final class ItemUtils {
/**
* Checks if the item is a pair of boots.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a pair of boots, false otherwise
*/
public static boolean isBoots(ItemStack item) {
@ -248,7 +248,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a wearable armor piece.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is armor, false otherwise
*/
public static boolean isArmor(ItemStack item) {
@ -258,7 +258,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a wearable *vanilla* armor piece.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is armor, false otherwise
*/
public static boolean isMinecraftArmor(ItemStack item) {
@ -268,7 +268,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a leather armor piece.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is leather armor, false otherwise
*/
public static boolean isLeatherArmor(ItemStack item) {
@ -287,7 +287,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a gold armor piece.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is gold armor, false otherwise
*/
public static boolean isGoldArmor(ItemStack item) {
@ -306,7 +306,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is an iron armor piece.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is iron armor, false otherwise
*/
public static boolean isIronArmor(ItemStack item) {
@ -325,7 +325,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a diamond armor piece.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is diamond armor, false otherwise
*/
public static boolean isDiamondArmor(ItemStack item) {
@ -344,7 +344,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a chainmail armor piece.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is chainmail armor, false otherwise
*/
public static boolean isChainmailArmor(ItemStack item) {
@ -363,7 +363,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a *vanilla* tool.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a tool, false otherwise
*/
public static boolean isMinecraftTool(ItemStack item) {
@ -373,7 +373,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a stone tool.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a stone tool, false otherwise
*/
public static boolean isStoneTool(ItemStack item) {
@ -393,7 +393,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a wooden tool.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a wooden tool, false otherwise
*/
public static boolean isWoodTool(ItemStack item) {
@ -413,7 +413,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a string tool.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a string tool, false otherwise
*/
public static boolean isStringTool(ItemStack item) {
@ -431,7 +431,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a gold tool.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a stone tool, false otherwise
*/
public static boolean isGoldTool(ItemStack item) {
@ -451,7 +451,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is an iron tool.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is an iron tool, false otherwise
*/
public static boolean isIronTool(ItemStack item) {
@ -474,7 +474,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a diamond tool.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a diamond tool, false otherwise
*/
public static boolean isDiamondTool(ItemStack item) {
@ -494,7 +494,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is enchantable.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is enchantable, false otherwise
*/
public static boolean isEnchantable(ItemStack item) {
@ -535,7 +535,7 @@ public final class ItemUtils {
/**
* Check if an item is sharable.
*
* @param item Item that will get shared
* @param item ItemStack that will get shared
* @return True if the item can be shared.
*/
public static boolean isSharable(ItemStack item) {
@ -549,7 +549,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a mining drop.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a mining drop, false otherwise
*/
public static boolean isMiningDrop(ItemStack item) {
@ -579,7 +579,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a herbalism drop.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a herbalism drop, false otherwise
*/
public static boolean isHerbalismDrop(ItemStack item) {
@ -617,7 +617,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a mob drop.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a mob drop, false otherwise
*/
public static boolean isMobDrop(ItemStack item) {
@ -674,7 +674,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a woodcutting drop.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a woodcutting drop, false otherwise
*/
public static boolean isWoodcuttingDrop(ItemStack item) {
@ -714,7 +714,7 @@ public final class ItemUtils {
/**
* Checks to see if an item is a miscellaneous drop. These items are read from the config file
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a miscellaneous drop, false otherwise
*/
public static boolean isMiscDrop(ItemStack item) {

View File

@ -92,7 +92,7 @@ public final class Misc {
*
* @param location The location to drop the item at
* @param itemStack The item to drop
* @return Dropped Item entity or null if invalid or cancelled
* @return Dropped ItemStack entity or null if invalid or cancelled
*/
public static Item dropItem(Location location, ItemStack itemStack) {
if (itemStack.getType() == Material.AIR) {

View File

@ -167,7 +167,7 @@ public class ModManager {
/**
* Checks to see if an item is a custom tool.
*
* @param item Item to check
* @param item ItemStack to check
* @return true if the item is a custom tool, false otherwise
*/
public boolean isCustomTool(ItemStack item) {

View File

@ -25,7 +25,7 @@ public class ExperienceBarManager {
this.mcMMOPlayer = mcMMOPlayer;
}
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin) {
public void updateExperienceBar(PrimarySkillType primarySkillType) {
if (!ExperienceConfig.getInstance().isExperienceBarsEnabled() || !ExperienceConfig.getInstance().isExperienceBarEnabled(primarySkillType))
return;
@ -45,15 +45,15 @@ public class ExperienceBarManager {
//Setup Hide Bar Task
if (experienceBarHideTaskHashMap.get(primarySkillType) != null) {
experienceBarHideTaskHashMap.get(primarySkillType).cancel();
scheduleHideTask(primarySkillType, plugin);
scheduleHideTask(primarySkillType);
} else {
scheduleHideTask(primarySkillType, plugin);
scheduleHideTask(primarySkillType);
}
}
private void scheduleHideTask(PrimarySkillType primarySkillType, Plugin plugin) {
private void scheduleHideTask(PrimarySkillType primarySkillType) {
ExperienceBarHideTask experienceBarHideTask = new ExperienceBarHideTask(this, mcMMOPlayer, primarySkillType);
experienceBarHideTask.runTaskLater(plugin, 20 * 2);
experienceBarHideTask.runTaskLater(20 * 2);
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
}

View File

@ -3,14 +3,12 @@ package com.gmail.nossr50.core.util.skills;
import com.gmail.nossr50.core.config.RankConfig;
import com.gmail.nossr50.core.data.UserManager;
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.core.mcmmo.entity.Player;
import com.gmail.nossr50.core.runnables.skills.SkillUnlockNotificationTask;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.core.skills.SubSkillType;
import com.gmail.nossr50.core.skills.SuperAbilityType;
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.util.HashMap;
@ -18,12 +16,11 @@ public class RankUtils {
private static HashMap<String, HashMap<Integer, Integer>> subSkillRanks;
/**
* @param plugin plugin instance ref
* @param mcMMOPlayer target player
* @param primarySkillType
* @param newLevel the new level of this skill
*/
public static void executeSkillUnlockNotifications(Plugin plugin, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel) {
public static void executeSkillUnlockNotifications(McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel) {
int count = 0;
for (SubSkillType subSkillType : primarySkillType.getSkillAbilities()) {
@ -39,7 +36,7 @@ public class RankUtils {
if (newLevel == innerMap.get(playerRankInSkill)) {
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
skillUnlockNotificationTask.runTaskLater(plugin, ((count * 4) + 1) * 20);
skillUnlockNotificationTask.runTaskLater(((count * 4) + 1) * 20);
count++;
}