From 6c1ee24101e1fda455c3b496aa08e875339056e1 Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 29 Mar 2012 14:24:41 -0400 Subject: [PATCH] Tweaked some stuff with adding XP, added an ExperienceAPI class. --- .../com/gmail/nossr50/api/ExperienceAPI.java | 118 ++++++++++++++++++ .../java/com/gmail/nossr50/api/PartyAPI.java | 16 +-- .../commands/general/AddxpCommand.java | 6 +- .../commands/general/InspectCommand.java | 2 +- .../nossr50/datatypes/PlayerProfile.java | 82 ++++++------ .../nossr50/listeners/mcEntityListener.java | 2 +- src/main/java/com/gmail/nossr50/m.java | 9 +- src/main/java/com/gmail/nossr50/mcMMO.java | 19 --- .../com/gmail/nossr50/runnables/GainXp.java | 2 +- .../com/gmail/nossr50/skills/Acrobatics.java | 6 +- .../com/gmail/nossr50/skills/BlastMining.java | 2 +- .../com/gmail/nossr50/skills/Excavation.java | 2 +- .../com/gmail/nossr50/skills/Fishing.java | 4 +- .../com/gmail/nossr50/skills/Herbalism.java | 2 +- .../java/com/gmail/nossr50/skills/Mining.java | 2 +- .../java/com/gmail/nossr50/skills/Repair.java | 2 +- .../java/com/gmail/nossr50/skills/Skills.java | 2 +- .../com/gmail/nossr50/skills/WoodCutting.java | 4 +- 18 files changed, 184 insertions(+), 98 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/api/ExperienceAPI.java diff --git a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java new file mode 100644 index 000000000..7be4b88e6 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java @@ -0,0 +1,118 @@ +package com.gmail.nossr50.api; + +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.skills.Skills; + +public class ExperienceAPI { + + /** + * Check the XP of a player. This should be called after giving XP to process level-ups. + * + * @param player The player to check + * @param skillType The skill to check + */ + private static void checkXP(Player player, SkillType skillType) { + if (skillType.equals(SkillType.ALL)) { + Skills.XpCheckAll(player); + } + else { + Skills.XpCheckSkill(skillType, player); + } + } + + /** + * Adds XP to the player, doesn't calculate for XP Rate or other modifiers. + *
+ * This function is designed for API usage. + * + * @param player The player to add XP to + * @param skillType The skill to add XP to + * @param XP The amount of XP to add + */ + public static void addRawXP(Player player, SkillType skillType, int XP) { + Users.getProfile(player).addXPOverride(skillType, XP); + checkXP(player, skillType); + } + + /** + * Adds XP to the player, calculates for XP Rate but not skill modifiers. + *
+ * This function is designed for API usage. + * + * @param player The player to add XP to + * @param skillType The skill to add XP to + * @param XP The amount of XP to add + */ + public static void addMultipliedXP(Player player, SkillType skillType, int XP) { + Users.getProfile(player).addXPOverrideBonus(skillType, XP); + checkXP(player, skillType); + } + + /** + * Adds XP to the player, calculates for XP Rate and skill modifiers. + *
+ * This function is designed for API usage. + * + * @param player The player to add XP to + * @param skillType The skill to add XP to + * @param XP The amount of XP to add + */ + public static void addXP(Player player, SkillType skillType, int XP) { + Users.getProfile(player).addXP(skillType, XP); + checkXP(player, skillType); + } + + /** + * Get the amount of XP a player has in a specific skill. + *
+ * This function is designed for API usage. + * + * @param player The player to get XP for + * @param skillType The skill to get XP for + * @return the amount of XP in a given skill + */ + public static int getXP(Player player, SkillType skillType) { + return Users.getProfile(player).getSkillXpLevel(skillType); + } + + /** + * Get the amount of XP left before leveling up. + *
+ * This function is designed for API usage. + * + * @param player The player to get the XP amount for + * @param skillType The skill to get the XP amount for + * @return the amount of XP left before leveling up a specifc skill + */ + public static int getXPToNextLevel(Player player, SkillType skillType) { + return Users.getProfile(player).getXpToLevel(skillType); + } + + /** + * Add levels to a skill. + *
+ * This function is designed for API usage. + * + * @param skillType Type of skill to add levels to + * @param levels Number of levels to add + */ + public static void addLevel(Player player, SkillType skillType, int levels) { + Users.getProfile(player).addLevels(skillType, levels); + } + + /** + * Get the level a player has in a specific skill. + *
+ * This function is designed for API usage. + * + * @param player The player to get the level for + * @param skillType The skill to get the level for + * @return the level of a given skill + */ + public static int getLevel(Player player, SkillType skillType) { + return Users.getProfile(player).getSkillLevel(skillType); + } +} diff --git a/src/main/java/com/gmail/nossr50/api/PartyAPI.java b/src/main/java/com/gmail/nossr50/api/PartyAPI.java index 1973d9bb1..79aae0134 100644 --- a/src/main/java/com/gmail/nossr50/api/PartyAPI.java +++ b/src/main/java/com/gmail/nossr50/api/PartyAPI.java @@ -8,7 +8,6 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import com.gmail.nossr50.Users; -import com.gmail.nossr50.datatypes.PlayerProfile; public class PartyAPI { @@ -21,8 +20,7 @@ public class PartyAPI { * @return the name of the player's party */ public static String getPartyName(Player player) { - PlayerProfile PP = Users.getProfile(player); - return PP.getParty(); + return Users.getProfile(player).getParty(); } /** @@ -34,8 +32,7 @@ public class PartyAPI { * @return true if the player is in a party, false otherwise */ public static boolean inParty(Player player) { - PlayerProfile PP = Users.getProfile(player); - return PP.inParty(); + return Users.getProfile(player).inParty(); } /** @@ -48,13 +45,8 @@ public class PartyAPI { * @return true if the two players are in the same party, false otherwise */ public static boolean inSameParty(Player playera, Player playerb) { - if (Users.getProfile(playera).inParty() && Users.getProfile(playerb).inParty()) { - if (Users.getProfile(playera).getParty().equals(Users.getProfile(playerb).getParty())) { - return true; - } - else { - return false; - } + if (inParty(playera) && inParty(playerb) && getPartyName(playera).equals(getPartyName(playerb))) { + return true; } else { return false; diff --git a/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java b/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java index 4afadbe5f..a970140d9 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java @@ -41,7 +41,7 @@ public class AddxpCommand implements CommandExecutor { } else if (args.length == 3) { if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) { int newvalue = Integer.valueOf(args[2]); - Users.getProfile(plugin.getServer().getPlayer(args[0])).addXPOverrideNoBonus(Skills.getSkillType(args[1]), newvalue); + Users.getProfile(plugin.getServer().getPlayer(args[0])).addXPOverride(Skills.getSkillType(args[1]), newvalue); plugin.getServer().getPlayer(args[0]).sendMessage(ChatColor.GREEN + "Experience granted!"); //TODO: Needs more locale. System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + "."); Skills.XpCheckAll(plugin.getServer().getPlayer(args[0])); @@ -65,14 +65,14 @@ public class AddxpCommand implements CommandExecutor { if (args.length == 3) { if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) { int newvalue = Integer.valueOf(args[2]); - Users.getProfile(plugin.getServer().getPlayer(args[0])).addXP(Skills.getSkillType(args[1]), newvalue, plugin.getServer().getPlayer(args[0])); + Users.getProfile(plugin.getServer().getPlayer(args[0])).addXP(Skills.getSkillType(args[1]), newvalue); plugin.getServer().getPlayer(args[0]).sendMessage(ChatColor.GREEN + "Experience granted!"); //TODO: Needs more locale. player.sendMessage(ChatColor.RED + args[1] + " has been modified."); //TODO: Needs more locale. Skills.XpCheckAll(plugin.getServer().getPlayer(args[0])); } } else if (args.length == 2 && m.isInt(args[1]) && Skills.isSkill(args[0])) { int newvalue = Integer.valueOf(args[1]); - Users.getProfile(player).addXP(Skills.getSkillType(args[0]), newvalue, player); + Users.getProfile(player).addXP(Skills.getSkillType(args[0]), newvalue); player.sendMessage(ChatColor.GREEN + "Experience granted!"); //TODO: Needs more locale. player.sendMessage(ChatColor.RED + args[0] + " has been modified."); //TODO: Needs more locale. Skills.XpCheckAll(plugin.getServer().getPlayer(args[0])); diff --git a/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java b/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java index 2bfca452c..3a80bcef4 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java @@ -47,7 +47,7 @@ public class InspectCommand implements CommandExecutor { PlayerProfile PPt = Users.getProfile(target); //If they are not an Op they have to be close - if(sender instanceof Player && !player.isOp() && !m.isNear(player.getLocation(), target.getLocation(), 5)) + if(sender instanceof Player && !player.isOp() && !m.isNear(player.getLocation(), target.getLocation(), 5.0)) { sender.sendMessage("You are too far away to inspect that player!"); //TODO: Needs more locale. } diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index b8e076bac..95f724ebd 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -125,7 +125,7 @@ public class PlayerProfile { } public boolean loadMySQL() { - Integer id = 0; + int id = 0; id = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'"); if(id == 0) return false; @@ -207,7 +207,7 @@ public class PlayerProfile { } public void addMySQLPlayer() { - Integer id = 0; + int id = 0; mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"users (user, lastlogin) VALUES ('" + playerName + "'," + System.currentTimeMillis() / 1000 +")"); id = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'"); mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")"); @@ -989,11 +989,11 @@ public class PlayerProfile { * XP Functions */ - public Integer getSkillLevel(SkillType skillType) { + public int getSkillLevel(SkillType skillType) { return skills.get(skillType); } - public Integer getSkillXpLevel(SkillType skillType) { + public int getSkillXpLevel(SkillType skillType) { return skillsXp.get(skillType); } @@ -1003,7 +1003,7 @@ public class PlayerProfile { * @param skillType The skill to add XP to * @param newValue The amount of XP to add */ - public void addXPOverrideNoBonus(SkillType skillType, int newValue) { + public void addXPOverride(SkillType skillType, int newValue) { Player player = Bukkit.getPlayer(playerName); if (skillType.equals(SkillType.ALL)) { @@ -1029,26 +1029,9 @@ public class PlayerProfile { * @param skillType The skill to add XP to * @param newValue The amount of XP to add */ - public void addXPOverride(SkillType skillType, int newValue) { - Player player = Bukkit.getPlayer(playerName); - - if (skillType.equals(SkillType.ALL)) { - for (SkillType x : SkillType.values()) { - if (x.equals(SkillType.ALL)) { - continue; - } - - Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, x, newValue)); - skillsXp.put(x, skillsXp.get(x) + newValue); - } - } - else { - int xp = newValue * LoadProperties.xpGainMultiplier; - - Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp)); - skillsXp.put(skillType, skillsXp.get(skillType) + xp); - lastgained = skillType; - } + public void addXPOverrideBonus(SkillType skillType, int newValue) { + int xp = newValue * LoadProperties.xpGainMultiplier; + addXPOverride(skillType, xp); } /** @@ -1058,7 +1041,9 @@ public class PlayerProfile { * @param newvalue The amount of XP to add * @param player The player to add XP to */ - public void addXP(SkillType skillType, int newValue, Player player) { + public void addXP(SkillType skillType, int newValue) { + Player player = Bukkit.getPlayer(playerName); + if (System.currentTimeMillis() < ((xpGainATS * 1000) + 250) || player.getGameMode().equals(GameMode.CREATIVE)) { return; } @@ -1067,20 +1052,7 @@ public class PlayerProfile { double bonusModifier = 0; if (inParty()) { - for (Player x : Party.getInstance().getPartyMembers(player)) { - if (x.isOnline() && !x.getName().equals(player.getName()) && Party.getInstance().isPartyLeader(x.getName(), this.getParty())) { - if (m.isNear(player.getLocation(), x.getLocation(), 25)) { - PlayerProfile PartyLeader = Users.getProfile(x); - - if (PartyLeader.getSkillLevel(skillType) >= this.getSkillLevel(skillType)) { - - int leaderLevel = PartyLeader.getSkillLevel(skillType); - int difference = leaderLevel - this.getSkillLevel(skillType); - bonusModifier = (difference * 0.75D) / 100D; - } - } - } - } + bonusModifier = partyModifier(skillType); } int xp = (int) (newValue / skillType.getXpModifier()) * LoadProperties.xpGainMultiplier; @@ -1155,10 +1127,38 @@ public class PlayerProfile { * @param skillType Type of skill to check * @return the XP remaining until next level */ - public Integer getXpToLevel(SkillType skillType) { + public int getXpToLevel(SkillType skillType) { return (int) (1020 + (skills.get(skillType) * 20)); //Do we REALLY need to cast to int here? } + /** + * Calculate the party XP modifier. + * + * @param skillType Type of skill to check + * @return the party bonus multiplier + */ + private double partyModifier(SkillType skillType) { + Player player = Bukkit.getPlayer(playerName); + double bonusModifier = 0.0; + + for (Player x : Party.getInstance().getPartyMembers(player)) { + if (x.isOnline() && !x.getName().equals(player.getName()) && Party.getInstance().isPartyLeader(x.getName(), this.getParty())) { + if (m.isNear(player.getLocation(), x.getLocation(), 25.0)) { + PlayerProfile PartyLeader = Users.getProfile(x); + + if (PartyLeader.getSkillLevel(skillType) >= this.getSkillLevel(skillType)) { + + int leaderLevel = PartyLeader.getSkillLevel(skillType); + int difference = leaderLevel - this.getSkillLevel(skillType); + bonusModifier = (difference * 0.75) / 100.0; + } + } + } + } + + return bonusModifier; + } + /* * Party Stuff */ diff --git a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java index f661e4909..efb74b449 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java @@ -307,7 +307,7 @@ public class mcEntityListener implements Listener { break; } - PP.addXP(SkillType.TAMING, xp, player); + PP.addXP(SkillType.TAMING, xp); Skills.XpCheckSkill(SkillType.TAMING, player); } } diff --git a/src/main/java/com/gmail/nossr50/m.java b/src/main/java/com/gmail/nossr50/m.java index d18f43c6e..42483312a 100644 --- a/src/main/java/com/gmail/nossr50/m.java +++ b/src/main/java/com/gmail/nossr50/m.java @@ -177,13 +177,8 @@ public class m { * @param maxDistance The max distance apart * @return true if the distance between first and second is less than maxDistance, false otherwise */ - public static boolean isNear(Location first, Location second, int maxDistance) { - double relX = first.getX() - second.getX(); - double relY = first.getY() - second.getY(); - double relZ = first.getZ() - second.getZ(); - double dist = (relX * relX) + (relY * relY) + (relZ * relZ); - - if (dist < maxDistance * maxDistance) { + public static boolean isNear(Location first, Location second, double maxDistance) { + if (first.distance(second) < maxDistance) { return true; } else { diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 952b0d48c..f5c72c8f6 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -1,7 +1,6 @@ package com.gmail.nossr50; import com.gmail.nossr50.datatypes.PlayerProfile; -import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.commands.skills.*; import com.gmail.nossr50.commands.spout.*; import com.gmail.nossr50.commands.mc.*; @@ -9,7 +8,6 @@ import com.gmail.nossr50.commands.party.*; import com.gmail.nossr50.commands.general.*; import com.gmail.nossr50.config.*; import com.gmail.nossr50.runnables.*; -import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.listeners.mcBlockListener; import com.gmail.nossr50.listeners.mcEntityListener; @@ -187,23 +185,6 @@ public class mcMMO extends JavaPlugin { return Users.getProfile(player); } - /** - * Check the XP of a player. - *
- * This function is designed for API usage. - * - * @param player - * @param skillType - */ - public static void checkXp(Player player, SkillType skillType) { - if (skillType == SkillType.ALL) { - Skills.XpCheckAll(player); - } - else { - Skills.XpCheckSkill(skillType, player); - } - } - /** * Things to be run when the plugin is disabled. */ diff --git a/src/main/java/com/gmail/nossr50/runnables/GainXp.java b/src/main/java/com/gmail/nossr50/runnables/GainXp.java index 44a79d859..8ba896dfc 100644 --- a/src/main/java/com/gmail/nossr50/runnables/GainXp.java +++ b/src/main/java/com/gmail/nossr50/runnables/GainXp.java @@ -39,7 +39,7 @@ public class GainXp implements Runnable { damage += health; } - PP.addXP(skillType, (int) (damage * baseXp), player); + PP.addXP(skillType, (int) (damage * baseXp)); Skills.XpCheckSkill(skillType, player); } } diff --git a/src/main/java/com/gmail/nossr50/skills/Acrobatics.java b/src/main/java/com/gmail/nossr50/skills/Acrobatics.java index 2f90feae1..205c2ebd5 100644 --- a/src/main/java/com/gmail/nossr50/skills/Acrobatics.java +++ b/src/main/java/com/gmail/nossr50/skills/Acrobatics.java @@ -58,7 +58,7 @@ public class Acrobatics { /* Check for death */ if (health - damage >= 1) { - PP.addXP(SkillType.ACROBATICS, damage * ROLL_XP_MODIFIER, player); + PP.addXP(SkillType.ACROBATICS, damage * ROLL_XP_MODIFIER); Skills.XpCheckSkill(SkillType.ACROBATICS, player); event.setDamage(newDamage); @@ -76,7 +76,7 @@ public class Acrobatics { } } else if (health - damage >= 1) { - PP.addXP(SkillType.ACROBATICS, event.getDamage() * FALL_XP_MODIFIER, player); + PP.addXP(SkillType.ACROBATICS, event.getDamage() * FALL_XP_MODIFIER); Skills.XpCheckSkill(SkillType.ACROBATICS, player); } } @@ -111,7 +111,7 @@ public class Acrobatics { defender.sendMessage(mcLocale.getString("Acrobatics.Dodge")); if (System.currentTimeMillis() >= (5000 + PPd.getRespawnATS()) && defender.getHealth() >= 1) { - PPd.addXP(SkillType.ACROBATICS, damage * DODGE_MODIFIER, defender); + PPd.addXP(SkillType.ACROBATICS, damage * DODGE_MODIFIER); Skills.XpCheckSkill(SkillType.ACROBATICS, defender); } diff --git a/src/main/java/com/gmail/nossr50/skills/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/BlastMining.java index 54cbddc6c..01964c272 100644 --- a/src/main/java/com/gmail/nossr50/skills/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/BlastMining.java @@ -257,7 +257,7 @@ public class BlastMining { Block block = player.getTargetBlock(transparent, BLOCKS_AWAY); if (block.getType().equals(Material.TNT) && m.blockBreakSimulate(block, player, true) && PP.getSkillLevel(SkillType.MINING) >= 125) { - final int MAX_DISTANCE_AWAY = 10; + final double MAX_DISTANCE_AWAY = 10.0; AbilityType ability = AbilityType.BLAST_MINING; /* Check Cooldown */ diff --git a/src/main/java/com/gmail/nossr50/skills/Excavation.java b/src/main/java/com/gmail/nossr50/skills/Excavation.java index 7c45a6242..2a57aa7b1 100644 --- a/src/main/java/com/gmail/nossr50/skills/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/Excavation.java @@ -120,7 +120,7 @@ public class Excavation { } //Handle XP related tasks - PP.addXP(SkillType.EXCAVATION, xp, player); + PP.addXP(SkillType.EXCAVATION, xp); Skills.XpCheckSkill(SkillType.EXCAVATION, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/Fishing.java b/src/main/java/com/gmail/nossr50/skills/Fishing.java index e5cad6602..28d814d3e 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -101,7 +101,7 @@ public class Fishing { FishingTreasure treasure = rewards.get(random.nextInt(rewards.size())); if (random.nextInt(100) <= treasure.getDropChance()) { - Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player); + Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp()); theCatch.setItemStack(treasure.getDrop()); } } @@ -116,7 +116,7 @@ public class Fishing { } m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH)); //Always drop a fish - PP.addXP(SkillType.FISHING, LoadProperties.mfishing, player); + PP.addXP(SkillType.FISHING, LoadProperties.mfishing); Skills.XpCheckSkill(SkillType.FISHING, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/Herbalism.java index 1845a3985..09d9d9401 100644 --- a/src/main/java/com/gmail/nossr50/skills/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/Herbalism.java @@ -251,7 +251,7 @@ public class Herbalism { } } - PP.addXP(SkillType.HERBALISM, xp, player); + PP.addXP(SkillType.HERBALISM, xp); Skills.XpCheckSkill(SkillType.HERBALISM, player); } } diff --git a/src/main/java/com/gmail/nossr50/skills/Mining.java b/src/main/java/com/gmail/nossr50/skills/Mining.java index 5fc96bd13..04623444d 100644 --- a/src/main/java/com/gmail/nossr50/skills/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/Mining.java @@ -145,7 +145,7 @@ public class Mining { break; } - PP.addXP(SkillType.MINING, xp, player); + PP.addXP(SkillType.MINING, xp); Skills.XpCheckSkill(SkillType.MINING, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/Repair.java b/src/main/java/com/gmail/nossr50/skills/Repair.java index 56fbacd69..1f4e29fc4 100644 --- a/src/main/java/com/gmail/nossr50/skills/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/Repair.java @@ -138,7 +138,7 @@ public class Repair { dif = (short) (dif / 2); } - PP.addXP(SkillType.REPAIR, dif * 10, player); + PP.addXP(SkillType.REPAIR, dif * 10); Skills.XpCheckSkill(SkillType.REPAIR, player); //CLANG CLANG diff --git a/src/main/java/com/gmail/nossr50/skills/Skills.java b/src/main/java/com/gmail/nossr50/skills/Skills.java index c5280fe6d..a35755739 100644 --- a/src/main/java/com/gmail/nossr50/skills/Skills.java +++ b/src/main/java/com/gmail/nossr50/skills/Skills.java @@ -26,7 +26,7 @@ import com.gmail.nossr50.locale.mcLocale; public class Skills { private final static int TIME_CONVERSION_FACTOR = 1000; - private final static int MAX_DISTANCE_AWAY = 10; + private final static double MAX_DISTANCE_AWAY = 10.0; /** * Checks to see if the cooldown for an item or ability is expired. diff --git a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java index fe93be469..e0ab7cf13 100644 --- a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java @@ -156,7 +156,7 @@ public class WoodCutting { } } - PP.addXP(SkillType.WOODCUTTING, xp, player); //Tree Feller gives nerf'd XP + PP.addXP(SkillType.WOODCUTTING, xp); //Tree Feller gives nerf'd XP Skills.XpCheckSkill(SkillType.WOODCUTTING, player); } @@ -297,7 +297,7 @@ public class WoodCutting { } WoodCutting.woodCuttingProcCheck(player, block); - PP.addXP(SkillType.WOODCUTTING, xp, player); + PP.addXP(SkillType.WOODCUTTING, xp); Skills.XpCheckSkill(SkillType.WOODCUTTING, player); }