From bc0c3c7a5705f48f8fd50115667be913d3980dfe Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 14 Apr 2011 20:48:54 -0700 Subject: [PATCH] 0.9.30 WIP --- mcMMO/Changelog.txt | 9 + mcMMO/com/gmail/nossr50/mcAcrobatics.java | 12 +- mcMMO/com/gmail/nossr50/mcBlockListener.java | 8 +- mcMMO/com/gmail/nossr50/mcCombat.java | 54 +- mcMMO/com/gmail/nossr50/mcEntityListener.java | 22 +- mcMMO/com/gmail/nossr50/mcExcavation.java | 30 +- mcMMO/com/gmail/nossr50/mcHerbalism.java | 14 +- mcMMO/com/gmail/nossr50/mcLoadProperties.java | 3 +- mcMMO/com/gmail/nossr50/mcMMO.java | 1 + mcMMO/com/gmail/nossr50/mcMining.java | 4 +- mcMMO/com/gmail/nossr50/mcPermissions.java | 7 + mcMMO/com/gmail/nossr50/mcPlayerListener.java | 58 +- mcMMO/com/gmail/nossr50/mcRepair.java | 12 +- mcMMO/com/gmail/nossr50/mcSkills.java | 76 +- mcMMO/com/gmail/nossr50/mcTaming.java | 47 + mcMMO/com/gmail/nossr50/mcUsers.java | 800 ++++++++++-------- mcMMO/com/gmail/nossr50/mcWoodCutting.java | 4 +- mcMMO/plugin.yml | 2 +- 18 files changed, 680 insertions(+), 483 deletions(-) create mode 100644 mcMMO/com/gmail/nossr50/mcTaming.java diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index b0a05c811..b1b50509b 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,14 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# +Version 0.9.29 +Fixes critical bug involving water turning anything into clay + +Version 0.9.28 +Green thumb can now spread grass to dirt using seeds +Adding XP will check for level ups again +Acrobatics won't hand out XP on death anymore +Acrobatics will check plugins for the event being cancelled before handing out XP + Version 0.9.27 Fixed Herbalism not properly receiving Triple Drops from Green Terra Fixed Herbalism not handing out any XP outside of Green Terra diff --git a/mcMMO/com/gmail/nossr50/mcAcrobatics.java b/mcMMO/com/gmail/nossr50/mcAcrobatics.java index e53f0e731..c2f04d211 100644 --- a/mcMMO/com/gmail/nossr50/mcAcrobatics.java +++ b/mcMMO/com/gmail/nossr50/mcAcrobatics.java @@ -22,7 +22,7 @@ public class mcAcrobatics { int acrovar = PP.getAcrobaticsInt(); if(player.isSneaking()) acrovar = acrovar * 2; - if(Math.random() * 1000 <= acrovar){ + if(Math.random() * 1000 <= acrovar && !event.isCancelled()){ int threshold = 7; if(player.isSneaking()) threshold = 14; @@ -34,7 +34,7 @@ public class mcAcrobatics { */ if(player.getHealth() - newDamage >= 1){ if(!event.isCancelled()) - PP.addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); + PP.addAcrobaticsXP((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(player); event.setDamage(newDamage); if(event.getDamage() <= 0) @@ -45,9 +45,11 @@ public class mcAcrobatics { player.sendMessage("**ROLL**"); } } - } else if (!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) && !event.isCancelled()){ - PP.addAcrobaticsGather((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier); - mcSkills.getInstance().XpCheck(player); + } else if (!event.isCancelled()){ + if(player.getHealth() - event.getDamage() >= 1){ + PP.addAcrobaticsXP((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier); + mcSkills.getInstance().XpCheck(player); + } } } } diff --git a/mcMMO/com/gmail/nossr50/mcBlockListener.java b/mcMMO/com/gmail/nossr50/mcBlockListener.java index 74536a52a..400bc66ad 100644 --- a/mcMMO/com/gmail/nossr50/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java @@ -88,13 +88,13 @@ public class mcBlockListener extends BlockListener { if(mcm.getInstance().isAxes(inhand)){ if(!mcConfig.getInstance().isBlockWatched(block)){ mcWoodCutting.getInstance().woodCuttingProcCheck(player, block); - PP.addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier); + PP.addWoodcuttingXP(7 * mcLoadProperties.xpGainMultiplier); } } } else { if(block.getData() != 5){ mcWoodCutting.getInstance().woodCuttingProcCheck(player, block); - PP.addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier); + PP.addWoodcuttingXP(7 * mcLoadProperties.xpGainMultiplier); } } mcSkills.getInstance().XpCheck(player); @@ -120,7 +120,7 @@ public class mcBlockListener extends BlockListener { //XP WOODCUTTING if(!mcConfig.getInstance().isBlockWatched(block)){ mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx); - PP.addWoodcuttingGather(7); + PP.addWoodcuttingXP(7); } } if(blockx.getTypeId() == 18){ @@ -265,7 +265,7 @@ public class mcBlockListener extends BlockListener { for (int cz = -radius; cz <= radius; cz++) { Block block = world.getBlockAt(ox + cx, oy + cy, oz + cz); //If block is block - if (isWater == true){ + if (isWater == true && block.getType() == Material.GRAVEL){ //Change block.setType(Material.CLAY); return; diff --git a/mcMMO/com/gmail/nossr50/mcCombat.java b/mcMMO/com/gmail/nossr50/mcCombat.java index b5b9bcfc1..afe635353 100644 --- a/mcMMO/com/gmail/nossr50/mcCombat.java +++ b/mcMMO/com/gmail/nossr50/mcCombat.java @@ -93,11 +93,11 @@ public class mcCombat { if(PPd.inParty() && PPa.inParty() && mcParty.getInstance().inSameParty(attacker, defender)) return; if(mcm.getInstance().isAxes(attacker.getItemInHand())) - PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); + PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); if(mcm.getInstance().isSwords(attacker.getItemInHand())) - PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); + PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); if(attacker.getItemInHand().getTypeId() == 0) - PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); + PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); } /* * CHECK FOR LEVEL UPS @@ -113,13 +113,13 @@ public class mcCombat { } Squid defender = (Squid)event.getEntity(); if(mcm.getInstance().isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){ - PPa.addSwordsGather(10 * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsXP(10 * mcLoadProperties.xpGainMultiplier); } mcSkills.getInstance().XpCheck(attacker); if(mcm.getInstance().isAxes(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().axes(attacker)){ - PPa.addAxesGather(10 * mcLoadProperties.xpGainMultiplier); + PPa.addAxesXP(10 * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(attacker); } if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ @@ -144,7 +144,7 @@ public class mcCombat { //XP if(defender.getHealth() != 0){ - PPa.addUnarmedGather(10 * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedXP(10 * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(attacker); } } @@ -191,15 +191,15 @@ public class mcCombat { && mcPermissions.getInstance().swords(attacker)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(x instanceof Creeper) - PPa.addSwordsGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsXP((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); if(x instanceof Spider) - PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - PPa.addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof Zombie) - PPa.addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); } mcSkills.getInstance().XpCheck(attacker); } @@ -208,15 +208,15 @@ public class mcCombat { && mcPermissions.getInstance().axes(attacker)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(x instanceof Creeper) - PPa.addAxesGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesXP((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); if(x instanceof Spider) - PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - PPa.addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof Zombie) - PPa.addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); } mcSkills.getInstance().XpCheck(attacker); } @@ -243,15 +243,15 @@ public class mcCombat { //XP if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(x instanceof Creeper) - PPa.addUnarmedGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedXP((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); if(x instanceof Spider) - PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - PPa.addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof Zombie) - PPa.addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); } mcSkills.getInstance().XpCheck(attacker); } @@ -351,15 +351,15 @@ public class mcCombat { //XP if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(x instanceof Creeper) - PPa.addArcheryGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryXP((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); if(x instanceof Spider) - PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - PPa.addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof Zombie) - PPa.addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); } } /* @@ -415,7 +415,7 @@ public class mcCombat { * PVP XP */ if(mcLoadProperties.pvpxp && !mcParty.getInstance().inSameParty(attacker, defender)){ - PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); + PPa.addArcheryXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); } /* * DAZE PROC diff --git a/mcMMO/com/gmail/nossr50/mcEntityListener.java b/mcMMO/com/gmail/nossr50/mcEntityListener.java index ce6cc0579..b423c2628 100644 --- a/mcMMO/com/gmail/nossr50/mcEntityListener.java +++ b/mcMMO/com/gmail/nossr50/mcEntityListener.java @@ -8,6 +8,7 @@ import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; +import org.bukkit.entity.Wolf; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent; @@ -70,9 +71,9 @@ public class mcEntityListener extends EntityListener { * Entity Damage by Entity checks */ if(event instanceof EntityDamageByEntityEvent && event.getDamage() >= 1){ - if(event.isCancelled()){ + if(event.isCancelled()) return; - } + EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event; Entity e = eventb.getEntity(); //Defender Entity f = eventb.getDamager(); //Attacker @@ -209,7 +210,7 @@ public class mcEntityListener extends EntityListener { if(PPd.getAcrobaticsInt() <= 800){ if(Math.random() * 4000 <= PPd.getAcrobaticsInt()){ defender.sendMessage(ChatColor.GREEN+"**DODGE**"); - PPd.addAcrobaticsGather(event.getDamage() * 12); + PPd.addAcrobaticsXP(event.getDamage() * 12); mcSkills.getInstance().XpCheck(defender); event.setDamage(event.getDamage() / 2); //Needs to do minimal damage @@ -218,7 +219,7 @@ public class mcEntityListener extends EntityListener { } } else if(Math.random() * 4000 <= 800) { defender.sendMessage(ChatColor.GREEN+"**DODGE**"); - PPd.addAcrobaticsGather(event.getDamage() * 12); + PPd.addAcrobaticsXP(event.getDamage() * 12); mcSkills.getInstance().XpCheck(defender); event.setDamage(event.getDamage() / 2); //Needs to do minimal damage @@ -227,8 +228,21 @@ public class mcEntityListener extends EntityListener { } } } + /* + * TAMING STUFF + */ + if(f instanceof Wolf){ + Wolf theWolf = (Wolf)f; + if(mcTaming.getInstance().hasOwner(theWolf, plugin)){ + Player wolfMaster = mcTaming.getInstance().getOwner(theWolf, plugin); + if(!event.isCancelled()){ + mcUsers.getProfile(wolfMaster.getName()).addXpToSkill(event.getDamage(), "Taming"); + } + } + } } + /* * Check to see if the defender took damage so we can apply recently hurt */ diff --git a/mcMMO/com/gmail/nossr50/mcExcavation.java b/mcMMO/com/gmail/nossr50/mcExcavation.java index e3f56705f..bc80c62eb 100644 --- a/mcMMO/com/gmail/nossr50/mcExcavation.java +++ b/mcMMO/com/gmail/nossr50/mcExcavation.java @@ -74,14 +74,14 @@ public class mcExcavation { if(PP.getExcavationInt() > 250){ //CHANCE TO GET EGGS if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){ - PP.addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(10 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(344); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } //CHANCE TO GET APPLES if(mcLoadProperties.apples == true && Math.random() * 100 > 99){ - PP.addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(10 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(260); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -90,11 +90,11 @@ public class mcExcavation { } //DIRT SAND OR GRAVEL if(type == 3 || type == 13 || type == 2 || type == 12){ - PP.addExcavationGather(4 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(4 * mcLoadProperties.xpGainMultiplier); if(PP.getExcavationInt() > 750){ //CHANCE TO GET CAKE if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){ - PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(300 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(354); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -103,7 +103,7 @@ public class mcExcavation { if(PP.getExcavationInt() > 350){ //CHANCE TO GET DIAMOND if(mcLoadProperties.diamond == true && Math.random() * 750 > 749){ - PP.addExcavationGather(100 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(100 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(264); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -112,7 +112,7 @@ public class mcExcavation { if(PP.getExcavationInt() > 250){ //CHANCE TO GET YELLOW MUSIC if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){ - PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(300 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(2256); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -122,7 +122,7 @@ public class mcExcavation { if(PP.getExcavationInt() > 350){ //CHANCE TO GET GREEN MUSIC if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){ - PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(300 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(2257); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -133,14 +133,14 @@ public class mcExcavation { if(type == 12){ //CHANCE TO GET GLOWSTONE if(mcLoadProperties.glowstone == true && PP.getExcavationInt() > 50 && Math.random() * 100 > 95){ - PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(8 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(348); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } //CHANCE TO GET SLOWSAND if(mcLoadProperties.slowsand == true && PP.getExcavationInt() > 650 && Math.random() * 200 > 199){ - PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(8 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(88); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -151,7 +151,7 @@ public class mcExcavation { if(PP.getExcavationInt() > 50){ //CHANCE FOR COCOA BEANS if(mcLoadProperties.eggs == true && Math.random() * 75 > 74){ - PP.addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(10 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(351); is = new ItemStack(mat, 1, (byte)0, (byte)0); is.setDurability((byte) 3); //COCOA @@ -160,7 +160,7 @@ public class mcExcavation { } //CHANCE FOR SHROOMS if(mcLoadProperties.mushrooms == true && PP.getExcavationInt() > 500 && Math.random() * 200 > 199){ - PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(8 * mcLoadProperties.xpGainMultiplier); if(Math.random() * 10 > 5){ mat = Material.getMaterial(39); } else { @@ -171,7 +171,7 @@ public class mcExcavation { } //CHANCE TO GET GLOWSTONE if(mcLoadProperties.glowstone == true && PP.getExcavationInt() > 25 && Math.random() * 100 > 95){ - PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(8 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(348); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -181,7 +181,7 @@ public class mcExcavation { if(type == 13){ //CHANCE TO GET NETHERRACK if(mcLoadProperties.netherrack == true && PP.getExcavationInt() > 850 && Math.random() * 200 > 199){ - PP.addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(3 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(87); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -189,7 +189,7 @@ public class mcExcavation { //CHANCE TO GET SULPHUR if(mcLoadProperties.sulphur == true && PP.getExcavationInt() > 75){ if(Math.random() * 10 > 9){ - PP.addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(3 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(289); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -198,7 +198,7 @@ public class mcExcavation { //CHANCE TO GET BONES if(mcLoadProperties.bones == true && PP.getExcavationInt() > 175){ if(Math.random() * 10 > 9){ - PP.addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationXP(3 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(352); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); diff --git a/mcMMO/com/gmail/nossr50/mcHerbalism.java b/mcMMO/com/gmail/nossr50/mcHerbalism.java index 141a27fae..a74bd60cc 100644 --- a/mcMMO/com/gmail/nossr50/mcHerbalism.java +++ b/mcMMO/com/gmail/nossr50/mcHerbalism.java @@ -32,7 +32,7 @@ public class mcHerbalism { Material mat = Material.getMaterial(296); Location loc = block.getLocation(); ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0); - PP.addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismXP(5 * mcLoadProperties.xpGainMultiplier); loc.getWorld().dropItemNaturally(loc, is); herbalismProcCheck(block, player, event); herbalismProcCheck(block, player, event); @@ -128,7 +128,7 @@ public class mcHerbalism { if(type == 59 && block.getData() == (byte) 0x7){ mat = Material.getMaterial(296); is = new ItemStack(mat, 1, (byte)0, (byte)0); - PP.addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismXP(5 * mcLoadProperties.xpGainMultiplier); if(player != null){ if(Math.random() * 1000 <= PP.getHerbalismInt()){ loc.getWorld().dropItemNaturally(loc, is); @@ -172,7 +172,7 @@ public class mcHerbalism { loc.getWorld().dropItemNaturally(loc, is); } } - PP.addHerbalismGather(3 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismXP(3 * mcLoadProperties.xpGainMultiplier); } //Sugar Canes if(type == 83){ @@ -182,7 +182,7 @@ public class mcHerbalism { loc.getWorld().dropItemNaturally(loc, is); } } - PP.addHerbalismGather(3 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismXP(3 * mcLoadProperties.xpGainMultiplier); } //Pumpkins if(type == 91 || type == 86){ @@ -193,7 +193,7 @@ public class mcHerbalism { loc.getWorld().dropItemNaturally(loc, is); } } - PP.addHerbalismGather(55 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismXP(55 * mcLoadProperties.xpGainMultiplier); } //Mushroom if(type == 39 || type == 40){ @@ -204,7 +204,7 @@ public class mcHerbalism { loc.getWorld().dropItemNaturally(loc, is); } } - PP.addHerbalismGather(40 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismXP(40 * mcLoadProperties.xpGainMultiplier); } //Flower if(type == 37 || type == 38){ @@ -215,7 +215,7 @@ public class mcHerbalism { loc.getWorld().dropItemNaturally(loc, is); } } - PP.addHerbalismGather(10 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismXP(10 * mcLoadProperties.xpGainMultiplier); } } mcSkills.getInstance().XpCheck(player); diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java index 6515ba57a..16ff92be2 100644 --- a/mcMMO/com/gmail/nossr50/mcLoadProperties.java +++ b/mcMMO/com/gmail/nossr50/mcLoadProperties.java @@ -3,7 +3,7 @@ package com.gmail.nossr50; public class mcLoadProperties { public static Boolean cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static String addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn; - public static int xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; + public static int xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public static void loadMain(){ String propertiesFile = mcMMO.maindirectory + "mcmmo.properties"; @@ -38,6 +38,7 @@ public class mcLoadProperties { * EXPERIENCE RATE MODIFIER */ globalxpmodifier = properties.getInteger("globalXpModifier", 1); + tamingxpmodifier = properties.getInteger("tamingXpModifier", 2); miningxpmodifier = properties.getInteger("miningXpModifier", 2); repairxpmodifier = properties.getInteger("repairXpModifier", 2); woodcuttingxpmodifier = properties.getInteger("woodcuttingXpModifier", 2); diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index 852ce6b9d..5da6fc10c 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -118,6 +118,7 @@ public class mcMMO extends JavaPlugin { public void addXp(Player player, String skillname, Integer newvalue){ PlayerProfile PP = mcUsers.getProfile(player.getName()); PP.addXpToSkill(newvalue, skillname); + mcSkills.getInstance().XpCheck(player); } public void modifySkill(Player player, String skillname, Integer newvalue){ PlayerProfile PP = mcUsers.getProfile(player.getName()); diff --git a/mcMMO/com/gmail/nossr50/mcMining.java b/mcMMO/com/gmail/nossr50/mcMining.java index a64e115c1..ff5fcaff1 100644 --- a/mcMMO/com/gmail/nossr50/mcMining.java +++ b/mcMMO/com/gmail/nossr50/mcMining.java @@ -163,7 +163,7 @@ public class mcMining { xp += 40; blockProcCheck(block, player); } - PP.addMiningGather(xp * mcLoadProperties.xpGainMultiplier); + PP.addMiningXP(xp * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(player); } /* @@ -318,7 +318,7 @@ public class mcMining { block.setType(Material.AIR); } if(block.getData() != (byte) 5) - PP.addMiningGather(xp * mcLoadProperties.xpGainMultiplier); + PP.addMiningXP(xp * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(player); } } diff --git a/mcMMO/com/gmail/nossr50/mcPermissions.java b/mcMMO/com/gmail/nossr50/mcPermissions.java index 4b78a1204..c40311e77 100644 --- a/mcMMO/com/gmail/nossr50/mcPermissions.java +++ b/mcMMO/com/gmail/nossr50/mcPermissions.java @@ -183,6 +183,13 @@ public class mcPermissions { } return instance; } + public boolean taming(Player player) { + if (permissionsEnabled) { + return permission(player, "mcmmo.skills.taming"); + } else { + return true; + } + } public boolean mining(Player player) { if (permissionsEnabled) { return permission(player, "mcmmo.skills.mining"); diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index d442d4f25..462cff052 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -116,15 +116,20 @@ public class mcPlayerListener extends PlayerListener { } //GREEN THUMB - if(block != null && block.getType() == Material.COBBLESTONE && player.getItemInHand().getType() == Material.SEEDS){ + if(block != null && (block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT) && player.getItemInHand().getType() == Material.SEEDS){ boolean pass = false; if(mcHerbalism.getInstance().hasSeeds(player)){ mcHerbalism.getInstance().removeSeeds(player); - if(Math.random() * 1500 <= PP.getHerbalismInt()){ + if(block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getHerbalismInt()){ player.sendMessage(ChatColor.GREEN+"**GREEN THUMB**"); block.setType(Material.MOSSY_COBBLESTONE); pass = true; } + if(block.getType() == Material.DIRT && Math.random() * 1500 <= PP.getHerbalismInt()){ + player.sendMessage(ChatColor.GREEN+"**GREEN THUMB**"); + block.setType(Material.GRASS); + pass = true; + } if(pass == false) player.sendMessage(ChatColor.RED+"**GREEN THUMB FAIL**"); } @@ -368,45 +373,49 @@ public class mcPlayerListener extends PlayerListener { player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)"); player.sendMessage("OP: " + target.isOp()); player.sendMessage(ChatColor.GREEN+"mcMMO Stats for "+ChatColor.YELLOW+target.getName()); + if(mcPermissions.getInstance().taming(target)) + player.sendMessage(ChatColor.YELLOW + "Taming Skill: " + ChatColor.GREEN + PPt.getTaming()+ChatColor.DARK_AQUA + + " XP("+PPt.getTamingXP() + +"/"+PPt.getXpToLevel("taming")+")"); if(mcPermissions.getInstance().mining(target)) player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + PPt.getMining()+ChatColor.DARK_AQUA - + " XP("+PPt.getMiningGather() + + " XP("+PPt.getMiningXP() +"/"+PPt.getXpToLevel("mining")+")"); if(mcPermissions.getInstance().repair(target)) player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + PPt.getRepair()+ChatColor.DARK_AQUA - + " XP("+PPt.getRepairGather() + + " XP("+PPt.getRepairXP() +"/"+PPt.getXpToLevel("repair")+")"); if(mcPermissions.getInstance().woodcutting(target)) player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + PPt.getWoodCutting()+ChatColor.DARK_AQUA - + " XP("+PPt.getWoodCuttingGather() + + " XP("+PPt.getWoodCuttingXP() +"/"+PPt.getXpToLevel("woodcutting")+")"); if(mcPermissions.getInstance().unarmed(target)) player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + PPt.getUnarmed()+ChatColor.DARK_AQUA - + " XP("+PPt.getUnarmedGather() + + " XP("+PPt.getUnarmedXP() +"/"+PPt.getXpToLevel("unarmed")+")"); if(mcPermissions.getInstance().herbalism(target)) player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + PPt.getHerbalism()+ChatColor.DARK_AQUA - + " XP("+PPt.getHerbalismGather() + + " XP("+PPt.getHerbalismXP() +"/"+PPt.getXpToLevel("herbalism")+")"); if(mcPermissions.getInstance().excavation(target)) player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + PPt.getExcavation()+ChatColor.DARK_AQUA - + " XP("+PPt.getExcavationGather() + + " XP("+PPt.getExcavationXP() +"/"+PPt.getXpToLevel("excavation")+")"); if(mcPermissions.getInstance().archery(target)) player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + PPt.getArchery()+ChatColor.DARK_AQUA - + " XP("+PPt.getArcheryGather() + + " XP("+PPt.getArcheryXP() +"/"+PPt.getXpToLevel("archery")+")"); if(mcPermissions.getInstance().swords(target)) player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + PPt.getSwords()+ChatColor.DARK_AQUA - + " XP("+PPt.getSwordsGather() + + " XP("+PPt.getSwordsXP() +"/"+PPt.getXpToLevel("swords")+")"); if(mcPermissions.getInstance().axes(target)) player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + PPt.getAxes()+ChatColor.DARK_AQUA - + " XP("+PPt.getAxesGather() + + " XP("+PPt.getAxesXP() +"/"+PPt.getXpToLevel("axes")+")"); if(mcPermissions.getInstance().acrobatics(target)) player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PPt.getAcrobatics()+ChatColor.DARK_AQUA - + " XP("+PPt.getAcrobaticsGather() + + " XP("+PPt.getAcrobaticsXP() +"/"+PPt.getXpToLevel("acrobatics")+")"); player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getInstance().getPowerLevel(target))); player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~"); @@ -423,45 +432,50 @@ public class mcPlayerListener extends PlayerListener { player.sendMessage(ChatColor.GREEN + "Your mcMMO Stats"); if(mcPermissions.getInstance().permissionsEnabled) player.sendMessage(ChatColor.DARK_GRAY+"If you don't have access to a skill it will not be shown here."); + + if(mcPermissions.getInstance().taming(player)) + player.sendMessage(ChatColor.YELLOW + "Taming Skill: " + ChatColor.GREEN + PP.getTaming()+ChatColor.DARK_AQUA + + " XP("+PP.getTamingXP() + +"/"+PP.getXpToLevel("taming")+")"); if(mcPermissions.getInstance().mining(player)) player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + PP.getMining()+ChatColor.DARK_AQUA - + " XP("+PP.getMiningGather() + + " XP("+PP.getMiningXP() +"/"+PP.getXpToLevel("mining")+")"); if(mcPermissions.getInstance().repair(player)) player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + PP.getRepair()+ChatColor.DARK_AQUA - + " XP("+PP.getRepairGather() + + " XP("+PP.getRepairXP() +"/"+PP.getXpToLevel("repair")+")"); if(mcPermissions.getInstance().woodcutting(player)) player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + PP.getWoodCutting()+ChatColor.DARK_AQUA - + " XP("+PP.getWoodCuttingGather() + + " XP("+PP.getWoodCuttingXP() +"/"+PP.getXpToLevel("woodcutting")+")"); if(mcPermissions.getInstance().unarmed(player)) player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + PP.getUnarmed()+ChatColor.DARK_AQUA - + " XP("+PP.getUnarmedGather() + + " XP("+PP.getUnarmedXP() +"/"+PP.getXpToLevel("unarmed")+")"); if(mcPermissions.getInstance().herbalism(player)) player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + PP.getHerbalism()+ChatColor.DARK_AQUA - + " XP("+PP.getHerbalismGather() + + " XP("+PP.getHerbalismXP() +"/"+PP.getXpToLevel("herbalism")+")"); if(mcPermissions.getInstance().excavation(player)) player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + PP.getExcavation()+ChatColor.DARK_AQUA - + " XP("+PP.getExcavationGather() + + " XP("+PP.getExcavationXP() +"/"+PP.getXpToLevel("excavation")+")"); if(mcPermissions.getInstance().archery(player)) player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + PP.getArchery()+ChatColor.DARK_AQUA - + " XP("+PP.getArcheryGather() + + " XP("+PP.getArcheryXP() +"/"+PP.getXpToLevel("archery")+")"); if(mcPermissions.getInstance().swords(player)) player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + PP.getSwords()+ChatColor.DARK_AQUA - + " XP("+PP.getSwordsGather() + + " XP("+PP.getSwordsXP() +"/"+PP.getXpToLevel("swords")+")"); if(mcPermissions.getInstance().axes(player)) player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + PP.getAxes()+ChatColor.DARK_AQUA - + " XP("+PP.getAxesGather() + + " XP("+PP.getAxesXP() +"/"+PP.getXpToLevel("axes")+")"); if(mcPermissions.getInstance().acrobatics(player)) player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PP.getAcrobatics()+ChatColor.DARK_AQUA - + " XP("+PP.getAcrobaticsGather() + + " XP("+PP.getAcrobaticsXP() +"/"+PP.getXpToLevel("acrobatics")+")"); player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getInstance().getPowerLevel(player))); } diff --git a/mcMMO/com/gmail/nossr50/mcRepair.java b/mcMMO/com/gmail/nossr50/mcRepair.java index 6ba5eb533..71911aadb 100644 --- a/mcMMO/com/gmail/nossr50/mcRepair.java +++ b/mcMMO/com/gmail/nossr50/mcRepair.java @@ -42,7 +42,7 @@ public class mcRepair { player.sendMessage(String.valueOf(durabilityBefore - durabilityAfter)); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 6); //Boost XP - PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); } else if (isIronArmor(is) && hasIron(player)){ /* * IRON ARMOR @@ -52,7 +52,7 @@ public class mcRepair { durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 2); //Boost XP - PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); //GOLD ARMOR } else if (isGoldArmor(is) && hasGold(player)){ removeGold(player); @@ -60,7 +60,7 @@ public class mcRepair { durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 4); //Boost XP of Gold to around Iron - PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); } else { needMoreVespeneGas(is, player); } @@ -86,7 +86,7 @@ public class mcRepair { dif = (short) (dif / 2); if(mcm.getInstance().isHoe(is)) dif = (short) (dif / 2); - PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); } else if (isDiamondTools(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds /* * DIAMOND TOOLS @@ -101,7 +101,7 @@ public class mcRepair { dif = (short) (dif / 2); if(mcm.getInstance().isHoe(is)) dif = (short) (dif / 2); - PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); } else if(isGoldTools(is) && hasGold(player)){ player.getItemInHand().setDurability(getToolRepairAmount(is, player)); removeGold(player); @@ -114,7 +114,7 @@ public class mcRepair { dif = (short) (dif / 2); if(mcm.getInstance().isHoe(is)) dif = (short) (dif / 2); - PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); } else { needMoreVespeneGas(is, player); } diff --git a/mcMMO/com/gmail/nossr50/mcSkills.java b/mcMMO/com/gmail/nossr50/mcSkills.java index 31c0c0a50..687ac5155 100644 --- a/mcMMO/com/gmail/nossr50/mcSkills.java +++ b/mcMMO/com/gmail/nossr50/mcSkills.java @@ -342,14 +342,27 @@ public class mcSkills { } public void XpCheck(Player player){ PlayerProfile PP = mcUsers.getProfile(player.getName()); + /* + * TAMING + */ + if(player != null && PP.getTamingXPInt() >= PP.getXpToLevel("taming")){ + int skillups = 0; + while(PP.getTamingXPInt() >= PP.getXpToLevel("taming")){ + skillups++; + PP.removeTamingXP(PP.getXpToLevel("taming")); + PP.skillUpTaming(1); + } + if(player != null && PP.getTaming() != null) + player.sendMessage(ChatColor.YELLOW+"Taming skill increased by "+skillups+"."+" Total ("+PP.getTaming()+")"); + } /* * ACROBATICS */ - if(player != null && PP.getAcrobaticsGatherInt() >= PP.getXpToLevel("acrobatics")){ + if(player != null && PP.getAcrobaticsXPInt() >= PP.getXpToLevel("acrobatics")){ int skillups = 0; - while(PP.getAcrobaticsGatherInt() >= PP.getXpToLevel("acrobatics")){ + while(PP.getAcrobaticsXPInt() >= PP.getXpToLevel("acrobatics")){ skillups++; - PP.removeAcrobaticsGather(PP.getXpToLevel("acrobatics")); + PP.removeAcrobaticsXP(PP.getXpToLevel("acrobatics")); PP.skillUpAcrobatics(1); } if(player != null && PP.getAcrobatics() != null) @@ -358,11 +371,11 @@ public class mcSkills { /* * ARCHERY */ - if(PP.getArcheryGatherInt() >= PP.getXpToLevel("archery")){ + if(PP.getArcheryXPInt() >= PP.getXpToLevel("archery")){ int skillups = 0; - while(PP.getArcheryGatherInt() >= PP.getXpToLevel("archery")){ + while(PP.getArcheryXPInt() >= PP.getXpToLevel("archery")){ skillups++; - PP.removeArcheryGather(PP.getXpToLevel("archery")); + PP.removeArcheryXP(PP.getXpToLevel("archery")); PP.skillUpArchery(1); } if(player != null && PP.getArchery() != null) @@ -371,11 +384,11 @@ public class mcSkills { /* * SWORDS */ - if(PP.getSwordsGatherInt() >= PP.getXpToLevel("swords")){ + if(PP.getSwordsXPInt() >= PP.getXpToLevel("swords")){ int skillups = 0; - while(PP.getSwordsGatherInt() >= PP.getXpToLevel("swords")){ + while(PP.getSwordsXPInt() >= PP.getXpToLevel("swords")){ skillups++; - PP.removeSwordsGather(PP.getXpToLevel("swords")); + PP.removeSwordsXP(PP.getXpToLevel("swords")); PP.skillUpSwords(1); } if(player != null && PP.getSwords() != null) @@ -384,11 +397,11 @@ public class mcSkills { /* * AXES */ - if(PP.getAxesGatherInt() >= PP.getXpToLevel("axes")){ + if(PP.getAxesXPInt() >= PP.getXpToLevel("axes")){ int skillups = 0; - while(PP.getAxesGatherInt() >= PP.getXpToLevel("axes")){ + while(PP.getAxesXPInt() >= PP.getXpToLevel("axes")){ skillups++; - PP.removeAxesGather(PP.getXpToLevel("axes")); + PP.removeAxesXP(PP.getXpToLevel("axes")); PP.skillUpAxes(1); } if(player != null && PP.getAxes() != null) @@ -397,11 +410,11 @@ public class mcSkills { /* * UNARMED */ - if(PP.getUnarmedGatherInt() >= PP.getXpToLevel("unarmed")){ + if(PP.getUnarmedXPInt() >= PP.getXpToLevel("unarmed")){ int skillups = 0; - while(PP.getUnarmedGatherInt() >= PP.getXpToLevel("unarmed")){ + while(PP.getUnarmedXPInt() >= PP.getXpToLevel("unarmed")){ skillups++; - PP.removeUnarmedGather(PP.getXpToLevel("unarmed")); + PP.removeUnarmedXP(PP.getXpToLevel("unarmed")); PP.skillUpUnarmed(1); } if(player != null && PP.getUnarmed() != null) @@ -410,11 +423,11 @@ public class mcSkills { /* * HERBALISM */ - if(PP.getHerbalismGatherInt() >= PP.getXpToLevel("herbalism")){ + if(PP.getHerbalismXPInt() >= PP.getXpToLevel("herbalism")){ int skillups = 0; - while(PP.getHerbalismGatherInt() >= PP.getXpToLevel("herbalism")){ + while(PP.getHerbalismXPInt() >= PP.getXpToLevel("herbalism")){ skillups++; - PP.removeHerbalismGather(PP.getXpToLevel("herbalism")); + PP.removeHerbalismXP(PP.getXpToLevel("herbalism")); PP.skillUpHerbalism(1); } if(player != null && PP.getHerbalism() != null) @@ -423,11 +436,11 @@ public class mcSkills { /* * MINING */ - if(player != null && PP.getMiningGatherInt() >= PP.getXpToLevel("mining")){ + if(player != null && PP.getMiningXPInt() >= PP.getXpToLevel("mining")){ int skillups = 0; - while(PP.getMiningGatherInt() >= PP.getXpToLevel("mining")){ + while(PP.getMiningXPInt() >= PP.getXpToLevel("mining")){ skillups++; - PP.removeMiningGather(PP.getXpToLevel("mining")); + PP.removeMiningXP(PP.getXpToLevel("mining")); PP.skillUpMining(1); } if(player != null && PP.getMining() != null) @@ -436,11 +449,11 @@ public class mcSkills { /* * WOODCUTTING */ - if(player != null && PP.getWoodCuttingGatherInt() >= PP.getXpToLevel("woodcutting")){ + if(player != null && PP.getWoodCuttingXPInt() >= PP.getXpToLevel("woodcutting")){ int skillups = 0; - while(PP.getWoodCuttingGatherInt() >= PP.getXpToLevel("woodcutting")){ + while(PP.getWoodCuttingXPInt() >= PP.getXpToLevel("woodcutting")){ skillups++; - PP.removeWoodCuttingGather(PP.getXpToLevel("woodcutting")); + PP.removeWoodCuttingXP(PP.getXpToLevel("woodcutting")); PP.skillUpWoodCutting(1); } if(player != null && PP.getWoodCutting() != null) @@ -449,11 +462,11 @@ public class mcSkills { /* * REPAIR */ - if(PP.getRepairGatherInt() >= PP.getXpToLevel("repair")){ + if(PP.getRepairXPInt() >= PP.getXpToLevel("repair")){ int skillups = 0; - while(PP.getRepairGatherInt() >= PP.getXpToLevel("repair")){ + while(PP.getRepairXPInt() >= PP.getXpToLevel("repair")){ skillups++; - PP.removeRepairGather(PP.getXpToLevel("repair")); + PP.removeRepairXP(PP.getXpToLevel("repair")); PP.skillUpRepair(1); } if(player != null && PP.getRepair() != null) @@ -462,11 +475,11 @@ public class mcSkills { /* * EXCAVATION */ - if(PP.getExcavationGatherInt() >= PP.getXpToLevel("excavation")){ + if(PP.getExcavationXPInt() >= PP.getXpToLevel("excavation")){ int skillups = 0; - while(PP.getExcavationGatherInt() >= PP.getXpToLevel("excavation")){ + while(PP.getExcavationXPInt() >= PP.getXpToLevel("excavation")){ skillups++; - PP.removeExcavationGather(PP.getXpToLevel("excavation")); + PP.removeExcavationXP(PP.getXpToLevel("excavation")); PP.skillUpExcavation(1); } if(player != null && PP.getExcavation() != null) @@ -478,6 +491,9 @@ public class mcSkills { if(skillname.equals("all")){ return true; } + if(skillname.equals("taming")){ + return true; + } if(skillname.equals("mining")){ return true; } diff --git a/mcMMO/com/gmail/nossr50/mcTaming.java b/mcMMO/com/gmail/nossr50/mcTaming.java new file mode 100644 index 000000000..0ed79bae9 --- /dev/null +++ b/mcMMO/com/gmail/nossr50/mcTaming.java @@ -0,0 +1,47 @@ +package com.gmail.nossr50; + +import net.minecraft.server.EntityWolf; + +import org.bukkit.craftbukkit.entity.CraftWolf; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +public class mcTaming { + private static mcMMO plugin; + public mcTaming(mcMMO instance) { + plugin = instance; + } + + private static volatile mcTaming instance; + + public static mcTaming getInstance() { + if (instance == null) { + instance = new mcTaming(plugin); + } + return instance; + } + public String getOwnerName(Entity theWolf){ + CraftWolf cWolf = (CraftWolf)theWolf; + EntityWolf eWolf = (EntityWolf)cWolf.getHandle(); + + String playerName = eWolf.v(); + return playerName; + } + public boolean hasOwner(Entity theWolf, Plugin pluginx){ + for(Player x : pluginx.getServer().getOnlinePlayers()){ + if(x != null && x.getName().equals(getOwnerName(theWolf))){ + return true; + } + } + return false; + } + public Player getOwner(Entity theWolf, Plugin pluginx){ + for(Player x : pluginx.getServer().getOnlinePlayers()){ + if(x != null && x.getName().equals(getOwnerName(theWolf))){ + return x; + } + } + return null; + } +} diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java index 58221800c..bb04ed3b6 100644 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ b/mcMMO/com/gmail/nossr50/mcUsers.java @@ -155,8 +155,8 @@ class PlayerList class PlayerProfile { protected final Logger log = Logger.getLogger("Minecraft"); - private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation, - archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather; + private String taming, tamingXP, playerName, miningXP, woodCuttingXP, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation, + archery, swords, axes, invite, acrobatics, repairXP, unarmedXP, herbalismXP, excavationXP, archeryXP, swordsXP, axesXP, acrobaticsXP; private boolean greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode; private long gigaDrillBreakerCooldown = 0, berserkCooldown = 0, superBreakerCooldown = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, greenTerraCooldown = 0, treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0, @@ -188,29 +188,31 @@ class PlayerList myspawnworld = new String(); mining = new String(); repair = new String(); - repairgather = new String(); + repairXP = new String(); unarmed = new String(); - unarmedgather = new String(); + unarmedXP = new String(); herbalism = new String(); - herbalismgather = new String(); + herbalismXP = new String(); excavation = new String(); - excavationgather = new String(); + excavationXP = new String(); archery = new String(); - archerygather = new String(); + archeryXP = new String(); swords = new String(); - swordsgather = new String(); + swordsXP = new String(); axes = new String(); - axesgather = new String(); + axesXP = new String(); acrobatics = new String(); - acrobaticsgather = new String(); + acrobaticsXP = new String(); + taming = new String(); + tamingXP = new String(); invite = new String(); //mining = "0"; - wgather = new String(); - //wgather = "0"; + woodCuttingXP = new String(); + //woodCuttingXP = "0"; woodcutting = new String(); //woodcutting = "0"; - gather = new String(); - //gather = "0"; + miningXP = new String(); + //XP = "0"; party = null; dead = false; treeFellerMode = false; @@ -258,13 +260,13 @@ class PlayerList //Party if(character.length > 3) party = character[3]; - //Mining Gather + //Mining XP if(character.length > 4) - gather = character[4]; + miningXP = character[4]; if(character.length > 5) woodcutting = character[5]; if(character.length > 6) - wgather = character[6]; + woodCuttingXP = character[6]; if(character.length > 7) repair = character[7]; if(character.length > 8) @@ -282,23 +284,27 @@ class PlayerList if(character.length > 14) acrobatics = character[14]; if(character.length > 15) - repairgather = character[15]; + repairXP = character[15]; if(character.length > 16) - unarmedgather = character[16]; + unarmedXP = character[16]; if(character.length > 17) - herbalismgather = character[17]; + herbalismXP = character[17]; if(character.length > 18) - excavationgather = character[18]; + excavationXP = character[18]; if(character.length > 19) - archerygather = character[19]; + archeryXP = character[19]; if(character.length > 20) - swordsgather = character[20]; + swordsXP = character[20]; if(character.length > 21) - axesgather = character[21]; + axesXP = character[21]; if(character.length > 22) - acrobaticsgather = character[22]; + acrobaticsXP = character[22]; if(character.length > 23) myspawnworld = character[23]; + if(character.length > 24) + taming = character[24]; + if(character.length > 25) + tamingXP = character[25]; in.close(); return true; } @@ -341,9 +347,9 @@ class PlayerList writer.append(mining + ":"); writer.append(myspawn + ":"); writer.append(party+":"); - writer.append(gather+":"); + writer.append(miningXP+":"); writer.append(woodcutting+":"); - writer.append(wgather+":"); + writer.append(woodCuttingXP+":"); writer.append(repair+":"); writer.append(unarmed+":"); writer.append(herbalism+":"); @@ -352,15 +358,17 @@ class PlayerList writer.append(swords+":"); writer.append(axes+":"); writer.append(acrobatics+":"); - writer.append(repairgather+":"); - writer.append(unarmedgather+":"); - writer.append(herbalismgather+":"); - writer.append(excavationgather+":"); - writer.append(archerygather+":"); - writer.append(swordsgather+":"); - writer.append(axesgather+":"); - writer.append(acrobaticsgather+":"); + writer.append(repairXP+":"); + writer.append(unarmedXP+":"); + writer.append(herbalismXP+":"); + writer.append(excavationXP+":"); + writer.append(archeryXP+":"); + writer.append(swordsXP+":"); + writer.append(axesXP+":"); + writer.append(acrobaticsXP+":"); writer.append(myspawnworld+":"); + writer.append(taming+":"); + writer.append(tamingXP+":"); writer.append("\r\n"); } } @@ -385,9 +393,9 @@ class PlayerList out.append(0 + ":"); //mining out.append(myspawn+":"); out.append(party+":"); - out.append(0+":"); //gather + out.append(0+":"); //XP out.append(0+":"); //woodcutting - out.append(0+":"); //wgather + out.append(0+":"); //woodCuttingXP out.append(0+":"); //repair out.append(0+":"); //unarmed out.append(0+":"); //herbalism @@ -396,15 +404,17 @@ class PlayerList out.append(0+":"); //swords out.append(0+":"); //axes out.append(0+":"); //acrobatics - out.append(0+":"); //repairgather - out.append(0+":"); //unarmedgather - out.append(0+":"); //herbalismgather - out.append(0+":"); //excavationgather - out.append(0+":"); //archerygather - out.append(0+":"); //swordsgather - out.append(0+":"); //axesgather - out.append(0+":"); //acrobaticsgather + out.append(0+":"); //repairXP + out.append(0+":"); //unarmedXP + out.append(0+":"); //herbalismXP + out.append(0+":"); //excavationXP + out.append(0+":"); //archeryXP + out.append(0+":"); //swordsXP + out.append(0+":"); //axesXP + out.append(0+":"); //acrobaticsXP out.append(thisplayer.getWorld().getName()); + out.append(0+":"); //taming + out.append(0+":"); //tamingXP //Add more in the same format as the line above out.newLine(); @@ -770,6 +780,20 @@ class PlayerList public void setRecentlyHurt(long newvalue){ recentlyHurt = newvalue; } + public void skillUpTaming(int newskill){ + int x = 0; + if(taming != null){ + if(isInt(taming)){ + x = Integer.parseInt(taming); + }else { + taming = "0"; + x = Integer.parseInt(taming); + } + } + x += newskill; + taming = Integer.toString(x); + save(); + } public void skillUpAxes(int newskill){ int x = 0; if(axes != null){ @@ -910,6 +934,13 @@ class PlayerList woodcutting = Integer.toString(x); save(); } + public String getTaming(){ + if(taming != null && !taming.equals("") && !taming.equals("null")){ + return taming; + } else { + return "0"; + } + } public String getRepair(){ if(repair != null && !repair.equals("") && !repair.equals("null")){ return repair; @@ -973,6 +1004,14 @@ class PlayerList return "0"; } } + public int getTamingInt(){ + if(isInt(taming)){ + int x = Integer.parseInt(taming); + return x; + } else{ + return 0; + } + } public int getMiningInt(){ if(isInt(mining)){ int x = Integer.parseInt(mining); @@ -1063,220 +1102,242 @@ class PlayerList /* * EXPERIENCE STUFF */ - public void clearRepairGather(){ - repairgather = "0"; + public void clearTamingXP(){ + tamingXP = "0"; } - public void clearUnarmedGather(){ - unarmedgather = "0"; + public void clearRepairXP(){ + repairXP = "0"; } - public void clearHerbalismGather(){ - herbalismgather = "0"; + public void clearUnarmedXP(){ + unarmedXP = "0"; } - public void clearExcavationGather(){ - excavationgather = "0"; + public void clearHerbalismXP(){ + herbalismXP = "0"; } - public void clearArcheryGather(){ - archerygather = "0"; + public void clearExcavationXP(){ + excavationXP = "0"; } - public void clearSwordsGather(){ - swordsgather = "0"; + public void clearArcheryXP(){ + archeryXP = "0"; } - public void clearAxesGather(){ - axesgather = "0"; + public void clearSwordsXP(){ + swordsXP = "0"; } - public void clearAcrobaticsGather(){ - acrobaticsgather = "0"; + public void clearAxesXP(){ + axesXP = "0"; } - public void addAcrobaticsGather(int newgather) + public void clearAcrobaticsXP(){ + acrobaticsXP = "0"; + } + public void addTamingXP(int newXP) { int x = 0; - if(isInt(acrobaticsgather)){ - x = Integer.parseInt(acrobaticsgather); + if(isInt(tamingXP)){ + x = Integer.parseInt(tamingXP); } - x += newgather; - acrobaticsgather = String.valueOf(x); + x += newXP; + acrobaticsXP = String.valueOf(x); save(); } - public void addAxesGather(int newgather) + public void addAcrobaticsXP(int newXP) { int x = 0; - if(isInt(axesgather)){ - x = Integer.parseInt(axesgather); + if(isInt(acrobaticsXP)){ + x = Integer.parseInt(acrobaticsXP); } - x += newgather; - axesgather = String.valueOf(x); + x += newXP; + acrobaticsXP = String.valueOf(x); save(); } - public void addSwordsGather(int newgather) + public void addAxesXP(int newXP) { int x = 0; - if(isInt(swordsgather)){ - x = Integer.parseInt(swordsgather); + if(isInt(axesXP)){ + x = Integer.parseInt(axesXP); } - x += newgather; - swordsgather = String.valueOf(x); + x += newXP; + axesXP = String.valueOf(x); save(); } - public void addArcheryGather(int newgather) + public void addSwordsXP(int newXP) { int x = 0; - if(isInt(archerygather)){ - x = Integer.parseInt(archerygather); + if(isInt(swordsXP)){ + x = Integer.parseInt(swordsXP); } - x += newgather; - archerygather = String.valueOf(x); + x += newXP; + swordsXP = String.valueOf(x); save(); } - public void addExcavationGather(int newgather) + public void addArcheryXP(int newXP) { int x = 0; - if(isInt(excavationgather)){ - x = Integer.parseInt(excavationgather); + if(isInt(archeryXP)){ + x = Integer.parseInt(archeryXP); } - x += newgather; - excavationgather = String.valueOf(x); + x += newXP; + archeryXP = String.valueOf(x); save(); } - public void addHerbalismGather(int newgather) + public void addExcavationXP(int newXP) { int x = 0; - if(isInt(herbalismgather)){ - x = Integer.parseInt(herbalismgather); + if(isInt(excavationXP)){ + x = Integer.parseInt(excavationXP); } - x += newgather; - herbalismgather = String.valueOf(x); + x += newXP; + excavationXP = String.valueOf(x); save(); } - public void addRepairGather(int newgather) + public void addHerbalismXP(int newXP) { int x = 0; - if(isInt(repairgather)){ - x = Integer.parseInt(repairgather); + if(isInt(herbalismXP)){ + x = Integer.parseInt(herbalismXP); } - x += newgather; - repairgather = String.valueOf(x); + x += newXP; + herbalismXP = String.valueOf(x); save(); } - public void addUnarmedGather(int newgather) + public void addRepairXP(int newXP) { int x = 0; - if(isInt(unarmedgather)){ - x = Integer.parseInt(unarmedgather); + if(isInt(repairXP)){ + x = Integer.parseInt(repairXP); } - x += newgather; - unarmedgather = String.valueOf(x); + x += newXP; + repairXP = String.valueOf(x); save(); } - public void addWoodcuttingGather(int newgather) + public void addUnarmedXP(int newXP) { int x = 0; - if(isInt(wgather)){ - x = Integer.parseInt(wgather); + if(isInt(unarmedXP)){ + x = Integer.parseInt(unarmedXP); } - x += newgather; - wgather = String.valueOf(x); + x += newXP; + unarmedXP = String.valueOf(x); save(); } - public void removeWoodCuttingGather(int newgather){ - int x = 0; - if(isInt(wgather)){ - x = Integer.parseInt(wgather); - } - x -= newgather; - wgather = String.valueOf(x); - save(); - } - public void addMiningGather(int newgather) + public void addWoodcuttingXP(int newXP) { int x = 0; - if(isInt(gather)){ - x = Integer.parseInt(gather); + if(isInt(woodCuttingXP)){ + x = Integer.parseInt(woodCuttingXP); + } + x += newXP; + woodCuttingXP = String.valueOf(x); + save(); + } + public void removeTamingXP(int newXP){ + int x = 0; + if(isInt(tamingXP)){ + x = Integer.parseInt(tamingXP); + } + x -= newXP; + tamingXP = String.valueOf(x); + save(); + } + public void removeWoodCuttingXP(int newXP){ + int x = 0; + if(isInt(woodCuttingXP)){ + x = Integer.parseInt(woodCuttingXP); + } + x -= newXP; + woodCuttingXP = String.valueOf(x); + save(); + } + public void addMiningXP(int newXP) + { + int x = 0; + if(isInt(miningXP)){ + x = Integer.parseInt(miningXP); } else { x = 0; } - x += newgather; - gather = String.valueOf(x); + x += newXP; + miningXP = String.valueOf(x); save(); } - public void removeMiningGather(int newgather){ + public void removeMiningXP(int newXP){ int x = 0; - if(isInt(gather)){ - x = Integer.parseInt(gather); + if(isInt(miningXP)){ + x = Integer.parseInt(miningXP); } - x -= newgather; - gather = String.valueOf(x); + x -= newXP; + miningXP = String.valueOf(x); save(); } - public void removeRepairGather(int newgather){ + public void removeRepairXP(int newXP){ int x = 0; - if(isInt(repairgather)){ - x = Integer.parseInt(repairgather); + if(isInt(repairXP)){ + x = Integer.parseInt(repairXP); } - x -= newgather; - repairgather = String.valueOf(x); + x -= newXP; + repairXP = String.valueOf(x); save(); } - public void removeUnarmedGather(int newgather){ + public void removeUnarmedXP(int newXP){ int x = 0; - if(isInt(unarmedgather)){ - x = Integer.parseInt(unarmedgather); + if(isInt(unarmedXP)){ + x = Integer.parseInt(unarmedXP); } - x -= newgather; - unarmedgather = String.valueOf(x); + x -= newXP; + unarmedXP = String.valueOf(x); save(); } - public void removeHerbalismGather(int newgather){ + public void removeHerbalismXP(int newXP){ int x = 0; - if(isInt(herbalismgather)){ - x = Integer.parseInt(herbalismgather); + if(isInt(herbalismXP)){ + x = Integer.parseInt(herbalismXP); } - x -= newgather; - herbalismgather = String.valueOf(x); + x -= newXP; + herbalismXP = String.valueOf(x); save(); } - public void removeExcavationGather(int newgather){ + public void removeExcavationXP(int newXP){ int x = 0; - if(isInt(excavationgather)){ - x = Integer.parseInt(excavationgather); + if(isInt(excavationXP)){ + x = Integer.parseInt(excavationXP); } - x -= newgather; - excavationgather = String.valueOf(x); + x -= newXP; + excavationXP = String.valueOf(x); save(); } - public void removeArcheryGather(int newgather){ + public void removeArcheryXP(int newXP){ int x = 0; - if(isInt(archerygather)){ - x = Integer.parseInt(archerygather); + if(isInt(archeryXP)){ + x = Integer.parseInt(archeryXP); } - x -= newgather; - archerygather = String.valueOf(x); + x -= newXP; + archeryXP = String.valueOf(x); save(); } - public void removeSwordsGather(int newgather){ + public void removeSwordsXP(int newXP){ int x = 0; - if(isInt(swordsgather)){ - x = Integer.parseInt(swordsgather); + if(isInt(swordsXP)){ + x = Integer.parseInt(swordsXP); } - x -= newgather; - swordsgather = String.valueOf(x); + x -= newXP; + swordsXP = String.valueOf(x); save(); } - public void removeAxesGather(int newgather){ + public void removeAxesXP(int newXP){ int x = 0; - if(isInt(axesgather)){ - x = Integer.parseInt(axesgather); + if(isInt(axesXP)){ + x = Integer.parseInt(axesXP); } - x -= newgather; - axesgather = String.valueOf(x); + x -= newXP; + axesXP = String.valueOf(x); save(); } - public void removeAcrobaticsGather(int newgather){ + public void removeAcrobaticsXP(int newXP){ int x = 0; - if(isInt(acrobaticsgather)){ - x = Integer.parseInt(acrobaticsgather); + if(isInt(acrobaticsXP)){ + x = Integer.parseInt(acrobaticsXP); } - x -= newgather; - acrobaticsgather = String.valueOf(x); + x -= newXP; + acrobaticsXP = String.valueOf(x); save(); } @@ -1306,230 +1367,252 @@ class PlayerList public void modifyInvite(String invitename){ invite = invitename; } - //Returns player gather - public String getMiningGather(){ - if(gather != null && !gather.equals("") && !gather.equals("null")){ - return gather; + //Returns player XP + public String getTamingXP(){ + if(tamingXP != null && !tamingXP.equals("") && !tamingXP.equals("null")){ + return tamingXP; + } else { + return "0"; + } + } + public String getMiningXP(){ + if(miningXP != null && !miningXP.equals("") && !miningXP.equals("null")){ + return miningXP; } else { return "0"; } } public String getInvite() { return invite; } - public String getWoodCuttingGather(){ - if(wgather != null && !wgather.equals("") && !wgather.equals("null")){ - return wgather; + public String getWoodCuttingXP(){ + if(woodCuttingXP != null && !woodCuttingXP.equals("") && !woodCuttingXP.equals("null")){ + return woodCuttingXP; } else { return "0"; } } - public String getRepairGather(){ - if(repairgather != null && !repairgather.equals("") && !repairgather.equals("null")){ - return repairgather; + public String getRepairXP(){ + if(repairXP != null && !repairXP.equals("") && !repairXP.equals("null")){ + return repairXP; } else { return "0"; } } - public String getHerbalismGather(){ - if(herbalismgather != null && !herbalismgather.equals("") && !herbalismgather.equals("null")){ - return herbalismgather; + public String getHerbalismXP(){ + if(herbalismXP != null && !herbalismXP.equals("") && !herbalismXP.equals("null")){ + return herbalismXP; } else { return "0"; } } - public String getExcavationGather(){ - if(excavationgather != null && !excavationgather.equals("") && !excavationgather.equals("null")){ - return excavationgather; + public String getExcavationXP(){ + if(excavationXP != null && !excavationXP.equals("") && !excavationXP.equals("null")){ + return excavationXP; } else { return "0"; } } - public String getArcheryGather(){ - if(archerygather != null && !archerygather.equals("") && !archerygather.equals("null")){ - return archerygather; + public String getArcheryXP(){ + if(archeryXP != null && !archeryXP.equals("") && !archeryXP.equals("null")){ + return archeryXP; } else { return "0"; } } - public String getSwordsGather(){ - if(swordsgather != null && !swordsgather.equals("") && !swordsgather.equals("null")){ - return swordsgather; + public String getSwordsXP(){ + if(swordsXP != null && !swordsXP.equals("") && !swordsXP.equals("null")){ + return swordsXP; } else { return "0"; } } - public String getAxesGather(){ - if(axesgather != null && !axesgather.equals("") && !axesgather.equals("null")){ - return axesgather; + public String getAxesXP(){ + if(axesXP != null && !axesXP.equals("") && !axesXP.equals("null")){ + return axesXP; } else { return "0"; } } - public String getAcrobaticsGather(){ - if(acrobaticsgather != null && !acrobaticsgather.equals("") && !acrobaticsgather.equals("null")){ - return acrobaticsgather; + public String getAcrobaticsXP(){ + if(acrobaticsXP != null && !acrobaticsXP.equals("") && !acrobaticsXP.equals("null")){ + return acrobaticsXP; } else { return "0"; } } - public String getUnarmedGather(){ - if(unarmedgather != null && !unarmedgather.equals("") && !unarmedgather.equals("null")){ - return unarmedgather; + public String getUnarmedXP(){ + if(unarmedXP != null && !unarmedXP.equals("") && !unarmedXP.equals("null")){ + return unarmedXP; } else { return "0"; } } - - public int getWoodCuttingGatherInt() { - if(isInt(wgather)){ - return Integer.parseInt(wgather); + public int getTamingXPInt() { + if(isInt(tamingXP)){ + return Integer.parseInt(tamingXP); } else { - wgather = "0"; + tamingXP = "0"; save(); return 0; } } - public int getRepairGatherInt() { - if(isInt(repairgather)){ - return Integer.parseInt(repairgather); + public int getWoodCuttingXPInt() { + if(isInt(woodCuttingXP)){ + return Integer.parseInt(woodCuttingXP); } else { - repairgather = "0"; + woodCuttingXP = "0"; save(); return 0; } } - public int getUnarmedGatherInt() { - if(isInt(unarmedgather)){ - return Integer.parseInt(unarmedgather); + public int getRepairXPInt() { + if(isInt(repairXP)){ + return Integer.parseInt(repairXP); } else { - unarmedgather = "0"; + repairXP = "0"; save(); return 0; } } - public int getHerbalismGatherInt() { - if(isInt(herbalismgather)){ - return Integer.parseInt(herbalismgather); + public int getUnarmedXPInt() { + if(isInt(unarmedXP)){ + return Integer.parseInt(unarmedXP); } else { - herbalismgather = "0"; + unarmedXP = "0"; save(); return 0; } } - public int getExcavationGatherInt() { - if(isInt(excavationgather)){ - return Integer.parseInt(excavationgather); + public int getHerbalismXPInt() { + if(isInt(herbalismXP)){ + return Integer.parseInt(herbalismXP); } else { - excavationgather = "0"; + herbalismXP = "0"; save(); return 0; } } - public int getArcheryGatherInt() { - if(isInt(archerygather)){ - return Integer.parseInt(archerygather); + public int getExcavationXPInt() { + if(isInt(excavationXP)){ + return Integer.parseInt(excavationXP); } else { - archerygather = "0"; + excavationXP = "0"; save(); return 0; } } - public int getSwordsGatherInt() { - if(isInt(swordsgather)){ - return Integer.parseInt(swordsgather); + public int getArcheryXPInt() { + if(isInt(archeryXP)){ + return Integer.parseInt(archeryXP); } else { - swordsgather = "0"; + archeryXP = "0"; save(); return 0; } } - public int getAxesGatherInt() { - if(isInt(axesgather)){ - return Integer.parseInt(axesgather); + public int getSwordsXPInt() { + if(isInt(swordsXP)){ + return Integer.parseInt(swordsXP); } else { - axesgather = "0"; + swordsXP = "0"; save(); return 0; } } - public int getAcrobaticsGatherInt() { - if(isInt(acrobaticsgather)){ - return Integer.parseInt(acrobaticsgather); + public int getAxesXPInt() { + if(isInt(axesXP)){ + return Integer.parseInt(axesXP); } else { - acrobaticsgather = "0"; + axesXP = "0"; + save(); + return 0; + } + } + public int getAcrobaticsXPInt() { + if(isInt(acrobaticsXP)){ + return Integer.parseInt(acrobaticsXP); + } else { + acrobaticsXP = "0"; save(); return 0; } } public void addXpToSkill(int newvalue, String skillname){ - if(!isInt(gather)) - gather = String.valueOf(0); - if(!isInt(wgather)) - wgather = String.valueOf(0); - if(!isInt(repairgather)) - repairgather = String.valueOf(0); - if(!isInt(herbalismgather)) - herbalismgather = String.valueOf(0); - if(!isInt(acrobaticsgather)) - acrobaticsgather = String.valueOf(0); - if(!isInt(swordsgather)) - swordsgather = String.valueOf(0); - if(!isInt(archerygather)) - archerygather = String.valueOf(0); - if(!isInt(unarmedgather)) - unarmedgather = String.valueOf(0); - if(!isInt(excavationgather)) - excavationgather = String.valueOf(0); - if(!isInt(axesgather)) - axesgather = String.valueOf(0); + if(!isInt(tamingXP)) + tamingXP = String.valueOf(0); + if(!isInt(miningXP)) + miningXP = String.valueOf(0); + if(!isInt(woodCuttingXP)) + woodCuttingXP = String.valueOf(0); + if(!isInt(repairXP)) + repairXP = String.valueOf(0); + if(!isInt(herbalismXP)) + herbalismXP = String.valueOf(0); + if(!isInt(acrobaticsXP)) + acrobaticsXP = String.valueOf(0); + if(!isInt(swordsXP)) + swordsXP = String.valueOf(0); + if(!isInt(archeryXP)) + archeryXP = String.valueOf(0); + if(!isInt(unarmedXP)) + unarmedXP = String.valueOf(0); + if(!isInt(excavationXP)) + excavationXP = String.valueOf(0); + if(!isInt(axesXP)) + axesXP = String.valueOf(0); + if(skillname.toLowerCase().equals("taming")){ + tamingXP = String.valueOf(Integer.valueOf(tamingXP)+newvalue); + } if(skillname.toLowerCase().equals("mining")){ - gather = String.valueOf(Integer.valueOf(gather)+newvalue); + miningXP = String.valueOf(Integer.valueOf(miningXP)+newvalue); } if(skillname.toLowerCase().equals("woodcutting")){ - wgather = String.valueOf(Integer.valueOf(wgather)+newvalue); + woodCuttingXP = String.valueOf(Integer.valueOf(woodCuttingXP)+newvalue); } if(skillname.toLowerCase().equals("repair")){ - repairgather = String.valueOf(Integer.valueOf(repairgather)+newvalue); + repairXP = String.valueOf(Integer.valueOf(repairXP)+newvalue); } if(skillname.toLowerCase().equals("herbalism")){ - herbalismgather = String.valueOf(Integer.valueOf(herbalismgather)+newvalue); + herbalismXP = String.valueOf(Integer.valueOf(herbalismXP)+newvalue); } if(skillname.toLowerCase().equals("acrobatics")){ - acrobaticsgather = String.valueOf(Integer.valueOf(acrobaticsgather)+newvalue); + acrobaticsXP = String.valueOf(Integer.valueOf(acrobaticsXP)+newvalue); } if(skillname.toLowerCase().equals("swords")){ - swordsgather = String.valueOf(Integer.valueOf(swordsgather)+newvalue); + swordsXP = String.valueOf(Integer.valueOf(swordsXP)+newvalue); } if(skillname.toLowerCase().equals("archery")){ - archerygather = String.valueOf(Integer.valueOf(archerygather)+newvalue); + archeryXP = String.valueOf(Integer.valueOf(archeryXP)+newvalue); } if(skillname.toLowerCase().equals("unarmed")){ - unarmedgather = String.valueOf(Integer.valueOf(unarmedgather)+newvalue); + unarmedXP = String.valueOf(Integer.valueOf(unarmedXP)+newvalue); } if(skillname.toLowerCase().equals("excavation")){ - excavationgather = String.valueOf(Integer.valueOf(excavationgather)+newvalue); + excavationXP = String.valueOf(Integer.valueOf(excavationXP)+newvalue); } if(skillname.toLowerCase().equals("axes")){ - axesgather = String.valueOf(Integer.valueOf(axesgather)+newvalue); + axesXP = String.valueOf(Integer.valueOf(axesXP)+newvalue); } if(skillname.toLowerCase().equals("all")){ - gather = String.valueOf(Integer.valueOf(gather)+newvalue); - wgather = String.valueOf(Integer.valueOf(wgather)+newvalue); - repairgather = String.valueOf(Integer.valueOf(repairgather)+newvalue); - herbalismgather = String.valueOf(Integer.valueOf(herbalismgather)+newvalue); - acrobaticsgather = String.valueOf(Integer.valueOf(acrobaticsgather)+newvalue); - swordsgather = String.valueOf(Integer.valueOf(swordsgather)+newvalue); - archerygather = String.valueOf(Integer.valueOf(archerygather)+newvalue); - unarmedgather = String.valueOf(Integer.valueOf(unarmedgather)+newvalue); - excavationgather = String.valueOf(Integer.valueOf(excavationgather)+newvalue); - axesgather = String.valueOf(Integer.valueOf(axesgather)+newvalue); + tamingXP = String.valueOf(Integer.valueOf(tamingXP)+newvalue); + miningXP = String.valueOf(Integer.valueOf(miningXP)+newvalue); + woodCuttingXP = String.valueOf(Integer.valueOf(woodCuttingXP)+newvalue); + repairXP = String.valueOf(Integer.valueOf(repairXP)+newvalue); + herbalismXP = String.valueOf(Integer.valueOf(herbalismXP)+newvalue); + acrobaticsXP = String.valueOf(Integer.valueOf(acrobaticsXP)+newvalue); + swordsXP = String.valueOf(Integer.valueOf(swordsXP)+newvalue); + archeryXP = String.valueOf(Integer.valueOf(archeryXP)+newvalue); + unarmedXP = String.valueOf(Integer.valueOf(unarmedXP)+newvalue); + excavationXP = String.valueOf(Integer.valueOf(excavationXP)+newvalue); + axesXP = String.valueOf(Integer.valueOf(axesXP)+newvalue); } save(); - if(isPlayer(playerName)){ mcSkills.getInstance().XpCheck(thisplayer); - } } public void modifyskill(int newvalue, String skillname){ + if(skillname.toLowerCase().equals("taming")){ + taming = String.valueOf(newvalue); + } if(skillname.toLowerCase().equals("mining")){ mining = String.valueOf(newvalue); } @@ -1561,6 +1644,7 @@ class PlayerList axes = String.valueOf(newvalue); } if(skillname.toLowerCase().equals("all")){ + taming = String.valueOf(newvalue); mining = String.valueOf(newvalue); woodcutting = String.valueOf(newvalue); repair = String.valueOf(newvalue); @@ -1575,6 +1659,9 @@ class PlayerList save(); } public Integer getXpToLevel(String skillname){ + if(skillname.equals("taming")){ + return ((getTamingInt() + 50) * mcLoadProperties.tamingxpmodifier) * mcLoadProperties.globalxpmodifier; + } if(skillname.equals("mining")){ return ((getMiningInt() + 50) * mcLoadProperties.miningxpmodifier) * mcLoadProperties.globalxpmodifier; } @@ -1608,95 +1695,94 @@ class PlayerList return 0; } } - public int getMiningGatherInt() { - if(isInt(gather)){ - return Integer.parseInt(gather); + public int getMiningXPInt() { + if(isInt(miningXP)){ + return Integer.parseInt(miningXP); } else { - gather = "0"; + miningXP = "0"; save(); return 0; } } - //Store the player's party - public void setParty(String newParty) - { - party = newParty; - save(); - } - //Retrieve the player's party - public String getParty() {return party;} + //Store the player's party + public void setParty(String newParty) + { + party = newParty; + save(); + } + //Retrieve the player's party + public String getParty() {return party;} //Remove party - public void removeParty() { - party = null; - save(); - } - //Retrieve whether or not the player is in a party - public boolean inParty() { - if(party != null && !party.equals("") && !party.equals("null")){ - return true; - } else { - return false; - } - } - //Retrieve whether or not the player has an invite - public boolean hasPartyInvite() { - if(invite != null && !invite.equals("") && !invite.equals("null")){ - return true; - } else { - return false; - } - } - public String getMySpawnWorld(Plugin plugin){ - if(myspawnworld != null && !myspawnworld.equals("") && !myspawnworld.equals("null")){ - return myspawnworld; - } else { - return plugin.getServer().getWorlds().get(0).toString(); - } - } - //Save a users spawn location - public void setMySpawn(double x, double y, double z, String myspawnworldlocation){ - myspawn = x+","+y+","+z; - myspawnworld = myspawnworldlocation; - save(); - } - public String getX(){ - String[] split = myspawn.split(","); - String x = split[0]; - return x; - } - public String getY(){ - String[] split = myspawn.split(","); - String y = split[1]; - return y; - } - public String getZ(){ - String[] split = myspawn.split(","); - String z = split[2]; - return z; - } - public void setDead(boolean x){ - dead = x; - save(); - } - public boolean isDead(){ - return dead; - } - public Location getMySpawn(Player player){ - Location loc = player.getWorld().getSpawnLocation(); - if(isDouble(getX()) && isDouble(getY()) && isDouble(getX())){ - loc.setX(Double.parseDouble(mcUsers.getProfile(player.getName()).getX())); - loc.setY(Double.parseDouble(mcUsers.getProfile(player.getName()).getY())); - loc.setZ(Double.parseDouble(mcUsers.getProfile(player.getName()).getZ())); - } else { - return null; - } - loc.setYaw(0); - loc.setPitch(0); - return loc; - } - } - + public void removeParty() { + party = null; + save(); + } + //Retrieve whether or not the player is in a party + public boolean inParty() { + if(party != null && !party.equals("") && !party.equals("null")){ + return true; + } else { + return false; + } + } + //Retrieve whether or not the player has an invite + public boolean hasPartyInvite() { + if(invite != null && !invite.equals("") && !invite.equals("null")){ + return true; + } else { + return false; + } + } + public String getMySpawnWorld(Plugin plugin){ + if(myspawnworld != null && !myspawnworld.equals("") && !myspawnworld.equals("null")){ + return myspawnworld; + } else { + return plugin.getServer().getWorlds().get(0).toString(); + } + } + //Save a users spawn location + public void setMySpawn(double x, double y, double z, String myspawnworldlocation){ + myspawn = x+","+y+","+z; + myspawnworld = myspawnworldlocation; + save(); + } + public String getX(){ + String[] split = myspawn.split(","); + String x = split[0]; + return x; + } + public String getY(){ + String[] split = myspawn.split(","); + String y = split[1]; + return y; + } + public String getZ(){ + String[] split = myspawn.split(","); + String z = split[2]; + return z; + } + public void setDead(boolean x){ + dead = x; + save(); + } + public boolean isDead(){ + return dead; + } + public Location getMySpawn(Player player){ + Location loc = player.getWorld().getSpawnLocation(); + if(isDouble(getX()) && isDouble(getY()) && isDouble(getX())){ + loc.setX(Double.parseDouble(mcUsers.getProfile(player.getName()).getX())); + loc.setY(Double.parseDouble(mcUsers.getProfile(player.getName()).getY())); + loc.setZ(Double.parseDouble(mcUsers.getProfile(player.getName()).getZ())); + } else { + return null; + } + loc.setYaw(0); + loc.setPitch(0); + return loc; + } + } } diff --git a/mcMMO/com/gmail/nossr50/mcWoodCutting.java b/mcMMO/com/gmail/nossr50/mcWoodCutting.java index b7f5e1824..e20a1c5e8 100644 --- a/mcMMO/com/gmail/nossr50/mcWoodCutting.java +++ b/mcMMO/com/gmail/nossr50/mcWoodCutting.java @@ -77,9 +77,9 @@ public class mcWoodCutting { public void treeFeller(Block block, Player player){ PlayerProfile PP = mcUsers.getProfile(player.getName()); int radius = 1; - if(PP.getWoodCuttingGatherInt() >= 500) + if(PP.getWoodCuttingXPInt() >= 500) radius++; - if(PP.getWoodCuttingGatherInt() >= 950) + if(PP.getWoodCuttingXPInt() >= 950) radius++; ArrayList blocklist = new ArrayList(); ArrayList toAdd = new ArrayList(); diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index 584961175..3dee3a60b 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.9.27 \ No newline at end of file +version: 0.9.30 WIP \ No newline at end of file