From 6592b3db750f80b47e0ec706ad11fce5441d6a96 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 19 Jul 2011 07:17:14 -0700 Subject: [PATCH] WIP of 1.0.37 --- mcMMO/Changelog.txt | 11 +- mcMMO/com/gmail/nossr50/Combat.java | 82 +-- mcMMO/com/gmail/nossr50/Leaderboard.java | 73 +- .../nossr50/datatypes/PlayerProfile.java | 663 +++++++----------- .../gmail/nossr50/datatypes/SkillType.java | 18 + .../nossr50/listeners/mcBlockListener.java | 20 +- .../nossr50/listeners/mcEntityListener.java | 5 +- .../nossr50/listeners/mcPlayerListener.java | 5 +- mcMMO/com/gmail/nossr50/m.java | 23 +- mcMMO/com/gmail/nossr50/mcMMO.java | 244 ++++--- .../com/gmail/nossr50/skills/Acrobatics.java | 35 +- mcMMO/com/gmail/nossr50/skills/Archery.java | 19 +- mcMMO/com/gmail/nossr50/skills/Axes.java | 10 +- .../com/gmail/nossr50/skills/Excavation.java | 144 ++-- mcMMO/com/gmail/nossr50/skills/Herbalism.java | 43 +- mcMMO/com/gmail/nossr50/skills/Mining.java | 13 +- mcMMO/com/gmail/nossr50/skills/Repair.java | 40 +- mcMMO/com/gmail/nossr50/skills/Skills.java | 315 ++------- mcMMO/com/gmail/nossr50/skills/Swords.java | 18 +- mcMMO/com/gmail/nossr50/skills/Unarmed.java | 11 +- .../com/gmail/nossr50/skills/WoodCutting.java | 9 +- mcMMO/plugin.yml | 2 +- 22 files changed, 761 insertions(+), 1042 deletions(-) create mode 100644 mcMMO/com/gmail/nossr50/datatypes/SkillType.java diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 3582351ee..160d447a3 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,6 +1,15 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code -Versions 1.0.36 +Version 1.0.37 +Taming no longer receives xp from wolves being harmed +Fixed bug where modifying a skill also modified the xp to the same amount (when it should be zero) + +Code Stuff +Added getPlayerProfile() which returns a PlayerProfile object for plugin devs +100% more enums +Changed how checking skill xp worked to be more efficient + +Version 1.0.36 mcMMO now properly supports Bukkit/PEX/Permissions for Permissions Config.yml will no longer generate Performance Debugging nodes Registered permission nodes to plugin.yml diff --git a/mcMMO/com/gmail/nossr50/Combat.java b/mcMMO/com/gmail/nossr50/Combat.java index a85653f94..bd300fa75 100644 --- a/mcMMO/com/gmail/nossr50/Combat.java +++ b/mcMMO/com/gmail/nossr50/Combat.java @@ -10,6 +10,7 @@ import org.bukkit.plugin.Plugin; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.skills.Acrobatics; @@ -26,9 +27,7 @@ public class Combat { if(event.isCancelled() || event.getDamage() == 0) return; - /* - * CHANGE DAMAGE BASED ON DIFFICULTY - */ + if(event instanceof EntityDamageByEntityEvent) { /* @@ -44,7 +43,7 @@ public class Combat //Damage modifiers if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0) //Unarmed Unarmed.unarmedBonus(attacker, eventb); - if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker) && PPa.getSkill("axes") >= 500) + if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker) && PPa.getSkillLevel(SkillType.AXES) >= 500) event.setDamage(event.getDamage()+4); //If there are any abilities to activate @@ -89,11 +88,11 @@ public class Combat && defender.getHealth() >= 1) { if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)) - PPa.addAxesXP((event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); + PPa.addXP(SkillType.AXES, (event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker)) - PPa.addSwordsXP((event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); + PPa.addXP(SkillType.SWORDS, (event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); if(attacker.getItemInHand().getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) - PPa.addUnarmedXP((event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); + PPa.addXP(SkillType.UNARMED, (event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); } } } @@ -133,13 +132,13 @@ public class Combat } if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker)) - PPa.addSwordsXP(xp); - if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)) - PPa.addAxesXP(xp); - if(attacker.getItemInHand().getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) - PPa.addUnarmedXP(xp); + PPa.addXP(SkillType.SWORDS, xp); + else if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)) + PPa.addXP(SkillType.AXES, xp); + else if(attacker.getItemInHand().getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) + PPa.addXP(SkillType.UNARMED, xp); } - Skills.XpCheck(attacker); + Skills.XpCheckAll(attacker); if(event.getEntity() instanceof Wolf) { @@ -182,13 +181,13 @@ public class Combat if(mcPermissions.getInstance().taming(master)) { //Sharpened Claws - if(PPo.getSkill("taming") >= 750) + if(PPo.getSkillLevel(SkillType.TAMING) >= 750) { event.setDamage(event.getDamage() + 2); } //Gore - if(Math.random() * 1000 <= PPo.getSkill("taming")) + if(Math.random() * 1000 <= PPo.getSkillLevel(SkillType.TAMING)) { event.setDamage(event.getDamage() * 2); @@ -222,14 +221,14 @@ public class Combat xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; if(event.getEntity() instanceof Ghast) xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; - Users.getProfile(master).addTamingXP(xp); + Users.getProfile(master).addXP(SkillType.TAMING, xp); } if(event.getEntity() instanceof Player) { xp = (event.getDamage() * 2) * LoadProperties.xpGainMultiplier; - Users.getProfile(master).addTamingXP(xp); + Users.getProfile(master).addXP(SkillType.TAMING, xp); } - Skills.XpCheck(master); + Skills.XpCheckSkill(SkillType.TAMING, master); } } } @@ -264,24 +263,15 @@ public class Combat Player master = Taming.getOwner(theWolf, pluginx); PlayerProfile PPo = Users.getProfile(master); if(mcPermissions.getInstance().taming(master)) - { - /* - * TEMPORARY FIX AS WOLVES AREN'T TRIGGERING DAMAGE EVENTS WHEN ATTACKING NON PLAYERS AT THE TIME OF WRITING - */ - if(!event.isCancelled() && event.getCause() != DamageCause.LIGHTNING) - { - PPo.addTamingXP(event.getDamage() * 3); - Skills.XpCheck(master); - } - + { //Shock-Proof - if((event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION) && PPo.getSkill("taming") >= 500) + if((event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION) && PPo.getSkillLevel(SkillType.TAMING) >= 500) { event.setDamage(2); } //Thick Fur - if(PPo.getSkill("taming") >= 250) + if(PPo.getSkillLevel(SkillType.TAMING) >= 250) event.setDamage(event.getDamage() / 2); } } @@ -311,7 +301,7 @@ public class Combat Users.addUser(defender); if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0) { - if(defender != null && PPd.getSkill("unarmed") >= 1000) + if(defender != null && PPd.getSkillLevel(SkillType.UNARMED) >= 1000) { if(Math.random() * 1000 <= 500) { @@ -319,7 +309,7 @@ public class Combat defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect")); //$NON-NLS-1$ return; } - } else if(defender != null && Math.random() * 1000 <= (PPd.getSkill("unarmed") / 2)) + } else if(defender != null && Math.random() * 1000 <= (PPd.getSkillLevel(SkillType.UNARMED) / 2)) { event.setCancelled(true); defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect")); //$NON-NLS-1$ @@ -340,15 +330,15 @@ public class Combat /* * DAMAGE MODIFIER */ - if(PPa.getSkill("archery") >= 50 && PPa.getSkill("archery") < 250) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 50 && PPa.getSkillLevel(SkillType.ARCHERY) < 250) event.setDamage(event.getDamage()+1); - if(PPa.getSkill("archery") >= 250 && PPa.getSkill("archery") < 575) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 250 && PPa.getSkillLevel(SkillType.ARCHERY) < 575) event.setDamage(event.getDamage()+2); - if(PPa.getSkill("archery") >= 575 && PPa.getSkill("archery") < 725) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 575 && PPa.getSkillLevel(SkillType.ARCHERY) < 725) event.setDamage(event.getDamage()+3); - if(PPa.getSkill("archery") >= 725 && PPa.getSkill("archery") < 1000) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 725 && PPa.getSkillLevel(SkillType.ARCHERY) < 1000) event.setDamage(event.getDamage()+4); - if(PPa.getSkill("archery") >= 1000) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 1000) event.setDamage(event.getDamage()+5); /* @@ -361,19 +351,19 @@ public class Combat if(x instanceof Monster){ //XP if(x instanceof Creeper) - PPa.addArcheryXP((event.getDamage() * 4) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 4) * LoadProperties.xpGainMultiplier); if(x instanceof Spider) - PPa.addArcheryXP((event.getDamage() * 3) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - PPa.addArcheryXP((event.getDamage() * 2) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2) * LoadProperties.xpGainMultiplier); if(x instanceof Zombie) - PPa.addArcheryXP((event.getDamage() * 2) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2) * LoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - PPa.addArcheryXP((event.getDamage() * 3) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); if(x instanceof Slime) - PPa.addArcheryXP((event.getDamage() * 3) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); if(x instanceof Ghast) - PPa.addArcheryXP((event.getDamage() * 3) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); } /* * Attacker is Player @@ -398,7 +388,7 @@ public class Combat if(LoadProperties.pvpxp && !Party.getInstance().inSameParty(attacker, defender) && ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis()) { - PPa.addArcheryXP((event.getDamage() * 3) * LoadProperties.pvpxprewardmodifier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.pvpxprewardmodifier); } /* * DAZE PROC @@ -406,7 +396,7 @@ public class Combat Archery.dazeCheck(defender, attacker); } } - Skills.XpCheck(attacker); + Skills.XpCheckSkill(SkillType.ARCHERY, attacker); } } public static void dealDamage(Entity target, int dmg){ diff --git a/mcMMO/com/gmail/nossr50/Leaderboard.java b/mcMMO/com/gmail/nossr50/Leaderboard.java index 21361f2ac..d16c7cbf7 100644 --- a/mcMMO/com/gmail/nossr50/Leaderboard.java +++ b/mcMMO/com/gmail/nossr50/Leaderboard.java @@ -10,6 +10,7 @@ import java.util.logging.Logger; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerStat; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.Tree; public class Leaderboard @@ -50,48 +51,48 @@ public class Leaderboard int Plvl = 0; - if(character.length > 1 && isInt(character[1])) + if(character.length > 1 && m.isInt(character[1])) { Mining.add(p, Integer.valueOf(character[1])); Plvl += Integer.valueOf(character[1]); } - if(character.length > 5 && isInt(character[5])){ + if(character.length > 5 && m.isInt(character[5])){ WoodCutting.add(p, Integer.valueOf(character[5])); Plvl += Integer.valueOf(character[5]); } - if(character.length > 7 && isInt(character[7])){ + if(character.length > 7 && m.isInt(character[7])){ Repair.add(p, Integer.valueOf(character[7])); Plvl += Integer.valueOf(character[7]); } - if(character.length > 8 && isInt(character[8])){ + if(character.length > 8 && m.isInt(character[8])){ Unarmed.add(p, Integer.valueOf(character[8])); Plvl += Integer.valueOf(character[8]); } - if(character.length > 9 && isInt(character[9])){ + if(character.length > 9 && m.isInt(character[9])){ Herbalism.add(p, Integer.valueOf(character[9])); Plvl += Integer.valueOf(character[9]); } - if(character.length > 10 && isInt(character[10])){ + if(character.length > 10 && m.isInt(character[10])){ Excavation.add(p, Integer.valueOf(character[10])); Plvl += Integer.valueOf(character[10]); } - if(character.length > 11 && isInt(character[11])){ + if(character.length > 11 && m.isInt(character[11])){ Archery.add(p, Integer.valueOf(character[11])); Plvl += Integer.valueOf(character[11]); } - if(character.length > 12 && isInt(character[12])){ + if(character.length > 12 && m.isInt(character[12])){ Swords.add(p, Integer.valueOf(character[12])); Plvl += Integer.valueOf(character[12]); } - if(character.length > 13 && isInt(character[13])){ + if(character.length > 13 && m.isInt(character[13])){ Axes.add(p, Integer.valueOf(character[13])); Plvl += Integer.valueOf(character[13]); } - if(character.length > 14 && isInt(character[14])){ + if(character.length > 14 && m.isInt(character[14])){ Acrobatics.add(p, Integer.valueOf(character[14])); Plvl += Integer.valueOf(character[14]); } - if(character.length > 24 && isInt(character[24])){ + if(character.length > 24 && m.isInt(character[24])){ Taming.add(p, Integer.valueOf(character[24])); Plvl += Integer.valueOf(character[24]); } @@ -104,22 +105,22 @@ public class Leaderboard + location + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$ } //Write the leader board files - leaderWrite(Mining.inOrder(), "mining"); //$NON-NLS-1$ - leaderWrite(WoodCutting.inOrder(), "woodcutting"); //$NON-NLS-1$ - leaderWrite(Repair.inOrder(), "repair"); //$NON-NLS-1$ - leaderWrite(Unarmed.inOrder(), "unarmed"); //$NON-NLS-1$ - leaderWrite(Herbalism.inOrder(), "herbalism"); //$NON-NLS-1$ - leaderWrite(Excavation.inOrder(), "excavation"); //$NON-NLS-1$ - leaderWrite(Archery.inOrder(), "archery"); //$NON-NLS-1$ - leaderWrite(Swords.inOrder(), "swords"); //$NON-NLS-1$ - leaderWrite(Axes.inOrder(), "axes"); //$NON-NLS-1$ - leaderWrite(Acrobatics.inOrder(), "acrobatics"); //$NON-NLS-1$ - leaderWrite(Taming.inOrder(), "taming"); //$NON-NLS-1$ - leaderWrite(PowerLevel.inOrder(), "powerlevel"); //$NON-NLS-1$ + leaderWrite(Mining.inOrder(), SkillType.MINING); //$NON-NLS-1$ + leaderWrite(WoodCutting.inOrder(), SkillType.WOODCUTTING); //$NON-NLS-1$ + leaderWrite(Repair.inOrder(), SkillType.REPAIR); //$NON-NLS-1$ + leaderWrite(Unarmed.inOrder(), SkillType.UNARMED); //$NON-NLS-1$ + leaderWrite(Herbalism.inOrder(), SkillType.HERBALISM); //$NON-NLS-1$ + leaderWrite(Excavation.inOrder(), SkillType.EXCAVATION); //$NON-NLS-1$ + leaderWrite(Archery.inOrder(), SkillType.ARCHERY); //$NON-NLS-1$ + leaderWrite(Swords.inOrder(), SkillType.SWORDS); //$NON-NLS-1$ + leaderWrite(Axes.inOrder(), SkillType.AXES); //$NON-NLS-1$ + leaderWrite(Acrobatics.inOrder(), SkillType.ACROBATICS); //$NON-NLS-1$ + leaderWrite(Taming.inOrder(), SkillType.TAMING); //$NON-NLS-1$ + leaderWrite(PowerLevel.inOrder(), SkillType.ALL); //$NON-NLS-1$ } - public static void leaderWrite(PlayerStat[] ps, String statName) + public static void leaderWrite(PlayerStat[] ps, SkillType skillType) { - String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + statName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$ + String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$ //CHECK IF THE FILE EXISTS File theDir = new File(theLocation); if(!theDir.exists()) @@ -171,8 +172,9 @@ public class Leaderboard //Close the file } - public static String[] retrieveInfo(String statName, int pagenumber){ - String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + statName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$ + public static String[] retrieveInfo(String skillName, int pagenumber) + { + String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$ try { FileReader file = new FileReader(theLocation); BufferedReader in = new BufferedReader(file); @@ -198,10 +200,11 @@ public class Leaderboard } return null; //Shouldn't get here } - public static void updateLeaderboard(PlayerStat ps, String statName){ + public static void updateLeaderboard(PlayerStat ps, SkillType skillType) + { if(LoadProperties.useMySQL) return; - String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + statName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$ + String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$ try { //Open the file FileReader file = new FileReader(theLocation); @@ -239,16 +242,4 @@ public class Leaderboard log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$ //$NON-NLS-2$ } } - public static boolean isInt(String string) - { - try - { - Integer.parseInt(string); - } - catch(NumberFormatException nFE) - { - return false; - } - return true; - } } diff --git a/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java b/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java index e08d468d9..a10ead519 100644 --- a/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -15,6 +15,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; @@ -49,48 +50,50 @@ public class PlayerProfile private String playername; //Time to HashMap this shiz - HashMap stats = new HashMap(); //Skills and XP + HashMap skills = new HashMap(); //Skills and XP + HashMap skillsXp = new HashMap(); //Skills and XP + String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users"; public PlayerProfile(Player player) { //Setup the HashMap for the skills - stats.put("sorcery", 0); - stats.put("sorceryXP", 0); + skills.put(SkillType.SORCERY, 0); + skillsXp.put(SkillType.SORCERY, 0); - stats.put("unarmed", 0); - stats.put("unarmedXP", 0); + skills.put(SkillType.UNARMED, 0); + skillsXp.put(SkillType.UNARMED, 0); - stats.put("taming", 0); - stats.put("tamingXP", 0); + skills.put(SkillType.TAMING, 0); + skillsXp.put(SkillType.TAMING, 0); - stats.put("mining", 0); - stats.put("miningXP", 0); + skills.put(SkillType.MINING, 0); + skillsXp.put(SkillType.MINING, 0); - stats.put("woodcutting", 0); - stats.put("woodcuttingXP", 0); + skills.put(SkillType.WOODCUTTING, 0); + skillsXp.put(SkillType.WOODCUTTING, 0); - stats.put("repair", 0); - stats.put("repairXP", 0); + skills.put(SkillType.REPAIR, 0); + skillsXp.put(SkillType.REPAIR, 0); - stats.put("herbalism", 0); - stats.put("herbalismXP", 0); + skills.put(SkillType.HERBALISM, 0); + skillsXp.put(SkillType.HERBALISM, 0); - stats.put("excavation", 0); - stats.put("excavationXP", 0); + skills.put(SkillType.EXCAVATION, 0); + skillsXp.put(SkillType.EXCAVATION, 0); - stats.put("archery", 0); - stats.put("archeryXP", 0); + skills.put(SkillType.ARCHERY, 0); + skillsXp.put(SkillType.ARCHERY, 0); - stats.put("swords", 0); - stats.put("swordsXP", 0); + skills.put(SkillType.SWORDS, 0); + skillsXp.put(SkillType.SWORDS, 0); - stats.put("axes", 0); - stats.put("axesXP", 0); + skills.put(SkillType.AXES, 0); + skillsXp.put(SkillType.AXES, 0); - stats.put("acrobatics", 0); - stats.put("acrobaticsXP", 0); + skills.put(SkillType.ACROBATICS, 0); + skillsXp.put(SkillType.ACROBATICS, 0); mana = getMaxMana(); @@ -148,30 +151,30 @@ public class PlayerProfile serratedStrikesDATS = Long.valueOf(cooldowns.get(1).get(5)) * 1000; skullSplitterDATS = Long.valueOf(cooldowns.get(1).get(6)) * 1000; } - HashMap> skills = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id); - stats.put("taming", Integer.valueOf(skills.get(1).get(0))); - stats.put("mining", Integer.valueOf(skills.get(1).get(1))); - stats.put("repair", Integer.valueOf(skills.get(1).get(2))); - stats.put("woodcutting", Integer.valueOf(skills.get(1).get(3))); - stats.put("unarmed", Integer.valueOf(skills.get(1).get(4))); - stats.put("herbalism", Integer.valueOf(skills.get(1).get(5))); - stats.put("excavation", Integer.valueOf(skills.get(1).get(6))); - stats.put("archery", Integer.valueOf(skills.get(1).get(7))); - stats.put("swords", Integer.valueOf(skills.get(1).get(8))); - stats.put("axes", Integer.valueOf(skills.get(1).get(9))); - stats.put("acrobatics", Integer.valueOf(skills.get(1).get(10))); + HashMap> stats = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id); + skills.put(SkillType.TAMING, Integer.valueOf(stats.get(1).get(0))); + skills.put(SkillType.MINING, Integer.valueOf(stats.get(1).get(1))); + skills.put(SkillType.REPAIR, Integer.valueOf(stats.get(1).get(2))); + skills.put(SkillType.WOODCUTTING, Integer.valueOf(stats.get(1).get(3))); + skills.put(SkillType.UNARMED, Integer.valueOf(stats.get(1).get(4))); + skills.put(SkillType.HERBALISM, Integer.valueOf(stats.get(1).get(5))); + skills.put(SkillType.EXCAVATION, Integer.valueOf(stats.get(1).get(6))); + skills.put(SkillType.ARCHERY, Integer.valueOf(stats.get(1).get(7))); + skills.put(SkillType.SWORDS, Integer.valueOf(stats.get(1).get(8))); + skills.put(SkillType.AXES, Integer.valueOf(stats.get(1).get(9))); + skills.put(SkillType.ACROBATICS, Integer.valueOf(stats.get(1).get(10))); HashMap> experience = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM "+LoadProperties.MySQLtablePrefix+"experience WHERE user_id = " + id); - stats.put("tamingXP", Integer.valueOf(experience.get(1).get(0))); - stats.put("miningXP", Integer.valueOf(experience.get(1).get(1))); - stats.put("repairXP", Integer.valueOf(experience.get(1).get(2))); - stats.put("woodcuttingXP", Integer.valueOf(experience.get(1).get(3))); - stats.put("unarmedXP", Integer.valueOf(experience.get(1).get(4))); - stats.put("herbalismXP", Integer.valueOf(experience.get(1).get(5))); - stats.put("excavationXP", Integer.valueOf(experience.get(1).get(6))); - stats.put("archeryXP", Integer.valueOf(experience.get(1).get(7))); - stats.put("swordsXP", Integer.valueOf(experience.get(1).get(8))); - stats.put("axesXP", Integer.valueOf(experience.get(1).get(9))); - stats.put("acrobaticsXP", Integer.valueOf(experience.get(1).get(10))); + skillsXp.put(SkillType.TAMING, Integer.valueOf(experience.get(1).get(0))); + skillsXp.put(SkillType.MINING, Integer.valueOf(experience.get(1).get(1))); + skillsXp.put(SkillType.REPAIR, Integer.valueOf(experience.get(1).get(2))); + skillsXp.put(SkillType.WOODCUTTING, Integer.valueOf(experience.get(1).get(3))); + skillsXp.put(SkillType.UNARMED, Integer.valueOf(experience.get(1).get(4))); + skillsXp.put(SkillType.HERBALISM, Integer.valueOf(experience.get(1).get(5))); + skillsXp.put(SkillType.EXCAVATION, Integer.valueOf(experience.get(1).get(6))); + skillsXp.put(SkillType.ARCHERY, Integer.valueOf(experience.get(1).get(7))); + skillsXp.put(SkillType.SWORDS, Integer.valueOf(experience.get(1).get(8))); + skillsXp.put(SkillType.AXES, Integer.valueOf(experience.get(1).get(9))); + skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(experience.get(1).get(10))); return true; } else { @@ -204,8 +207,8 @@ public class PlayerProfile if(!character[0].equals(playername)){continue;} //Get Mining - if(character.length > 1 && isInt(character[1])) - stats.put("mining", Integer.valueOf(character[1])); + if(character.length > 1 && m.isInt(character[1])) + skills.put(SkillType.MINING, Integer.valueOf(character[1])); //Myspawn if(character.length > 2) myspawn = character[2]; @@ -213,50 +216,50 @@ public class PlayerProfile if(character.length > 3) party = character[3]; //Mining XP - if(character.length > 4 && isInt(character[4])) - stats.put("miningXP", Integer.valueOf(character[4])); - if(character.length > 5 && isInt(character[5])) - stats.put("woodcutting", Integer.valueOf(character[5])); - if(character.length > 6 && isInt(character[6])) - stats.put("woodcuttingXP", Integer.valueOf(character[6])); - if(character.length > 7 && isInt(character[7])) - stats.put("repair", Integer.valueOf(character[7])); - if(character.length > 8 && isInt(character[8])) - stats.put("unarmed", Integer.valueOf(character[8])); - if(character.length > 9 && isInt(character[9])) - stats.put("herbalism", Integer.valueOf(character[9])); - if(character.length > 10 && isInt(character[10])) - stats.put("excavation", Integer.valueOf(character[10])); - if(character.length > 11 && isInt(character[11])) - stats.put("archery", Integer.valueOf(character[11])); - if(character.length > 12 && isInt(character[12])) - stats.put("swords", Integer.valueOf(character[12])); - if(character.length > 13 && isInt(character[13])) - stats.put("axes", Integer.valueOf(character[13])); - if(character.length > 14 && isInt(character[14])) - stats.put("acrobatics", Integer.valueOf(character[14])); - if(character.length > 15 && isInt(character[15])) - stats.put("repairXP", Integer.valueOf(character[15])); - if(character.length > 16 && isInt(character[16])) - stats.put("unarmedXP", Integer.valueOf(character[16])); - if(character.length > 17 && isInt(character[17])) - stats.put("herbalismXP", Integer.valueOf(character[17])); - if(character.length > 18 && isInt(character[18])) - stats.put("excavationXP", Integer.valueOf(character[18])); - if(character.length > 19 && isInt(character[19])) - stats.put("archeryXP", Integer.valueOf(character[19])); - if(character.length > 20 && isInt(character[20])) - stats.put("swordsXP", Integer.valueOf(character[20])); - if(character.length > 21 && isInt(character[21])) - stats.put("axesXP", Integer.valueOf(character[21])); - if(character.length > 22 && isInt(character[22])) - stats.put("acrobaticsXP", Integer.valueOf(character[22])); - if(character.length > 23 && isInt(character[23])) + if(character.length > 4 && m.isInt(character[4])) + skillsXp.put(SkillType.MINING, Integer.valueOf(character[4])); + if(character.length > 5 && m.isInt(character[5])) + skills.put(SkillType.WOODCUTTING, Integer.valueOf(character[5])); + if(character.length > 6 && m.isInt(character[6])) + skillsXp.put(SkillType.WOODCUTTING, Integer.valueOf(character[6])); + if(character.length > 7 && m.isInt(character[7])) + skills.put(SkillType.REPAIR, Integer.valueOf(character[7])); + if(character.length > 8 && m.isInt(character[8])) + skills.put(SkillType.UNARMED, Integer.valueOf(character[8])); + if(character.length > 9 && m.isInt(character[9])) + skills.put(SkillType.HERBALISM, Integer.valueOf(character[9])); + if(character.length > 10 && m.isInt(character[10])) + skills.put(SkillType.EXCAVATION, Integer.valueOf(character[10])); + if(character.length > 11 && m.isInt(character[11])) + skills.put(SkillType.ARCHERY, Integer.valueOf(character[11])); + if(character.length > 12 && m.isInt(character[12])) + skills.put(SkillType.SWORDS, Integer.valueOf(character[12])); + if(character.length > 13 && m.isInt(character[13])) + skills.put(SkillType.AXES, Integer.valueOf(character[13])); + if(character.length > 14 && m.isInt(character[14])) + skills.put(SkillType.ACROBATICS, Integer.valueOf(character[14])); + if(character.length > 15 && m.isInt(character[15])) + skillsXp.put(SkillType.REPAIR, Integer.valueOf(character[15])); + if(character.length > 16 && m.isInt(character[16])) + skillsXp.put(SkillType.UNARMED, Integer.valueOf(character[16])); + if(character.length > 17 && m.isInt(character[17])) + skillsXp.put(SkillType.HERBALISM, Integer.valueOf(character[17])); + if(character.length > 18 && m.isInt(character[18])) + skillsXp.put(SkillType.EXCAVATION, Integer.valueOf(character[18])); + if(character.length > 19 && m.isInt(character[19])) + skillsXp.put(SkillType.ARCHERY, Integer.valueOf(character[19])); + if(character.length > 20 && m.isInt(character[20])) + skillsXp.put(SkillType.SWORDS, Integer.valueOf(character[20])); + if(character.length > 21 && m.isInt(character[21])) + skillsXp.put(SkillType.AXES, Integer.valueOf(character[21])); + if(character.length > 22 && m.isInt(character[22])) + skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(character[22])); + if(character.length > 23 && m.isInt(character[23])) myspawnworld = character[23]; - if(character.length > 24 && isInt(character[24])) - stats.put("taming", Integer.valueOf(character[24])); - if(character.length > 25 && isInt(character[25])) - stats.put("tamingXP", Integer.valueOf(character[25])); + if(character.length > 24 && m.isInt(character[24])) + skills.put(SkillType.TAMING, Integer.valueOf(character[24])); + if(character.length > 25 && m.isInt(character[25])) + skillsXp.put(SkillType.TAMING, Integer.valueOf(character[25])); if(character.length > 26) berserkDATS = Long.valueOf(character[26]) * 1000; if(character.length > 27) @@ -300,30 +303,30 @@ public class PlayerProfile +", axes = "+(skullSplitterDATS/1000) +" WHERE user_id = "+this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET " - +" taming = "+stats.get("taming") - +", mining = "+stats.get("mining") - +", repair = "+stats.get("repair") - +", woodcutting = "+stats.get("woodcutting") - +", unarmed = "+stats.get("unarmed") - +", herbalism = "+stats.get("herbalism") - +", excavation = "+stats.get("excavation") - +", archery = " +stats.get("archery") - +", swords = " +stats.get("swords") - +", axes = "+stats.get("axes") - +", acrobatics = "+stats.get("acrobatics") + +" taming = "+skills.get(SkillType.TAMING) + +", mining = "+skills.get(SkillType.MINING) + +", repair = "+skills.get(SkillType.REPAIR) + +", woodcutting = "+skills.get(SkillType.WOODCUTTING) + +", unarmed = "+skills.get(SkillType.UNARMED) + +", herbalism = "+skills.get(SkillType.HERBALISM) + +", excavation = "+skills.get(SkillType.EXCAVATION) + +", archery = " +skills.get(SkillType.ARCHERY) + +", swords = " +skills.get(SkillType.SWORDS) + +", axes = "+skills.get(SkillType.AXES) + +", acrobatics = "+skills.get(SkillType.ACROBATICS) +" WHERE user_id = "+this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"experience SET " - +" taming = "+stats.get("tamingXP") - +", mining = "+stats.get("miningXP") - +", repair = "+stats.get("repairXP") - +", woodcutting = "+stats.get("woodcuttingXP") - +", unarmed = "+stats.get("unarmedXP") - +", herbalism = "+stats.get("herbalismXP") - +", excavation = "+stats.get("excavationXP") - +", archery = " +stats.get("archeryXP") - +", swords = " +stats.get("swordsXP") - +", axes = "+stats.get("axesXP") - +", acrobatics = "+stats.get("acrobaticsXP") + +" taming = "+skillsXp.get(SkillType.TAMING) + +", mining = "+skillsXp.get(SkillType.MINING) + +", repair = "+skillsXp.get(SkillType.REPAIR) + +", woodcutting = "+skillsXp.get(SkillType.WOODCUTTING) + +", unarmed = "+skillsXp.get(SkillType.UNARMED) + +", herbalism = "+skillsXp.get(SkillType.HERBALISM) + +", excavation = "+skillsXp.get(SkillType.EXCAVATION) + +", archery = " +skillsXp.get(SkillType.ARCHERY) + +", swords = " +skillsXp.get(SkillType.SWORDS) + +", axes = "+skillsXp.get(SkillType.AXES) + +", acrobatics = "+skillsXp.get(SkillType.ACROBATICS) +" WHERE user_id = "+this.userid); } else { @@ -347,31 +350,31 @@ public class PlayerProfile //Otherwise write the new player information } else { writer.append(playername + ":"); - writer.append(stats.get("mining") + ":"); + writer.append(skills.get(SkillType.MINING) + ":"); writer.append(myspawn + ":"); writer.append(party+":"); - writer.append(stats.get("miningXP") + ":"); - writer.append(stats.get("woodcutting") + ":"); - writer.append(stats.get("woodcuttingXP") + ":"); - writer.append(stats.get("repair") + ":"); - writer.append(stats.get("unarmed") + ":"); - writer.append(stats.get("herbalism") + ":"); - writer.append(stats.get("excavation") + ":"); - writer.append(stats.get("archery") + ":"); - writer.append(stats.get("swords") + ":"); - writer.append(stats.get("axes") + ":"); - writer.append(stats.get("acrobatics") + ":"); - writer.append(stats.get("repairXP") + ":"); - writer.append(stats.get("unarmedXP") + ":"); - writer.append(stats.get("herbalismXP") + ":"); - writer.append(stats.get("excavationXP") + ":"); - writer.append(stats.get("archeryXP") + ":"); - writer.append(stats.get("swordsXP") + ":"); - writer.append(stats.get("axesXP") + ":"); - writer.append(stats.get("acrobaticsXP") + ":"); + writer.append(skillsXp.get(SkillType.MINING) + ":"); + writer.append(skills.get(SkillType.WOODCUTTING) + ":"); + writer.append(skillsXp.get(SkillType.WOODCUTTING) + ":"); + writer.append(skills.get(SkillType.REPAIR) + ":"); + writer.append(skills.get(SkillType.UNARMED) + ":"); + writer.append(skills.get(SkillType.HERBALISM) + ":"); + writer.append(skills.get(SkillType.EXCAVATION) + ":"); + writer.append(skills.get(SkillType.ARCHERY) + ":"); + writer.append(skills.get(SkillType.SWORDS) + ":"); + writer.append(skills.get(SkillType.AXES) + ":"); + writer.append(skills.get(SkillType.ACROBATICS) + ":"); + writer.append(skillsXp.get(SkillType.REPAIR) + ":"); + writer.append(skillsXp.get(SkillType.UNARMED) + ":"); + writer.append(skillsXp.get(SkillType.HERBALISM) + ":"); + writer.append(skillsXp.get(SkillType.EXCAVATION) + ":"); + writer.append(skillsXp.get(SkillType.ARCHERY) + ":"); + writer.append(skillsXp.get(SkillType.SWORDS) + ":"); + writer.append(skillsXp.get(SkillType.AXES) + ":"); + writer.append(skillsXp.get(SkillType.ACROBATICS) + ":"); writer.append(myspawnworld+":"); - writer.append(stats.get("taming") + ":"); - writer.append(stats.get("tamingXP") + ":"); + writer.append(skills.get(SkillType.TAMING) + ":"); + writer.append(skillsXp.get(SkillType.TAMING) + ":"); //Need to store the DATS of abilities nao //Berserk, Gigadrillbreaker, Tree Feller, Green Terra, Serrated Strikes, Skull Splitter, Super Breaker writer.append(String.valueOf(berserkDATS/1000)+":"); @@ -475,9 +478,9 @@ public class PlayerProfile } public int getMaxMana() { - if(stats.get("sorcery") < 50) + if(skills.get(SkillType.SORCERY) < 50) return 5; - return stats.get("sorcery") / 10; + return skills.get(SkillType.SORCERY) / 10; } public void setDyeChanged(Boolean bool) { @@ -529,12 +532,9 @@ public class PlayerProfile public boolean getAbilityUse(){ return abilityuse; } - public void toggleAbilityUse(){ - if(abilityuse == false){ - abilityuse = true; - } else { - abilityuse = false; - } + public void toggleAbilityUse() + { + abilityuse = !abilityuse; } public long getMySpawnATS(){ return mySpawnATS; @@ -542,10 +542,9 @@ public class PlayerProfile public void setMySpawnATS(long newvalue){ mySpawnATS = newvalue; } - public void decreaseBleedTicks(){ - if(bleedticks >= 1){ - bleedticks--; - } + public void decreaseBleedTicks() + { + bleedticks--; } public Integer getBleedTicks(){ return bleedticks; @@ -819,204 +818,65 @@ public class PlayerProfile public void setRecentlyHurt(long newvalue){ recentlyHurt = newvalue; } - public void skillUp(String skillname, int newvalue) + public void skillUp(SkillType skillType, int newvalue) { - stats.put(skillname, stats.get(skillname)+newvalue); + skills.put(skillType, skills.get(skillType)+newvalue); save(); } - public void skillUpSorcery (int newskill){ - skillUp("sorcery", newskill); - } - public void skillUpTaming(int newskill){ - skillUp("taming", newskill); - } - public void skillUpAxes(int newskill){ - skillUp("axes", newskill); - } - public void skillUpAcrobatics(int newskill){ - skillUp("acrobatics", newskill); - } - public void skillUpSwords(int newskill){ - skillUp("swords", newskill); - } - public void skillUpArchery(int newskill){ - skillUp("archery", newskill); - } - public void skillUpRepair(int newskill){ - skillUp("repair", newskill); - } - public void skillUpMining(int newskill){ - skillUp("mining", newskill); - } - public void skillUpUnarmed(int newskill){ - skillUp("unarmed", newskill); - } - public void skillUpHerbalism(int newskill){ - skillUp("herbalism", newskill); - } - public void skillUpExcavation(int newskill){ - skillUp("excavation", newskill); - } - public void skillUpWoodCutting(int newskill){ - skillUp("woodcutting", newskill); - } - public String getSkillToString(String skillname){ - return String.valueOf(stats.get(skillname)); - } - public Integer getSkill(String skillname){ - return stats.get(skillname); - } - public void resetSkillXp(String skillname){ - stats.put(skillname+"XP", 0); - } - public void addXP(String skillname, int newvalue) + public Integer getSkillLevel(SkillType skillType) { - if(skillname.toLowerCase().equals("all")){ - stats.put("tamingXP", stats.get("tamingXP")+newvalue); - stats.put("miningXP", stats.get("miningXP")+newvalue); - stats.put("woodcuttingXP", stats.get("woodcuttingXP")+newvalue); - stats.put("repairXP", stats.get("repairXP")+newvalue); - stats.put("herbalismXP", stats.get("herbalismXP")+newvalue); - stats.put("acrobaticsXP", stats.get("acrobaticsXP")+newvalue); - stats.put("swordsXP", stats.get("swordsXP")+newvalue); - stats.put("archeryXP", stats.get("archeryXP")+newvalue); - stats.put("unarmedXP", stats.get("unarmedXP")+newvalue); - stats.put("excavationXP", stats.get("excavationXP")+newvalue); - stats.put("axesXP", stats.get("axesXP")+newvalue); - stats.put("sorcery", stats.get("sorceryXP")+newvalue); + return skills.get(skillType); + } + public Integer getSkillXpLevel(SkillType skillType) + { + return skillsXp.get(skillType); + } + public void resetSkillXp(SkillType skillType) + { + skills.put(skillType, 0); + } + public void addXP(SkillType skillType, int newvalue) + { + if(skillType == SkillType.ALL) + { + skillsXp.put(SkillType.TAMING, skillsXp.get(SkillType.TAMING)+newvalue); + skillsXp.put(SkillType.MINING, skillsXp.get(SkillType.MINING)+newvalue); + skillsXp.put(SkillType.WOODCUTTING, skillsXp.get(SkillType.WOODCUTTING)+newvalue); + skillsXp.put(SkillType.REPAIR, skillsXp.get(SkillType.REPAIR)+newvalue); + skillsXp.put(SkillType.HERBALISM, skillsXp.get(SkillType.HERBALISM)+newvalue); + skillsXp.put(SkillType.ACROBATICS, skillsXp.get(SkillType.ACROBATICS)+newvalue); + skillsXp.put(SkillType.SWORDS, skillsXp.get(SkillType.SWORDS)+newvalue); + skillsXp.put(SkillType.ARCHERY, skillsXp.get(SkillType.ARCHERY)+newvalue); + skillsXp.put(SkillType.UNARMED, skillsXp.get(SkillType.UNARMED)+newvalue); + skillsXp.put(SkillType.EXCAVATION, skillsXp.get(SkillType.EXCAVATION)+newvalue); + skillsXp.put(SkillType.AXES, skillsXp.get(SkillType.AXES)+newvalue); + skillsXp.put(SkillType.SORCERY, skillsXp.get(SkillType.SORCERY)+newvalue); } else { - stats.put(skillname.toLowerCase()+"XP", stats.get(skillname.toLowerCase()+"XP")+newvalue); + skillsXp.put(skillType, skillsXp.get(skillType)+newvalue); } //save(); } - public void addSorceryXP(int newXP) + public void removeXP(SkillType skillType, int newvalue) { - addXP("sorcery", newXP); - } - public void addTamingXP(int newXP) - { - addXP("taming", newXP); - } - public void addAcrobaticsXP(int newXP) - { - addXP("acrobatics", newXP); - } - public void addAxesXP(int newXP) - { - addXP("axes", newXP); - } - public void addSwordsXP(int newXP) - { - addXP("swords", newXP); - } - public void addArcheryXP(int newXP) - { - addXP("archery", newXP); - } - public void addExcavationXP(int newXP) - { - addXP("excavation", newXP); - } - public void addHerbalismXP(int newXP) - { - addXP("herbalism", newXP); - } - public void addRepairXP(int newXP) - { - addXP("repair", newXP); - } - public void addUnarmedXP(int newXP) - { - addXP("unarmed", newXP); - } - public void addWoodcuttingXP(int newXP) - { - addXP("woodcutting", newXP); - } - public void addMiningXP(int newXP) - { - addXP("mining", newXP); - } - public void removeXP(String skillname, int newvalue) - { - if(skillname.toLowerCase().equals("all")){ - stats.put("tamingXP", stats.get("tamingXP")-newvalue); - stats.put("miningXP", stats.get("miningXP")-newvalue); - stats.put("woodcuttingXP", stats.get("woodcuttingXP")-newvalue); - stats.put("repairXP", stats.get("repairXP")-newvalue); - stats.put("herbalismXP", stats.get("herbalismXP")-newvalue); - stats.put("acrobaticsXP", stats.get("acrobaticsXP")-newvalue); - stats.put("swordsXP", stats.get("swordsXP")-newvalue); - stats.put("archeryXP", stats.get("archeryXP")-newvalue); - stats.put("unarmedXP", stats.get("unarmedXP")-newvalue); - stats.put("excavationXP", stats.get("excavationXP")-newvalue); - stats.put("axesXP", stats.get("axesXP")-newvalue); - stats.put("sorceryXP", stats.get("sorceryXP")-newvalue); + if(skillType == SkillType.ALL) + { + skillsXp.put(SkillType.TAMING, skillsXp.get(SkillType.TAMING)-newvalue); + skillsXp.put(SkillType.MINING, skillsXp.get(SkillType.MINING)-newvalue); + skillsXp.put(SkillType.WOODCUTTING, skillsXp.get(SkillType.WOODCUTTING)-newvalue); + skillsXp.put(SkillType.REPAIR, skillsXp.get(SkillType.REPAIR)-newvalue); + skillsXp.put(SkillType.HERBALISM, skillsXp.get(SkillType.HERBALISM)-newvalue); + skillsXp.put(SkillType.ACROBATICS, skillsXp.get(SkillType.ACROBATICS)-newvalue); + skillsXp.put(SkillType.SWORDS, skillsXp.get(SkillType.SWORDS)-newvalue); + skillsXp.put(SkillType.ARCHERY, skillsXp.get(SkillType.ARCHERY)-newvalue); + skillsXp.put(SkillType.UNARMED, skillsXp.get(SkillType.UNARMED)-newvalue); + skillsXp.put(SkillType.EXCAVATION, skillsXp.get(SkillType.EXCAVATION)-newvalue); + skillsXp.put(SkillType.AXES, skillsXp.get(SkillType.AXES)-newvalue); + skillsXp.put(SkillType.SORCERY, skillsXp.get(SkillType.SORCERY)-newvalue); } else { - stats.put(skillname.toLowerCase()+"XP", stats.get(skillname.toLowerCase()+"XP")-newvalue); + skillsXp.put(skillType, skillsXp.get(skillType)-newvalue); } save(); } - public void removeSorceryXP(int newXP){ - removeXP("sorcery", newXP); - } - public void removeTamingXP(int newXP){ - removeXP("taming", newXP); - } - public void removeWoodCuttingXP(int newXP){ - removeXP("woodcutting", newXP); - } - public void removeMiningXP(int newXP){ - removeXP("mining", newXP); - } - public void removeRepairXP(int newXP){ - removeXP("repair", newXP); - } - public void removeUnarmedXP(int newXP){ - removeXP("unarmed", newXP); - } - public void removeHerbalismXP(int newXP){ - removeXP("herbalism", newXP); - } - public void removeExcavationXP(int newXP){ - removeXP("excavation", newXP); - } - public void removeArcheryXP(int newXP){ - removeXP("archery", newXP); - } - public void removeSwordsXP(int newXP){ - removeXP("swords", newXP); - } - public void removeAxesXP(int newXP){ - removeXP("axes", newXP); - } - public void removeAcrobaticsXP(int newXP){ - removeXP("acrobatics", newXP); - } - - public boolean isInt(String string) - { - try { - Integer.parseInt(string); - } - catch(NumberFormatException nFE) { - return false; - } - return true; - } - - public boolean isDouble(String string) - { - try - { - Double.valueOf(string); - } - catch(NumberFormatException nFE) - { - return false; - } - return true; - } public void acceptInvite() { party = invite; @@ -1028,84 +888,75 @@ public class PlayerProfile } public String getInvite() { return invite; } - public void modifyskill(int newvalue, String skillname){ - if(skillname.toLowerCase().equals("all")){ - stats.put("sorcery", newvalue); - stats.put("taming", newvalue); - stats.put("mining", newvalue); - stats.put("woodcutting", newvalue); - stats.put("repair", newvalue); - stats.put("herbalism", newvalue); - stats.put("acrobatics", newvalue); - stats.put("swords", newvalue); - stats.put("archery", newvalue); - stats.put("unarmed", newvalue); - stats.put("excavation", newvalue); - stats.put("axes", newvalue); + public void modifyskill(SkillType skillType, int newvalue) + { + if(skillType == SkillType.ALL) + { + skills.put(SkillType.TAMING, newvalue); + skills.put(SkillType.MINING, newvalue); + skills.put(SkillType.WOODCUTTING, newvalue); + skills.put(SkillType.REPAIR, newvalue); + skills.put(SkillType.HERBALISM, newvalue); + skills.put(SkillType.ACROBATICS, newvalue); + skills.put(SkillType.SWORDS, newvalue); + skills.put(SkillType.ARCHERY, newvalue); + skills.put(SkillType.UNARMED, newvalue); + skills.put(SkillType.EXCAVATION, newvalue); + skills.put(SkillType.AXES, newvalue); + skills.put(SkillType.SORCERY, newvalue); - stats.put("tamingXP", 0); - stats.put("sorceryXP", 0); - stats.put("miningXP", 0); - stats.put("woodcuttingXP", 0); - stats.put("repairXP", 0); - stats.put("herbalismXP", 0); - stats.put("acrobaticsXP", 0); - stats.put("swordsXP", 0); - stats.put("archeryXP", 0); - stats.put("unarmedXP", 0); - stats.put("excavationXP", 0); - stats.put("axesXP", 0); + skillsXp.put(SkillType.TAMING, 0); + skillsXp.put(SkillType.MINING, 0); + skillsXp.put(SkillType.WOODCUTTING, 0); + skillsXp.put(SkillType.REPAIR, 0); + skillsXp.put(SkillType.HERBALISM, 0); + skillsXp.put(SkillType.ACROBATICS, 0); + skillsXp.put(SkillType.SWORDS, 0); + skillsXp.put(SkillType.ARCHERY, 0); + skillsXp.put(SkillType.UNARMED, 0); + skillsXp.put(SkillType.EXCAVATION, 0); + skillsXp.put(SkillType.AXES, 0); + skillsXp.put(SkillType.SORCERY, 0); } else { - stats.put(skillname, newvalue); - stats.put(skillname+"XP", newvalue); + skills.put(skillType, newvalue); + skillsXp.put(skillType, newvalue); } save(); } - public Integer getXpToLevel(String skillname) + public Integer getXpToLevel(SkillType skillType) { - if(skillname.equals("sorcery")){ - return ((stats.get("sorcery") + 50) * LoadProperties.sorceryxpmodifier) * LoadProperties.globalxpmodifier; + switch(skillType) + { + case SORCERY: + return ((skills.get(skillType) + 50) * LoadProperties.sorceryxpmodifier * LoadProperties.globalxpmodifier); + case TAMING: + return ((skills.get(skillType) + 50) * LoadProperties.tamingxpmodifier * LoadProperties.globalxpmodifier); + case MINING: + return ((skills.get(skillType) + 50) * LoadProperties.miningxpmodifier * LoadProperties.globalxpmodifier); + case WOODCUTTING: + return ((skills.get(skillType) + 50) * LoadProperties.woodcuttingxpmodifier * LoadProperties.globalxpmodifier); + case REPAIR: + return ((skills.get(skillType) + 50) * LoadProperties.repairxpmodifier * LoadProperties.globalxpmodifier); + case HERBALISM: + return ((skills.get(skillType) + 50) * LoadProperties.herbalismxpmodifier * LoadProperties.globalxpmodifier); + case ACROBATICS: + return ((skills.get(skillType) + 50) * LoadProperties.acrobaticsxpmodifier * LoadProperties.globalxpmodifier); + case SWORDS: + return ((skills.get(skillType) + 50) * LoadProperties.swordsxpmodifier * LoadProperties.globalxpmodifier); + case ARCHERY: + return ((skills.get(skillType) + 50) * LoadProperties.archeryxpmodifier * LoadProperties.globalxpmodifier); + case UNARMED: + return ((skills.get(skillType) + 50) * LoadProperties.unarmedxpmodifier * LoadProperties.globalxpmodifier); + case EXCAVATION: + return ((skills.get(skillType) + 50) * LoadProperties.excavationxpmodifier * LoadProperties.globalxpmodifier); + case AXES: + return ((skills.get(skillType) + 50) * LoadProperties.axesxpmodifier * LoadProperties.globalxpmodifier); + default: + return null; } - if(skillname.equals("taming")){ - return ((stats.get("taming") + 50) * LoadProperties.tamingxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("mining")){ - return ((stats.get("mining") + 50) * LoadProperties.miningxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("woodcutting")){ - return ((stats.get("woodcutting") + 50) * LoadProperties.woodcuttingxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("repair")){ - return ((stats.get("repair") + 50) * LoadProperties.repairxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("herbalism")){ - return ((stats.get("herbalism") + 50) * LoadProperties.herbalismxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("acrobatics")){ - return ((stats.get("acrobatics") + 50) * LoadProperties.acrobaticsxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("swords")){ - return ((stats.get("swords") + 50) * LoadProperties.swordsxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("archery")){ - return ((stats.get("archery") + 50) * LoadProperties.archeryxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("unarmed")){ - return ((stats.get("unarmed") + 50) * LoadProperties.unarmedxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("excavation")){ - return ((stats.get("excavation") + 50) * LoadProperties.excavationxpmodifier) * LoadProperties.globalxpmodifier; - } - if(skillname.equals("axes")){ - return ((stats.get("axes") + 50) * LoadProperties.axesxpmodifier) * LoadProperties.globalxpmodifier; - } else { - System.out.println("ELSE CONDITIONS MET"); - return 0; - } - } - - - //Store the player's party + } + + //Store the player's party public void setParty(String newParty) { party = newParty; @@ -1184,7 +1035,7 @@ public class PlayerProfile Location loc = null; if(myspawn != null) { - if(isDouble(getX()) && isDouble(getY()) && isDouble(getZ())) + if(m.isDouble(getX()) && m.isDouble(getY()) && m.isDouble(getZ())) loc = new Location(player.getWorld(),(Double.parseDouble(getX())), Double.parseDouble(getY()), Double.parseDouble(getZ())); else return null; diff --git a/mcMMO/com/gmail/nossr50/datatypes/SkillType.java b/mcMMO/com/gmail/nossr50/datatypes/SkillType.java new file mode 100644 index 000000000..5fa8f3a99 --- /dev/null +++ b/mcMMO/com/gmail/nossr50/datatypes/SkillType.java @@ -0,0 +1,18 @@ +package com.gmail.nossr50.datatypes; + +public enum SkillType +{ + ACROBATICS, + ALL, //This one is just for convenience + ARCHERY, + AXES, + EXCAVATION, + HERBALISM, + MINING, + REPAIR, + SORCERY, + SWORDS, + TAMING, + UNARMED, + WOODCUTTING; +} diff --git a/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java b/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java index 76e7525d1..eadb959a2 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java @@ -6,6 +6,8 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; + import org.bukkit.Material; import org.bukkit.Statistic; import org.bukkit.block.Block; @@ -109,13 +111,13 @@ public class mcBlockListener extends BlockListener { WoodCutting.woodCuttingProcCheck(player, block); //Default if(block.getData() == (byte)0) - PP.addWoodcuttingXP(LoadProperties.mpine * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine * LoadProperties.xpGainMultiplier); //Spruce if(block.getData() == (byte)1) - PP.addWoodcuttingXP(LoadProperties.mspruce * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce * LoadProperties.xpGainMultiplier); //Birch if(block.getData() == (byte)2) - PP.addWoodcuttingXP(LoadProperties.mbirch * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch * LoadProperties.xpGainMultiplier); } } } else @@ -125,16 +127,16 @@ public class mcBlockListener extends BlockListener { WoodCutting.woodCuttingProcCheck(player, block); //Default if(block.getData() == (byte)0) - PP.addWoodcuttingXP(LoadProperties.mpine * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine * LoadProperties.xpGainMultiplier); //Spruce if(block.getData() == (byte)1) - PP.addWoodcuttingXP(LoadProperties.mspruce * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce * LoadProperties.xpGainMultiplier); //Birch if(block.getData() == (byte)2) - PP.addWoodcuttingXP(LoadProperties.mbirch * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch * LoadProperties.xpGainMultiplier); } } - Skills.XpCheck(player); + Skills.XpCheckSkill(SkillType.WOODCUTTING, player); /* * IF PLAYER IS USING TREEFELLER @@ -159,7 +161,7 @@ public class mcBlockListener extends BlockListener { if(!plugin.misc.blockWatchList.contains(block)) { WoodCutting.woodCuttingProcCheck(player, blockx); - PP.addWoodcuttingXP(LoadProperties.mpine); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine); } } if(blockx.getTypeId() == 18) @@ -303,7 +305,7 @@ public class mcBlockListener extends BlockListener { /* * LEAF BLOWER */ - if(block.getTypeId() == 18 && mcPermissions.getInstance().woodcutting(player) && PP.getSkill("woodcutting") >= 100 && m.isAxes(player.getItemInHand()) && m.blockBreakSimulate(block, player, plugin)) + if(block.getTypeId() == 18 && mcPermissions.getInstance().woodcutting(player) && PP.getSkillLevel(SkillType.WOODCUTTING) >= 100 && m.isAxes(player.getItemInHand()) && m.blockBreakSimulate(block, player, plugin)) { m.damageTool(player, (short)1); if(Math.random() * 10 > 9) diff --git a/mcMMO/com/gmail/nossr50/listeners/mcEntityListener.java b/mcMMO/com/gmail/nossr50/listeners/mcEntityListener.java index 994f15ece..7596f0411 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcEntityListener.java @@ -20,6 +20,7 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.skills.Acrobatics; @@ -79,7 +80,7 @@ public class mcEntityListener extends EntityListener if(master == null || PPo == null) return; //Environmentally Aware - if((event.getCause() == DamageCause.CONTACT || event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE) && PPo.getSkill("taming") >= 100) + if((event.getCause() == DamageCause.CONTACT || event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE) && PPo.getSkillLevel(SkillType.TAMING) >= 100) { if(event.getDamage() < ((Wolf) event.getEntity()).getHealth()) { @@ -88,7 +89,7 @@ public class mcEntityListener extends EntityListener event.getEntity().setFireTicks(0); } } - if(event.getCause() == DamageCause.FALL && PPo.getSkill("taming") >= 100) + if(event.getCause() == DamageCause.FALL && PPo.getSkillLevel(SkillType.TAMING) >= 100) { event.setCancelled(true); } diff --git a/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java index ce1255984..70fe4ddd0 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -25,6 +25,7 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.skills.Herbalism; @@ -157,12 +158,12 @@ public class mcPlayerListener extends PlayerListener boolean pass = false; if(Herbalism.hasSeeds(player) && mcPermissions.getInstance().herbalism(player)){ Herbalism.removeSeeds(player); - if(LoadProperties.enableCobbleToMossy && m.blockBreakSimulate(block, player, plugin) && block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getSkill("herbalism")){ + if(LoadProperties.enableCobbleToMossy && m.blockBreakSimulate(block, player, plugin) && block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)){ player.sendMessage(mcLocale.getString("mcPlayerListener.GreenThumb")); block.setType(Material.MOSSY_COBBLESTONE); pass = true; } - if(block.getType() == Material.DIRT && m.blockBreakSimulate(block, player, plugin) && Math.random() * 1500 <= PP.getSkill("herbalism")){ + if(block.getType() == Material.DIRT && m.blockBreakSimulate(block, player, plugin) && Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)){ player.sendMessage(mcLocale.getString("mcPlayerListener.GreenThumb")); block.setType(Material.GRASS); pass = true; diff --git a/mcMMO/com/gmail/nossr50/m.java b/mcMMO/com/gmail/nossr50/m.java index 6de6a5d5b..c3c141772 100644 --- a/mcMMO/com/gmail/nossr50/m.java +++ b/mcMMO/com/gmail/nossr50/m.java @@ -15,6 +15,7 @@ import org.bukkit.plugin.Plugin; import com.gmail.nossr50.config.*; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.FakeBlockBreakEvent; +import com.gmail.nossr50.datatypes.SkillType; public class m { @@ -76,27 +77,27 @@ public class m PlayerProfile PP = Users.getProfile(player); int x = 0; if(mcPermissions.getInstance().taming(player)) - x+=PP.getSkill("taming"); + x+=PP.getSkillLevel(SkillType.TAMING); if(mcPermissions.getInstance().mining(player)) - x+=PP.getSkill("mining"); + x+=PP.getSkillLevel(SkillType.MINING); if(mcPermissions.getInstance().woodcutting(player)) - x+=PP.getSkill("woodcutting"); + x+=PP.getSkillLevel(SkillType.WOODCUTTING); if(mcPermissions.getInstance().unarmed(player)) - x+=PP.getSkill("unarmed"); + x+=PP.getSkillLevel(SkillType.UNARMED); if(mcPermissions.getInstance().herbalism(player)) - x+=PP.getSkill("herbalism"); + x+=PP.getSkillLevel(SkillType.HERBALISM); if(mcPermissions.getInstance().excavation(player)) - x+=PP.getSkill("excavation"); + x+=PP.getSkillLevel(SkillType.EXCAVATION); if(mcPermissions.getInstance().archery(player)) - x+=PP.getSkill("archery"); + x+=PP.getSkillLevel(SkillType.ARCHERY); if(mcPermissions.getInstance().swords(player)) - x+=PP.getSkill("swords"); + x+=PP.getSkillLevel(SkillType.SWORDS); if(mcPermissions.getInstance().axes(player)) - x+=PP.getSkill("axes"); + x+=PP.getSkillLevel(SkillType.AXES); if(mcPermissions.getInstance().acrobatics(player)) - x+=PP.getSkill("acrobatics"); + x+=PP.getSkillLevel(SkillType.ACROBATICS); if(mcPermissions.getInstance().repair(player)) - x+=PP.getSkill("repair"); + x+=PP.getSkillLevel(SkillType.REPAIR); return x; } diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index 915f770c9..c0175752e 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -2,6 +2,7 @@ package com.gmail.nossr50; import com.gmail.nossr50.datatypes.Mob; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.config.*; import com.gmail.nossr50.listeners.mcBlockListener; import com.gmail.nossr50.listeners.mcEntityListener; @@ -118,7 +119,13 @@ public class mcMMO extends JavaPlugin //mcMMO_SpellTimer.schedule(new mcTimerSpells(this), (long)0, (long)(100)); } - public boolean inSameParty(Player playera, Player playerb){ + public PlayerProfile getPlayerProfile(Player player) + { + return Users.getProfile(player); + } + + public 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; @@ -129,23 +136,6 @@ public class mcMMO extends JavaPlugin return false; } } - public void getXpToLevel(Player player, String skillname){ - Users.getProfile(player).getXpToLevel(skillname.toLowerCase()); - } - public void removeXp(Player player, String skillname, Integer newvalue){ - PlayerProfile PP = Users.getProfile(player); - PP.removeXP(skillname, newvalue); - Skills.XpCheck(player); - } - public void addXp(Player player, String skillname, Integer newvalue){ - PlayerProfile PP = Users.getProfile(player); - PP.addXP(skillname, newvalue); - Skills.XpCheck(player); - } - public void modifySkill(Player player, String skillname, Integer newvalue){ - PlayerProfile PP = Users.getProfile(player); - PP.modifyskill(newvalue, skillname); - } public ArrayList getParties(){ String location = "plugins/mcMMO/mcmmo.users"; ArrayList parties = new ArrayList(); @@ -198,13 +188,13 @@ public class mcMMO extends JavaPlugin //Check if the command is an MMO related help command if(split[0].equalsIgnoreCase("taming") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillTaming").toLowerCase())){ - float skillvalue = (float)PP.getSkill("taming"); + float skillvalue = (float)PP.getSkillLevel(SkillType.TAMING); String percentage = String.valueOf((skillvalue / 1000) * 100); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillTaming")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainTaming")})); if(mcPermissions.getInstance().taming(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("taming"), PP.getSkillToString("tamingXP"), PP.getXpToLevel("taming")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming1_0"), mcLocale.getString("m.EffectsTaming1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming2_0"), mcLocale.getString("m.EffectsTaming2_1")})); @@ -213,28 +203,28 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming5_0"), mcLocale.getString("m.EffectsTaming5_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming6_0"), mcLocale.getString("m.EffectsTaming6_1")})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - if(PP.getSkill("taming") < 100) + if(PP.getSkillLevel(SkillType.TAMING) < 100) player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming1")})); else player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming1_0"), mcLocale.getString("m.AbilBonusTaming1_1")})); - if(PP.getSkill("taming") < 250) + if(PP.getSkillLevel(SkillType.TAMING) < 250) player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming2")})); else player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming2_0"), mcLocale.getString("m.AbilBonusTaming2_1")})); - if(PP.getSkill("taming") < 500) + if(PP.getSkillLevel(SkillType.TAMING) < 500) player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming3")})); else player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming3_0"), mcLocale.getString("m.AbilBonusTaming3_1")})); - if(PP.getSkill("taming") < 750) + if(PP.getSkillLevel(SkillType.TAMING) < 750) player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming4")})); else player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming4_0"), mcLocale.getString("m.AbilBonusTaming4_1")})); player.sendMessage(mcLocale.getString("m.TamingGoreChance", new Object[] {percentage})); } if(split[0].equalsIgnoreCase("woodcutting") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillWoodCutting").toLowerCase())){ - float skillvalue = (float)PP.getSkill("woodcutting"); + float skillvalue = (float)PP.getSkillLevel(SkillType.WOODCUTTING); int ticks = 2; - int x = PP.getSkill("woodcutting"); + int x = PP.getSkillLevel(SkillType.WOODCUTTING); while(x >= 50){ x-=50; ticks++; @@ -243,13 +233,13 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillWoodCutting")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainWoodCutting")})); if(mcPermissions.getInstance().woodcutting(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("woodcutting"), PP.getSkillToString("woodcuttingXP"), PP.getXpToLevel("woodcutting")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting1_0"), mcLocale.getString("m.EffectsWoodCutting1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting2_0"), mcLocale.getString("m.EffectsWoodCutting2_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting3_0"), mcLocale.getString("m.EffectsWoodCutting3_1")})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - if(PP.getSkill("woodcutting") < 100) + if(PP.getSkillLevel(SkillType.WOODCUTTING) < 100) player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockWoodCutting1")})); else player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusWoodCutting1_0"), mcLocale.getString("m.AbilBonusWoodCutting1_1")})); @@ -258,33 +248,33 @@ public class mcMMO extends JavaPlugin } if(split[0].equalsIgnoreCase("archery") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillArchery").toLowerCase())){ Integer rank = 0; - if(PP.getSkill("archery") >= 50) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 50) rank++; - if(PP.getSkill("archery") >= 250) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 250) rank++; - if(PP.getSkill("archery") >= 575) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 575) rank++; - if(PP.getSkill("archery") >= 725) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 725) rank++; - if(PP.getSkill("archery") >= 1000) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 1000) rank++; - float skillvalue = (float)PP.getSkill("archery"); + float skillvalue = (float)PP.getSkillLevel(SkillType.ARCHERY); String percentage = String.valueOf((skillvalue / 1000) * 100); int ignition = 20; - if(PP.getSkill("archery") >= 200) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 200) ignition+=20; - if(PP.getSkill("archery") >= 400) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 400) ignition+=20; - if(PP.getSkill("archery") >= 600) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 600) ignition+=20; - if(PP.getSkill("archery") >= 800) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 800) ignition+=20; - if(PP.getSkill("archery") >= 1000) + if(PP.getSkillLevel(SkillType.ARCHERY) >= 1000) ignition+=20; String percentagedaze; - if(PP.getSkill("archery") < 1000){ + if(PP.getSkillLevel(SkillType.ARCHERY) < 1000){ percentagedaze = String.valueOf((skillvalue / 2000) * 100); } else { percentagedaze = "50"; @@ -292,7 +282,7 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillArchery")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainArchery")})); if(mcPermissions.getInstance().archery(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("archery"), PP.getSkillToString("archeryXP"), PP.getXpToLevel("archery")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery1_0"), mcLocale.getString("m.EffectsArchery1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery2_0"), mcLocale.getString("m.EffectsArchery2_1")})); @@ -306,14 +296,14 @@ public class mcMMO extends JavaPlugin } if(split[0].equalsIgnoreCase("axes") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillAxes"))){ String percentage; - float skillvalue = (float)PP.getSkill("axes"); - if(PP.getSkill("axes") < 750){ + float skillvalue = (float)PP.getSkillLevel(SkillType.AXES); + if(PP.getSkillLevel(SkillType.AXES) < 750){ percentage = String.valueOf((skillvalue / 1000) * 100); } else { percentage = "75"; } int ticks = 2; - int x = PP.getSkill("axes"); + int x = PP.getSkillLevel(SkillType.AXES); while(x >= 50){ x-=50; ticks++; @@ -322,14 +312,14 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillAxes")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainAxes")})); if(mcPermissions.getInstance().axes(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("axes"), PP.getSkillToString("axesXP"), PP.getXpToLevel("axes")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes1_0"), mcLocale.getString("m.EffectsAxes1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes2_0"), mcLocale.getString("m.EffectsAxes2_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes3_0"), mcLocale.getString("m.EffectsAxes3_1")})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); player.sendMessage(mcLocale.getString("m.AxesCritChance", new Object[] {percentage})); - if(PP.getSkill("axes") < 500){ + if(PP.getSkillLevel(SkillType.AXES) < 500){ player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockAxes1")})); } else { player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusAxes1_0"), mcLocale.getString("m.AbilBonusAxes1_1")})); @@ -339,8 +329,8 @@ public class mcMMO extends JavaPlugin if(split[0].equalsIgnoreCase("swords") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillSwords").toLowerCase())){ int bleedrank = 2; String percentage, parrypercentage = null, counterattackpercentage; - float skillvalue = (float)PP.getSkill("swords"); - if(PP.getSkill("swords") < 750){ + float skillvalue = (float)PP.getSkillLevel(SkillType.SWORDS); + if(PP.getSkillLevel(SkillType.SWORDS) < 750){ percentage = String.valueOf((skillvalue / 1000) * 100); } else { percentage = "75"; @@ -348,20 +338,20 @@ public class mcMMO extends JavaPlugin if(skillvalue >= 750) bleedrank+=1; - if(PP.getSkill("swords") <= 900){ + if(PP.getSkillLevel(SkillType.SWORDS) <= 900){ parrypercentage = String.valueOf((skillvalue / 3000) * 100); } else { parrypercentage = "30"; } - if(PP.getSkill("swords") <= 600){ + if(PP.getSkillLevel(SkillType.SWORDS) <= 600){ counterattackpercentage = String.valueOf((skillvalue / 2000) * 100); } else { counterattackpercentage = "30"; } int ticks = 2; - int x = PP.getSkill("swords"); + int x = PP.getSkillLevel(SkillType.SWORDS); while(x >= 50){ x-=50; ticks++; @@ -370,7 +360,7 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillSwords")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainSwords")})); if(mcPermissions.getInstance().swords(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("swords"), PP.getSkillToString("swordsXP"), PP.getXpToLevel("swords")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords1_0"), mcLocale.getString("m.EffectsSwords1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords2_0"), mcLocale.getString("m.EffectsSwords2_1")})); @@ -388,10 +378,10 @@ public class mcMMO extends JavaPlugin } if(split[0].equalsIgnoreCase("acrobatics") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillAcrobatics").toLowerCase())){ String dodgepercentage; - float skillvalue = (float)PP.getSkill("acrobatics"); + float skillvalue = (float)PP.getSkillLevel(SkillType.ACROBATICS); String percentage = String.valueOf((skillvalue / 1000) * 100); String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2); - if(PP.getSkill("acrobatics") <= 800){ + if(PP.getSkillLevel(SkillType.ACROBATICS) <= 800){ dodgepercentage = String.valueOf((skillvalue / 4000 * 100)); } else { dodgepercentage = "20"; @@ -399,7 +389,7 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillAcrobatics")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainAcrobatics")})); if(mcPermissions.getInstance().acrobatics(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("acrobatics"), PP.getSkillToString("acrobaticsXP"), PP.getXpToLevel("acrobatics")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAcrobatics1_0"), mcLocale.getString("m.EffectsAcrobatics1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAcrobatics2_0"), mcLocale.getString("m.EffectsAcrobatics2_1")})); @@ -410,10 +400,10 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.AcrobaticsDodgeChance", new Object[] {dodgepercentage})); } if(split[0].equalsIgnoreCase("mining") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillMining"))){ - float skillvalue = (float)PP.getSkill("mining"); + float skillvalue = (float)PP.getSkillLevel(SkillType.MINING); String percentage = String.valueOf((skillvalue / 1000) * 100); int ticks = 2; - int x = PP.getSkill("mining"); + int x = PP.getSkillLevel(SkillType.MINING); while(x >= 50){ x-=50; ticks++; @@ -421,7 +411,7 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillMining")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainMining")})); if(mcPermissions.getInstance().mining(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("mining"), PP.getSkillToString("miningXP"), PP.getXpToLevel("mining")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsMining1_0"), mcLocale.getString("m.EffectsMining1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsMining2_0"), mcLocale.getString("m.EffectsMining2_1")})); @@ -430,13 +420,13 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.MiningSuperBreakerLength", new Object[] {ticks})); } if(split[0].equalsIgnoreCase("repair") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillRepair").toLowerCase())){ - float skillvalue = (float)PP.getSkill("repair"); + float skillvalue = (float)PP.getSkillXpLevel(SkillType.REPAIR); String percentage = String.valueOf((skillvalue / 1000) * 100); String repairmastery = String.valueOf((skillvalue / 500) * 100); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillRepair")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainRepair")})); if(mcPermissions.getInstance().repair(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("repair"), PP.getSkillToString("repairXP"), PP.getXpToLevel("repair")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillXpLevel(SkillType.REPAIR), PP.getSkillLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair1_0"), mcLocale.getString("m.EffectsRepair1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair2_0"), mcLocale.getString("m.EffectsRepair2_1")})); @@ -448,15 +438,15 @@ public class mcMMO extends JavaPlugin } if(split[0].equalsIgnoreCase("unarmed")){ String percentage, arrowpercentage; - float skillvalue = (float)PP.getSkill("unarmed"); + float skillvalue = (float)PP.getSkillLevel(SkillType.UNARMED); - if(PP.getSkill("unarmed") < 1000){ + if(PP.getSkillLevel(SkillType.UNARMED) < 1000){ percentage = String.valueOf((skillvalue / 4000) * 100); } else { percentage = "25"; } - if(PP.getSkill("unarmed") < 1000){ + if(PP.getSkillLevel(SkillType.UNARMED) < 1000){ arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2); } else { arrowpercentage = "50"; @@ -464,7 +454,7 @@ public class mcMMO extends JavaPlugin int ticks = 2; - int x = PP.getSkill("unarmed"); + int x = PP.getSkillLevel(SkillType.UNARMED); while(x >= 50){ x-=50; ticks++; @@ -473,7 +463,7 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillUnarmed")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainUnarmed")})); if(mcPermissions.getInstance().unarmed(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("unarmed"), PP.getSkillToString("unarmedXP"), PP.getXpToLevel("unarmed")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed1_0"), mcLocale.getString("m.EffectsUnarmed1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed2_0"), mcLocale.getString("m.EffectsUnarmed2_1")})); @@ -483,9 +473,9 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); player.sendMessage(mcLocale.getString("m.UnarmedArrowDeflectChance", new Object[] {arrowpercentage})); player.sendMessage(mcLocale.getString("m.UnarmedDisarmChance", new Object[] {percentage})); - if(PP.getSkill("unarmed") < 250){ + if(PP.getSkillLevel(SkillType.UNARMED) < 250){ player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockUnarmed1")})); - } else if(PP.getSkill("unarmed") >= 250 && PP.getSkill("unarmed") < 500){ + } else if(PP.getSkillLevel(SkillType.UNARMED) >= 250 && PP.getSkillLevel(SkillType.UNARMED) < 500){ player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusUnarmed1_0"), mcLocale.getString("m.AbilBonusUnarmed1_1")})); player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockUnarmed2")})); } else { @@ -495,44 +485,44 @@ public class mcMMO extends JavaPlugin } if(split[0].equalsIgnoreCase("herbalism") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillHerbalism").toLowerCase())){ int rank = 0; - if(PP.getSkill("herbalism") >= 50) + if(PP.getSkillLevel(SkillType.HERBALISM) >= 50) rank++; - if (PP.getSkill("herbalism") >= 150) + if (PP.getSkillLevel(SkillType.HERBALISM) >= 150) rank++; - if (PP.getSkill("herbalism") >= 250) + if (PP.getSkillLevel(SkillType.HERBALISM) >= 250) rank++; - if (PP.getSkill("herbalism") >= 350) + if (PP.getSkillLevel(SkillType.HERBALISM) >= 350) rank++; - if (PP.getSkill("herbalism") >= 450) + if (PP.getSkillLevel(SkillType.HERBALISM) >= 450) rank++; - if (PP.getSkill("herbalism") >= 550) + if (PP.getSkillLevel(SkillType.HERBALISM) >= 550) rank++; - if (PP.getSkill("herbalism") >= 650) + if (PP.getSkillLevel(SkillType.HERBALISM) >= 650) rank++; - if (PP.getSkill("herbalism") >= 750) + if (PP.getSkillLevel(SkillType.HERBALISM) >= 750) rank++; int bonus = 0; - if(PP.getSkill("herbalism") >= 200) + if(PP.getSkillLevel(SkillType.HERBALISM) >= 200) bonus++; - if(PP.getSkill("herbalism") >= 400) + if(PP.getSkillLevel(SkillType.HERBALISM) >= 400) bonus++; - if(PP.getSkill("herbalism") >= 600) + if(PP.getSkillLevel(SkillType.HERBALISM) >= 600) bonus++; int ticks = 2; - int x = PP.getSkill("herbalism"); + int x = PP.getSkillLevel(SkillType.HERBALISM); while(x >= 50){ x-=50; ticks++; } - float skillvalue = (float)PP.getSkill("herbalism"); + float skillvalue = (float)PP.getSkillLevel(SkillType.HERBALISM); String percentage = String.valueOf((skillvalue / 1000) * 100); String gpercentage = String.valueOf((skillvalue / 1500) * 100); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillHerbalism")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainHerbalism")})); if(mcPermissions.getInstance().herbalism(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("herbalism"), PP.getSkillToString("herbalismXP"), PP.getXpToLevel("herbalism")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism1_0"), mcLocale.getString("m.EffectsHerbalism1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism2_0"), mcLocale.getString("m.EffectsHerbalism2_1")})); @@ -550,7 +540,7 @@ public class mcMMO extends JavaPlugin if(split[0].equalsIgnoreCase("excavation") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillExcavation").toLowerCase())) { int ticks = 2; - int x = PP.getSkill("excavation"); + int x = PP.getSkillLevel(SkillType.EXCAVATION); while(x >= 50){ x-=50; ticks++; @@ -558,7 +548,7 @@ public class mcMMO extends JavaPlugin player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillExcavation")})); player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainExcavation")})); if(mcPermissions.getInstance().excavation(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillToString("excavation"), PP.getSkillToString("excavationXP"), PP.getXpToLevel("excavation")})); + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION)})); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1")})); @@ -677,7 +667,7 @@ public class mcMMO extends JavaPlugin */ if(split.length == 1){ int p = 1; - String[] info = Leaderboard.retrieveInfo("powerlevel", p); + String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p); player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); int n = 1 * p; //Position for(String x : info){ @@ -692,11 +682,11 @@ public class mcMMO extends JavaPlugin } } } - if(split.length >= 2 && Leaderboard.isInt(split[1])){ + if(split.length >= 2 && m.isInt(split[1])){ int p = 1; //Grab page value if specified if(split.length >= 2){ - if(Leaderboard.isInt(split[1])){ + if(m.isInt(split[1])){ p = Integer.valueOf(split[1]); } } @@ -706,7 +696,7 @@ public class mcMMO extends JavaPlugin pt += (pt * 10); pt = 10; } - String[] info = Leaderboard.retrieveInfo("powerlevel", p); + String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p); player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); int n = 1 * pt; //Position for(String x : info){ @@ -724,11 +714,13 @@ public class mcMMO extends JavaPlugin /* * SKILL SPECIFIED INFO RETRIEVAL */ - if(split.length >= 2 && Skills.isSkill(split[1])){ + if(split.length >= 2 && Skills.isSkill(split[1])) + { int p = 1; //Grab page value if specified - if(split.length >= 3){ - if(Leaderboard.isInt(split[2])){ + if(split.length >= 3) + { + if(m.isInt(split[2])){ p = Integer.valueOf(split[2]); } } @@ -742,11 +734,13 @@ public class mcMMO extends JavaPlugin String remainder = split[1].substring(1); // Get remainder of word. String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); - String[] info = Leaderboard.retrieveInfo(split[1].toLowerCase(), p); + String[] info = Leaderboard.retrieveInfo(split[1].toUpperCase(), p); player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] {capitalized})); int n = 1 * pt; //Position - for(String x : info){ - if(x != null){ + for(String x : info) + { + if(x != null) + { String digit = String.valueOf(n); if(n < 10) digit ="0"+String.valueOf(n); @@ -953,7 +947,7 @@ public class mcMMO extends JavaPlugin if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) { int newvalue = Integer.valueOf(split[3]); - Users.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]); + Users.getProfile(getPlayer(split[1])).modifyskill(Skills.getSkillType(split[2]), newvalue); player.sendMessage(ChatColor.RED+split[2]+" has been modified."); } } @@ -962,7 +956,7 @@ public class mcMMO extends JavaPlugin if(m.isInt(split[2]) && Skills.isSkill(split[1])) { int newvalue = Integer.valueOf(split[2]); - PP.modifyskill(newvalue, split[1]); + PP.modifyskill(Skills.getSkillType(split[1]), newvalue); player.sendMessage(ChatColor.RED+split[1]+" has been modified."); } } else @@ -984,17 +978,19 @@ public class mcMMO extends JavaPlugin return true; } if(split.length == 4){ - if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])){ + if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) + { int newvalue = Integer.valueOf(split[3]); - Users.getProfile(getPlayer(split[1])).addXP(split[2], newvalue); + Users.getProfile(getPlayer(split[1])).addXP(Skills.getSkillType(split[2]), newvalue); getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!"); player.sendMessage(ChatColor.RED+split[2]+" has been modified."); - Skills.XpCheck(getPlayer(split[1])); + Skills.XpCheckAll(getPlayer(split[1])); } } - else if(split.length == 3 && m.isInt(split[2]) && Skills.isSkill(split[1])){ + else if(split.length == 3 && m.isInt(split[2]) && Skills.isSkill(split[1])) + { int newvalue = Integer.valueOf(split[2]); - Users.getProfile(player).addXP(split[1], newvalue); + Users.getProfile(player).addXP(Skills.getSkillType(split[1]), newvalue); player.sendMessage(ChatColor.RED+split[1]+" has been modified."); } else { player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp"); @@ -1050,33 +1046,33 @@ public class mcMMO extends JavaPlugin player.sendMessage(ChatColor.GOLD+"-=GATHERING SKILLS=-"); if(mcPermissions.getInstance().excavation(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillToString("excavation"), PPt.getSkillToString("excavationXP"), PPt.getXpToLevel("excavation"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION))); if(mcPermissions.getInstance().herbalism(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillToString("herbalism"), PPt.getSkillToString("herbalismXP"), PPt.getXpToLevel("herbalism"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM))); if(mcPermissions.getInstance().mining(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillToString("mining"), PPt.getSkillToString("miningXP"), PPt.getXpToLevel("mining"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING))); if(mcPermissions.getInstance().woodCuttingAbility(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillToString("woodcutting"), PPt.getSkillToString("woodcuttingXP"), PPt.getXpToLevel("woodcutting"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING))); player.sendMessage(ChatColor.GOLD+"-=COMBAT SKILLS=-"); if(mcPermissions.getInstance().axes(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillToString("axes"), PPt.getSkillToString("axesXP"), PPt.getXpToLevel("axes"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES))); if(mcPermissions.getInstance().archery(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillToString("archery"), PPt.getSkillToString("archeryXP"), PPt.getXpToLevel("archery"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY))); //if(mcPermissions.getInstance().sorcery(target)) - //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PPt.getSkillToString("sorcery"), PPt.getSkillToString("sorceryXP"), PPt.getXpToLevel("excavation"))); + //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PPt.getSkill("sorcery"), PPt.getSkill("sorceryXP"), PPt.getXpToLevel("excavation"))); if(mcPermissions.getInstance().swords(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillToString("swords"), PPt.getSkillToString("swordsXP"), PPt.getXpToLevel("swords"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS))); if(mcPermissions.getInstance().taming(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillToString("taming"), PPt.getSkillToString("tamingXP"), PPt.getXpToLevel("taming"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING))); if(mcPermissions.getInstance().unarmed(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillToString("unarmed"), PPt.getSkillToString("unarmedXP"), PPt.getXpToLevel("unarmed"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED))); player.sendMessage(ChatColor.GOLD+"-=MISC SKILLS=-"); if(mcPermissions.getInstance().acrobatics(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillToString("acrobatics"), PPt.getSkillToString("acrobaticsXP"), PPt.getXpToLevel("acrobatics"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS))); if(mcPermissions.getInstance().repair(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillToString("repair"), PPt.getSkillToString("repairXP"), PPt.getXpToLevel("repair"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR))); player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") +ChatColor.GREEN+(m.getPowerLevel(target))); @@ -1101,36 +1097,36 @@ public class mcMMO extends JavaPlugin if(Skills.hasGatheringSkills(player)){ player.sendMessage(header+"-=GATHERING SKILLS=-"); if(mcPermissions.getInstance().excavation(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillToString("excavation"), PP.getSkillToString("excavationXP"), PP.getXpToLevel("excavation"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION))); if(mcPermissions.getInstance().herbalism(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillToString("herbalism"), PP.getSkillToString("herbalismXP"), PP.getXpToLevel("herbalism"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM))); if(mcPermissions.getInstance().mining(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillToString("mining"), PP.getSkillToString("miningXP"), PP.getXpToLevel("mining"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING))); if(mcPermissions.getInstance().woodCuttingAbility(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillToString("woodcutting"), PP.getSkillToString("woodcuttingXP"), PP.getXpToLevel("woodcutting"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING))); } if(Skills.hasCombatSkills(player)){ player.sendMessage(header+"-=COMBAT SKILLS=-"); if(mcPermissions.getInstance().axes(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillToString("axes"), PP.getSkillToString("axesXP"), PP.getXpToLevel("axes"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES))); if(mcPermissions.getInstance().archery(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillToString("archery"), PP.getSkillToString("archeryXP"), PP.getXpToLevel("archery"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY))); //if(mcPermissions.getInstance().sorcery(player)) - //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PP.getSkillToString("sorcery"), PP.getSkillToString("sorceryXP"), PP.getXpToLevel("excavation"))); + //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PP.getSkill("sorcery"), PP.getSkill("sorceryXP"), PP.getXpToLevel("excavation"))); if(mcPermissions.getInstance().swords(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillToString("swords"), PP.getSkillToString("swordsXP"), PP.getXpToLevel("swords"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS))); if(mcPermissions.getInstance().taming(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillToString("taming"), PP.getSkillToString("tamingXP"), PP.getXpToLevel("taming"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING))); if(mcPermissions.getInstance().unarmed(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillToString("unarmed"), PP.getSkillToString("unarmedXP"), PP.getXpToLevel("unarmed"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED))); } if(Skills.hasMiscSkills(player)){ player.sendMessage(header+"-=MISC SKILLS=-"); if(mcPermissions.getInstance().acrobatics(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillToString("acrobatics"), PP.getSkillToString("acrobaticsXP"), PP.getXpToLevel("acrobatics"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS))); if(mcPermissions.getInstance().repair(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillToString("repair"), PP.getSkillToString("repairXP"), PP.getXpToLevel("repair"))); + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillXpLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR))); } player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel")+ChatColor.GREEN+(m.getPowerLevel(player))); } diff --git a/mcMMO/com/gmail/nossr50/skills/Acrobatics.java b/mcMMO/com/gmail/nossr50/skills/Acrobatics.java index 5154d4b20..cad714436 100644 --- a/mcMMO/com/gmail/nossr50/skills/Acrobatics.java +++ b/mcMMO/com/gmail/nossr50/skills/Acrobatics.java @@ -9,19 +9,26 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; public class Acrobatics { - public static void acrobaticsCheck(Player player, EntityDamageEvent event){ - if(player != null && mcPermissions.getInstance().acrobatics(player)){ + public static void acrobaticsCheck(Player player, EntityDamageEvent event) + { + if(player != null && mcPermissions.getInstance().acrobatics(player)) + { PlayerProfile PP = Users.getProfile(player); - int acrovar = PP.getSkill("acrobatics"); + int acrovar = PP.getSkillLevel(SkillType.ACROBATICS); + if(player.isSneaking()) acrovar = acrovar * 2; - if(Math.random() * 1000 <= acrovar && !event.isCancelled()){ + + if(Math.random() * 1000 <= acrovar && !event.isCancelled()) + { int threshold = 7; if(player.isSneaking()) threshold = 14; + int newDamage = event.getDamage() - threshold; if(newDamage < 0) newDamage = 0; @@ -30,8 +37,8 @@ public class Acrobatics { */ if(player.getHealth() - newDamage >= 1){ if(!event.isCancelled()) - PP.addAcrobaticsXP((event.getDamage() * 8) * LoadProperties.xpGainMultiplier); - Skills.XpCheck(player); + PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 8) * LoadProperties.xpGainMultiplier); + Skills.XpCheckSkill(SkillType.ACROBATICS, player); event.setDamage(newDamage); if(event.getDamage() <= 0) event.setCancelled(true); @@ -43,8 +50,8 @@ public class Acrobatics { } } else if (!event.isCancelled()){ if(player.getHealth() - event.getDamage() >= 1){ - PP.addAcrobaticsXP((event.getDamage() * 12) * LoadProperties.xpGainMultiplier); - Skills.XpCheck(player); + PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 12) * LoadProperties.xpGainMultiplier); + Skills.XpCheckSkill(SkillType.ACROBATICS, player); } } } @@ -54,12 +61,12 @@ public class Acrobatics { PlayerProfile PPd = Users.getProfile(defender); if(mcPermissions.getInstance().acrobatics(defender)){ - if(PPd.getSkill("acrobatics") <= 800){ - if(Math.random() * 4000 <= PPd.getSkill("acrobatics")){ + if(PPd.getSkillLevel(SkillType.ACROBATICS) <= 800){ + if(Math.random() * 4000 <= PPd.getSkillLevel(SkillType.ACROBATICS)){ defender.sendMessage(ChatColor.GREEN+"**DODGE**"); if(System.currentTimeMillis() >= 5000 + PPd.getRespawnATS() && defender.getHealth() >= 1){ - PPd.addAcrobaticsXP(event.getDamage() * 12); - Skills.XpCheck(defender); + PPd.addXP(SkillType.ACROBATICS, event.getDamage() * 12); + Skills.XpCheckSkill(SkillType.ACROBATICS, defender); } event.setDamage(event.getDamage() / 2); //Needs to do minimal damage @@ -69,8 +76,8 @@ public class Acrobatics { } else if(Math.random() * 4000 <= 800) { defender.sendMessage(ChatColor.GREEN+"**DODGE**"); if(System.currentTimeMillis() >= 5000 + PPd.getRespawnATS() && defender.getHealth() >= 1){ - PPd.addAcrobaticsXP(event.getDamage() * 12); - Skills.XpCheck(defender); + PPd.addXP(SkillType.ACROBATICS, event.getDamage() * 12); + Skills.XpCheckSkill(SkillType.ACROBATICS, defender); } event.setDamage(event.getDamage() / 2); //Needs to deal minimal damage diff --git a/mcMMO/com/gmail/nossr50/skills/Archery.java b/mcMMO/com/gmail/nossr50/skills/Archery.java index 6c56f7a30..e77a7291f 100644 --- a/mcMMO/com/gmail/nossr50/skills/Archery.java +++ b/mcMMO/com/gmail/nossr50/skills/Archery.java @@ -8,6 +8,7 @@ import org.bukkit.event.entity.EntityDamageByProjectileEvent; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; @@ -21,7 +22,7 @@ public class Archery pluginx.misc.arrowTracker.put(x, 0); if(attacker != null) { - if(Math.random() * 1000 <= PPa.getSkill("archery")) + if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)) { pluginx.misc.arrowTracker.put(x, 1); } @@ -32,7 +33,7 @@ public class Archery { if(attacker != null) { - if(Math.random() * 1000 <= PPa.getSkill("archery")) + if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)) { pluginx.misc.arrowTracker.put(x, 1); } @@ -47,15 +48,15 @@ public class Archery { int ignition = 20; - if(PPa.getSkill("archery") >= 200) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 200) ignition+=20; - if(PPa.getSkill("archery") >= 400) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 400) ignition+=20; - if(PPa.getSkill("archery") >= 600) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 600) ignition+=20; - if(PPa.getSkill("archery") >= 800) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 800) ignition+=20; - if(PPa.getSkill("archery") >= 1000) + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 1000) ignition+=20; if(x instanceof Player) @@ -84,13 +85,13 @@ public class Archery } else { loc.setPitch(-90); } - if(PPa.getSkill("archery") >= 1000){ + if(PPa.getSkillLevel(SkillType.ARCHERY) >= 1000){ if(Math.random() * 1000 <= 500){ defender.teleport(loc); defender.sendMessage(mcLocale.getString("Combat.TouchedFuzzy")); //$NON-NLS-1$ attacker.sendMessage(mcLocale.getString("Combat.TargetDazed")); //$NON-NLS-1$ //$NON-NLS-2$ } - } else if(Math.random() * 2000 <= PPa.getSkill("archery")){ + } else if(Math.random() * 2000 <= PPa.getSkillLevel(SkillType.ARCHERY)){ defender.teleport(loc); defender.sendMessage(mcLocale.getString("Combat.TouchedFuzzy")); //$NON-NLS-1$ attacker.sendMessage(mcLocale.getString("Combat.TargetDazed")); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/mcMMO/com/gmail/nossr50/skills/Axes.java b/mcMMO/com/gmail/nossr50/skills/Axes.java index ad8e9282d..5d451b841 100644 --- a/mcMMO/com/gmail/nossr50/skills/Axes.java +++ b/mcMMO/com/gmail/nossr50/skills/Axes.java @@ -14,6 +14,7 @@ import com.gmail.nossr50.m; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.party.Party; public class Axes { @@ -28,7 +29,7 @@ public class Axes { PP.setAxePreparationMode(false); } int ticks = 2; - int x = PP.getSkill("axes"); + int x = PP.getSkillLevel(SkillType.AXES); while(x >= 50){ x-=50; ticks++; @@ -64,7 +65,7 @@ public class Axes { } PlayerProfile PPa = Users.getProfile(attacker); if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ - if(PPa.getSkill("axes") >= 750){ + if(PPa.getSkillLevel(SkillType.AXES) >= 750){ if(Math.random() * 1000 <= 750){ if(x instanceof Player){ Player player = (Player)x; @@ -77,7 +78,7 @@ public class Axes { } attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } - } else if(Math.random() * 1000 <= PPa.getSkill("axes")){ + } else if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.AXES)){ if(x instanceof Player){ Player player = (Player)x; player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); @@ -123,6 +124,9 @@ public class Axes { { Player target = (Player)derp; + if(Users.getProfile(target).getGodMode()) + continue; + if(target.getName().equals(attacker.getName())) continue; diff --git a/mcMMO/com/gmail/nossr50/skills/Excavation.java b/mcMMO/com/gmail/nossr50/skills/Excavation.java index b351c5aa0..471a03762 100644 --- a/mcMMO/com/gmail/nossr50/skills/Excavation.java +++ b/mcMMO/com/gmail/nossr50/skills/Excavation.java @@ -12,29 +12,38 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; -public class Excavation { - public static void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx){ +public class Excavation +{ + public static void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx) + { PlayerProfile PP = Users.getProfile(player); - if(m.isShovel(player.getItemInHand())){ - if(block != null){ + if(m.isShovel(player.getItemInHand())) + { + if(block != null) + { if(!m.abilityBlockCheck(block)) return; } - if(PP.getShovelPreparationMode()){ + if(PP.getShovelPreparationMode()) + { PP.setShovelPreparationMode(false); } int ticks = 2; - int x = PP.getSkill("excavation"); - while(x >= 50){ + int x = PP.getSkillLevel(SkillType.EXCAVATION); + while(x >= 50) + { x-=50; ticks++; } - if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerDeactivatedTimeStamp() < System.currentTimeMillis()){ + if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerDeactivatedTimeStamp() < System.currentTimeMillis()) + { player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOn")); - for(Player y : pluginx.getServer().getOnlinePlayers()){ + for(Player y : pluginx.getServer().getOnlinePlayers()) + { if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) y.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerPlayer", new Object[] {player.getName()})); } @@ -45,7 +54,8 @@ public class Excavation { } } - public static boolean canBeGigaDrillBroken(Block block){ + public static boolean canBeGigaDrillBroken(Block block) + { int i = block.getTypeId(); if(i == 2||i == 3||i == 12||i == 13){ return true; @@ -53,7 +63,8 @@ public class Excavation { return false; } } - public static void excavationProcCheck(Block block, Player player){ + public static void excavationProcCheck(Block block, Player player) + { PlayerProfile PP = Users.getProfile(player); int type = block.getTypeId(); Location loc = block.getLocation(); @@ -62,19 +73,22 @@ public class Excavation { if(block.getData() == (byte) 5){ return; } - if(type == 2){ - if(PP.getSkill("excavation") >= 250) + if(type == 2) + { + if(PP.getSkillLevel(SkillType.EXCAVATION) >= 250) { //CHANCE TO GET EGGS - if(LoadProperties.eggs == true && Math.random() * 100 > 99){ - PP.addExcavationXP(LoadProperties.meggs * LoadProperties.xpGainMultiplier); + if(LoadProperties.eggs == true && Math.random() * 100 > 99) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.meggs * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(344); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } //CHANCE TO GET APPLES - if(LoadProperties.apples == true && Math.random() * 100 > 99){ - PP.addExcavationXP(LoadProperties.mapple * LoadProperties.xpGainMultiplier); + if(LoadProperties.apples == true && Math.random() * 100 > 99) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mapple * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(260); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -82,40 +96,48 @@ public class Excavation { } } //DIRT SAND OR GRAVEL - if(type == 3 || type == 13 || type == 2 || type == 12){ - PP.addExcavationXP(LoadProperties.mbase * LoadProperties.xpGainMultiplier); - if(PP.getSkill("excavation") >= 750){ + if(type == 3 || type == 13 || type == 2 || type == 12) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mbase * LoadProperties.xpGainMultiplier); + if(PP.getSkillLevel(SkillType.EXCAVATION) >= 750){ //CHANCE TO GET CAKE - if(LoadProperties.cake == true && Math.random() * 2000 > 1999){ - PP.addExcavationXP(LoadProperties.mcake * LoadProperties.xpGainMultiplier); + if(LoadProperties.cake == true && Math.random() * 2000 > 1999) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mcake * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(354); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } - if(PP.getSkill("excavation") >= 350){ + if(PP.getSkillLevel(SkillType.EXCAVATION) >= 350) + { //CHANCE TO GET DIAMOND - if(LoadProperties.diamond == true && Math.random() * 750 > 749){ - PP.addExcavationXP(LoadProperties.mdiamond2 * LoadProperties.xpGainMultiplier); + if(LoadProperties.diamond == true && Math.random() * 750 > 749) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mdiamond2 * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(264); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } - if(PP.getSkill("excavation") >= 250){ + if(PP.getSkillLevel(SkillType.EXCAVATION) >= 250) + { //CHANCE TO GET YELLOW MUSIC - if(LoadProperties.music == true && Math.random() * 2000 > 1999){ - PP.addExcavationXP(LoadProperties.mmusic * LoadProperties.xpGainMultiplier); + if(LoadProperties.music == true && Math.random() * 2000 > 1999) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mmusic * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(2256); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } - if(PP.getSkill("excavation") >= 350){ + if(PP.getSkillLevel(SkillType.EXCAVATION) >= 350) + { //CHANCE TO GET GREEN MUSIC - if(LoadProperties.music == true && Math.random() * 2000 > 1999){ - PP.addExcavationXP(LoadProperties.mmusic * LoadProperties.xpGainMultiplier); + if(LoadProperties.music == true && Math.random() * 2000 > 1999) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mmusic * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(2257); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -123,28 +145,34 @@ public class Excavation { } } //SAND - if(type == 12){ + if(type == 12) + { //CHANCE TO GET GLOWSTONE - if(LoadProperties.glowstone == true && PP.getSkill("excavation") >= 50 && Math.random() * 100 > 95){ - PP.addExcavationXP(LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier); + if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 50 && Math.random() * 100 > 95) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(348); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } //CHANCE TO GET SLOWSAND - if(LoadProperties.slowsand == true && PP.getSkill("excavation") >= 650 && Math.random() * 200 > 199){ - PP.addExcavationXP(LoadProperties.mslowsand * LoadProperties.xpGainMultiplier); + if(LoadProperties.slowsand == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 650 && Math.random() * 200 > 199) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mslowsand * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(88); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } //GRASS OR DIRT - if(type == 2 || type == 3){ - if(PP.getSkill("excavation") >= 50){ + if(type == 2 || type == 3) + { + if(PP.getSkillLevel(SkillType.EXCAVATION) >= 50) + { //CHANCE FOR COCOA BEANS - if(LoadProperties.cocoabeans == true && Math.random() * 75 > 74){ - PP.addExcavationXP(LoadProperties.mcocoa * LoadProperties.xpGainMultiplier); + if(LoadProperties.cocoabeans == true && Math.random() * 75 > 74) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mcocoa * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(351); is = new ItemStack(mat, 1, (byte)0, (byte)0); is.setDurability((byte) 3); //COCOA @@ -152,8 +180,9 @@ public class Excavation { } } //CHANCE FOR SHROOMS - if(LoadProperties.mushrooms == true && PP.getSkill("excavation") >= 500 && Math.random() * 200 > 199){ - PP.addExcavationXP(LoadProperties.mmushroom2 * LoadProperties.xpGainMultiplier); + if(LoadProperties.mushrooms == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 500 && Math.random() * 200 > 199) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mmushroom2 * LoadProperties.xpGainMultiplier); if(Math.random() * 10 > 5){ mat = Material.getMaterial(39); } else { @@ -163,41 +192,48 @@ public class Excavation { loc.getWorld().dropItemNaturally(loc, is); } //CHANCE TO GET GLOWSTONE - if(LoadProperties.glowstone == true && PP.getSkill("excavation") >= 25 && Math.random() * 100 > 95){ - PP.addExcavationXP(LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier); + if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 25 && Math.random() * 100 > 95) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(348); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } //GRAVEL - if(type == 13){ + if(type == 13) + { //CHANCE TO GET NETHERRACK - if(LoadProperties.netherrack == true && PP.getSkill("excavation") >= 850 && Math.random() * 200 > 199){ - PP.addExcavationXP(LoadProperties.mnetherrack * LoadProperties.xpGainMultiplier); + if(LoadProperties.netherrack == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 850 && Math.random() * 200 > 199) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mnetherrack * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(87); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } //CHANCE TO GET SULPHUR - if(LoadProperties.sulphur == true && PP.getSkill("excavation") >= 75){ - if(Math.random() * 10 > 9){ - PP.addExcavationXP(LoadProperties.msulphur * LoadProperties.xpGainMultiplier); + if(LoadProperties.sulphur == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 75) + { + if(Math.random() * 10 > 9) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.msulphur * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(289); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } //CHANCE TO GET BONES - if(LoadProperties.bones == true && PP.getSkill("excavation") >= 175){ - if(Math.random() * 10 > 9){ - PP.addExcavationXP(LoadProperties.mbones * LoadProperties.xpGainMultiplier); + if(LoadProperties.bones == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 175) + { + if(Math.random() * 10 > 9) + { + PP.addXP(SkillType.EXCAVATION, LoadProperties.mbones * LoadProperties.xpGainMultiplier); mat = Material.getMaterial(352); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } } - Skills.XpCheck(player); + Skills.XpCheckSkill(SkillType.EXCAVATION, player); } } diff --git a/mcMMO/com/gmail/nossr50/skills/Herbalism.java b/mcMMO/com/gmail/nossr50/skills/Herbalism.java index 607c99c75..ae4437063 100644 --- a/mcMMO/com/gmail/nossr50/skills/Herbalism.java +++ b/mcMMO/com/gmail/nossr50/skills/Herbalism.java @@ -14,6 +14,7 @@ import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -28,7 +29,7 @@ public class Herbalism { Material mat = Material.getMaterial(296); Location loc = block.getLocation(); ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0); - PP.addHerbalismXP(5 * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, 5 * LoadProperties.xpGainMultiplier); loc.getWorld().dropItemNaturally(loc, is); //DROP SOME SEEDS @@ -99,7 +100,7 @@ public class Herbalism { PP.setHoePreparationMode(false); } int ticks = 2; - int x = PP.getSkill("herbalism"); + int x = PP.getSkillLevel(SkillType.HERBALISM); while(x >= 50){ x-=50; ticks++; @@ -133,14 +134,14 @@ public class Herbalism { if(type == 59 && block.getData() == (byte) 0x7){ mat = Material.getMaterial(296); is = new ItemStack(mat, 1, (byte)0, (byte)0); - PP.addHerbalismXP(LoadProperties.mwheat * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat * LoadProperties.xpGainMultiplier); if(player != null){ - if(Math.random() * 1000 <= PP.getSkill("herbalism")){ + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){ loc.getWorld().dropItemNaturally(loc, is); } } //GREEN THUMB - if(Math.random() * 1500 <= PP.getSkill("herbalism")){ + if(Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)){ event.setCancelled(true); loc.getWorld().dropItemNaturally(loc, is); //DROP SOME SEEDS @@ -152,11 +153,11 @@ public class Herbalism { //Setup the bonuses int bonus = 0; - if(PP.getSkill("herbalism") >= 200) + if(PP.getSkillLevel(SkillType.HERBALISM) >= 200) bonus++; - if(PP.getSkill("herbalism") >= 400) + if(PP.getSkillLevel(SkillType.HERBALISM) >= 400) bonus++; - if(PP.getSkill("herbalism") >= 600) + if(PP.getSkillLevel(SkillType.HERBALISM) >= 600) bonus++; //Change wheat to be whatever stage based on the bonus @@ -199,11 +200,11 @@ public class Herbalism { is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0); if(byteArray[x] != (byte) 5) { - if(Math.random() * 1000 <= PP.getSkill("herbalism")) + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) { loc.getWorld().dropItemNaturally(target.getLocation(), is); } - PP.addHerbalismXP(LoadProperties.mcactus * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mcactus * LoadProperties.xpGainMultiplier); } } x++; @@ -237,11 +238,11 @@ public class Herbalism { //Check for being placed by the player if(byteArray[x] != (byte) 5) { - if(Math.random() * 1000 <= PP.getSkill("herbalism")) + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) { loc.getWorld().dropItemNaturally(target.getLocation(), is); } - PP.addHerbalismXP(LoadProperties.msugar * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.msugar * LoadProperties.xpGainMultiplier); } } x++; @@ -254,40 +255,40 @@ public class Herbalism { mat = Material.getMaterial(block.getTypeId()); is = new ItemStack(mat, 1, (byte)0, (byte)0); if(player != null){ - if(Math.random() * 1000 <= PP.getSkill("herbalism")){ + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){ loc.getWorld().dropItemNaturally(loc, is); } } - PP.addHerbalismXP(LoadProperties.mpumpkin * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin * LoadProperties.xpGainMultiplier); } //Mushroom if(type == 39 || type == 40){ mat = Material.getMaterial(block.getTypeId()); is = new ItemStack(mat, 1, (byte)0, (byte)0); if(player != null){ - if(Math.random() * 1000 <= PP.getSkill("herbalism")){ + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){ loc.getWorld().dropItemNaturally(loc, is); } } - PP.addHerbalismXP(LoadProperties.mmushroom * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mmushroom * LoadProperties.xpGainMultiplier); } //Flower if(type == 37 || type == 38){ mat = Material.getMaterial(block.getTypeId()); is = new ItemStack(mat, 1, (byte)0, (byte)0); if(player != null){ - if(Math.random() * 1000 <= PP.getSkill("herbalism")){ + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){ loc.getWorld().dropItemNaturally(loc, is); } } - PP.addHerbalismXP(LoadProperties.mflower * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mflower * LoadProperties.xpGainMultiplier); } } - Skills.XpCheck(player); + Skills.XpCheckSkill(SkillType.HERBALISM, player); } public static void breadCheck(Player player, ItemStack is){ PlayerProfile PP = Users.getProfile(player); - int herbalism = PP.getSkill("herbalism"); + int herbalism = PP.getSkillLevel(SkillType.HERBALISM); if(is != null && PP != null) { if(is.getTypeId() == 297) @@ -314,7 +315,7 @@ public class Herbalism { } public static void stewCheck(Player player, ItemStack is){ PlayerProfile PP = Users.getProfile(player); - int herbalism = PP.getSkill("herbalism"); + int herbalism = PP.getSkillLevel(SkillType.HERBALISM); if(is.getTypeId() == 282){ if(herbalism >= 50 && herbalism < 150){ player.setHealth(player.getHealth() + 1); diff --git a/mcMMO/com/gmail/nossr50/skills/Mining.java b/mcMMO/com/gmail/nossr50/skills/Mining.java index 5c185505b..bf2bb46bc 100644 --- a/mcMMO/com/gmail/nossr50/skills/Mining.java +++ b/mcMMO/com/gmail/nossr50/skills/Mining.java @@ -13,6 +13,7 @@ import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -30,7 +31,7 @@ public class Mining { PP.setPickaxePreparationMode(false); } int ticks = 2; - int x = PP.getSkill("mining"); + int x = PP.getSkillLevel(SkillType.MINING); while(x >= 50) { x-=50; @@ -102,7 +103,7 @@ public class Mining { { PlayerProfile PP = Users.getProfile(player); if(player != null){ - if(Math.random() * 1000 <= PP.getSkill("mining")){ + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)){ blockProcSimulate(block); return; } @@ -163,8 +164,8 @@ public class Mining { xp += LoadProperties.mlapus; blockProcCheck(block, player); } - PP.addMiningXP(xp * LoadProperties.xpGainMultiplier); - Skills.XpCheck(player); + PP.addXP(SkillType.MINING, xp * LoadProperties.xpGainMultiplier); + Skills.XpCheckSkill(SkillType.MINING, player); } /* * Handling SuperBreaker stuff @@ -349,7 +350,7 @@ public class Mining { block.setType(Material.AIR); } if(block.getData() != (byte) 5) - PP.addMiningXP(xp * LoadProperties.xpGainMultiplier); - Skills.XpCheck(player); + PP.addXP(SkillType.MINING, xp * LoadProperties.xpGainMultiplier); + Skills.XpCheckSkill(SkillType.MINING, player); } } diff --git a/mcMMO/com/gmail/nossr50/skills/Repair.java b/mcMMO/com/gmail/nossr50/skills/Repair.java index 51101b528..5d04c2bc0 100644 --- a/mcMMO/com/gmail/nossr50/skills/Repair.java +++ b/mcMMO/com/gmail/nossr50/skills/Repair.java @@ -10,6 +10,7 @@ import com.gmail.nossr50.m; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -45,14 +46,14 @@ public class Repair { /* * DIAMOND ARMOR */ - if(isDiamondArmor(is) && hasItem(player, rDiamond) && PP.getSkill("repair") >= LoadProperties.repairdiamondlevel){ + if(isDiamondArmor(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){ removeItem(player, rDiamond); player.getItemInHand().setDurability(getRepairAmount(is, player)); durabilityAfter = player.getItemInHand().getDurability(); player.sendMessage(String.valueOf(durabilityBefore - durabilityAfter)); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 6); //Boost XP - PP.addRepairXP(dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); } else if (isIronArmor(is) && hasItem(player, rIron)){ /* @@ -63,7 +64,7 @@ public class Repair { durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 2); //Boost XP - PP.addRepairXP(dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); //GOLD ARMOR } else if (isGoldArmor(is) && hasItem(player, rGold)){ removeItem(player, rGold); @@ -71,7 +72,7 @@ public class Repair { durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 4); //Boost XP of Gold to around Iron - PP.addRepairXP(dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); } else { needMoreVespeneGas(is, player); } @@ -97,7 +98,7 @@ public class Repair { //STONE NERF dif = (short) (dif / 2); - PP.addRepairXP(dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); } else if(isWoodTools(is) && hasItem(player,rWood)){ removeItem(player,rWood); /* @@ -115,7 +116,7 @@ public class Repair { //WOOD NERF dif = (short) (dif / 2); - PP.addRepairXP(dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); } else if(isIronTools(is) && hasItem(player, rIron)){ removeItem(player, rIron); /* @@ -130,8 +131,8 @@ public class Repair { dif = (short) (dif / 2); if(m.isHoe(is)) dif = (short) (dif / 2); - PP.addRepairXP(dif * LoadProperties.xpGainMultiplier); - } else if (isDiamondTools(is) && hasItem(player, rDiamond) && PP.getSkill("repair") >= LoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds + PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); + } else if (isDiamondTools(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds /* * DIAMOND TOOLS */ @@ -145,7 +146,7 @@ public class Repair { dif = (short) (dif / 2); if(m.isHoe(is)) dif = (short) (dif / 2); - PP.addRepairXP(dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); } else if(isGoldTools(is) && hasItem(player, rGold)){ player.getItemInHand().setDurability(getRepairAmount(is, player)); removeItem(player, rGold); @@ -158,7 +159,7 @@ public class Repair { dif = (short) (dif / 2); if(m.isHoe(is)) dif = (short) (dif / 2); - PP.addRepairXP(dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); } else { needMoreVespeneGas(is, player); } @@ -171,7 +172,7 @@ public class Repair { /* * GIVE SKILL IF THERE IS ENOUGH XP */ - Skills.XpCheck(player); + Skills.XpCheckSkill(SkillType.REPAIR, player); } } public static boolean isArmor(ItemStack is){ @@ -284,7 +285,7 @@ public class Repair { } public static short repairCalculate(Player player, short durability, short ramt){ PlayerProfile PP = Users.getProfile(player); - float bonus = (PP.getSkill("repair") / 500); + float bonus = (PP.getSkillLevel(SkillType.REPAIR) / 500); bonus = (ramt * bonus); ramt = ramt+=bonus; if(checkPlayerProcRepair(player)){ @@ -448,9 +449,11 @@ public class Repair { } return repairCalculate(player, durability, ramt); } - public static void needMoreVespeneGas(ItemStack is, Player player){ + public static void needMoreVespeneGas(ItemStack is, Player player) + { PlayerProfile PP = Users.getProfile(player); - if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getSkill("repair") < LoadProperties.repairdiamondlevel){ + if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getSkillLevel(SkillType.REPAIR) < LoadProperties.repairdiamondlevel) + { player.sendMessage(mcLocale.getString("AdeptDiamond")); } else if (isDiamondTools(is) && !hasItem(player, rDiamond) || isIronTools(is) && !hasItem(player, rIron) || isGoldTools(is) && !hasItem(player, rGold)){ if(isDiamondTools(is) && !hasItem(player, rDiamond)) @@ -472,10 +475,13 @@ public class Repair { } else if (is.getAmount() > 1) player.sendMessage(mcLocale.getString("Skills.StackedItems")); } - public static boolean checkPlayerProcRepair(Player player){ + public static boolean checkPlayerProcRepair(Player player) + { PlayerProfile PP = Users.getProfile(player); - if(player != null){ - if(Math.random() * 1000 <= PP.getSkill("repair")){ + if(player != null) + { + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.REPAIR)) + { player.sendMessage(mcLocale.getString("Skills.FeltEasy")); return true; } diff --git a/mcMMO/com/gmail/nossr50/skills/Skills.java b/mcMMO/com/gmail/nossr50/skills/Skills.java index f2ce8797e..4100f6583 100644 --- a/mcMMO/com/gmail/nossr50/skills/Skills.java +++ b/mcMMO/com/gmail/nossr50/skills/Skills.java @@ -14,6 +14,7 @@ import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerStat; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -269,266 +270,62 @@ public class Skills { } } } - public static void XpCheck(Player player){ - PlayerProfile PP = Users.getProfile(player); - /* - * TAMING - */ - if(player != null){ - if(PP.getSkill("tamingXP") >= PP.getXpToLevel("taming")){ - int skillups = 0; - while(PP.getSkill("tamingXP") >= PP.getXpToLevel("taming")){ - skillups++; - PP.removeTamingXP(PP.getXpToLevel("taming")); - PP.skillUpTaming(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - if(!LoadProperties.useMySQL){ - ps.statVal = PP.getSkill("taming"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "taming"); - } - if(player != null && PP != null && PP.getSkillToString("taming") != null) - player.sendMessage(mcLocale.getString("Skills.TamingUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("taming")})); - } - /* - * ACROBATICS - */ - if(PP.getSkill("acrobaticsXP") >= PP.getXpToLevel("acrobatics")){ - int skillups = 0; - while(PP.getSkill("acrobaticsXP") >= PP.getXpToLevel("acrobatics")){ - skillups++; - PP.removeAcrobaticsXP(PP.getXpToLevel("acrobatics")); - PP.skillUpAcrobatics(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("acrobatics"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "acrobatics"); - } - - if(player != null && PP != null && PP.getSkillToString("acrobatics") != null) - player.sendMessage(mcLocale.getString("Skills.AcrobaticsUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("acrobatics")})); - } - /* - * ARCHERY - */ - if(PP.getSkill("archeryXP") >= PP.getXpToLevel("archery")){ - int skillups = 0; - while(PP.getSkill("archeryXP") >= PP.getXpToLevel("archery")){ - skillups++; - PP.removeArcheryXP(PP.getXpToLevel("archery")); - PP.skillUpArchery(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("archery"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "archery"); - } - if(player != null && PP != null && PP.getSkillToString("archery") != null) - player.sendMessage(mcLocale.getString("Skills.ArcheryUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("archery")})); - } - /* - * SWORDS - */ - if(PP.getSkill("swordsXP") >= PP.getXpToLevel("swords")){ - int skillups = 0; - while(PP.getSkill("swordsXP") >= PP.getXpToLevel("swords")){ - skillups++; - PP.removeSwordsXP(PP.getXpToLevel("swords")); - PP.skillUpSwords(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("swords"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "swords"); - } - - if(player != null && PP != null && PP.getSkillToString("swords") != null) - player.sendMessage(mcLocale.getString("Skills.SwordsUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("swords")})); - } - /* - * AXES - */ - if(PP.getSkill("axesXP") >= PP.getXpToLevel("axes")){ - int skillups = 0; - while(PP.getSkill("axesXP") >= PP.getXpToLevel("axes")){ - skillups++; - PP.removeAxesXP(PP.getXpToLevel("axes")); - PP.skillUpAxes(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("axes"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "axes"); - } - if(player != null && PP != null && PP.getSkillToString("axes") != null) - player.sendMessage(mcLocale.getString("Skills.AxesUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("axes")})); - } - /* - * UNARMED - */ - if(PP.getSkill("unarmedXP") >= PP.getXpToLevel("unarmed")){ - int skillups = 0; - while(PP.getSkill("unarmedXP") >= PP.getXpToLevel("unarmed")){ - skillups++; - PP.removeUnarmedXP(PP.getXpToLevel("unarmed")); - PP.skillUpUnarmed(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("unarmed"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "unarmed"); - } - if(player != null && PP != null && PP.getSkillToString("unarmed") != null) - player.sendMessage(mcLocale.getString("Skills.UnarmedUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("unarmed")})); - } - /* - * HERBALISM - */ - if(PP.getSkill("herbalismXP") >= PP.getXpToLevel("herbalism")){ - int skillups = 0; - while(PP.getSkill("herbalismXP") >= PP.getXpToLevel("herbalism")){ - skillups++; - PP.removeHerbalismXP(PP.getXpToLevel("herbalism")); - PP.skillUpHerbalism(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("herbalism"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "herbalism"); - } - if(player != null && PP != null && PP.getSkillToString("herbalism") != null) - player.sendMessage(mcLocale.getString("Skills.HerbalismUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("herbalism")})); - } - /* - * MINING - */ - if(player != null && PP.getSkill("miningXP") >= PP.getXpToLevel("mining")){ - int skillups = 0; - while(PP.getSkill("miningXP") >= PP.getXpToLevel("mining")){ - skillups++; - PP.removeMiningXP(PP.getXpToLevel("mining")); - PP.skillUpMining(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("mining"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "mining"); - } - if(player != null && PP != null && PP.getSkillToString("mining") != null) - player.sendMessage(mcLocale.getString("Skills.MiningUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("mining")})); - } - /* - * WOODCUTTING - */ - if(player != null && PP.getSkill("woodcuttingXP") >= PP.getXpToLevel("woodcutting")){ - int skillups = 0; - while(PP.getSkill("woodcuttingXP") >= PP.getXpToLevel("woodcutting")){ - skillups++; - PP.removeWoodCuttingXP(PP.getXpToLevel("woodcutting")); - PP.skillUpWoodCutting(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("woodcutting"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "woodcutting"); - } - if(player != null && PP != null && PP.getSkillToString("woodcutting") != null) - player.sendMessage(mcLocale.getString("Skills.WoodcuttingUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("woodcutting")})); - } - /* - * REPAIR - */ - if(PP.getSkill("repairXP") >= PP.getXpToLevel("repair")){ - int skillups = 0; - while(PP.getSkill("repairXP") >= PP.getXpToLevel("repair")){ - skillups++; - PP.removeRepairXP(PP.getXpToLevel("repair")); - PP.skillUpRepair(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("repair"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "repair"); - } - if(player != null && PP != null && PP.getSkillToString("repair") != null) - player.sendMessage(mcLocale.getString("Skills.RepairUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("repair")})); - } - /* - * EXCAVATION - */ - if(PP.getSkill("excavationXP") >= PP.getXpToLevel("excavation")){ - int skillups = 0; - while(PP.getSkill("excavationXP") >= PP.getXpToLevel("excavation")){ - skillups++; - PP.removeExcavationXP(PP.getXpToLevel("excavation")); - PP.skillUpExcavation(1); - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL){ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSkill("excavation"); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "excavation"); - } - if(player != null && PP != null && PP.getSkillToString("excavation") != null) - player.sendMessage(mcLocale.getString("Skills.ExcavationUp", new Object[] {String.valueOf(skillups), PP.getSkillToString("excavation")})); - //player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+String.valueOf(skillups)+"."+" Total ("+PP.getSkillToString("excavation")+")"); - - } - } - /* - * Leaderboard updating stuff - */ - if(!LoadProperties.useMySQL) + + public static void ProcessLeaderboardUpdate(SkillType skillType, Player player) + { + PlayerProfile PP = Users.getProfile(player); + + PlayerStat ps = new PlayerStat(); + ps.statVal = PP.getSkillLevel(skillType); + ps.name = player.getName(); + Leaderboard.updateLeaderboard(ps, skillType); + } + + public static void XpCheckSkill(SkillType skillType, Player player) + { + PlayerProfile PP = Users.getProfile(player); + + if(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { - PlayerStat ps = new PlayerStat(); - ps.statVal = m.getPowerLevel(player); - ps.name = player.getName(); - Leaderboard.updateLeaderboard(ps, "powerlevel"); + int skillups = 0; + + while(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) + { + skillups++; + PP.removeXP(skillType, PP.getXpToLevel(skillType)); + PP.skillUp(skillType, 1); + } + + if(!LoadProperties.useMySQL) + ProcessLeaderboardUpdate(skillType, player); + + String firstLetter = skillType.toString().substring(0,1); + String remainder = skillType.toString().substring(1); + String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); + + player.sendMessage(mcLocale.getString("Skills."+capitalized+"Up", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)})); + } + } + + public static void XpCheckAll(Player player) + { + for(SkillType x : SkillType.values()) + { + //Don't want to do anything with this one + if(x == SkillType.ALL) + continue; + + XpCheckSkill(x, player); + } + } + public static SkillType getSkillType(String skillName) + { + for(SkillType x : SkillType.values()) + { + if(x.toString().equals(skillName.toUpperCase())) + return x; } + return null; } public static boolean isSkill(String skillname){ skillname = skillname.toLowerCase(); @@ -588,7 +385,7 @@ public class Skills { } plugin.misc.arrowTracker.remove(entity); } - public static String getSkillStats(String skillname, String level, String XP, Integer XPToLevel) + public static String getSkillStats(String skillname, Integer level, Integer XP, Integer XPToLevel) { ChatColor parColor = ChatColor.DARK_AQUA; ChatColor xpColor = ChatColor.GRAY; diff --git a/mcMMO/com/gmail/nossr50/skills/Swords.java b/mcMMO/com/gmail/nossr50/skills/Swords.java index ba8fdef3f..67c373a54 100644 --- a/mcMMO/com/gmail/nossr50/skills/Swords.java +++ b/mcMMO/com/gmail/nossr50/skills/Swords.java @@ -16,6 +16,7 @@ import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; @@ -30,7 +31,7 @@ public class Swords PP.setSwordsPreparationMode(false); } int ticks = 2; - int x = PP.getSkill("swords"); + int x = PP.getSkillLevel(SkillType.SWORDS); while(x >= 50) { x-=50; @@ -69,7 +70,7 @@ public class Swords } } if(mcPermissions.getInstance().swords(attacker) && m.isSwords(attacker.getItemInHand())){ - if(PPa.getSkill("swords") >= 750) + if(PPa.getSkillLevel(SkillType.SWORDS) >= 750) { if(Math.random() * 1000 >= 750) { @@ -83,7 +84,7 @@ public class Swords attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**"); } } - else if (Math.random() * 1000 <= PPa.getSkill("swords")) + else if (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.SWORDS)) { if(!(x instanceof Player)) pluginx.misc.addToBleedQue(x); @@ -130,6 +131,9 @@ public class Swords if(target.getName().equals(attacker.getName())) continue; + if(Users.getProfile(target).getGodMode()) + continue; + if(Party.getInstance().inSameParty(attacker, target)) continue; if(targets >= 1 && derp.getWorld().getPVP()) @@ -162,7 +166,7 @@ public class Swords PlayerProfile PPd = Users.getProfile(defender); if(defender != null && m.isSwords(defender.getItemInHand()) && mcPermissions.getInstance().swords(defender)){ - if(PPd.getSkill("swords") >= 900) + if(PPd.getSkillLevel(SkillType.SWORDS) >= 900) { if(Math.random() * 3000 <= 900) { @@ -177,7 +181,7 @@ public class Swords } } else { - if(Math.random() * 3000 <= PPd.getSkill("swords")) + if(Math.random() * 3000 <= PPd.getSkillLevel(SkillType.SWORDS)) { event.setCancelled(true); defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*"); @@ -206,7 +210,7 @@ public class Swords PlayerProfile PPd = Users.getProfile(defender); if(m.isSwords(defender.getItemInHand()) && mcPermissions.getInstance().swords(defender)) { - if(PPd.getSkill("swords") >= 600) + if(PPd.getSkillLevel(SkillType.SWORDS) >= 600) { if(Math.random() * 2000 <= 600) { @@ -216,7 +220,7 @@ public class Swords ((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!"); } } - else if (Math.random() * 2000 <= PPd.getSkill("swords")) + else if (Math.random() * 2000 <= PPd.getSkillLevel(SkillType.SWORDS)) { Combat.dealDamage(f, event.getDamage() / 2); defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**"); diff --git a/mcMMO/com/gmail/nossr50/skills/Unarmed.java b/mcMMO/com/gmail/nossr50/skills/Unarmed.java index a96d9def9..98242b7e0 100644 --- a/mcMMO/com/gmail/nossr50/skills/Unarmed.java +++ b/mcMMO/com/gmail/nossr50/skills/Unarmed.java @@ -10,6 +10,7 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; public class Unarmed { @@ -20,7 +21,7 @@ public class Unarmed { PP.setFistsPreparationMode(false); } int ticks = 2; - int x = PP.getSkill("unarmed"); + int x = PP.getSkillLevel(SkillType.UNARMED); while(x >= 50){ x-=50; ticks++; @@ -42,9 +43,9 @@ public class Unarmed { { PlayerProfile PPa = Users.getProfile(attacker); int bonus = 0; - if (PPa.getSkill("unarmed") >= 250) + if (PPa.getSkillLevel(SkillType.UNARMED) >= 250) bonus+=2; - if (PPa.getSkill("unarmed") >= 500) + if (PPa.getSkillLevel(SkillType.UNARMED) >= 500) bonus+=2; event.setDamage(event.getDamage()+bonus); } @@ -53,7 +54,7 @@ public class Unarmed { PlayerProfile PP = Users.getProfile(attacker); if(attacker.getItemInHand().getTypeId() == 0) { - if(PP.getSkill("unarmed") >= 1000) + if(PP.getSkillLevel(SkillType.UNARMED) >= 1000) { if(Math.random() * 4000 <= 1000) { @@ -71,7 +72,7 @@ public class Unarmed { } } } else { - if(Math.random() * 4000 <= PP.getSkill("unarmed")){ + if(Math.random() * 4000 <= PP.getSkillLevel(SkillType.UNARMED)){ Location loc = defender.getLocation(); if(defender.getItemInHand() != null && defender.getItemInHand().getTypeId() != 0) { diff --git a/mcMMO/com/gmail/nossr50/skills/WoodCutting.java b/mcMMO/com/gmail/nossr50/skills/WoodCutting.java index 4845a30cb..33e8131ab 100644 --- a/mcMMO/com/gmail/nossr50/skills/WoodCutting.java +++ b/mcMMO/com/gmail/nossr50/skills/WoodCutting.java @@ -14,6 +14,7 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.config.*; @@ -27,7 +28,7 @@ public class WoodCutting { byte type = block.getData(); Material mat = Material.getMaterial(block.getTypeId()); if(player != null){ - if(Math.random() * 1000 <= PP.getSkill("woodcutting")){ + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)){ ItemStack item = new ItemStack(mat, 1, (short) 0, type); block.getWorld().dropItemNaturally(block.getLocation(), item); } @@ -51,7 +52,7 @@ public class WoodCutting { PP.setAxePreparationMode(false); } int ticks = 2; - int x = PP.getSkill("woodcutting"); + int x = PP.getSkillLevel(SkillType.WOODCUTTING); while(x >= 50){ x-=50; ticks++; @@ -76,9 +77,9 @@ public class WoodCutting { public static void treeFeller(Block block, Player player, mcMMO plugin){ PlayerProfile PP = Users.getProfile(player); int radius = 1; - if(PP.getSkill("woodcutting") >= 500) + if(PP.getSkillLevel(SkillType.WOODCUTTING) >= 500) radius++; - if(PP.getSkill("woodcutting") >= 950) + if(PP.getSkillLevel(SkillType.WOODCUTTING) >= 950) radius++; ArrayList blocklist = new ArrayList(); ArrayList toAdd = new ArrayList(); diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index f6e61c237..679c0813a 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,6 +1,6 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 1.0.36 +version: 1.0.37 commands: mcc: description: Lists mcMMO commands