diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index d643fd911..fa9f7f91b 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,35 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# + +Version 0.9.25 +Fixed issue with anti-exploits and Herbalism +MySpawn works like a hearthstone now, no inv pentality, 1hr cooldown +Added Green Terra Ability to Herbalism +Added Green Thumb ability to Herbalism +Fixed Repair not working for Iron Tools +Fixed bug where Axes Ability checked for Unarmed Ability Permission +Added Cocoa Beans to Excavation XP/Loot Tables, Found in Grass/Dirt +Using Super Breaker on Obsidian significantly damages it compared to other materials +Added Obsidian to Mining XP Table/Super Breaker +Added Pumpkins/Reeds/Cactus to Herbalism XP Tables/Double Drops +Corrected "mcMMMO" to "mcMMO" in MOTD + +Version 0.9.24 +PLAYER_BED_ENTER removed due to its unusual issues +Added info about the Wiki to the motd +/mcrefresh will reset if you were recently hurt (Chimaera Wing/HP Regen) +Fixed Armor Repair not adding XP +Boosted Repair XP of Armor to match Tools +Repairing Armor won't trigger Super Repair twice anymore +Setting your MySpawn now just requires right clicking a bed (still requires the setmyspawn permission node) + +Version 0.9.23 +Players will now announce ability usage within a short distance to nearby players +Chimaera Wing now takes the world into account +Acrobatics won't give XP on death, and will fail if you would've died after the damage reduction +Added yet another check to see if a Player is not in the Users system for NPC mod compatibility + + Version 0.9.22 Fixed bug where chimaera wing was unusable after being hurt even after the cooldown diff --git a/mcMMO/com/gmail/nossr50/Tree.java b/mcMMO/com/gmail/nossr50/Tree.java new file mode 100644 index 000000000..6cfe8324a --- /dev/null +++ b/mcMMO/com/gmail/nossr50/Tree.java @@ -0,0 +1,26 @@ +package com.gmail.nossr50; + +import java.util.ArrayList; + +import org.bukkit.entity.Player; + +public class Tree { + + TreeNode root; + + public Tree(){} + + public void add(Player p, int in ) + { + if(root == null) + root = new TreeNode(p, in); + else + root.add(p,in); + } + + public Player[] inOrder() + { + return (Player[]) root.inOrder(new ArrayList()).toArray(); + } + +} diff --git a/mcMMO/com/gmail/nossr50/TreeNode.java b/mcMMO/com/gmail/nossr50/TreeNode.java new file mode 100644 index 000000000..71f9cf882 --- /dev/null +++ b/mcMMO/com/gmail/nossr50/TreeNode.java @@ -0,0 +1,44 @@ +package com.gmail.nossr50; + +import java.util.ArrayList; + +import org.bukkit.entity.Player; + +public class TreeNode { + TreeNode left = null + , right = null; + Player player; + int stat; + + public TreeNode(Player p, int in) {stat = in; player = p;} + + public void add (Player p, int in) { + if (in <= stat) + { + if (left == null) + left = new TreeNode(p,in); + else + left.add(p, in); + } + else if(in > stat) + { + if (right == null) + right = new TreeNode(p,in); + else + right.add(p, in); + } + } + + public ArrayList inOrder(ArrayList a) + { + if(left != null) + a = left.inOrder(a); + + a.add(player); + + if(right != null) + a = right.inOrder(a); + + return a; + } +} diff --git a/mcMMO/com/gmail/nossr50/mcAcrobatics.java b/mcMMO/com/gmail/nossr50/mcAcrobatics.java index d483ff277..e53f0e731 100644 --- a/mcMMO/com/gmail/nossr50/mcAcrobatics.java +++ b/mcMMO/com/gmail/nossr50/mcAcrobatics.java @@ -5,6 +5,8 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcAcrobatics { private static volatile mcAcrobatics instance; @@ -16,7 +18,8 @@ public class mcAcrobatics { } public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){ if(player != null && mcPermissions.getInstance().acrobatics(player)){ - int acrovar = mcUsers.getProfile(player).getAcrobaticsInt(); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + int acrovar = PP.getAcrobaticsInt(); if(player.isSneaking()) acrovar = acrovar * 2; if(Math.random() * 1000 <= acrovar){ @@ -26,19 +29,24 @@ public class mcAcrobatics { int newDamage = event.getDamage() - threshold; if(newDamage < 0) newDamage = 0; - if(!event.isCancelled()) - mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); - mcSkills.getInstance().XpCheck(player); - event.setDamage(newDamage); - if(event.getDamage() <= 0) - event.setCancelled(true); - if(player.isSneaking()){ - player.sendMessage(ChatColor.GREEN+"**GRACEFUL ROLL**"); - } else { - player.sendMessage("**ROLL**"); + /* + * Check for death + */ + if(player.getHealth() - newDamage >= 1){ + if(!event.isCancelled()) + PP.addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); + mcSkills.getInstance().XpCheck(player); + event.setDamage(newDamage); + if(event.getDamage() <= 0) + event.setCancelled(true); + if(player.isSneaking()){ + player.sendMessage(ChatColor.GREEN+"**GRACEFUL ROLL**"); + } else { + player.sendMessage("**ROLL**"); + } } } else if (!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) && !event.isCancelled()){ - mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier); + PP.addAcrobaticsGather((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 8f989a6dd..cdd706f48 100644 --- a/mcMMO/com/gmail/nossr50/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java @@ -43,14 +43,27 @@ public class mcBlockListener extends BlockListener { public void onBlockBreak(BlockBreakEvent event) { Player player = event.getPlayer(); - PlayerProfile PP = mcUsers.getProfile(player); + PlayerProfile PP = mcUsers.getProfile(player.getName()); Block block = event.getBlock(); ItemStack inhand = player.getItemInHand(); if(event.isCancelled()) return; if (event instanceof FakeBlockBreakEvent) return; + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(player); + /* + * HERBALISM + */ + if(mcPermissions.getInstance().herbalismAbility(player)&& PP.getGreenTerraMode() && block.getTypeId() == 59 && block.getData() == (byte) 0x07){ + mcHerbalism.getInstance().greenTerraCheck(player, block, plugin); + mcHerbalism.getInstance().greenTerraWheat(player, block, event); + } + + /* * MINING */ @@ -89,11 +102,7 @@ public class mcBlockListener extends BlockListener { && PP.getTreeFellerMode() && block.getTypeId() == 17 && mcm.getInstance().blockBreakSimulate(block, player, plugin)){ - /* - * Check if the Timer is doing its job - */ - mcSkills.getInstance().monitorSkills(player); - + mcWoodCutting.getInstance().treeFeller(block, player); for(Block blockx : mcConfig.getInstance().getTreeFeller()){ if(blockx != null){ @@ -132,8 +141,11 @@ public class mcBlockListener extends BlockListener { /* * HERBALISM */ - if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5) - mcHerbalism.getInstance().herbalismProcCheck(block, player); + if(mcPermissions.getInstance().herbalism(player) && mcHerbalism.getInstance().canBeGreenTerra(block)){ + mcHerbalism.getInstance().greenTerraCheck(player, block, plugin); + if(block.getData() != (byte) 5) + mcHerbalism.getInstance().herbalismProcCheck(block, player, event); + } //Change the byte back when broken if(block.getData() == 5) block.setData((byte) 0); @@ -142,20 +154,33 @@ public class mcBlockListener extends BlockListener { if(event.isCancelled()) return; Player player = event.getPlayer(); - PlayerProfile PP = mcUsers.getProfile(player); + PlayerProfile PP = mcUsers.getProfile(player.getName()); ItemStack inhand = player.getItemInHand(); Block block = event.getBlock(); + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(player); /* * ABILITY PREPARATION CHECKS */ + if(PP.getHoePreparationMode() && mcHerbalism.getInstance().canBeGreenTerra(block)) + mcHerbalism.getInstance().greenTerraCheck(player, block, plugin); if(PP.getAxePreparationMode() && block.getTypeId() == 17) - mcWoodCutting.getInstance().treeFellerCheck(player, block); + mcWoodCutting.getInstance().treeFellerCheck(player, block, plugin); if(PP.getPickaxePreparationMode()) - mcMining.getInstance().superBreakerCheck(player, block); + mcMining.getInstance().superBreakerCheck(player, block, plugin); if(PP.getShovelPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block)) - mcExcavation.getInstance().gigaDrillBreakerActivationCheck(player, block); + mcExcavation.getInstance().gigaDrillBreakerActivationCheck(player, block, plugin); if(PP.getFistsPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block)) - mcSkills.getInstance().berserkActivationCheck(player); + mcSkills.getInstance().berserkActivationCheck(player, plugin); + /* + * GREEN TERRA STUFF + */ + if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player) && PP.getGreenTerraMode()){ + mcHerbalism.getInstance().greenTerra(player, block); + } + /* * GIGA DRILL BREAKER CHECKS */ @@ -163,10 +188,6 @@ public class mcBlockListener extends BlockListener { && mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcExcavation.getInstance().canBeGigaDrillBroken(block) && mcm.getInstance().isShovel(inhand)){ - /* - * Check if the Timer is doing its job - */ - mcSkills.getInstance().monitorSkills(player); if(mcm.getInstance().getTier(player) >= 2) mcExcavation.getInstance().excavationProcCheck(block, player); @@ -191,10 +212,6 @@ public class mcBlockListener extends BlockListener { && mcm.getInstance().blockBreakSimulate(block, player, plugin) && player.getItemInHand().getTypeId() == 0 && mcExcavation.getInstance().canBeGigaDrillBroken(block)){ - /* - * Check if the Timer is doing its job - */ - mcSkills.getInstance().monitorSkills(player); Material mat = Material.getMaterial(block.getTypeId()); if(block.getTypeId() == 2) mat = Material.DIRT; @@ -210,10 +227,6 @@ public class mcBlockListener extends BlockListener { if(PP.getSuperBreakerMode() && mcMining.getInstance().canBeSuperBroken(block) && mcm.getInstance().blockBreakSimulate(block, player, plugin)){ - /* - * Check if the Timer is doing its job - */ - mcSkills.getInstance().monitorSkills(player); if(mcLoadProperties.miningrequirespickaxe){ if(mcm.getInstance().isMiningPick(inhand)) diff --git a/mcMMO/com/gmail/nossr50/mcCombat.java b/mcMMO/com/gmail/nossr50/mcCombat.java index d719d7bed..b5b9bcfc1 100644 --- a/mcMMO/com/gmail/nossr50/mcCombat.java +++ b/mcMMO/com/gmail/nossr50/mcCombat.java @@ -18,6 +18,8 @@ import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcCombat { private static mcMMO plugin; @@ -37,13 +39,16 @@ public class mcCombat { event.setCancelled(true); return; } + PlayerProfile PPa = mcUsers.getProfile(attacker.getName()); Player defender = (Player)x; + PlayerProfile PPd = mcUsers.getProfile(defender.getName()); + /* * COMPATABILITY CHECKS (Stuff that wouldn't happen normally in MC basically...) */ - if(mcUsers.getProfile(defender) == null) + if(mcUsers.getProfile(defender.getName()) == null) mcUsers.addUser(defender); - if(attacker != null && defender != null && mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){ + if(attacker != null && defender != null && mcUsers.getProfile(attacker.getName()).inParty() && mcUsers.getProfile(defender.getName()).inParty()){ if(mcParty.getInstance().inSameParty(defender, attacker)){ event.setCancelled(true); return; @@ -60,9 +65,9 @@ public class mcCombat { //Bonus just for having unarmed int bonus = 2; - if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) + if (PPa.getUnarmedInt() >= 250) bonus++; - if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) + if (PPa.getUnarmedInt() >= 500) bonus++; event.setDamage(calculateDamage(event, bonus)); @@ -85,14 +90,14 @@ public class mcCombat { * PVP XP */ if(attacker != null && defender != null && mcLoadProperties.pvpxp){ - if(mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty() && mcParty.getInstance().inSameParty(attacker, defender)) + if(PPd.inParty() && PPa.inParty() && mcParty.getInstance().inSameParty(attacker, defender)) return; if(mcm.getInstance().isAxes(attacker.getItemInHand())) - mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); + PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); if(mcm.getInstance().isSwords(attacker.getItemInHand())) - mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); + PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); if(attacker.getItemInHand().getTypeId() == 0) - mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); + PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); } /* * CHECK FOR LEVEL UPS @@ -101,23 +106,24 @@ public class mcCombat { } } public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ + PlayerProfile PPa = mcUsers.getProfile(attacker.getName()); if(x instanceof Squid){ if(!mcConfig.getInstance().isBleedTracked(x)){ bleedCheck(attacker, x); } Squid defender = (Squid)event.getEntity(); if(mcm.getInstance().isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){ - mcUsers.getProfile(attacker).addSwordsGather(10 * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsGather(10 * mcLoadProperties.xpGainMultiplier); } mcSkills.getInstance().XpCheck(attacker); if(mcm.getInstance().isAxes(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().axes(attacker)){ - mcUsers.getProfile(attacker).addAxesGather(10 * mcLoadProperties.xpGainMultiplier); + PPa.addAxesGather(10 * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(attacker); } if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ - if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ + if(PPa.getAxesInt() >= 500){ event.setDamage(calculateDamage(event, 4)); } } @@ -130,21 +136,22 @@ public class mcCombat { //Bonus just for having unarmed int bonus = 2; - if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) + if (PPa.getUnarmedInt() >= 250) bonus++; - if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) + if (PPa.getUnarmedInt() >= 500) bonus++; event.setDamage(calculateDamage(event, bonus)); //XP if(defender.getHealth() != 0){ - mcUsers.getProfile(attacker).addUnarmedGather(10 * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedGather(10 * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(attacker); } } } } public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){ + PlayerProfile PPa = mcUsers.getProfile(attacker.getName()); if(x instanceof Animals){ if(!mcConfig.getInstance().isBleedTracked(x)){ bleedCheck(attacker, x); @@ -153,22 +160,23 @@ public class mcCombat { if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(defender.getHealth() <= 0) return; - if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ + if(PPa.getAxesInt() >= 500){ event.setDamage(calculateDamage(event, 4)); } } if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ //Bonus just for having unarmed int bonus = 2; - if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) + if (PPa.getUnarmedInt() >= 250) bonus++; - if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) + if (PPa.getUnarmedInt() >= 500) bonus++; event.setDamage(calculateDamage(event, bonus)); } } } public void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ + PlayerProfile PPa = mcUsers.getProfile(attacker.getName()); if(x instanceof Monster){ /* * AXE PROC CHECKS @@ -183,15 +191,15 @@ public class mcCombat { && mcPermissions.getInstance().swords(attacker)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(x instanceof Creeper) - mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); if(x instanceof Spider) - mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof Zombie) - mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); } mcSkills.getInstance().XpCheck(attacker); } @@ -200,15 +208,15 @@ public class mcCombat { && mcPermissions.getInstance().axes(attacker)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(x instanceof Creeper) - mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); if(x instanceof Spider) - mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof Zombie) - mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); } mcSkills.getInstance().XpCheck(attacker); } @@ -216,7 +224,7 @@ public class mcCombat { * AXE DAMAGE SCALING && LOOT CHECKS */ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ - if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ + if(PPa.getAxesInt() >= 500){ event.setDamage(calculateDamage(event, 4)); } } @@ -226,24 +234,24 @@ public class mcCombat { //Bonus just for having unarmed int bonus = 2; - if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) + if (PPa.getUnarmedInt() >= 250) bonus++; - if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) + if (PPa.getUnarmedInt() >= 500) bonus++; event.setDamage(calculateDamage(event, bonus)); //XP if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(x instanceof Creeper) - mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); if(x instanceof Spider) - mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof Zombie) - mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); } mcSkills.getInstance().XpCheck(attacker); } @@ -254,16 +262,17 @@ public class mcCombat { Entity x = event.getEntity(); if(event.getProjectile().toString().equals("CraftArrow") && x instanceof Player){ Player defender = (Player)x; - if(mcUsers.getProfile(defender) == null) + PlayerProfile PPd = mcUsers.getProfile(defender.getName()); + if(PPd == null) mcUsers.addUser(defender); if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){ - if(defender != null && mcUsers.getProfile(defender).getUnarmedInt() >= 1000){ + if(defender != null && PPd.getUnarmedInt() >= 1000){ if(Math.random() * 1000 <= 500){ event.setCancelled(true); defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**"); return; } - } else if(defender != null && Math.random() * 1000 <= (mcUsers.getProfile(defender).getUnarmedInt() / 2)){ + } else if(defender != null && Math.random() * 1000 <= (PPd.getUnarmedInt() / 2)){ event.setCancelled(true); defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**"); return; @@ -275,18 +284,19 @@ public class mcCombat { */ if(y instanceof Player){ Player attacker = (Player)y; + PlayerProfile PPa = mcUsers.getProfile(attacker.getName()); if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){ if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){ mcConfig.getInstance().addArrowTrack(x, 0); if(attacker != null){ - if(Math.random() * 1000 <= mcUsers.getProfile(attacker).getArcheryInt()){ + if(Math.random() * 1000 <= PPa.getArcheryInt()){ mcConfig.getInstance().addArrowCount(x, 1); } } } else { if(event.getDamage() > 0){ if(attacker != null){ - if(Math.random() * 1000 <= mcUsers.getProfile(attacker).getArcheryInt()){ + if(Math.random() * 1000 <= PPa.getArcheryInt()){ mcConfig.getInstance().addArrowCount(x, 1); } } @@ -297,16 +307,16 @@ public class mcCombat { */ if(Math.random() * 100 >= 75){ - int ignition = 20; - if(mcUsers.getProfile(attacker).getArcheryInt() >= 200) + int ignition = 20; + if(PPa.getArcheryInt() >= 200) ignition+=20; - if(mcUsers.getProfile(attacker).getArcheryInt() >= 400) + if(PPa.getArcheryInt() >= 400) ignition+=20; - if(mcUsers.getProfile(attacker).getArcheryInt() >= 600) + if(PPa.getArcheryInt() >= 600) ignition+=20; - if(mcUsers.getProfile(attacker).getArcheryInt() >= 800) + if(PPa.getArcheryInt() >= 800) ignition+=20; - if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) + if(PPa.getArcheryInt() >= 1000) ignition+=20; if(x instanceof Player){ @@ -328,58 +338,58 @@ public class mcCombat { /* * TRACK ARROWS USED AGAINST THE ENTITY */ - if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) + if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250) event.setDamage(calculateDamage(event, 1)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) + if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575) event.setDamage(calculateDamage(event, 2)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) + if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725) event.setDamage(calculateDamage(event, 3)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) + if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000) event.setDamage(calculateDamage(event, 4)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) + if(PPa.getArcheryInt() >= 1000) event.setDamage(calculateDamage(event, 5)); //XP if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(x instanceof Creeper) - mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); if(x instanceof Spider) - mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); if(x instanceof Skeleton) - mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof Zombie) - mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); + PPa.addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); if(x instanceof PigZombie) - mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - } + PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); } + } /* * Defender is Animals */ if(x instanceof Animals){ - if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) + if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250) event.setDamage(calculateDamage(event, 1)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) + if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575) event.setDamage(calculateDamage(event, 2)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) + if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725) event.setDamage(calculateDamage(event, 3)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) + if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000) event.setDamage(calculateDamage(event, 4)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) + if(PPa.getArcheryInt() >= 1000) event.setDamage(calculateDamage(event, 5)); } /* * Defender is Squid */ if(x instanceof Squid){ - if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) + if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250) event.setDamage(calculateDamage(event, 1)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) + if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575) event.setDamage(calculateDamage(event, 2)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) + if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725) event.setDamage(calculateDamage(event, 3)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) + if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000) event.setDamage(calculateDamage(event, 4)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) + if(PPa.getArcheryInt() >= 1000) event.setDamage(calculateDamage(event, 5)); } /* @@ -391,10 +401,11 @@ public class mcCombat { return; } Player defender = (Player)x; + PlayerProfile PPd = mcUsers.getProfile(defender.getName()); /* * Stuff for the daze proc */ - if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){ + if(PPa.inParty() && PPd.inParty()){ if(mcParty.getInstance().inSameParty(defender, attacker)){ event.setCancelled(true); return; @@ -404,7 +415,7 @@ public class mcCombat { * PVP XP */ if(mcLoadProperties.pvpxp && !mcParty.getInstance().inSameParty(attacker, defender)){ - mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); + PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); } /* * DAZE PROC @@ -415,27 +426,27 @@ public class mcCombat { } else { loc.setPitch(-90); } - if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000){ + if(PPa.getArcheryInt() >= 1000){ if(Math.random() * 1000 <= 500){ defender.teleportTo(loc); defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); } - } else if(Math.random() * 2000 <= mcUsers.getProfile(attacker).getArcheryInt()){ + } else if(Math.random() * 2000 <= PPa.getArcheryInt()){ defender.teleportTo(loc); defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); } - if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) + if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250) event.setDamage(calculateDamage(event, 1)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) + if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575) event.setDamage(calculateDamage(event, 2)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) + if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725) event.setDamage(calculateDamage(event, 3)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) + if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000) event.setDamage(calculateDamage(event, 4)); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) + if(PPa.getArcheryInt() >= 1000) event.setDamage(calculateDamage(event, 5)); } } @@ -443,35 +454,37 @@ public class mcCombat { } } public boolean simulateUnarmedProc(Player player){ - if(mcUsers.getProfile(player).getUnarmedInt() >= 1000){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); + if(PP.getUnarmedInt() >= 1000){ if(Math.random() * 4000 <= 1000){ return true; } } else { - if(Math.random() * 4000 <= mcUsers.getProfile(player).getUnarmedInt()){ + if(Math.random() * 4000 <= PP.getUnarmedInt()){ return true; } } return false; } public void bleedCheck(Player attacker, Entity x){ + PlayerProfile PPa = mcUsers.getProfile(attacker.getName()); if(mcPermissions.getInstance().swords(attacker) && mcm.getInstance().isSwords(attacker.getItemInHand())){ - if(mcUsers.getProfile(attacker).getSwordsInt() >= 750){ + if(PPa.getSwordsInt() >= 750){ if(Math.random() * 1000 >= 750){ if(!(x instanceof Player)) mcConfig.getInstance().addToBleedQue(x); if(x instanceof Player){ Player target = (Player)x; - mcUsers.getProfile(target).addBleedTicks(3); + mcUsers.getProfile(target.getName()).addBleedTicks(3); } attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**"); } - } else if (Math.random() * 1000 <= mcUsers.getProfile(attacker).getSwordsInt()){ + } else if (Math.random() * 1000 <= PPa.getSwordsInt()){ if(!(x instanceof Player)) mcConfig.getInstance().addToBleedQue(x); if(x instanceof Player){ Player target = (Player)x; - mcUsers.getProfile(target).addBleedTicks(2); + mcUsers.getProfile(target.getName()).addBleedTicks(2); } attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**"); } @@ -534,7 +547,7 @@ public class mcCombat { if(!target.getName().equals(attacker.getName()) && targets >= 1){ target.damage(event.getDamage() / 4); target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!"); - mcUsers.getProfile(target).addBleedTicks(5); + mcUsers.getProfile(target.getName()).addBleedTicks(5); targets--; } } @@ -560,8 +573,9 @@ public class mcCombat { } } public void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){ + PlayerProfile PPa = mcUsers.getProfile(attacker.getName()); if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ - if(mcUsers.getProfile(attacker).getAxesInt() >= 750){ + if(PPa.getAxesInt() >= 750){ if(Math.random() * 1000 <= 750){ if(x instanceof Player){ Player player = (Player)x; @@ -574,7 +588,7 @@ public class mcCombat { } attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } - } else if(Math.random() * 1000 <= mcUsers.getProfile(attacker).getAxesInt()){ + } else if(Math.random() * 1000 <= PPa.getAxesInt()){ if(x instanceof Player){ Player player = (Player)x; player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); @@ -589,9 +603,10 @@ public class mcCombat { } } public void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){ + PlayerProfile PPd = mcUsers.getProfile(defender.getName()); if(defender != null && mcm.getInstance().isSwords(defender.getItemInHand()) && mcPermissions.getInstance().swords(defender)){ - if(mcUsers.getProfile(defender).getSwordsInt() >= 900){ + if(PPd.getSwordsInt() >= 900){ if(Math.random() * 3000 <= 900){ event.setCancelled(true); defender.sendMessage(ChatColor.GREEN+"**PARRIED**"); @@ -602,7 +617,7 @@ public class mcCombat { } } } else { - if(Math.random() * 3000 <= mcUsers.getProfile(defender).getSwordsInt()){ + if(Math.random() * 3000 <= PPd.getSwordsInt()){ event.setCancelled(true); defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*"); defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1)); diff --git a/mcMMO/com/gmail/nossr50/mcEntityListener.java b/mcMMO/com/gmail/nossr50/mcEntityListener.java index 080d838b5..ce6cc0579 100644 --- a/mcMMO/com/gmail/nossr50/mcEntityListener.java +++ b/mcMMO/com/gmail/nossr50/mcEntityListener.java @@ -5,12 +5,9 @@ import net.minecraft.server.EntityLiving; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.entity.Animals; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; -import org.bukkit.entity.Monster; 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; @@ -19,7 +16,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityListener; import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; +import com.gmail.nossr50.PlayerList.PlayerProfile; public class mcEntityListener extends EntityListener { @@ -84,8 +81,11 @@ public class mcEntityListener extends EntityListener { */ if(e instanceof Player){ Player defender = (Player)e; + PlayerProfile PPd = mcUsers.getProfile(defender.getName()); if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName())) event.setCancelled(true); + if(PPd == null) + mcUsers.addUser(defender); /* * PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT */ @@ -113,19 +113,25 @@ public class mcEntityListener extends EntityListener { //((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!"); int typeid = ((Player) f).getItemInHand().getTypeId(); Player attacker = (Player)f; + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(attacker); + + PlayerProfile PPa = mcUsers.getProfile(attacker.getName()); /* * ACTIVATE ABILITIES */ - if(mcUsers.getProfile(attacker).getAxePreparationMode()) - mcSkills.getInstance().skullSplitterCheck(attacker); - if(mcUsers.getProfile(attacker).getSwordsPreparationMode()) - mcSkills.getInstance().serratedStrikesActivationCheck(attacker); - if(mcUsers.getProfile(attacker).getFistsPreparationMode()) - mcSkills.getInstance().berserkActivationCheck(attacker); + if(PPa.getAxePreparationMode()) + mcSkills.getInstance().skullSplitterCheck(attacker, plugin); + if(PPa.getSwordsPreparationMode()) + mcSkills.getInstance().serratedStrikesActivationCheck(attacker, plugin); + if(PPa.getFistsPreparationMode()) + mcSkills.getInstance().berserkActivationCheck(attacker, plugin); /* * BERSERK DAMAGE MODIFIER */ - if(mcUsers.getProfile(attacker).getBerserkMode()) + if(PPa.getBerserkMode()) event.setDamage(event.getDamage() + (event.getDamage() / 2)); /* * Player versus Monster checks, this handles all skill damage modifiers and any procs. @@ -148,18 +154,10 @@ public class mcEntityListener extends EntityListener { * This will do AOE damage from the axes ability */ - if(!event.isCancelled() && mcUsers.getProfile(attacker).getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand())){ - /* - * Check if the Timer is doing its job - */ - mcSkills.getInstance().monitorSkills(attacker); + if(!event.isCancelled() && PPa.getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand())){ mcCombat.getInstance().applyAoeDamage(attacker, eventb, x); } - if(!event.isCancelled() && mcUsers.getProfile(attacker).getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand())){ - /* - * Check if the Timer is doing its job - */ - mcSkills.getInstance().monitorSkills(attacker); + if(!event.isCancelled() && PPa.getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand())){ mcCombat.getInstance().applySerratedStrikes(attacker, eventb, x); } } @@ -168,6 +166,7 @@ public class mcEntityListener extends EntityListener { */ if(e instanceof Player){ Player defender = (Player)e; + PlayerProfile PPd = mcUsers.getProfile(defender.getName()); if(f instanceof Player){ Player attacker = (Player)f; if(mcParty.getInstance().inSameParty(defender, attacker)){ @@ -188,14 +187,14 @@ public class mcEntityListener extends EntityListener { } if(isArrow == false){ //defender.sendMessage("isArrow ="+isArrow); - if(mcUsers.getProfile(defender).getSwordsInt() >= 600){ + if(PPd.getSwordsInt() >= 600){ if(Math.random() * 2000 <= 600){ mcCombat.getInstance().dealDamage(f, event.getDamage() / 2); defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**"); if(f instanceof Player) ((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!"); } - } else if (Math.random() * 2000 <= mcUsers.getProfile(defender).getSwordsInt()){ + } else if (Math.random() * 2000 <= PPd.getSwordsInt()){ mcCombat.getInstance().dealDamage(f, event.getDamage() / 2); defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**"); if(f instanceof Player) @@ -207,10 +206,10 @@ public class mcEntityListener extends EntityListener { * DODGE STUFF */ if(mcPermissions.getInstance().acrobatics(defender)){ - if(mcUsers.getProfile(defender).getAcrobaticsInt() <= 800){ - if(Math.random() * 4000 <= mcUsers.getProfile(defender).getAcrobaticsInt()){ + if(PPd.getAcrobaticsInt() <= 800){ + if(Math.random() * 4000 <= PPd.getAcrobaticsInt()){ defender.sendMessage(ChatColor.GREEN+"**DODGE**"); - mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12); + PPd.addAcrobaticsGather(event.getDamage() * 12); mcSkills.getInstance().XpCheck(defender); event.setDamage(event.getDamage() / 2); //Needs to do minimal damage @@ -219,7 +218,7 @@ public class mcEntityListener extends EntityListener { } } else if(Math.random() * 4000 <= 800) { defender.sendMessage(ChatColor.GREEN+"**DODGE**"); - mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12); + PPd.addAcrobaticsGather(event.getDamage() * 12); mcSkills.getInstance().XpCheck(defender); event.setDamage(event.getDamage() / 2); //Needs to do minimal damage @@ -235,7 +234,7 @@ public class mcEntityListener extends EntityListener { */ if(x instanceof Player && !event.isCancelled()){ Player herpderp = (Player)x; - mcUsers.getProfile(herpderp).setRecentlyHurt(System.currentTimeMillis()); + mcUsers.getProfile(herpderp.getName()).setRecentlyHurt(System.currentTimeMillis()); } } } @@ -255,7 +254,7 @@ public class mcEntityListener extends EntityListener { } if(x instanceof Player){ Player player = (Player)x; - mcUsers.getProfile(player).setBleedTicks(0); + mcUsers.getProfile(player.getName()).setBleedTicks(0); } } public boolean isPlayer(Entity entity){ diff --git a/mcMMO/com/gmail/nossr50/mcExcavation.java b/mcMMO/com/gmail/nossr50/mcExcavation.java index 63777308b..e3f56705f 100644 --- a/mcMMO/com/gmail/nossr50/mcExcavation.java +++ b/mcMMO/com/gmail/nossr50/mcExcavation.java @@ -6,6 +6,9 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +import com.gmail.nossr50.PlayerList.PlayerProfile; public class mcExcavation { @@ -20,27 +23,32 @@ public class mcExcavation { } return instance; } - public void gigaDrillBreakerActivationCheck(Player player, Block block){ + public void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(mcm.getInstance().isShovel(player.getItemInHand())){ if(block != null){ if(!mcm.getInstance().abilityBlockCheck(block)) return; } - if(mcUsers.getProfile(player).getShovelPreparationMode()){ - mcUsers.getProfile(player).setShovelPreparationMode(false); + if(PP.getShovelPreparationMode()){ + PP.setShovelPreparationMode(false); } int ticks = 2; - int x = mcUsers.getProfile(player).getExcavationInt(); + int x = PP.getExcavationInt(); while(x >= 50){ x-=50; ticks++; } - if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){ + if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**"); - mcUsers.getProfile(player).setGigaDrillBreakerTicks(ticks * 1000); - mcUsers.getProfile(player).setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis()); - mcUsers.getProfile(player).setGigaDrillBreakerMode(true); + for(Player y : pluginx.getServer().getOnlinePlayers()){ + if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10) + y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Giga Drill Breaker!"); + } + PP.setGigaDrillBreakerTicks(ticks * 1000); + PP.setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis()); + PP.setGigaDrillBreakerMode(true); } } @@ -54,6 +62,7 @@ public class mcExcavation { } } public void excavationProcCheck(Block block, Player player){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); int type = block.getTypeId(); Location loc = block.getLocation(); ItemStack is = null; @@ -62,17 +71,17 @@ public class mcExcavation { return; } if(type == 2){ - if(mcUsers.getProfile(player).getExcavationInt() > 250){ + if(PP.getExcavationInt() > 250){ //CHANCE TO GET EGGS if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){ - mcUsers.getProfile(player).addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationGather(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){ - mcUsers.getProfile(player).addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(260); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -81,39 +90,39 @@ public class mcExcavation { } //DIRT SAND OR GRAVEL if(type == 3 || type == 13 || type == 2 || type == 12){ - mcUsers.getProfile(player).addExcavationGather(4 * mcLoadProperties.xpGainMultiplier); - if(mcUsers.getProfile(player).getExcavationInt() > 750){ + PP.addExcavationGather(4 * mcLoadProperties.xpGainMultiplier); + if(PP.getExcavationInt() > 750){ //CHANCE TO GET CAKE if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){ - mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(354); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } - if(mcUsers.getProfile(player).getExcavationInt() > 350){ + if(PP.getExcavationInt() > 350){ //CHANCE TO GET DIAMOND if(mcLoadProperties.diamond == true && Math.random() * 750 > 749){ - mcUsers.getProfile(player).addExcavationGather(100 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationGather(100 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(264); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } - if(mcUsers.getProfile(player).getExcavationInt() > 250){ + if(PP.getExcavationInt() > 250){ //CHANCE TO GET YELLOW MUSIC if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){ - mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(2256); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } - if(mcUsers.getProfile(player).getExcavationInt() > 350){ + if(PP.getExcavationInt() > 350){ //CHANCE TO GET GREEN MUSIC if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){ - mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(2257); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -123,15 +132,15 @@ public class mcExcavation { //SAND if(type == 12){ //CHANCE TO GET GLOWSTONE - if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 50 && Math.random() * 100 > 95){ - mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); + if(mcLoadProperties.glowstone == true && PP.getExcavationInt() > 50 && Math.random() * 100 > 95){ + PP.addExcavationGather(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 && mcUsers.getProfile(player).getExcavationInt() > 650 && Math.random() * 200 > 199){ - mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); + if(mcLoadProperties.slowsand == true && PP.getExcavationInt() > 650 && Math.random() * 200 > 199){ + PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(88); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -139,9 +148,19 @@ public class mcExcavation { } //GRASS OR DIRT if(type == 2 || type == 3){ + if(PP.getExcavationInt() > 50){ + //CHANCE FOR COCOA BEANS + if(mcLoadProperties.eggs == true && Math.random() * 75 > 74){ + PP.addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); + mat = Material.getMaterial(351); + is = new ItemStack(mat, 1, (byte)0, (byte)0); + is.setDurability((byte) 3); //COCOA + loc.getWorld().dropItemNaturally(loc, is); + } + } //CHANCE FOR SHROOMS - if(mcLoadProperties.mushrooms == true && mcUsers.getProfile(player).getExcavationInt() > 500 && Math.random() * 200 > 199){ - mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); + if(mcLoadProperties.mushrooms == true && PP.getExcavationInt() > 500 && Math.random() * 200 > 199){ + PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); if(Math.random() * 10 > 5){ mat = Material.getMaterial(39); } else { @@ -151,8 +170,8 @@ public class mcExcavation { loc.getWorld().dropItemNaturally(loc, is); } //CHANCE TO GET GLOWSTONE - if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 25 && Math.random() * 100 > 95){ - mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); + if(mcLoadProperties.glowstone == true && PP.getExcavationInt() > 25 && Math.random() * 100 > 95){ + PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(348); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); @@ -161,25 +180,25 @@ public class mcExcavation { //GRAVEL if(type == 13){ //CHANCE TO GET NETHERRACK - if(mcLoadProperties.netherrack == true && mcUsers.getProfile(player).getExcavationInt() > 850 && Math.random() * 200 > 199){ - mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); + if(mcLoadProperties.netherrack == true && PP.getExcavationInt() > 850 && Math.random() * 200 > 199){ + PP.addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(87); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } //CHANCE TO GET SULPHUR - if(mcLoadProperties.sulphur == true && mcUsers.getProfile(player).getExcavationInt() > 75){ + if(mcLoadProperties.sulphur == true && PP.getExcavationInt() > 75){ if(Math.random() * 10 > 9){ - mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); mat = Material.getMaterial(289); is = new ItemStack(mat, 1, (byte)0, (byte)0); loc.getWorld().dropItemNaturally(loc, is); } } //CHANCE TO GET BONES - if(mcLoadProperties.bones == true && mcUsers.getProfile(player).getExcavationInt() > 175){ + if(mcLoadProperties.bones == true && PP.getExcavationInt() > 175){ if(Math.random() * 10 > 9){ - mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); + PP.addExcavationGather(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 864c223b2..0b6930de0 100644 --- a/mcMMO/com/gmail/nossr50/mcHerbalism.java +++ b/mcMMO/com/gmail/nossr50/mcHerbalism.java @@ -3,9 +3,14 @@ package com.gmail.nossr50; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.Player; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +import com.gmail.nossr50.PlayerList.PlayerProfile; public class mcHerbalism { @@ -20,7 +25,94 @@ public class mcHerbalism { } return instance; } - public void herbalismProcCheck(Block block, Player player){ + public void greenTerraWheat(Player player, Block block, BlockBreakEvent event){ + event.setCancelled(true); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + Material mat = Material.getMaterial(296); + Location loc = block.getLocation(); + ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0); + PP.addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier); + loc.getWorld().dropItemNaturally(loc, is); + herbalismProcCheck(block, player, event); + herbalismProcCheck(block, player, event); + block.setData((byte) 0x03); + } + public void greenTerra(Player player, Block block){ + if(!hasSeeds(player) && block.getType() != Material.WHEAT) + player.sendMessage("You need more seeds to spread Green Terra"); + if(hasSeeds(player) && block.getType() != Material.WHEAT){ + removeSeeds(player); + if(block.getType() == Material.DIRT) + block.setType(Material.GRASS); + if(block.getType() == Material.COBBLESTONE) + block.setType(Material.MOSSY_COBBLESTONE); + } + } + public Boolean canBeGreenTerra(Block block){ + int t = block.getTypeId(); + if(t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38){ + return true; + } else { + return false; + } + } + public boolean hasSeeds(Player player){ + ItemStack[] inventory = player.getInventory().getContents(); + for(ItemStack x : inventory){ + if(x != null && x.getTypeId() == 295){ + return true; + } + } + return false; + } + public void removeSeeds(Player player){ + ItemStack[] inventory = player.getInventory().getContents(); + for(ItemStack x : inventory){ + if(x != null && x.getTypeId() == 295){ + if(x.getAmount() == 1){ + x.setTypeId(0); + x.setAmount(0); + player.getInventory().setContents(inventory); + } else{ + x.setAmount(x.getAmount() - 1); + player.getInventory().setContents(inventory); + } + return; + } + } + } + public void greenTerraCheck(Player player, Block block, Plugin pluginx){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); + if(mcm.getInstance().isHoe(player.getItemInHand())){ + if(block != null){ + if(!mcm.getInstance().abilityBlockCheck(block)) + return; + } + if(PP.getHoePreparationMode()){ + PP.setHoePreparationMode(false); + } + int ticks = 2; + int x = PP.getHerbalismInt(); + while(x >= 50){ + x-=50; + ticks++; + } + + if(!PP.getGreenTerraMode() && PP.getGreenTerraCooldown() == 0){ + player.sendMessage(ChatColor.GREEN+"**GREEN TERRA ACTIVATED**"); + for(Player y : pluginx.getServer().getOnlinePlayers()){ + if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10) + y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Green Terra!"); + } + PP.setGreenTerraTicks(ticks * 1000); + PP.setGreenTerraActivatedTimeStamp(System.currentTimeMillis()); + PP.setGreenTerraMode(true); + } + + } + } + public void herbalismProcCheck(Block block, Player player, BlockBreakEvent event){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); int type = block.getTypeId(); Location loc = block.getLocation(); ItemStack is = null; @@ -32,80 +124,139 @@ public class mcHerbalism { if(type == 59 && block.getData() == (byte) 0x7){ mat = Material.getMaterial(296); is = new ItemStack(mat, 1, (byte)0, (byte)0); - mcUsers.getProfile(player).addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier); if(player != null){ - if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){ + if(Math.random() * 1000 <= PP.getHerbalismInt()){ loc.getWorld().dropItemNaturally(loc, is); } } + //GREEN THUMB + if(Math.random() * 1500 <= PP.getHerbalismInt()){ + event.setCancelled(true); + loc.getWorld().dropItemNaturally(loc, is); + //block.setType(Material.WHEAT); //Change broken block to wheat + block.setData((byte) 0x1); //Change it to first stage + + //Setup the bonuses + int bonus = 0; + if(PP.getHerbalismInt() >= 200) + bonus++; + if(PP.getHerbalismInt() >= 400) + bonus++; + if(PP.getHerbalismInt() >= 600) + bonus++; + + //Change wheat to be whatever stage based on the bonus + if(bonus == 1) + block.setData((byte) 0x2); + if(bonus == 2) + block.setData((byte) 0x3); + if(bonus == 3) + block.setData((byte) 0x4); + } } /* * We need to check not-wheat stuff for if it was placed by the player or not */ - if(!mcConfig.getInstance().isBlockWatched(block)){ + if(block.getData() != (byte) 5){ + //Cactus + if(type == 81){ + mat = Material.getMaterial(block.getTypeId()); + is = new ItemStack(mat, 1, (byte)0, (byte)0); + if(player != null){ + if(Math.random() * 1000 <= PP.getHerbalismInt()){ + loc.getWorld().dropItemNaturally(loc, is); + } + } + PP.addHerbalismGather(3 * mcLoadProperties.xpGainMultiplier); + } + //Sugar Canes + if(type == 83){ + mat = Material.getMaterial(block.getTypeId()); + is = new ItemStack(mat, 1, (byte)0, (byte)0); + if(player != null){ + if(Math.random() * 1000 <= PP.getHerbalismInt()){ + loc.getWorld().dropItemNaturally(loc, is); + } + } + PP.addHerbalismGather(3 * mcLoadProperties.xpGainMultiplier); + } + //Pumpkins + if(type == 91 || type == 86){ + mat = Material.getMaterial(block.getTypeId()); + is = new ItemStack(mat, 1, (byte)0, (byte)0); + if(player != null){ + if(Math.random() * 1000 <= PP.getHerbalismInt()){ + loc.getWorld().dropItemNaturally(loc, is); + } + } + PP.addHerbalismGather(55 * mcLoadProperties.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 <= mcUsers.getProfile(player).getHerbalismInt()){ + if(Math.random() * 1000 <= PP.getHerbalismInt()){ loc.getWorld().dropItemNaturally(loc, is); } } - mcUsers.getProfile(player).addHerbalismGather(40 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismGather(40 * mcLoadProperties.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 <= mcUsers.getProfile(player).getHerbalismInt()){ + if(Math.random() * 1000 <= PP.getHerbalismInt()){ loc.getWorld().dropItemNaturally(loc, is); } } - mcUsers.getProfile(player).addHerbalismGather(10 * mcLoadProperties.xpGainMultiplier); + PP.addHerbalismGather(10 * mcLoadProperties.xpGainMultiplier); } } mcSkills.getInstance().XpCheck(player); } public void breadCheck(Player player, ItemStack is){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(is.getTypeId() == 297){ - if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){ + if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){ player.setHealth(player.getHealth() + 1); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 250){ + } else if (PP.getHerbalismInt() >= 150 && PP.getHerbalismInt() < 250){ player.setHealth(player.getHealth() + 2); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 250 && mcUsers.getProfile(player).getHerbalismInt() < 350){ + } else if (PP.getHerbalismInt() >= 250 && PP.getHerbalismInt() < 350){ player.setHealth(player.getHealth() + 3); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 350 && mcUsers.getProfile(player).getHerbalismInt() < 450){ + } else if (PP.getHerbalismInt() >= 350 && PP.getHerbalismInt() < 450){ player.setHealth(player.getHealth() + 4); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 450 && mcUsers.getProfile(player).getHerbalismInt() < 550){ + } else if (PP.getHerbalismInt() >= 450 && PP.getHerbalismInt() < 550){ player.setHealth(player.getHealth() + 5); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 550 && mcUsers.getProfile(player).getHerbalismInt() < 650){ + } else if (PP.getHerbalismInt() >= 550 && PP.getHerbalismInt() < 650){ player.setHealth(player.getHealth() + 6); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 650 && mcUsers.getProfile(player).getHerbalismInt() < 750){ + } else if (PP.getHerbalismInt() >= 650 && PP.getHerbalismInt() < 750){ player.setHealth(player.getHealth() + 7); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 750){ + } else if (PP.getHerbalismInt() >= 750){ player.setHealth(player.getHealth() + 8); } } } public void stewCheck(Player player, ItemStack is){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(is.getTypeId() == 282){ - if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){ + if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){ player.setHealth(player.getHealth() + 1); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 250){ + } else if (PP.getHerbalismInt() >= 150 && PP.getHerbalismInt() < 250){ player.setHealth(player.getHealth() + 2); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 250 && mcUsers.getProfile(player).getHerbalismInt() < 350){ + } else if (PP.getHerbalismInt() >= 250 && PP.getHerbalismInt() < 350){ player.setHealth(player.getHealth() + 3); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 350 && mcUsers.getProfile(player).getHerbalismInt() < 450){ + } else if (PP.getHerbalismInt() >= 350 && PP.getHerbalismInt() < 450){ player.setHealth(player.getHealth() + 4); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 450 && mcUsers.getProfile(player).getHerbalismInt() < 550){ + } else if (PP.getHerbalismInt() >= 450 && PP.getHerbalismInt() < 550){ player.setHealth(player.getHealth() + 5); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 550 && mcUsers.getProfile(player).getHerbalismInt() < 650){ + } else if (PP.getHerbalismInt() >= 550 && PP.getHerbalismInt() < 650){ player.setHealth(player.getHealth() + 6); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 650 && mcUsers.getProfile(player).getHerbalismInt() < 750){ + } else if (PP.getHerbalismInt() >= 650 && PP.getHerbalismInt() < 750){ player.setHealth(player.getHealth() + 7); - } else if (mcUsers.getProfile(player).getHerbalismInt() >= 750){ + } else if (PP.getHerbalismInt() >= 750){ player.setHealth(player.getHealth() + 8); } } diff --git a/mcMMO/com/gmail/nossr50/mcItem.java b/mcMMO/com/gmail/nossr50/mcItem.java index d529a8cd0..7a1327361 100644 --- a/mcMMO/com/gmail/nossr50/mcItem.java +++ b/mcMMO/com/gmail/nossr50/mcItem.java @@ -1,10 +1,14 @@ package com.gmail.nossr50; import org.bukkit.ChatColor; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +import com.gmail.nossr50.PlayerList.PlayerProfile; public class mcItem { @@ -19,17 +23,18 @@ public class mcItem { } return instance; } - public void itemChecks(Player player){ + public void itemChecks(Player player, Plugin pluginx){ ItemStack inhand = player.getItemInHand(); if(inhand.getTypeId() == 288){ - chimaerawing(player); + chimaerawing(player, pluginx); } } - public void chimaerawing(Player player){ + public void chimaerawing(Player player, Plugin pluginx){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); ItemStack is = player.getItemInHand(); Block block = player.getLocation().getBlock(); if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){ - if(mcSkills.getInstance().cooldownOver(player, mcUsers.getProfile(player).getRecentlyHurt(), 60) && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){ + if(mcSkills.getInstance().cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){ Block derp = player.getLocation().getBlock(); int y = derp.getY(); ItemStack[] inventory = player.getInventory().getContents(); @@ -59,15 +64,21 @@ public class mcItem { } } } - if(mcUsers.getProfile(player).getMySpawn(player) != null){ - player.teleportTo(mcUsers.getProfile(player).getMySpawn(player)); + if(PP.getMySpawn(player) != null){ + Location mySpawn = PP.getMySpawn(player); + if(mySpawn != null && pluginx.getServer().getWorld(PP.getMySpawnWorld(pluginx)) != null) + mySpawn.setWorld(pluginx.getServer().getWorld(PP.getMySpawnWorld(pluginx))); + if(mySpawn != null){ + player.teleportTo(mySpawn);//Do it twice to prevent weird stuff + player.teleportTo(mySpawn); + } } else { player.teleportTo(player.getWorld().getSpawnLocation()); } player.sendMessage("**CHIMAERA WING**"); - } else if (!mcSkills.getInstance().cooldownOver(player, mcUsers.getProfile(player).getRecentlyHurt(), 60) && is.getAmount() >= 10) { + } else if (!mcSkills.getInstance().cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10) { player.sendMessage("You were injured recently and must wait to use this." - +ChatColor.YELLOW+" ("+mcSkills.getInstance().calculateTimeLeft(player, mcUsers.getProfile(player).getRecentlyHurt(), 60)+"s)"); + +ChatColor.YELLOW+" ("+mcSkills.getInstance().calculateTimeLeft(player, PP.getRecentlyHurt(), 60)+"s)"); } else if (is.getTypeId() == 288 && is.getAmount() <= 9){ player.sendMessage("You need more of that to use it"); } diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java index 89a846b16..6515ba57a 100644 --- a/mcMMO/com/gmail/nossr50/mcLoadProperties.java +++ b/mcMMO/com/gmail/nossr50/mcLoadProperties.java @@ -1,9 +1,9 @@ package com.gmail.nossr50; public class mcLoadProperties { - public static Boolean archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; + 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, 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, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public static void loadMain(){ String propertiesFile = mcMMO.maindirectory + "mcmmo.properties"; @@ -13,6 +13,7 @@ public class mcLoadProperties { /* * COOLDOWN CONTROL */ + greenTerraCooldown = properties.getInteger("greenTerraCooldown", 240); superBreakerCooldown = properties.getInteger("superBreakerCooldown", 240); gigaDrillBreakerCooldown = properties.getInteger("gigaDrillBreakerCooldown", 240); treeFellerCooldown = properties.getInteger("treeFellerCooldown", 240); @@ -58,6 +59,7 @@ public class mcLoadProperties { /* * EXCAVATION LOOT TOGGLES */ + cocoabeans = properties.getBoolean("canExcavateCocoaBeans", true); mushrooms = properties.getBoolean("canExcavateMushrooms", true); glowstone = properties.getBoolean("canExcavateGlowstone", true); pvp = properties.getBoolean("pvp", true); diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index dc676dd31..852ce6b9d 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -1,5 +1,6 @@ package com.gmail.nossr50; +import com.gmail.nossr50.PlayerList.PlayerProfile; import com.nijikokun.bukkit.Permissions.Permissions; import com.nijiko.Messaging; import com.nijiko.permissions.PermissionHandler; @@ -67,7 +68,6 @@ public class mcMMO extends JavaPlugin { mcUsers.addUser(player); } PluginManager pm = getServer().getPluginManager(); - pm.registerEvent(Event.Type.PLAYER_BED_ENTER, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this); @@ -105,8 +105,8 @@ public class mcMMO extends JavaPlugin { } } public boolean inSameParty(Player playera, Player playerb){ - if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){ - if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){ + if(mcUsers.getProfile(playera.getName()).inParty() && mcUsers.getProfile(playerb.getName()).inParty()){ + if(mcUsers.getProfile(playera.getName()).getParty().equals(mcUsers.getProfile(playerb.getName()).getParty())){ return true; } else { return false; @@ -116,10 +116,12 @@ public class mcMMO extends JavaPlugin { } } public void addXp(Player player, String skillname, Integer newvalue){ - mcUsers.getProfile(player).addXpToSkill(newvalue, skillname); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + PP.addXpToSkill(newvalue, skillname); } public void modifySkill(Player player, String skillname, Integer newvalue){ - mcUsers.getProfile(player).modifyskill(newvalue, skillname); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + PP.modifyskill(newvalue, skillname); } public ArrayList getParties(){ String location = "plugins/mcMMO/mcmmo.users"; @@ -147,10 +149,12 @@ public class mcMMO extends JavaPlugin { return parties; } public static String getPartyName(Player player){ - return mcUsers.getProfile(player).getParty(); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + return PP.getParty(); } public static boolean inParty(Player player){ - return mcUsers.getProfile(player).inParty(); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + return PP.inParty(); } public boolean isAdminChatToggled(Player player){ if(mcConfig.getInstance().isAdminToggled(player.getName())){ diff --git a/mcMMO/com/gmail/nossr50/mcMining.java b/mcMMO/com/gmail/nossr50/mcMining.java index a15eb9bf9..4663afdb8 100644 --- a/mcMMO/com/gmail/nossr50/mcMining.java +++ b/mcMMO/com/gmail/nossr50/mcMining.java @@ -6,6 +6,9 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +import com.gmail.nossr50.PlayerList.PlayerProfile; public class mcMining { @@ -21,27 +24,32 @@ public class mcMining { return instance; } - public void superBreakerCheck(Player player, Block block){ + public void superBreakerCheck(Player player, Block block, Plugin pluginx){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(mcm.getInstance().isMiningPick(player.getItemInHand())){ if(block != null){ if(!mcm.getInstance().abilityBlockCheck(block)) return; } - if(mcUsers.getProfile(player).getPickaxePreparationMode()){ - mcUsers.getProfile(player).setPickaxePreparationMode(false); + if(PP.getPickaxePreparationMode()){ + PP.setPickaxePreparationMode(false); } int ticks = 2; - int x = mcUsers.getProfile(player).getMiningInt(); + int x = PP.getMiningInt(); while(x >= 50){ x-=50; ticks++; } - if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ + if(!PP.getSuperBreakerMode() && PP.getSuperBreakerCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**"); - mcUsers.getProfile(player).setSuperBreakerTicks(ticks * 1000); - mcUsers.getProfile(player).setSuperBreakerActivatedTimeStamp(System.currentTimeMillis()); - mcUsers.getProfile(player).setSuperBreakerMode(true); + for(Player y : pluginx.getServer().getOnlinePlayers()){ + if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10) + y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Super Breaker!"); + } + PP.setSuperBreakerTicks(ticks * 1000); + PP.setSuperBreakerActivatedTimeStamp(System.currentTimeMillis()); + PP.setSuperBreakerMode(true); } } @@ -93,14 +101,16 @@ public class mcMining { } } public void blockProcCheck(Block block, Player player){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(player != null){ - if(Math.random() * 1000 <= mcUsers.getProfile(player).getMiningInt()){ + if(Math.random() * 1000 <= PP.getMiningInt()){ blockProcSimulate(block); return; } } } public void miningBlockCheck(Player player, Block block){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(mcConfig.getInstance().isBlockWatched(block) || block.getData() == (byte) 5) return; int xp = 0; @@ -108,6 +118,11 @@ public class mcMining { xp += 3; blockProcCheck(block, player); } + //OBSIDIAN + if(block.getTypeId() == 49){ + xp += 15; + blockProcCheck(block, player); + } //NETHERRACK if(block.getTypeId() == 87){ xp += 3; @@ -148,7 +163,7 @@ public class mcMining { xp += 40; blockProcCheck(block, player); } - mcUsers.getProfile(player).addMiningGather(xp * mcLoadProperties.xpGainMultiplier); + PP.addMiningGather(xp * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(player); } /* @@ -156,13 +171,14 @@ public class mcMining { */ public Boolean canBeSuperBroken(Block block){ int t = block.getTypeId(); - if(t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){ + if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){ return true; } else { return false; } } public void SuperBreakerBlockCheck(Player player, Block block){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(mcLoadProperties.toolsLoseDurabilityFromAbilities) mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss); Location loc = block.getLocation(); @@ -232,6 +248,20 @@ public class mcMining { loc.getWorld().dropItemNaturally(loc, item); block.setType(Material.AIR); } + //OBSIDIAN + if(block.getTypeId() == 49 && mcm.getInstance().getTier(player) >= 4){ + if(mcLoadProperties.toolsLoseDurabilityFromAbilities) + mcm.getInstance().damageTool(player, (short) 104); + if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ + xp += 15; + blockProcCheck(block, player); + blockProcCheck(block, player); + } + mat = Material.getMaterial(49); + item = new ItemStack(mat, 1, (byte)0, damage); + loc.getWorld().dropItemNaturally(loc, item); + block.setType(Material.AIR); + } //DIAMOND if(block.getTypeId() == 56 && mcm.getInstance().getTier(player) >= 3){ if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ @@ -288,7 +318,7 @@ public class mcMining { block.setType(Material.AIR); } if(block.getData() != (byte) 5) - mcUsers.getProfile(player).addMiningGather(xp * mcLoadProperties.xpGainMultiplier); + PP.addMiningGather(xp * mcLoadProperties.xpGainMultiplier); mcSkills.getInstance().XpCheck(player); } } diff --git a/mcMMO/com/gmail/nossr50/mcParty.java b/mcMMO/com/gmail/nossr50/mcParty.java index 7dd22fe45..849837f2c 100644 --- a/mcMMO/com/gmail/nossr50/mcParty.java +++ b/mcMMO/com/gmail/nossr50/mcParty.java @@ -17,12 +17,12 @@ public class mcParty { return instance; } public boolean inSameParty(Player playera, Player playerb){ - if(mcUsers.getProfile(playera) == null || mcUsers.getProfile(playerb) == null){ + if(mcUsers.getProfile(playera.getName()) == null || mcUsers.getProfile(playerb.getName()) == null){ mcUsers.addUser(playera); mcUsers.addUser(playerb); } - if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){ - if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){ + if(mcUsers.getProfile(playera.getName()).inParty() && mcUsers.getProfile(playerb.getName()).inParty()){ + if(mcUsers.getProfile(playera.getName()).getParty().equals(mcUsers.getProfile(playerb.getName()).getParty())){ return true; } else { return false; @@ -31,11 +31,12 @@ public class mcParty { return false; } } + public int partyCount(Player player, Player[] players){ int x = 0; for(Player hurrdurr : players){ if(player != null && hurrdurr != null){ - if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty())) + if(mcUsers.getProfile(player.getName()).getParty().equals(mcUsers.getProfile(hurrdurr.getName()).getParty())) x++; } } diff --git a/mcMMO/com/gmail/nossr50/mcPermissions.java b/mcMMO/com/gmail/nossr50/mcPermissions.java index 95877494a..4b78a1204 100644 --- a/mcMMO/com/gmail/nossr50/mcPermissions.java +++ b/mcMMO/com/gmail/nossr50/mcPermissions.java @@ -44,6 +44,13 @@ public class mcPermissions { return true; } } + public boolean herbalismAbility(Player player){ + if (permissionsEnabled) { + return permission(player, "mcmmo.ability.herbalism"); + } else { + return true; + } + } public boolean excavationAbility(Player player){ if (permissionsEnabled) { return permission(player, "mcmmo.ability.excavation"); @@ -135,13 +142,6 @@ public class mcPermissions { return true; } } - public boolean setMySpawnOther(Player player) { - if (permissionsEnabled) { - return permission(player, "mcmmo.commands.setmyspawnother"); - } else { - return true; - } - } public boolean partyChat(Player player) { if (permissionsEnabled) { return permission(player, "mcmmo.chat.partychat"); diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index 664a4fbaf..f93b5f185 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -9,10 +9,8 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerBedEnterEvent; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerListener; @@ -20,6 +18,8 @@ import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcPlayerListener extends PlayerListener { protected static final Logger log = Logger.getLogger("Minecraft"); @@ -31,10 +31,11 @@ public class mcPlayerListener extends PlayerListener { } public void onPlayerRespawn(PlayerRespawnEvent event) { Player player = event.getPlayer(); + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(player != null){ - Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); - if(mySpawn != null && plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)) != null) - mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin))); + Location mySpawn = PP.getMySpawn(player); + if(mySpawn != null && plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)) != null) + mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin))); if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){ event.setRespawnLocation(mySpawn); } @@ -66,16 +67,18 @@ public class mcPlayerListener extends PlayerListener { public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); if(mcPermissions.getInstance().motd(player)){ - player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help."); + player.sendMessage(ChatColor.BLUE +"This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help."); + player.sendMessage(ChatColor.GREEN+"http://mcmmo.wikia.com"+ChatColor.BLUE+" - mcMMO Wiki"); } } public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); + PlayerProfile PP = mcUsers.getProfile(player.getName()); Action action = event.getAction(); Block block = event.getClickedBlock(); //Archery Nerf if(player.getItemInHand().getTypeId() == 261 && mcLoadProperties.archeryFireRateLimit){ - if(System.currentTimeMillis() < mcUsers.getProfile(player).getArcheryShotATS() + 1000){ + if(System.currentTimeMillis() < PP.getArcheryShotATS() + 1000){ /* if(mcm.getInstance().hasArrows(player)) mcm.getInstance().addArrows(player); @@ -83,7 +86,7 @@ public class mcPlayerListener extends PlayerListener { player.updateInventory(); event.setCancelled(true); } else { - mcUsers.getProfile(player).setArcheryShotATS(System.currentTimeMillis()); + PP.setArcheryShotATS(System.currentTimeMillis()); } } /* @@ -91,15 +94,45 @@ public class mcPlayerListener extends PlayerListener { */ if(action == Action.RIGHT_CLICK_BLOCK){ ItemStack is = player.getItemInHand(); + if(block != null && player != null){ + if(block.getTypeId() == 26 && mcPermissions.getInstance().setMySpawn(player)){ + Location loc = player.getLocation(); + if(mcPermissions.getInstance().setMySpawn(player)){ + PP.setMySpawn(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName()); + } + player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location."); + } + } if(block != null && player != null && mcPermissions.getInstance().repair(player) && event.getClickedBlock().getTypeId() == 42){ mcRepair.getInstance().repairCheck(player, is, event.getClickedBlock()); } + if(mcm.getInstance().abilityBlockCheck(block)) { + if(block != null && mcm.getInstance().isHoe(player.getItemInHand()) && block.getTypeId() != 3){ + mcSkills.getInstance().hoeReadinessCheck(player); + } mcSkills.getInstance().abilityActivationCheck(player); } + + //GREEN THUMB + if(block != null && block.getType() == Material.COBBLESTONE && player.getItemInHand().getType() == Material.SEEDS){ + boolean pass = false; + if(mcHerbalism.getInstance().hasSeeds(player)){ + mcHerbalism.getInstance().removeSeeds(player); + if(Math.random() * 1500 <= PP.getHerbalismInt()){ + player.sendMessage(ChatColor.GREEN+"**GREEN THUMB**"); + block.setType(Material.MOSSY_COBBLESTONE); + pass = true; + } + if(pass == false) + player.sendMessage(ChatColor.RED+"**GREEN THUMB FAIL**"); + } + return; + } } if(action == Action.RIGHT_CLICK_AIR){ + mcSkills.getInstance().hoeReadinessCheck(player); mcSkills.getInstance().abilityActivationCheck(player); /* @@ -114,36 +147,39 @@ public class mcPlayerListener extends PlayerListener { * ITEM CHECKS */ if(action == Action.RIGHT_CLICK_AIR) - mcItem.getInstance().itemChecks(player); + mcItem.getInstance().itemChecks(player, plugin); if(action == Action.RIGHT_CLICK_BLOCK){ if(mcm.getInstance().abilityBlockCheck(event.getClickedBlock())) - mcItem.getInstance().itemChecks(player); + mcItem.getInstance().itemChecks(player, plugin); } } - public void onPlayerBedEnter(PlayerBedEnterEvent event) { - Player player = event.getPlayer(); - Location loc = player.getLocation(); - if(mcPermissions.getInstance().setMySpawn(player)){ - mcUsers.getProfile(player).setMySpawn(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName()); - } - player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location."); - } public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { Player player = event.getPlayer(); + PlayerProfile PP = mcUsers.getProfile(player.getName()); String[] split = event.getMessage().split(" "); String playerName = player.getName(); //Check if the command is an mcMMO related help command mcm.getInstance().mcmmoHelpCheck(split, player, event); if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcability)){ event.setCancelled(true); - if(mcUsers.getProfile(player).getAbilityUse()){ + if(PP.getAbilityUse()){ player.sendMessage("Ability use toggled off"); - mcUsers.getProfile(player).toggleAbilityUse(); + PP.toggleAbilityUse(); } else { player.sendMessage("Ability use toggled on"); - mcUsers.getProfile(player).toggleAbilityUse(); + PP.toggleAbilityUse(); } } + /* + if(split[0].equalsIgnoreCase("/mutechat")){ + event.setCancelled(true); + if(PP.getPartyChatOnlyToggle() == true) + player.sendMessage("Party Chat Only "+ChatColor.RED+"Off"); + if(PP.getPartyChatOnlyToggle() == false) + player.sendMessage("Party Chat Only "+ChatColor.RED+"On"); + PP.togglePartyChatOnly(); + } + */ if(mcPermissions.getInstance().mcAbility(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcrefresh)){ event.setCancelled(true); if(!mcPermissions.getInstance().mcrefresh(player)){ @@ -157,35 +193,43 @@ public class mcPlayerListener extends PlayerListener { /* * PREP MODES */ - mcUsers.getProfile(player).setAxePreparationMode(false); - mcUsers.getProfile(player).setFistsPreparationMode(false); - mcUsers.getProfile(player).setSwordsPreparationMode(false); - mcUsers.getProfile(player).setPickaxePreparationMode(false); + PP.setRecentlyHurt((long) 0); + PP.setHoePreparationMode(false); + PP.setAxePreparationMode(false); + PP.setFistsPreparationMode(false); + PP.setSwordsPreparationMode(false); + PP.setPickaxePreparationMode(false); + /* + * GREEN TERRA + */ + PP.setGreenTerraMode(false); + PP.setGreenTerraDeactivatedTimeStamp((long) 0); + /* * GIGA DRILL BREAKER */ - mcUsers.getProfile(player).setGigaDrillBreakerMode(false); - mcUsers.getProfile(player).setGigaDrillBreakerDeactivatedTimeStamp((long) 0); + PP.setGigaDrillBreakerMode(false); + PP.setGigaDrillBreakerDeactivatedTimeStamp((long) 0); /* * SERRATED STRIKE */ - mcUsers.getProfile(player).setSerratedStrikesMode(false); - mcUsers.getProfile(player).setSerratedStrikesDeactivatedTimeStamp((long) 0); + PP.setSerratedStrikesMode(false); + PP.setSerratedStrikesDeactivatedTimeStamp((long) 0); /* * SUPER BREAKER */ - mcUsers.getProfile(player).setSuperBreakerMode(false); - mcUsers.getProfile(player).setSuperBreakerDeactivatedTimeStamp((long) 0); + PP.setSuperBreakerMode(false); + PP.setSuperBreakerDeactivatedTimeStamp((long) 0); /* * TREE FELLER */ - mcUsers.getProfile(player).setTreeFellerMode(false); - mcUsers.getProfile(player).setTreeFellerDeactivatedTimeStamp((long) 0); + PP.setTreeFellerMode(false); + PP.setTreeFellerDeactivatedTimeStamp((long) 0); /* * BERSERK */ - mcUsers.getProfile(player).setBerserkMode(false); - mcUsers.getProfile(player).setBerserkDeactivatedTimeStamp((long)0); + PP.setBerserkMode(false); + PP.setBerserkDeactivatedTimeStamp((long)0); player.sendMessage(ChatColor.GREEN+"**ABILITIES REFRESHED!**"); } @@ -215,7 +259,7 @@ public class mcPlayerListener extends PlayerListener { double y = plugin.getServer().getWorlds().get(0).getSpawnLocation().getY(); double z = plugin.getServer().getWorlds().get(0).getSpawnLocation().getZ(); String worldname = plugin.getServer().getWorlds().get(0).getName(); - mcUsers.getProfile(player).setMySpawn(x, y, z, worldname); + PP.setMySpawn(x, y, z, worldname); player.sendMessage(ChatColor.DARK_AQUA+"Myspawn is now cleared."); } if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){ @@ -231,14 +275,14 @@ public class mcPlayerListener extends PlayerListener { if(split.length == 4){ if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){ int newvalue = Integer.valueOf(split[3]); - mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]); + mcUsers.getProfile(getPlayer(split[1]).getName()).modifyskill(newvalue, split[2]); player.sendMessage(ChatColor.RED+split[2]+" has been modified."); } } else if(split.length == 3){ if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){ int newvalue = Integer.valueOf(split[2]); - mcUsers.getProfile(player).modifyskill(newvalue, split[1]); + PP.modifyskill(newvalue, split[1]); player.sendMessage(ChatColor.RED+split[1]+" has been modified."); } } else { @@ -261,7 +305,7 @@ public class mcPlayerListener extends PlayerListener { if(split.length == 4){ if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){ int newvalue = Integer.valueOf(split[3]); - mcUsers.getProfile(getPlayer(split[1])).addXpToSkill(newvalue, split[2]); + mcUsers.getProfile(getPlayer(split[1]).getName()).addXpToSkill(newvalue, split[2]); getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!"); player.sendMessage(ChatColor.RED+split[2]+" has been modified."); } @@ -269,7 +313,7 @@ public class mcPlayerListener extends PlayerListener { else if(split.length == 3){ if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){ int newvalue = Integer.valueOf(split[2]); - mcUsers.getProfile(player).addXpToSkill(newvalue, split[1]); + PP.addXpToSkill(newvalue, split[1]); player.sendMessage(ChatColor.RED+split[1]+" has been modified."); } } else { @@ -277,7 +321,7 @@ public class mcPlayerListener extends PlayerListener { } } - if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/"+mcLoadProperties.ptp)){ + if(PP.inParty() && split[0].equalsIgnoreCase("/"+mcLoadProperties.ptp)){ event.setCancelled(true); if(!mcPermissions.getInstance().partyTeleport(player)){ player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); @@ -292,7 +336,8 @@ public class mcPlayerListener extends PlayerListener { } if(isPlayer(split[1])){ Player target = getPlayer(split[1]); - if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){ + PlayerProfile PPt = mcUsers.getProfile(target.getName()); + if(PP.getParty().equals(PPt.getParty())){ player.teleportTo(target); player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName()); target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you."); @@ -311,58 +356,59 @@ public class mcPlayerListener extends PlayerListener { //if split[1] is a player if(isPlayer(split[1])){ Player target = getPlayer(split[1]); + PlayerProfile PPt = mcUsers.getProfile(target.getName()); double x,y,z; x = target.getLocation().getX(); y = target.getLocation().getY(); z = target.getLocation().getZ(); player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~"); player.sendMessage(target.getName()); - if(mcUsers.getProfile(target).inParty()) - player.sendMessage("Party: "+mcUsers.getProfile(target).getParty()); + if(PPt.inParty()) + player.sendMessage("Party: "+PPt.getParty()); 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().mining(target)) - player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getMining()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getMiningGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("mining")+")"); + player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + PPt.getMining()+ChatColor.DARK_AQUA + + " XP("+PPt.getMiningGather() + +"/"+PPt.getXpToLevel("mining")+")"); if(mcPermissions.getInstance().repair(target)) - player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getRepair()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getRepairGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("repair")+")"); + player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + PPt.getRepair()+ChatColor.DARK_AQUA + + " XP("+PPt.getRepairGather() + +"/"+PPt.getXpToLevel("repair")+")"); if(mcPermissions.getInstance().woodcutting(target)) - player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getWoodCutting()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getWoodCuttingGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("woodcutting")+")"); + player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + PPt.getWoodCutting()+ChatColor.DARK_AQUA + + " XP("+PPt.getWoodCuttingGather() + +"/"+PPt.getXpToLevel("woodcutting")+")"); if(mcPermissions.getInstance().unarmed(target)) - player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getUnarmed()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getUnarmedGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("unarmed")+")"); + player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + PPt.getUnarmed()+ChatColor.DARK_AQUA + + " XP("+PPt.getUnarmedGather() + +"/"+PPt.getXpToLevel("unarmed")+")"); if(mcPermissions.getInstance().herbalism(target)) - player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getHerbalism()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getHerbalismGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("herbalism")+")"); + player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + PPt.getHerbalism()+ChatColor.DARK_AQUA + + " XP("+PPt.getHerbalismGather() + +"/"+PPt.getXpToLevel("herbalism")+")"); if(mcPermissions.getInstance().excavation(target)) - player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getExcavation()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getExcavationGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("excavation")+")"); + player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + PPt.getExcavation()+ChatColor.DARK_AQUA + + " XP("+PPt.getExcavationGather() + +"/"+PPt.getXpToLevel("excavation")+")"); if(mcPermissions.getInstance().archery(target)) - player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getArchery()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getArcheryGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("archery")+")"); + player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + PPt.getArchery()+ChatColor.DARK_AQUA + + " XP("+PPt.getArcheryGather() + +"/"+PPt.getXpToLevel("archery")+")"); if(mcPermissions.getInstance().swords(target)) - player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getSwords()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getSwordsGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("swords")+")"); + player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + PPt.getSwords()+ChatColor.DARK_AQUA + + " XP("+PPt.getSwordsGather() + +"/"+PPt.getXpToLevel("swords")+")"); if(mcPermissions.getInstance().axes(target)) - player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAxes()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getAxesGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("axes")+")"); + player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + PPt.getAxes()+ChatColor.DARK_AQUA + + " XP("+PPt.getAxesGather() + +"/"+PPt.getXpToLevel("axes")+")"); if(mcPermissions.getInstance().acrobatics(target)) - player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAcrobatics()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(target).getAcrobaticsGather() - +"/"+mcUsers.getProfile(target).getXpToLevel("acrobatics")+")"); - player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcUsers.getProfile(target).getPowerLevel())); + player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PPt.getAcrobatics()+ChatColor.DARK_AQUA + + " XP("+PPt.getAcrobaticsGather() + +"/"+PPt.getXpToLevel("acrobatics")+")"); + player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getInstance().getPowerLevel(target))); player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~"); player.sendMessage("X: "+x); player.sendMessage("Y: "+y); @@ -378,51 +424,51 @@ public class mcPlayerListener extends PlayerListener { 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().mining(player)) - player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getMiningGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("mining")+")"); + player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + PP.getMining()+ChatColor.DARK_AQUA + + " XP("+PP.getMiningGather() + +"/"+PP.getXpToLevel("mining")+")"); if(mcPermissions.getInstance().repair(player)) - player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getRepairGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("repair")+")"); + player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + PP.getRepair()+ChatColor.DARK_AQUA + + " XP("+PP.getRepairGather() + +"/"+PP.getXpToLevel("repair")+")"); if(mcPermissions.getInstance().woodcutting(player)) - player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getWoodCuttingGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("woodcutting")+")"); + player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + PP.getWoodCutting()+ChatColor.DARK_AQUA + + " XP("+PP.getWoodCuttingGather() + +"/"+PP.getXpToLevel("woodcutting")+")"); if(mcPermissions.getInstance().unarmed(player)) - player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getUnarmedGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("unarmed")+")"); + player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + PP.getUnarmed()+ChatColor.DARK_AQUA + + " XP("+PP.getUnarmedGather() + +"/"+PP.getXpToLevel("unarmed")+")"); if(mcPermissions.getInstance().herbalism(player)) - player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getHerbalismGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("herbalism")+")"); + player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + PP.getHerbalism()+ChatColor.DARK_AQUA + + " XP("+PP.getHerbalismGather() + +"/"+PP.getXpToLevel("herbalism")+")"); if(mcPermissions.getInstance().excavation(player)) - player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getExcavationGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("excavation")+")"); + player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + PP.getExcavation()+ChatColor.DARK_AQUA + + " XP("+PP.getExcavationGather() + +"/"+PP.getXpToLevel("excavation")+")"); if(mcPermissions.getInstance().archery(player)) - player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getArchery()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getArcheryGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("archery")+")"); + player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + PP.getArchery()+ChatColor.DARK_AQUA + + " XP("+PP.getArcheryGather() + +"/"+PP.getXpToLevel("archery")+")"); if(mcPermissions.getInstance().swords(player)) - player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getSwordsGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("swords")+")"); + player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + PP.getSwords()+ChatColor.DARK_AQUA + + " XP("+PP.getSwordsGather() + +"/"+PP.getXpToLevel("swords")+")"); if(mcPermissions.getInstance().axes(player)) - player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getAxesGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("axes")+")"); + player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + PP.getAxes()+ChatColor.DARK_AQUA + + " XP("+PP.getAxesGather() + +"/"+PP.getXpToLevel("axes")+")"); if(mcPermissions.getInstance().acrobatics(player)) - player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics()+ChatColor.DARK_AQUA - + " XP("+mcUsers.getProfile(player).getAcrobaticsGather() - +"/"+mcUsers.getProfile(player).getXpToLevel("acrobatics")+")"); - player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcUsers.getProfile(player).getPowerLevel())); + player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PP.getAcrobatics()+ChatColor.DARK_AQUA + + " XP("+PP.getAcrobaticsGather() + +"/"+PP.getXpToLevel("acrobatics")+")"); + player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getInstance().getPowerLevel(player))); } //Invite Command if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){ event.setCancelled(true); - if(!mcUsers.getProfile(player).inParty()){ + if(!PP.inParty()){ player.sendMessage(ChatColor.RED+"You are not in a party."); return; } @@ -430,24 +476,25 @@ public class mcPlayerListener extends PlayerListener { player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.invite+" "); return; } - if(mcUsers.getProfile(player).inParty() && split.length >= 2 && isPlayer(split[1])){ + if(PP.inParty() && split.length >= 2 && isPlayer(split[1])){ Player target = getPlayer(split[1]); - mcUsers.getProfile(target).modifyInvite(mcUsers.getProfile(player).getParty()); + PlayerProfile PPt = mcUsers.getProfile(target.getName()); + PPt.modifyInvite(PP.getParty()); player.sendMessage(ChatColor.GREEN+"Invite sent successfully"); - target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite()+" from "+player.getName()); + target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName()); target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/"+mcLoadProperties.accept+ChatColor.YELLOW+" to accept the invite"); } } //Accept invite if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){ event.setCancelled(true); - if(mcUsers.getProfile(player).hasPartyInvite()){ - if(mcUsers.getProfile(player).inParty()){ + if(PP.hasPartyInvite()){ + if(PP.inParty()){ mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline()); } - mcUsers.getProfile(player).acceptInvite(); + PP.acceptInvite(); mcParty.getInstance().informPartyMembers(player, getPlayersOnline()); - player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+mcUsers.getProfile(player).getParty()+")"); + player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+PP.getParty()+")"); } else { player.sendMessage(ChatColor.RED+"You have no invites at this time"); } @@ -459,16 +506,16 @@ public class mcPlayerListener extends PlayerListener { player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); return; } - if(split.length == 1 && !mcUsers.getProfile(player).inParty()){ + if(split.length == 1 && !PP.inParty()){ player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" or 'q' to quit"); return; } - if(split.length == 1 && mcUsers.getProfile(player).inParty()){ + if(split.length == 1 && PP.inParty()){ String tempList = ""; int x = 0; for(Player p : plugin.getServer().getOnlinePlayers()) { - if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(p).getParty())){ + if(PP.getParty().equals(mcUsers.getProfile(p.getName()).getParty())){ if(p != null && x+1 >= mcParty.getInstance().partyCount(player, getPlayersOnline())){ tempList+= p.getName(); x++; @@ -479,19 +526,19 @@ public class mcPlayerListener extends PlayerListener { } } } - player.sendMessage(ChatColor.GREEN+"You are in party \""+mcUsers.getProfile(player).getParty()+"\""); + player.sendMessage(ChatColor.GREEN+"You are in party \""+PP.getParty()+"\""); player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")"); } - if(split.length > 1 && split[1].equals("q") && mcUsers.getProfile(player).inParty()){ + if(split.length > 1 && split[1].equals("q") && PP.inParty()){ mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline()); - mcUsers.getProfile(player).removeParty(); + PP.removeParty(); player.sendMessage(ChatColor.RED + "You have left that party"); return; } if(split.length >= 2){ - if(mcUsers.getProfile(player).inParty()) + if(PP.inParty()) mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline()); - mcUsers.getProfile(player).setParty(split[1]); + PP.setParty(split[1]); player.sendMessage("Joined Party: " + split[1]); mcParty.getInstance().informPartyMembers(player, getPlayersOnline()); } @@ -535,14 +582,28 @@ public class mcPlayerListener extends PlayerListener { player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); return; } - if(mcUsers.getProfile(player).getMySpawn(player) != null){ - if(mcLoadProperties.myspawnclearsinventory) - player.getInventory().clear(); + if(System.currentTimeMillis() < PP.getMySpawnATS() + 3600000){ + long x = System.currentTimeMillis(); + int seconds = 0; + int minutes = 0; + while(x < PP.getMySpawnATS() + 3600000){ + x+=1000; + seconds++; + } + while(seconds >= 60){ + seconds-=60; + minutes++; + } + player.sendMessage("You must wait "+minutes+"m"+seconds+"s"+" to use myspawn"); + return; + } + PP.setMySpawnATS(System.currentTimeMillis()); + if(PP.getMySpawn(player) != null){ player.setHealth(20); - Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); + Location mySpawn = PP.getMySpawn(player); //player.sendMessage("mcMMO DEBUG CODE 1"); - if(mcUsers.getProfile(player).getMySpawnWorld(plugin) != null && !mcUsers.getProfile(player).getMySpawnWorld(plugin).equals("")){ - mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin))); + if(PP.getMySpawnWorld(plugin) != null && !PP.getMySpawnWorld(plugin).equals("")){ + mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin))); //player.sendMessage("mcMMO DEBUG CODE 2"); } else { //player.sendMessage("mcMMO DEBUG CODE 5"); @@ -554,23 +615,22 @@ public class mcPlayerListener extends PlayerListener { //Two lines of teleporting to prevent a bug when players try teleporting from one world to another bringing them to that worlds spawn at first. //player.sendMessage("mcMMO DEBUG CODE 4"); if(mcLoadProperties.myspawnclearsinventory) - player.sendMessage("Traveled to your MySpawn, Inventory cleared & health restored"); - else - player.sendMessage("Traveled to your MySpawn, Health has been restored."); + player.sendMessage("Traveled to your MySpawn"); } else { - player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn"); + player.sendMessage(ChatColor.RED+"Configure your myspawn first with a bed."); } } } public void onPlayerChat(PlayerChatEvent event) { Player player = event.getPlayer(); + PlayerProfile PP = mcUsers.getProfile(player.getName()); String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") "; String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} "; if(mcConfig.getInstance().isPartyToggled(player.getName())){ event.setCancelled(true); - log.log(Level.INFO, "[P]("+mcUsers.getProfile(player).getParty()+")"+"<"+player.getName()+"> "+event.getMessage()); + log.log(Level.INFO, "[P]("+PP.getParty()+")"+"<"+player.getName()+"> "+event.getMessage()); for(Player herp : plugin.getServer().getOnlinePlayers()){ - if(mcUsers.getProfile(herp).inParty()){ + if(mcUsers.getProfile(herp.getName()).inParty()){ if(mcParty.getInstance().inSameParty(herp, player)){ herp.sendMessage(x+event.getMessage()); } @@ -588,5 +648,12 @@ public class mcPlayerListener extends PlayerListener { } return; } + /* + * Remove from normal chat if toggled + for(Player z : event.getRecipients()){ + if(mcUsers.getProfile(z.getName()).getPartyChatOnlyToggle() == true) + event.getRecipients().remove(z); + } + */ } } \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/mcRepair.java b/mcMMO/com/gmail/nossr50/mcRepair.java index 8d855df10..6ba5eb533 100644 --- a/mcMMO/com/gmail/nossr50/mcRepair.java +++ b/mcMMO/com/gmail/nossr50/mcRepair.java @@ -5,6 +5,8 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcRepair { private static mcMMO plugin; @@ -19,12 +21,13 @@ public class mcRepair { return instance; } public void repairCheck(Player player, ItemStack is, Block block){ - short durabilityBefore = is.getDurability(); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + short durabilityBefore = player.getItemInHand().getDurability(); short durabilityAfter = 0; short dif = 0; if(block != null && mcPermissions.getInstance().repair(player)){ - if(player.getItemInHand().getDurability() > 0){ + if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){ /* * ARMOR */ @@ -32,29 +35,32 @@ public class mcRepair { /* * DIAMOND ARMOR */ - if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ + if(isDiamondArmor(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){ removeDiamond(player); player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - durabilityAfter = is.getDurability(); + durabilityAfter = player.getItemInHand().getDurability(); + player.sendMessage(String.valueOf(durabilityBefore - durabilityAfter)); dif = (short) (durabilityBefore - durabilityAfter); - mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + dif = (short) (dif * 6); //Boost XP + PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else if (isIronArmor(is) && hasIron(player)){ /* * IRON ARMOR */ removeIron(player); player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - durabilityAfter = is.getDurability(); + durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); - mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + dif = (short) (dif * 2); //Boost XP + PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); //GOLD ARMOR } else if (isGoldArmor(is) && hasGold(player)){ removeGold(player); player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - durabilityAfter = is.getDurability(); + durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 4); //Boost XP of Gold to around Iron - mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else { needMoreVespeneGas(is, player); } @@ -67,9 +73,12 @@ public class mcRepair { * IRON TOOLS */ if(isIronTools(is) && hasIron(player)){ - is.setDurability(getToolRepairAmount(is, player)); removeIron(player); - durabilityAfter = is.getDurability(); + /* + * Repair Durability and calculate dif + */ + player.getItemInHand().setDurability(getToolRepairAmount(is, player)); + durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); if(mcm.getInstance().isShovel(is)) dif = (short) (dif / 3); @@ -77,14 +86,14 @@ public class mcRepair { dif = (short) (dif / 2); if(mcm.getInstance().isHoe(is)) dif = (short) (dif / 2); - mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); - } else if (isDiamondTools(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds + PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + } else if (isDiamondTools(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds /* * DIAMOND TOOLS */ - is.setDurability(getToolRepairAmount(is, player)); + player.getItemInHand().setDurability(getToolRepairAmount(is, player)); removeDiamond(player); - durabilityAfter = is.getDurability(); + durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); if(mcm.getInstance().isShovel(is)) dif = (short) (dif / 3); @@ -92,11 +101,11 @@ public class mcRepair { dif = (short) (dif / 2); if(mcm.getInstance().isHoe(is)) dif = (short) (dif / 2); - mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else if(isGoldTools(is) && hasGold(player)){ - is.setDurability(getToolRepairAmount(is, player)); + player.getItemInHand().setDurability(getToolRepairAmount(is, player)); removeGold(player); - durabilityAfter = is.getDurability(); + durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron if(mcm.getInstance().isShovel(is)) @@ -105,7 +114,7 @@ public class mcRepair { dif = (short) (dif / 2); if(mcm.getInstance().isHoe(is)) dif = (short) (dif / 2); - mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); + PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else { needMoreVespeneGas(is, player); } @@ -263,7 +272,8 @@ public class mcRepair { return false; } public short repairCalculate(Player player, short durability, short ramt){ - float bonus = (mcUsers.getProfile(player).getRepairInt() / 500); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + float bonus = (PP.getRepairInt() / 500); bonus = (ramt * bonus); ramt = ramt+=bonus; if(checkPlayerProcRepair(player)){ @@ -388,12 +398,11 @@ public class mcRepair { } if(durability < 0) durability = 0; - if(checkPlayerProcRepair(player)) - durability = 0; return repairCalculate(player, durability, ramt); } public void needMoreVespeneGas(ItemStack is, Player player){ - if ((isDiamondTools(is) || isDiamondArmor(is)) && mcUsers.getProfile(player).getRepairInt() < mcLoadProperties.repairdiamondlevel){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); + if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getRepairInt() < mcLoadProperties.repairdiamondlevel){ player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond"); } else if (isDiamondTools(is) && !hasDiamond(player) || isIronTools(is) && !hasIron(player) || isGoldTools(is) && !hasGold(player)){ if(isDiamondTools(is) && !hasDiamond(player)) @@ -407,12 +416,15 @@ public class mcRepair { player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.BLUE+ "Diamonds"); } else if (isIronArmor(is) && !hasIron(player)){ player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron"); - } else if (isGoldArmor(is) && !hasGold(player)) + } else if (isGoldArmor(is) && !hasGold(player)){ player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold"); - } + } else if (is.getAmount() > 1) + player.sendMessage(ChatColor.DARK_RED+"You can't repair stacked items"); + } public boolean checkPlayerProcRepair(Player player){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(player != null){ - if(Math.random() * 1000 <= mcUsers.getProfile(player).getRepairInt()){ + if(Math.random() * 1000 <= PP.getRepairInt()){ player.sendMessage(ChatColor.GRAY + "That felt easy."); return true; } diff --git a/mcMMO/com/gmail/nossr50/mcSkills.java b/mcMMO/com/gmail/nossr50/mcSkills.java index f3b6e1d0c..31c0c0a50 100644 --- a/mcMMO/com/gmail/nossr50/mcSkills.java +++ b/mcMMO/com/gmail/nossr50/mcSkills.java @@ -5,6 +5,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; import com.gmail.nossr50.PlayerList.PlayerProfile; @@ -55,36 +56,54 @@ public class mcSkills { return x; } public void watchCooldowns(Player player){ - if(!mcUsers.getProfile(player).getTreeFellerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getTreeFellerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - mcUsers.getProfile(player).setTreeFellerInformed(true); + PlayerProfile PP = mcUsers.getProfile(player.getName()); + if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - PP.getGreenTerraDeactivatedTimeStamp() >= (mcLoadProperties.greenTerraCooldown * 1000)){ + PP.setGreenTerraInformed(true); + player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Green Terra "+ChatColor.GREEN+"ability is refreshed!"); + } + if(!PP.getTreeFellerInformed() && System.currentTimeMillis() - PP.getTreeFellerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + PP.setTreeFellerInformed(true); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!"); } - if(!mcUsers.getProfile(player).getSuperBreakerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSuperBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - mcUsers.getProfile(player).setSuperBreakerInformed(true); + if(!PP.getSuperBreakerInformed() && System.currentTimeMillis() - PP.getSuperBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + PP.setSuperBreakerInformed(true); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!"); } - if(!mcUsers.getProfile(player).getSerratedStrikesInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSerratedStrikesDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - mcUsers.getProfile(player).setSerratedStrikesInformed(true); + if(!PP.getSerratedStrikesInformed() && System.currentTimeMillis() - PP.getSerratedStrikesDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + PP.setSerratedStrikesInformed(true); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!"); } - if(!mcUsers.getProfile(player).getBerserkInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getBerserkDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - mcUsers.getProfile(player).setBerserkInformed(true); + if(!PP.getBerserkInformed() && System.currentTimeMillis() - PP.getBerserkDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + PP.setBerserkInformed(true); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!"); } - if(!mcUsers.getProfile(player).getSkullSplitterInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSkullSplitterDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - mcUsers.getProfile(player).setSkullSplitterInformed(true); + if(!PP.getSkullSplitterInformed() && System.currentTimeMillis() - PP.getSkullSplitterDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + PP.setSkullSplitterInformed(true); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!"); } - if(!mcUsers.getProfile(player).getGigaDrillBreakerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getGigaDrillBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - mcUsers.getProfile(player).setGigaDrillBreakerInformed(true); + if(!PP.getGigaDrillBreakerInformed() && System.currentTimeMillis() - PP.getGigaDrillBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + PP.setGigaDrillBreakerInformed(true); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!"); } } + public void hoeReadinessCheck(Player player){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); + if(mcPermissions.getInstance().herbalismAbility(player) && mcm.getInstance().isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){ + if(!PP.getGreenTerraMode() && !cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){ + player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." + +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)+"s)"); + return; + } + player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR HOE**"); + PP.setHoePreparationATS(System.currentTimeMillis()); + PP.setHoePreparationMode(true); + } + } public void abilityActivationCheck(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(!PP.getAbilityUse()) return; - if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !mcUsers.getProfile(player).getPickaxePreparationMode()){ + if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode()){ if(!PP.getSuperBreakerMode() && !cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){ player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)+"s)"); @@ -132,49 +151,59 @@ public class mcSkills { } } } - public void serratedStrikesActivationCheck(Player player){ + public void serratedStrikesActivationCheck(Player player, Plugin pluginx){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(mcm.getInstance().isSwords(player.getItemInHand())){ - if(mcUsers.getProfile(player).getSwordsPreparationMode()){ - mcUsers.getProfile(player).setSwordsPreparationMode(false); + if(PP.getSwordsPreparationMode()){ + PP.setSwordsPreparationMode(false); } int ticks = 2; - int x = mcUsers.getProfile(player).getSwordsInt(); + int x = PP.getSwordsInt(); while(x >= 50){ x-=50; ticks++; } - if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){ + if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**"); - mcUsers.getProfile(player).setSerratedStrikesTicks((ticks * 2) * 1000); - mcUsers.getProfile(player).setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis()); - mcUsers.getProfile(player).setSerratedStrikesMode(true); + for(Player y : pluginx.getServer().getOnlinePlayers()){ + if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10) + y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Serrated Strikes!"); + } + PP.setSerratedStrikesTicks((ticks * 2) * 1000); + PP.setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis()); + PP.setSerratedStrikesMode(true); } } } - public void berserkActivationCheck(Player player){ + public void berserkActivationCheck(Player player, Plugin pluginx){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(player.getItemInHand().getTypeId() == 0){ - if(mcUsers.getProfile(player).getFistsPreparationMode()){ - mcUsers.getProfile(player).setFistsPreparationMode(false); + if(PP.getFistsPreparationMode()){ + PP.setFistsPreparationMode(false); } int ticks = 2; - int x = mcUsers.getProfile(player).getUnarmedInt(); + int x = PP.getUnarmedInt(); while(x >= 50){ x-=50; ticks++; } - if(!mcUsers.getProfile(player).getBerserkMode() && cooldownOver(player, mcUsers.getProfile(player).getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){ + if(!PP.getBerserkMode() && cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){ player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**"); - mcUsers.getProfile(player).setBerserkTicks(ticks * 1000); - mcUsers.getProfile(player).setBerserkActivatedTimeStamp(System.currentTimeMillis()); - mcUsers.getProfile(player).setBerserkMode(true); + for(Player y : pluginx.getServer().getOnlinePlayers()){ + if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10) + y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Berserk!"); + } + PP.setBerserkTicks(ticks * 1000); + PP.setBerserkActivatedTimeStamp(System.currentTimeMillis()); + PP.setBerserkMode(true); } } } - public void skullSplitterCheck(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); + public void skullSplitterCheck(Player player, Plugin pluginx){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(mcm.getInstance().isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){ /* * CHECK FOR AXE PREP MODE @@ -183,7 +212,7 @@ public class mcSkills { PP.setAxePreparationMode(false); } int ticks = 2; - int x = mcUsers.getProfile(player).getAxesInt(); + int x = PP.getAxesInt(); while(x >= 50){ x-=50; ticks++; @@ -191,6 +220,10 @@ public class mcSkills { if(!PP.getSkullSplitterMode() && cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){ player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**"); + for(Player y : pluginx.getServer().getOnlinePlayers()){ + if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10) + y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Skull Splitter!"); + } PP.setSkullSplitterTicks(ticks * 1000); PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis()); PP.setSkullSplitterMode(true); @@ -202,12 +235,13 @@ public class mcSkills { } } public void monitorSkills(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - /* - * AXE PREPARATION MODE - */ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(PP == null) mcUsers.addUser(player); + if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){ + PP.setHoePreparationMode(false); + player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR HOE**"); + } if(PP.getAxePreparationMode() && System.currentTimeMillis() - PP.getAxePreparationATS() >= 4000){ PP.setAxePreparationMode(false); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**"); @@ -228,17 +262,26 @@ public class mcSkills { PP.setShovelPreparationMode(false); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**"); } + /* + * HERBALISM ABILITY + */ + if(mcPermissions.getInstance().herbalismAbility(player)){ + if(PP.getGreenTerraMode() && PP.getGreenTerraActivatedTimeStamp() + PP.getGreenTerraTicks() <= System.currentTimeMillis()){ + PP.setGreenTerraMode(false); + PP.setGreenTerraInformed(false); + player.sendMessage(ChatColor.RED+"**Green Terra has worn off**"); + PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis()); + } + } /* * AXES ABILITY */ if(mcPermissions.getInstance().axesAbility(player)){ - if(mcPermissions.getInstance().unarmedAbility(player)){ - if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){ - PP.setSkullSplitterMode(false); - PP.setSkullSplitterInformed(false); - player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**"); - PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis()); - } + if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){ + PP.setSkullSplitterMode(false); + PP.setSkullSplitterInformed(false); + player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**"); + PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis()); } } /* @@ -298,125 +341,136 @@ public class mcSkills { } } public void XpCheck(Player player){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); /* * ACROBATICS */ - if(player != null && mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ + if(player != null && PP.getAcrobaticsGatherInt() >= PP.getXpToLevel("acrobatics")){ int skillups = 0; - while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ + while(PP.getAcrobaticsGatherInt() >= PP.getXpToLevel("acrobatics")){ skillups++; - mcUsers.getProfile(player).removeAcrobaticsGather(mcUsers.getProfile(player).getXpToLevel("acrobatics")); - mcUsers.getProfile(player).skillUpAcrobatics(1); + PP.removeAcrobaticsGather(PP.getXpToLevel("acrobatics")); + PP.skillUpAcrobatics(1); } - player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")"); + if(player != null && PP.getAcrobatics() != null) + player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+PP.getAcrobatics()+")"); } /* * ARCHERY */ - if(mcUsers.getProfile(player).getArcheryGatherInt() >= mcUsers.getProfile(player).getXpToLevel("archery")){ + if(PP.getArcheryGatherInt() >= PP.getXpToLevel("archery")){ int skillups = 0; - while(mcUsers.getProfile(player).getArcheryGatherInt() >= mcUsers.getProfile(player).getXpToLevel("archery")){ + while(PP.getArcheryGatherInt() >= PP.getXpToLevel("archery")){ skillups++; - mcUsers.getProfile(player).removeArcheryGather(mcUsers.getProfile(player).getXpToLevel("archery")); - mcUsers.getProfile(player).skillUpArchery(1); + PP.removeArcheryGather(PP.getXpToLevel("archery")); + PP.skillUpArchery(1); } - player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getArchery()+")"); + if(player != null && PP.getArchery() != null) + player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+PP.getArchery()+")"); } /* * SWORDS */ - if(mcUsers.getProfile(player).getSwordsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("swords")){ + if(PP.getSwordsGatherInt() >= PP.getXpToLevel("swords")){ int skillups = 0; - while(mcUsers.getProfile(player).getSwordsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("swords")){ + while(PP.getSwordsGatherInt() >= PP.getXpToLevel("swords")){ skillups++; - mcUsers.getProfile(player).removeSwordsGather(mcUsers.getProfile(player).getXpToLevel("swords")); - mcUsers.getProfile(player).skillUpSwords(1); + PP.removeSwordsGather(PP.getXpToLevel("swords")); + PP.skillUpSwords(1); } - player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getSwords()+")"); + if(player != null && PP.getSwords() != null) + player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+PP.getSwords()+")"); } /* * AXES */ - if(mcUsers.getProfile(player).getAxesGatherInt() >= mcUsers.getProfile(player).getXpToLevel("axes")){ + if(PP.getAxesGatherInt() >= PP.getXpToLevel("axes")){ int skillups = 0; - while(mcUsers.getProfile(player).getAxesGatherInt() >= mcUsers.getProfile(player).getXpToLevel("axes")){ + while(PP.getAxesGatherInt() >= PP.getXpToLevel("axes")){ skillups++; - mcUsers.getProfile(player).removeAxesGather(mcUsers.getProfile(player).getXpToLevel("axes")); - mcUsers.getProfile(player).skillUpAxes(1); + PP.removeAxesGather(PP.getXpToLevel("axes")); + PP.skillUpAxes(1); } - player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAxes()+")"); + if(player != null && PP.getAxes() != null) + player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+PP.getAxes()+")"); } /* * UNARMED */ - if(mcUsers.getProfile(player).getUnarmedGatherInt() >= mcUsers.getProfile(player).getXpToLevel("unarmed")){ + if(PP.getUnarmedGatherInt() >= PP.getXpToLevel("unarmed")){ int skillups = 0; - while(mcUsers.getProfile(player).getUnarmedGatherInt() >= mcUsers.getProfile(player).getXpToLevel("unarmed")){ + while(PP.getUnarmedGatherInt() >= PP.getXpToLevel("unarmed")){ skillups++; - mcUsers.getProfile(player).removeUnarmedGather(mcUsers.getProfile(player).getXpToLevel("unarmed")); - mcUsers.getProfile(player).skillUpUnarmed(1); + PP.removeUnarmedGather(PP.getXpToLevel("unarmed")); + PP.skillUpUnarmed(1); } - player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getUnarmed()+")"); + if(player != null && PP.getUnarmed() != null) + player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+PP.getUnarmed()+")"); } /* * HERBALISM */ - if(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){ + if(PP.getHerbalismGatherInt() >= PP.getXpToLevel("herbalism")){ int skillups = 0; - while(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){ + while(PP.getHerbalismGatherInt() >= PP.getXpToLevel("herbalism")){ skillups++; - mcUsers.getProfile(player).removeHerbalismGather(mcUsers.getProfile(player).getXpToLevel("herbalism")); - mcUsers.getProfile(player).skillUpHerbalism(1); + PP.removeHerbalismGather(PP.getXpToLevel("herbalism")); + PP.skillUpHerbalism(1); } - player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")"); + if(player != null && PP.getHerbalism() != null) + player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+PP.getHerbalism()+")"); } /* * MINING */ - if(player != null && mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ + if(player != null && PP.getMiningGatherInt() >= PP.getXpToLevel("mining")){ int skillups = 0; - while(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ + while(PP.getMiningGatherInt() >= PP.getXpToLevel("mining")){ skillups++; - mcUsers.getProfile(player).removeMiningGather(mcUsers.getProfile(player).getXpToLevel("mining")); - mcUsers.getProfile(player).skillUpMining(1); + PP.removeMiningGather(PP.getXpToLevel("mining")); + PP.skillUpMining(1); } - player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getMining()+")"); + if(player != null && PP.getMining() != null) + player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+PP.getMining()+")"); } /* * WOODCUTTING */ - if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){ + if(player != null && PP.getWoodCuttingGatherInt() >= PP.getXpToLevel("woodcutting")){ int skillups = 0; - while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){ + while(PP.getWoodCuttingGatherInt() >= PP.getXpToLevel("woodcutting")){ skillups++; - mcUsers.getProfile(player).removeWoodCuttingGather(mcUsers.getProfile(player).getXpToLevel("woodcutting")); - mcUsers.getProfile(player).skillUpWoodCutting(1); + PP.removeWoodCuttingGather(PP.getXpToLevel("woodcutting")); + PP.skillUpWoodCutting(1); } - player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")"); + if(player != null && PP.getWoodCutting() != null) + player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+PP.getWoodCutting()+")"); } /* * REPAIR */ - if(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){ + if(PP.getRepairGatherInt() >= PP.getXpToLevel("repair")){ int skillups = 0; - while(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){ + while(PP.getRepairGatherInt() >= PP.getXpToLevel("repair")){ skillups++; - mcUsers.getProfile(player).removeRepairGather(mcUsers.getProfile(player).getXpToLevel("repair")); - mcUsers.getProfile(player).skillUpRepair(1); + PP.removeRepairGather(PP.getXpToLevel("repair")); + PP.skillUpRepair(1); } - player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getRepair()+")"); + if(player != null && PP.getRepair() != null) + player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+PP.getRepair()+")"); } /* * EXCAVATION */ - if(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){ + if(PP.getExcavationGatherInt() >= PP.getXpToLevel("excavation")){ int skillups = 0; - while(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){ + while(PP.getExcavationGatherInt() >= PP.getXpToLevel("excavation")){ skillups++; - mcUsers.getProfile(player).removeExcavationGather(mcUsers.getProfile(player).getXpToLevel("excavation")); - mcUsers.getProfile(player).skillUpExcavation(1); + PP.removeExcavationGather(PP.getXpToLevel("excavation")); + PP.skillUpExcavation(1); } - player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")"); + if(player != null && PP.getExcavation() != null) + player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+PP.getExcavation()+")"); } } public boolean isSkill(String skillname){ diff --git a/mcMMO/com/gmail/nossr50/mcTimer.java b/mcMMO/com/gmail/nossr50/mcTimer.java index c4318e304..a7fafa43c 100644 --- a/mcMMO/com/gmail/nossr50/mcTimer.java +++ b/mcMMO/com/gmail/nossr50/mcTimer.java @@ -5,6 +5,8 @@ import java.util.TimerTask; import org.bukkit.ChatColor; import org.bukkit.entity.*; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcTimer extends TimerTask{ private final mcMMO plugin; @@ -17,9 +19,10 @@ public class mcTimer extends TimerTask{ public void run() { Player[] playerlist = plugin.getServer().getOnlinePlayers(); for(Player player : playerlist){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(player == null) continue; - if(mcUsers.getProfile(player) == null) + if(PP == null) mcUsers.addUser(player); /* * MONITOR SKILLS @@ -33,31 +36,31 @@ public class mcTimer extends TimerTask{ /* * PLAYER BLEED MONITORING */ - if(thecount % 2 == 0 && player != null && mcUsers.getProfile(player).getBleedTicks() >= 1){ + if(thecount % 2 == 0 && player != null && PP.getBleedTicks() >= 1){ player.damage(2); - mcUsers.getProfile(player).decreaseBleedTicks(); + PP.decreaseBleedTicks(); } - if(mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= mcUsers.getProfile(player).getRecentlyHurt() + 60000){ + if(mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000){ if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){ if(player != null && player.getHealth() > 0 && player.getHealth() < 20 - && mcUsers.getProfile(player).getPowerLevel() >= 1000){ + && mcm.getInstance().getPowerLevel(player) >= 1000){ player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); } } if(thecount == 20 || thecount == 40){ if(player != null && player.getHealth() > 0 && player.getHealth() < 20 - && mcUsers.getProfile(player).getPowerLevel() >= 500 - && mcUsers.getProfile(player).getPowerLevel() < 1000){ + && mcm.getInstance().getPowerLevel(player) >= 500 + && mcm.getInstance().getPowerLevel(player) < 1000){ player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); } } if(thecount == 40){ if(player != null && player.getHealth() > 0 && player.getHealth() < 20 - && mcUsers.getProfile(player).getPowerLevel() < 500){ + && mcm.getInstance().getPowerLevel(player) < 500){ player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); } } diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java index 576f8b0e7..58221800c 100644 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ b/mcMMO/com/gmail/nossr50/mcUsers.java @@ -77,8 +77,8 @@ public class mcUsers { //Output: none //Use: Creates the player profile //===================================================================== - public static void removeUser(Player player){ - players.removePlayer(player); + public static void removeUser(String playername){ + players.removePlayer(playername); } //===================================================================== @@ -87,8 +87,8 @@ public class mcUsers { //Output: PlayerList.PlayerProfile: The profile //Use: Gets the player profile //===================================================================== - public static PlayerList.PlayerProfile getProfile(Player player){ - return players.findProfile(player); + public static PlayerList.PlayerProfile getProfile(String playername){ + return players.findProfile(playername); } public static mcUsers getInstance() { @@ -131,9 +131,9 @@ class PlayerList //Output: None //Use: Remove the profile of the specified player //===================================================================== - public void removePlayer(Player player) + public void removePlayer(String playername) { - players.remove(findProfile(player)); + players.remove(findProfile(playername)); } //===================================================================== @@ -142,11 +142,11 @@ class PlayerList //Output: PlayerProfile: The profile of the specified player //Use: Get the profile for the specified player //===================================================================== - public PlayerProfile findProfile(Player player) + public PlayerProfile findProfile(String playername) { for(PlayerProfile ply : players) { - if(ply.isPlayer(player)) + if(ply.isPlayer(playername)) return ply; } return null; @@ -157,12 +157,12 @@ class PlayerList 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 boolean berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode; + 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, - treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0, - superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0, - skullSplitterATS = 0, skullSplitterDATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0; - private int berserkTicks = 0, bleedticks = 0, gigaDrillBreakerTicks = 0, superBreakerTicks = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, treeFellerTicks = 0; + greenTerraCooldown = 0, treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0, + mySpawnATS = 0, greenTerraATS = 0, greenTerraDATS = 0, superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0, + skullSplitterATS = 0, skullSplitterDATS = 0, hoePreparationATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0; + private int berserkTicks = 0, bleedticks = 0, greenTerraTicks = 0, gigaDrillBreakerTicks = 0, superBreakerTicks = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, treeFellerTicks = 0; //ATS = (Time of) Activation Time Stamp //DATS = (Time of) Deactivation Time Stamp Player thisplayer; @@ -420,10 +420,12 @@ class PlayerList //Output: Player: The player this profile belongs to //Use: Finds if this profile belongs to a specified player //===================================================================== - public boolean isPlayer(Player player) + public boolean isPlayer(String player) { - return player.getName().equals(playerName); + return player.equals(playerName); } + public boolean getPartyChatOnlyToggle(){return partyChatOnly;} + public void togglePartyChatOnly(){partyChatOnly = !partyChatOnly;} public boolean getAbilityUse(){ return abilityuse; } @@ -434,6 +436,12 @@ class PlayerList abilityuse = false; } } + public long getMySpawnATS(){ + return mySpawnATS; + } + public void setMySpawnATS(long newvalue){ + mySpawnATS = newvalue; + } public void decreaseBleedTicks(){ if(bleedticks >= 1){ bleedticks--; @@ -461,6 +469,22 @@ class PlayerList public long getArcheryShotATS() {return archeryShotATS;} public void setArcheryShotATS(long newvalue) {archeryShotATS = newvalue;} + /* + * HOE PREPARATION + */ + public boolean getHoePreparationMode(){ + return hoePreparationMode; + } + public void setHoePreparationMode(Boolean bool){ + hoePreparationMode = bool; + } + public long getHoePreparationATS(){ + return hoePreparationATS; + } + public void setHoePreparationATS(long newvalue){ + hoePreparationATS = newvalue; + } + /* * SWORDS PREPARATION */ @@ -536,6 +560,35 @@ class PlayerList public void setPickaxePreparationATS(long newvalue){ pickaxePreparationATS = newvalue; } + /* + * GREEN TERRA MODE + */ + public boolean getGreenTerraInformed() {return greenTerraInformed;} + public void setGreenTerraInformed(Boolean bool){ + greenTerraInformed = bool; + } + public boolean getGreenTerraMode(){ + return greenTerraMode; + } + public void setGreenTerraMode(Boolean bool){ + greenTerraMode = bool; + } + public long getGreenTerraActivatedTimeStamp() {return greenTerraATS;} + public void setGreenTerraActivatedTimeStamp(Long newvalue){ + greenTerraATS = newvalue; + } + public long getGreenTerraDeactivatedTimeStamp() {return greenTerraDATS;} + public void setGreenTerraDeactivatedTimeStamp(Long newvalue){ + greenTerraDATS = newvalue; + } + public void setGreenTerraCooldown(Long newvalue){ + greenTerraCooldown = newvalue; + } + public long getGreenTerraCooldown(){ + return greenTerraCooldown; + } + public void setGreenTerraTicks(Integer newvalue){greenTerraTicks = newvalue;} + public int getGreenTerraTicks(){return greenTerraTicks;} /* * BERSERK MODE */ @@ -1472,7 +1525,9 @@ class PlayerList axesgather = String.valueOf(Integer.valueOf(axesgather)+newvalue); } save(); + if(isPlayer(playerName)){ mcSkills.getInstance().XpCheck(thisplayer); + } } public void modifyskill(int newvalue, String skillname){ if(skillname.toLowerCase().equals("mining")){ @@ -1553,30 +1608,6 @@ class PlayerList return 0; } } - public int getPowerLevel(){ - int x = 0; - if(mcPermissions.getInstance().mining(thisplayer)) - x+=getMiningInt(); - if(mcPermissions.getInstance().woodcutting(thisplayer)) - x+=getWoodCuttingInt(); - if(mcPermissions.getInstance().unarmed(thisplayer)) - x+=getUnarmedInt(); - if(mcPermissions.getInstance().herbalism(thisplayer)) - x+=getHerbalismInt(); - if(mcPermissions.getInstance().excavation(thisplayer)) - x+=getExcavationInt(); - if(mcPermissions.getInstance().archery(thisplayer)) - x+=getArcheryInt(); - if(mcPermissions.getInstance().swords(thisplayer)) - x+=getSwordsInt(); - if(mcPermissions.getInstance().axes(thisplayer)) - x+=getAxesInt(); - if(mcPermissions.getInstance().acrobatics(thisplayer)) - x+=getAcrobaticsInt(); - if(mcPermissions.getInstance().repair(thisplayer)) - x+=getRepairInt(); - return x; - } public int getMiningGatherInt() { if(isInt(gather)){ return Integer.parseInt(gather); @@ -1654,9 +1685,9 @@ class PlayerList public Location getMySpawn(Player player){ Location loc = player.getWorld().getSpawnLocation(); if(isDouble(getX()) && isDouble(getY()) && isDouble(getX())){ - loc.setX(Double.parseDouble(mcUsers.getProfile(player).getX())); - loc.setY(Double.parseDouble(mcUsers.getProfile(player).getY())); - loc.setZ(Double.parseDouble(mcUsers.getProfile(player).getZ())); + 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; } diff --git a/mcMMO/com/gmail/nossr50/mcWoodCutting.java b/mcMMO/com/gmail/nossr50/mcWoodCutting.java index b695b5d7e..b7f5e1824 100644 --- a/mcMMO/com/gmail/nossr50/mcWoodCutting.java +++ b/mcMMO/com/gmail/nossr50/mcWoodCutting.java @@ -8,6 +8,7 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; import com.gmail.nossr50.PlayerList.PlayerProfile; @@ -27,17 +28,18 @@ public class mcWoodCutting { return instance; } public void woodCuttingProcCheck(Player player, Block block){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); byte type = block.getData(); Material mat = Material.getMaterial(block.getTypeId()); if(player != null){ - if(Math.random() * 1000 <= mcUsers.getProfile(player).getWoodCuttingInt()){ + if(Math.random() * 1000 <= PP.getWoodCuttingInt()){ ItemStack item = new ItemStack(mat, 1, (short) 0, type); block.getWorld().dropItemNaturally(block.getLocation(), item); } } } - public void treeFellerCheck(Player player, Block block){ - PlayerProfile PP = mcUsers.getProfile(player); + public void treeFellerCheck(Player player, Block block, Plugin pluginx){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(mcm.getInstance().isAxes(player.getItemInHand())){ if(block != null){ if(!mcm.getInstance().abilityBlockCheck(block)) @@ -50,7 +52,7 @@ public class mcWoodCutting { PP.setAxePreparationMode(false); } int ticks = 2; - int x = mcUsers.getProfile(player).getWoodCuttingInt(); + int x = PP.getWoodCuttingInt(); while(x >= 50){ x-=50; ticks++; @@ -58,6 +60,10 @@ public class mcWoodCutting { if(!PP.getTreeFellerMode() && mcSkills.getInstance().cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){ player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**"); + for(Player y : pluginx.getServer().getOnlinePlayers()){ + if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10) + y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Tree Feller!"); + } PP.setTreeFellerTicks(ticks * 1000); PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis()); PP.setTreeFellerMode(true); @@ -69,10 +75,11 @@ public class mcWoodCutting { } } public void treeFeller(Block block, Player player){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); int radius = 1; - if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 500) + if(PP.getWoodCuttingGatherInt() >= 500) radius++; - if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 950) + if(PP.getWoodCuttingGatherInt() >= 950) radius++; ArrayList blocklist = new ArrayList(); ArrayList toAdd = new ArrayList(); diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index a8f581620..571749772 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -14,11 +14,14 @@ import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcm { /* * I'm storing my functions/methods in here in an unorganized manner. Spheal with it. */ private static mcMMO plugin; + private static mcMMO pluginx; public mcm(mcMMO instance) { plugin = instance; } @@ -30,7 +33,31 @@ public class mcm { return instance; } - + public int getPowerLevel(Player player){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); + int x = 0; + if(mcPermissions.getInstance().mining(player)) + x+=PP.getMiningInt(); + if(mcPermissions.getInstance().woodcutting(player)) + x+=PP.getWoodCuttingInt(); + if(mcPermissions.getInstance().unarmed(player)) + x+=PP.getUnarmedInt(); + if(mcPermissions.getInstance().herbalism(player)) + x+=PP.getHerbalismInt(); + if(mcPermissions.getInstance().excavation(player)) + x+=PP.getExcavationInt(); + if(mcPermissions.getInstance().archery(player)) + x+=PP.getArcheryInt(); + if(mcPermissions.getInstance().swords(player)) + x+=PP.getSwordsInt(); + if(mcPermissions.getInstance().axes(player)) + x+=PP.getAxesInt(); + if(mcPermissions.getInstance().acrobatics(player)) + x+=PP.getAcrobaticsInt(); + if(mcPermissions.getInstance().repair(player)) + x+=PP.getRepairInt(); + return x; + } public boolean blockBreakSimulate(Block block, Player player, Plugin plugin){ FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player); @@ -180,7 +207,7 @@ public class mcm { } public boolean shouldBeWatched(Block block){ int id = block.getTypeId(); - if(id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24){ + if(id == 49 || id == 81 || id == 83 || id == 86 || id == 91 || id == 1 || id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24){ return true; } else { return false; @@ -277,11 +304,12 @@ public class mcm { } } public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){ + PlayerProfile PP = mcUsers.getProfile(player.getName()); if(split[0].equalsIgnoreCase("/woodcutting")){ event.setCancelled(true); - float skillvalue = (float)mcUsers.getProfile(player).getWoodCuttingInt(); + float skillvalue = (float)PP.getWoodCuttingInt(); int ticks = 2; - int x = mcUsers.getProfile(player).getWoodCuttingInt(); + int x = PP.getWoodCuttingInt(); while(x >= 50){ x-=50; ticks++; @@ -299,33 +327,33 @@ public class mcm { if(split[0].equalsIgnoreCase("/archery")){ event.setCancelled(true); Integer rank = 0; - if(mcUsers.getProfile(player).getArcheryInt() >= 50) + if(PP.getArcheryInt() >= 50) rank++; - if(mcUsers.getProfile(player).getArcheryInt() >= 250) + if(PP.getArcheryInt() >= 250) rank++; - if(mcUsers.getProfile(player).getArcheryInt() >= 575) + if(PP.getArcheryInt() >= 575) rank++; - if(mcUsers.getProfile(player).getArcheryInt() >= 725) + if(PP.getArcheryInt() >= 725) rank++; - if(mcUsers.getProfile(player).getArcheryInt() >= 1000) + if(PP.getArcheryInt() >= 1000) rank++; - float skillvalue = (float)mcUsers.getProfile(player).getArcheryInt(); + float skillvalue = (float)PP.getArcheryInt(); String percentage = String.valueOf((skillvalue / 1000) * 100); int ignition = 20; - if(mcUsers.getProfile(player).getArcheryInt() >= 200) + if(PP.getArcheryInt() >= 200) ignition+=20; - if(mcUsers.getProfile(player).getArcheryInt() >= 400) + if(PP.getArcheryInt() >= 400) ignition+=20; - if(mcUsers.getProfile(player).getArcheryInt() >= 600) + if(PP.getArcheryInt() >= 600) ignition+=20; - if(mcUsers.getProfile(player).getArcheryInt() >= 800) + if(PP.getArcheryInt() >= 800) ignition+=20; - if(mcUsers.getProfile(player).getArcheryInt() >= 1000) + if(PP.getArcheryInt() >= 1000) ignition+=20; String percentagedaze; - if(mcUsers.getProfile(player).getArcheryInt() < 1000){ + if(PP.getArcheryInt() < 1000){ percentagedaze = String.valueOf((skillvalue / 2000) * 100); } else { percentagedaze = "50"; @@ -346,14 +374,14 @@ public class mcm { if(split[0].equalsIgnoreCase("/axes")){ event.setCancelled(true); String percentage; - float skillvalue = (float)mcUsers.getProfile(player).getAxesInt(); - if(mcUsers.getProfile(player).getAxesInt() < 750){ + float skillvalue = (float)PP.getAxesInt(); + if(PP.getAxesInt() < 750){ percentage = String.valueOf((skillvalue / 1000) * 100); } else { percentage = "75"; } int ticks = 2; - int x = mcUsers.getProfile(player).getAxesInt(); + int x = PP.getAxesInt(); while(x >= 50){ x-=50; ticks++; @@ -367,7 +395,7 @@ public class mcm { player.sendMessage(ChatColor.DARK_AQUA+"Axe Mastery (500 SKILL): "+ChatColor.GREEN+"Modifies Damage"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"Chance to crtically strike: "+ChatColor.YELLOW+percentage+"%"); - if(mcUsers.getProfile(player).getAxesInt() < 500){ + if(PP.getAxesInt() < 500){ player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (AXEMASTERY)"); } else { player.sendMessage(ChatColor.RED+"Axe Mastery:"+ChatColor.YELLOW+" Bonus 4 damage"); @@ -378,8 +406,8 @@ public class mcm { event.setCancelled(true); int bleedrank = 2; String percentage, parrypercentage = null, counterattackpercentage; - float skillvalue = (float)mcUsers.getProfile(player).getSwordsInt(); - if(mcUsers.getProfile(player).getSwordsInt() < 750){ + float skillvalue = (float)PP.getSwordsInt(); + if(PP.getSwordsInt() < 750){ percentage = String.valueOf((skillvalue / 1000) * 100); } else { percentage = "75"; @@ -387,20 +415,20 @@ public class mcm { if(skillvalue >= 750) bleedrank+=1; - if(mcUsers.getProfile(player).getSwordsInt() <= 900){ + if(PP.getSwordsInt() <= 900){ parrypercentage = String.valueOf((skillvalue / 3000) * 100); } else { parrypercentage = "30"; } - if(mcUsers.getProfile(player).getSwordsInt() <= 600){ + if(PP.getSwordsInt() <= 600){ counterattackpercentage = String.valueOf((skillvalue / 2000) * 100); } else { counterattackpercentage = "30"; } int ticks = 2; - int x = mcUsers.getProfile(player).getSwordsInt(); + int x = PP.getSwordsInt(); while(x >= 50){ x-=50; ticks++; @@ -426,10 +454,10 @@ public class mcm { if(split[0].equalsIgnoreCase("/acrobatics")){ event.setCancelled(true); String dodgepercentage; - float skillvalue = (float)mcUsers.getProfile(player).getAcrobaticsInt(); + float skillvalue = (float)PP.getAcrobaticsInt(); String percentage = String.valueOf((skillvalue / 1000) * 100); String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2); - if(mcUsers.getProfile(player).getAcrobaticsInt() <= 800){ + if(PP.getAcrobaticsInt() <= 800){ dodgepercentage = String.valueOf((skillvalue / 4000 * 100)); } else { dodgepercentage = "20"; @@ -446,10 +474,10 @@ public class mcm { player.sendMessage(ChatColor.RED+"Dodge Chance: "+ChatColor.YELLOW+dodgepercentage+"%"); } if(split[0].equalsIgnoreCase("/mining")){ - float skillvalue = (float)mcUsers.getProfile(player).getMiningInt(); + float skillvalue = (float)PP.getMiningInt(); String percentage = String.valueOf((skillvalue / 1000) * 100); int ticks = 2; - int x = mcUsers.getProfile(player).getMiningInt(); + int x = PP.getMiningInt(); while(x >= 50){ x-=50; ticks++; @@ -465,7 +493,7 @@ public class mcm { player.sendMessage(ChatColor.RED+"Super Breaker Length: "+ChatColor.YELLOW+ticks+"s"); } if(split[0].equalsIgnoreCase("/repair")){ - float skillvalue = (float)mcUsers.getProfile(player).getRepairInt(); + float skillvalue = (float)PP.getRepairInt(); String percentage = String.valueOf((skillvalue / 1000) * 100); String repairmastery = String.valueOf((skillvalue / 500) * 100); event.setCancelled(true); @@ -483,15 +511,15 @@ public class mcm { if(split[0].equalsIgnoreCase("/unarmed")){ event.setCancelled(true); String percentage, arrowpercentage; - float skillvalue = (float)mcUsers.getProfile(player).getUnarmedInt(); + float skillvalue = (float)PP.getUnarmedInt(); - if(mcUsers.getProfile(player).getUnarmedInt() < 1000){ + if(PP.getUnarmedInt() < 1000){ percentage = String.valueOf((skillvalue / 4000) * 100); } else { percentage = "25"; } - if(mcUsers.getProfile(player).getUnarmedInt() < 1000){ + if(PP.getUnarmedInt() < 1000){ arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2); } else { arrowpercentage = "50"; @@ -499,7 +527,7 @@ public class mcm { int ticks = 2; - int x = mcUsers.getProfile(player).getUnarmedInt(); + int x = PP.getUnarmedInt(); while(x >= 50){ x-=50; ticks++; @@ -516,9 +544,9 @@ public class mcm { player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"Arrow Deflect Chance: "+ChatColor.YELLOW+arrowpercentage+"%"); player.sendMessage(ChatColor.RED+"Disarm Chance: "+ChatColor.YELLOW+percentage+"%"); - if(mcUsers.getProfile(player).getUnarmedInt() < 250){ + if(PP.getUnarmedInt() < 250){ player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)"); - } else if(mcUsers.getProfile(player).getUnarmedInt() >= 250 && mcUsers.getProfile(player).getUnarmedInt() < 500){ + } else if(PP.getUnarmedInt() >= 250 && PP.getUnarmedInt() < 500){ player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade"); player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (UNARMED MASTERY)"); } else { @@ -529,37 +557,59 @@ public class mcm { if(split[0].equalsIgnoreCase("/herbalism")){ event.setCancelled(true); int rank = 0; - if(mcUsers.getProfile(player).getHerbalismInt() >= 50) + if(PP.getHerbalismInt() >= 50) rank++; - if (mcUsers.getProfile(player).getHerbalismInt() >= 150) + if (PP.getHerbalismInt() >= 150) rank++; - if (mcUsers.getProfile(player).getHerbalismInt() >= 250) + if (PP.getHerbalismInt() >= 250) rank++; - if (mcUsers.getProfile(player).getHerbalismInt() >= 350) + if (PP.getHerbalismInt() >= 350) rank++; - if (mcUsers.getProfile(player).getHerbalismInt() >= 450) + if (PP.getHerbalismInt() >= 450) rank++; - if (mcUsers.getProfile(player).getHerbalismInt() >= 550) + if (PP.getHerbalismInt() >= 550) rank++; - if (mcUsers.getProfile(player).getHerbalismInt() >= 650) + if (PP.getHerbalismInt() >= 650) rank++; - if (mcUsers.getProfile(player).getHerbalismInt() >= 750) + if (PP.getHerbalismInt() >= 750) rank++; - float skillvalue = (float)mcUsers.getProfile(player).getHerbalismInt(); + int bonus = 0; + if(PP.getHerbalismInt() >= 200) + bonus++; + if(PP.getHerbalismInt() >= 400) + bonus++; + if(PP.getHerbalismInt() >= 600) + bonus++; + + int ticks = 2; + int x = PP.getHerbalismInt(); + while(x >= 50){ + x-=50; + ticks++; + } + + float skillvalue = (float)PP.getHerbalismInt(); String percentage = String.valueOf((skillvalue / 1000) * 100); + String gpercentage = String.valueOf((skillvalue / 1500) * 100); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"HERBALISM"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Harvesting Herbs"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); + player.sendMessage(ChatColor.DARK_AQUA+"Green Terra (ABILITY): "+ChatColor.GREEN+"Spread the Terra, 3x Drops"); + player.sendMessage(ChatColor.DARK_AQUA+"Green Thumb (Wheat): "+ChatColor.GREEN+"Auto-Plants wheat when harvesting"); + player.sendMessage(ChatColor.DARK_AQUA+"Green Thumb (Cobble): "+ChatColor.GREEN+"Cobblestone -> Mossy w/ Seeds"); player.sendMessage(ChatColor.DARK_AQUA+"Food+: "+ChatColor.GREEN+"Modifies health received from bread/stew"); - player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (Wheat): "+ChatColor.GREEN+"Double the normal loot"); + player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (All Herbs): "+ChatColor.GREEN+"Double the normal loot"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); + player.sendMessage(ChatColor.RED+"Green Terra Length: "+ChatColor.YELLOW+ticks+"s"); + player.sendMessage(ChatColor.RED+"Green Thumb Chance: "+gpercentage+"%"); + player.sendMessage(ChatColor.RED+"Green Thumb Stage: Wheat grows in stage "+bonus); player.sendMessage(ChatColor.RED+"Double Drop Chance: "+percentage+"%"); player.sendMessage(ChatColor.RED+"Food+ (Rank"+rank+"): Bonus "+rank+" healing"); } if(split[0].equalsIgnoreCase("/excavation")){ event.setCancelled(true); int ticks = 2; - int x = mcUsers.getProfile(player).getExcavationInt(); + int x = PP.getExcavationInt(); while(x >= 50){ x-=50; ticks++; diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index ac8fad4c6..4f42da846 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.9.21 \ No newline at end of file +version: 0.9.25 \ No newline at end of file