From 6b97494b75480854d383c480948c861c687ad278 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 7 Aug 2011 15:44:50 -0700 Subject: [PATCH] Another WIP --- mcMMO/Changelog.txt | 1 + mcMMO/com/gmail/nossr50/Combat.java | 6 +- .../com/gmail/nossr50/contrib/SpoutStuff.java | 2 +- .../nossr50/listeners/mcBlockListener.java | 26 ++-- mcMMO/com/gmail/nossr50/m.java | 31 +++-- mcMMO/com/gmail/nossr50/skills/Axes.java | 4 +- .../com/gmail/nossr50/skills/Excavation.java | 6 +- mcMMO/com/gmail/nossr50/skills/Herbalism.java | 72 ++++++------ mcMMO/com/gmail/nossr50/skills/Mining.java | 111 ++++-------------- mcMMO/com/gmail/nossr50/skills/Repair.java | 1 - mcMMO/com/gmail/nossr50/skills/Skills.java | 2 +- mcMMO/com/gmail/nossr50/skills/Swords.java | 5 +- mcMMO/com/gmail/nossr50/skills/Unarmed.java | 17 +-- .../com/gmail/nossr50/skills/WoodCutting.java | 6 +- 14 files changed, 114 insertions(+), 176 deletions(-) diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 0813a674c..45b32fb1e 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -9,6 +9,7 @@ Intervals at which players renegerate hp have doubled in length Rewrote many variables stored per player to be integer instead of long, reducing overall memory usage of mcMMO Rewrote the Timer mcMMO relies on to instead use the BukkitScheduler for performance Fixed the party member list of /party +Removed a debug message when repairing diamond armor Version 1.0.50 New /xprate command for those with mcmmo.admin permissions! diff --git a/mcMMO/com/gmail/nossr50/Combat.java b/mcMMO/com/gmail/nossr50/Combat.java index 795877809..efd367c5a 100644 --- a/mcMMO/com/gmail/nossr50/Combat.java +++ b/mcMMO/com/gmail/nossr50/Combat.java @@ -266,11 +266,11 @@ public class Combat { //Check to see if any abilities need to be activated if(PPa.getAxePreparationMode()) - Axes.skullSplitterCheck(attacker, pluginx); + Axes.skullSplitterCheck(attacker); if(PPa.getSwordsPreparationMode()) - Swords.serratedStrikesActivationCheck(attacker, pluginx); + Swords.serratedStrikesActivationCheck(attacker); if(PPa.getFistsPreparationMode()) - Unarmed.berserkActivationCheck(attacker, pluginx); + Unarmed.berserkActivationCheck(attacker); } public static void archeryCheck(EntityDamageByProjectileEvent event, mcMMO pluginx) { diff --git a/mcMMO/com/gmail/nossr50/contrib/SpoutStuff.java b/mcMMO/com/gmail/nossr50/contrib/SpoutStuff.java index dd74cda5b..4c470fe32 100644 --- a/mcMMO/com/gmail/nossr50/contrib/SpoutStuff.java +++ b/mcMMO/com/gmail/nossr50/contrib/SpoutStuff.java @@ -332,7 +332,7 @@ public class SpoutStuff } public static String getUrlIcon(SkillType skillType) { - return "http://dl.dropbox.com/u/18212134/xpbar/+"+m.getCapitalized(skillType.toString())+".png"; + return "http://dl.dropbox.com/u/18212134/xpbar/"+m.getCapitalized(skillType.toString())+".png"; } public static boolean shouldBeFilled(PlayerProfile PP) { diff --git a/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java b/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java index a203c1374..56839ee21 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java @@ -115,7 +115,7 @@ public class mcBlockListener extends BlockListener //Green Terra if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07) { - Herbalism.greenTerraCheck(player, block, plugin); + Herbalism.greenTerraCheck(player, block); } //Wheat && Triple drops @@ -135,17 +135,11 @@ public class mcBlockListener extends BlockListener { if(m.isMiningPick(inhand)) { - if(PP.getSkillLevel(SkillType.MINING) >= 500) - Mining.miningBlockCheck(false, player, block, plugin); - else - Mining.miningBlockCheck(false, player, block, plugin); + Mining.miningBlockCheck(false, player, block, plugin); } } else { - if(PP.getSkillLevel(SkillType.MINING) >= 500) - Mining.miningBlockCheck(false, player, block, plugin); - else - Mining.miningBlockCheck(false, player, block, plugin); + Mining.miningBlockCheck(false, player, block, plugin); } } /* @@ -243,14 +237,14 @@ public class mcBlockListener extends BlockListener /* * EXCAVATION */ - if(mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 5) + if(Excavation.canBeGigaDrillBroken(block) && mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 5) Excavation.excavationProcCheck(block.getData(), block.getTypeId(), block.getLocation(), player); /* * HERBALISM */ if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalism(player) && Herbalism.canBeGreenTerra(block)) { - Herbalism.greenTerraCheck(player, block, plugin); + Herbalism.greenTerraCheck(player, block); } if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5) Herbalism.herbalismProcCheck(block, player, event, plugin); @@ -281,15 +275,15 @@ public class mcBlockListener extends BlockListener * ABILITY PREPARATION CHECKS */ if(PP.getHoePreparationMode() && Herbalism.canBeGreenTerra(block)) - Herbalism.greenTerraCheck(player, block, plugin); + Herbalism.greenTerraCheck(player, block); if(PP.getAxePreparationMode() && block.getTypeId() == 17) - WoodCutting.treeFellerCheck(player, block, plugin); + WoodCutting.treeFellerCheck(player, block); if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block)) - Mining.superBreakerCheck(player, block, plugin); + Mining.superBreakerCheck(player, block); if(PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block)) - Excavation.gigaDrillBreakerActivationCheck(player, block, plugin); + Excavation.gigaDrillBreakerActivationCheck(player, block); if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78)) - Unarmed.berserkActivationCheck(player, plugin); + Unarmed.berserkActivationCheck(player); /* * TREE FELLAN STUFF diff --git a/mcMMO/com/gmail/nossr50/m.java b/mcMMO/com/gmail/nossr50/m.java index 57393aab8..950d77c99 100644 --- a/mcMMO/com/gmail/nossr50/m.java +++ b/mcMMO/com/gmail/nossr50/m.java @@ -112,7 +112,6 @@ public class m public static boolean blockBreakSimulate(Block block, Player player, Plugin plugin) { - FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player); if(block != null && plugin != null && player != null){ plugin.getServer().getPluginManager().callEvent(event); @@ -146,7 +145,8 @@ public class m } } } - public static Integer getTier(Player player){ + public static Integer getTier(Player player) + { int i = player.getItemInHand().getTypeId(); if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){ return 1; //WOOD @@ -162,7 +162,8 @@ public class m return 1; //UNRECOGNIZED } } - public static Integer getMaxDurability(Integer tier, ItemStack item){ + public static Integer getMaxDurability(Integer tier, ItemStack item) + { int id = item.getTypeId(); if(tier == 1){ if((id == 276 || id == 277 || id == 278 || id == 279 || id == 293)){ @@ -242,8 +243,10 @@ public class m } return true; } - public static void mcDropItem(Location loc, int id){ - if(loc != null){ + public static void mcDropItem(Location loc, int id) + { + if(loc != null) + { Material mat = Material.getMaterial(id); byte damage = 0; ItemStack item = new ItemStack(mat, 1, (byte)0, damage); @@ -251,18 +254,24 @@ public class m } } - public static boolean isSwords(ItemStack is){ - if(is.getTypeId() == 268 || is.getTypeId() == 267 || is.getTypeId() == 272 || is.getTypeId() == 283 || is.getTypeId() == 276){ + public static boolean isSwords(ItemStack is) + { + if(is.getTypeId() == 268 || is.getTypeId() == 267 || is.getTypeId() == 272 || is.getTypeId() == 283 || is.getTypeId() == 276) + { return true; - } else { + } else + { return false; } } - public static boolean isHoe(ItemStack is){ + public static boolean isHoe(ItemStack is) + { int id = is.getTypeId(); - if(id == 290 || id == 291 || id == 292 || id == 293 || id == 294){ + if(id == 290 || id == 291 || id == 292 || id == 293 || id == 294) + { return true; - } else { + } else + { return false; } } diff --git a/mcMMO/com/gmail/nossr50/skills/Axes.java b/mcMMO/com/gmail/nossr50/skills/Axes.java index b2d0acf2e..f97bbc121 100644 --- a/mcMMO/com/gmail/nossr50/skills/Axes.java +++ b/mcMMO/com/gmail/nossr50/skills/Axes.java @@ -18,7 +18,7 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.party.Party; public class Axes { - public static void skullSplitterCheck(Player player, Plugin pluginx){ + public static void skullSplitterCheck(Player player){ PlayerProfile PP = Users.getProfile(player); if(m.isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){ /* @@ -38,7 +38,7 @@ public class Axes { if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown)) { player.sendMessage(mcLocale.getString("Skills.SkullSplitterOn")); - for(Player y : pluginx.getServer().getOnlinePlayers()){ + for(Player y : player.getWorld().getPlayers()){ if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) y.sendMessage(mcLocale.getString("Skills.SkullSplitterPlayer", new Object[] {player.getName()})); } diff --git a/mcMMO/com/gmail/nossr50/skills/Excavation.java b/mcMMO/com/gmail/nossr50/skills/Excavation.java index 7820518b2..9cd165acc 100644 --- a/mcMMO/com/gmail/nossr50/skills/Excavation.java +++ b/mcMMO/com/gmail/nossr50/skills/Excavation.java @@ -7,8 +7,6 @@ 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.locale.mcLocale; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; @@ -19,7 +17,7 @@ import com.gmail.nossr50.datatypes.SkillType; public class Excavation { - public static void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx) + public static void gigaDrillBreakerActivationCheck(Player player, Block block) { PlayerProfile PP = Users.getProfile(player); if(m.isShovel(player.getItemInHand())) @@ -44,7 +42,7 @@ public class Excavation if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerDeactivatedTimeStamp() < System.currentTimeMillis()) { player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOn")); - for(Player y : pluginx.getServer().getOnlinePlayers()) + for(Player y : player.getWorld().getPlayers()) { if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) y.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerPlayer", new Object[] {player.getName()})); diff --git a/mcMMO/com/gmail/nossr50/skills/Herbalism.java b/mcMMO/com/gmail/nossr50/skills/Herbalism.java index 53ed52784..bacefb9ee 100644 --- a/mcMMO/com/gmail/nossr50/skills/Herbalism.java +++ b/mcMMO/com/gmail/nossr50/skills/Herbalism.java @@ -7,8 +7,6 @@ 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.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; @@ -18,8 +16,46 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; -public class Herbalism { +public class Herbalism +{ + public static void greenTerraCheck(Player player, Block block) + { + PlayerProfile PP = Users.getProfile(player); + if(m.isHoe(player.getItemInHand())) + { + if(block != null) + { + if(!m.abilityBlockCheck(block)) + return; + } + if(PP.getHoePreparationMode()) + { + PP.setHoePreparationMode(false); + } + int ticks = 2; + int x = PP.getSkillLevel(SkillType.HERBALISM); + while(x >= 50) + { + x-=50; + ticks++; + } + + if(!PP.getGreenTerraMode() && Skills.cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), LoadProperties.greenTerraCooldown)) + { + player.sendMessage(mcLocale.getString("Skills.GreenTerraOn")); + for(Player y : player.getWorld().getPlayers()) + { + if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) + y.sendMessage(mcLocale.getString("Skills.GreenTerraPlayer", new Object[] {player.getName()})); + } + PP.setGreenTerraActivatedTimeStamp(System.currentTimeMillis()); + PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000)); + PP.setGreenTerraMode(true); + } + + } + } public static void greenTerraWheat(Player player, Block block, BlockBreakEvent event, mcMMO plugin) { if(block.getType() == Material.WHEAT && block.getData() == (byte) 0x07) @@ -89,36 +125,6 @@ public class Herbalism { } } } - public static void greenTerraCheck(Player player, Block block, Plugin pluginx){ - PlayerProfile PP = Users.getProfile(player); - if(m.isHoe(player.getItemInHand())){ - if(block != null){ - if(!m.abilityBlockCheck(block)) - return; - } - if(PP.getHoePreparationMode()){ - PP.setHoePreparationMode(false); - } - int ticks = 2; - int x = PP.getSkillLevel(SkillType.HERBALISM); - while(x >= 50){ - x-=50; - ticks++; - } - - if(!PP.getGreenTerraMode() && Skills.cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), LoadProperties.greenTerraCooldown)){ - player.sendMessage(mcLocale.getString("Skills.GreenTerraOn")); - for(Player y : pluginx.getServer().getOnlinePlayers()){ - if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) - y.sendMessage(mcLocale.getString("Skills.GreenTerraPlayer", new Object[] {player.getName()})); - } - PP.setGreenTerraActivatedTimeStamp(System.currentTimeMillis()); - PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000)); - PP.setGreenTerraMode(true); - } - - } - } public static void herbalismProcCheck(Block block, Player player, BlockBreakEvent event, mcMMO plugin) { PlayerProfile PP = Users.getProfile(player); diff --git a/mcMMO/com/gmail/nossr50/skills/Mining.java b/mcMMO/com/gmail/nossr50/skills/Mining.java index 943760239..6e58e32c7 100644 --- a/mcMMO/com/gmail/nossr50/skills/Mining.java +++ b/mcMMO/com/gmail/nossr50/skills/Mining.java @@ -6,7 +6,6 @@ import org.bukkit.Statistic; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; import org.getspout.spoutapi.sound.SoundEffect; import com.gmail.nossr50.Users; @@ -21,19 +20,24 @@ import com.gmail.nossr50.locale.mcLocale; public class Mining { - public static void superBreakerCheck(Player player, Block block, Plugin pluginx) + public static void superBreakerCheck(Player player, Block block) { PlayerProfile PP = Users.getProfile(player); - if(m.isMiningPick(player.getItemInHand())){ - if(block != null){ + if(m.isMiningPick(player.getItemInHand())) + { + if(block != null) + { if(!m.abilityBlockCheck(block)) return; } - if(PP.getPickaxePreparationMode()){ + if(PP.getPickaxePreparationMode()) + { PP.setPickaxePreparationMode(false); } + int ticks = 2; int x = PP.getSkillLevel(SkillType.MINING); + while(x >= 50) { x-=50; @@ -42,7 +46,7 @@ public class Mining if(!PP.getSuperBreakerMode() && Skills.cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), LoadProperties.superBreakerCooldown)){ player.sendMessage(mcLocale.getString("Skills.SuperBreakerOn")); - for(Player y : pluginx.getServer().getOnlinePlayers()) + for(Player y : player.getWorld().getPlayers()) { if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) y.sendMessage(mcLocale.getString("Skills.SuperBreakerPlayer", new Object[] {player.getName()})); @@ -108,93 +112,17 @@ public class Mining loc.getWorld().dropItemNaturally(loc, item); } } - public static void blockProcSmeltSimulate(Block block) - { - Location loc = block.getLocation(); - Material mat = Material.getMaterial(block.getTypeId()); - byte damage = 0; - ItemStack item = new ItemStack(mat, 1, (byte)0, damage); - if(block.getTypeId() != 14 && block.getTypeId() != 15 && block.getTypeId() != 89 && block.getTypeId() != 73 && block.getTypeId() != 74 - && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16) - loc.getWorld().dropItemNaturally(loc, item); - if(block.getTypeId() == 14) - { - mat = Material.getMaterial(266); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 15) - { - mat = Material.getMaterial(265); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 89) - { - mat = Material.getMaterial(348); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 73 || block.getTypeId() == 74){ - mat = Material.getMaterial(331); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - if(Math.random() * 10 > 5){ - loc.getWorld().dropItemNaturally(loc, item); - } - } - if(block.getTypeId() == 21){ - mat = Material.getMaterial(351); - item = new ItemStack(mat, 1, (byte)0,(byte)0x4); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 56){ - mat = Material.getMaterial(264); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 1){ - mat = Material.getMaterial(4); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 16){ - mat = Material.getMaterial(263); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - } - /* - public static void blockProcSmeltCheck(Block block, Player player) - { - PlayerProfile PP = Users.getProfile(player); - if(player != null) - { - if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)) - { - blockProcSmeltSimulate(block); - return; - } - } - } - */ public static void blockProcCheck(Block block, Player player) { PlayerProfile PP = Users.getProfile(player); - if(player != null) + + if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)) { - if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)) - { - blockProcSimulate(block); - return; - } - } + blockProcSimulate(block); + return; + } } + public static void miningBlockCheck(Boolean smelt, Player player, Block block, mcMMO plugin) { PlayerProfile PP = Users.getProfile(player); @@ -295,14 +223,17 @@ public class Mining /* * Handling SuperBreaker stuff */ - public static Boolean canBeSuperBroken(Block block){ + public static Boolean canBeSuperBroken(Block block) + { int t = block.getTypeId(); - if(t == 49 || 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 static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin) { PlayerProfile PP = Users.getProfile(player); diff --git a/mcMMO/com/gmail/nossr50/skills/Repair.java b/mcMMO/com/gmail/nossr50/skills/Repair.java index 5d04c2bc0..058f2f980 100644 --- a/mcMMO/com/gmail/nossr50/skills/Repair.java +++ b/mcMMO/com/gmail/nossr50/skills/Repair.java @@ -50,7 +50,6 @@ public class Repair { removeItem(player, rDiamond); player.getItemInHand().setDurability(getRepairAmount(is, player)); durabilityAfter = player.getItemInHand().getDurability(); - player.sendMessage(String.valueOf(durabilityBefore - durabilityAfter)); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 6); //Boost XP PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); diff --git a/mcMMO/com/gmail/nossr50/skills/Skills.java b/mcMMO/com/gmail/nossr50/skills/Skills.java index 42a3fd821..f898c3a99 100644 --- a/mcMMO/com/gmail/nossr50/skills/Skills.java +++ b/mcMMO/com/gmail/nossr50/skills/Skills.java @@ -100,7 +100,7 @@ public class Skills return; } player.sendMessage(mcLocale.getString("Skills.ReadyHoe")); - PP.setHoePreparationATS(System.currentTimeMillis()/1000); + PP.setHoePreparationATS(System.currentTimeMillis()); PP.setHoePreparationMode(true); } } diff --git a/mcMMO/com/gmail/nossr50/skills/Swords.java b/mcMMO/com/gmail/nossr50/skills/Swords.java index 67c373a54..b31745ec5 100644 --- a/mcMMO/com/gmail/nossr50/skills/Swords.java +++ b/mcMMO/com/gmail/nossr50/skills/Swords.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Wolf; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.plugin.Plugin; import com.gmail.nossr50.Combat; import com.gmail.nossr50.Users; @@ -22,7 +21,7 @@ import com.gmail.nossr50.party.Party; public class Swords { - public static void serratedStrikesActivationCheck(Player player, Plugin pluginx){ + public static void serratedStrikesActivationCheck(Player player){ PlayerProfile PP = Users.getProfile(player); if(m.isSwords(player.getItemInHand())) { @@ -41,7 +40,7 @@ public class Swords if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesDeactivatedTimeStamp() < System.currentTimeMillis()) { player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOn")); - for(Player y : pluginx.getServer().getOnlinePlayers()) + for(Player y : player.getWorld().getPlayers()) { if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) y.sendMessage(mcLocale.getString("Skills.SerratedStrikesPlayer", new Object[] {player.getName()})); diff --git a/mcMMO/com/gmail/nossr50/skills/Unarmed.java b/mcMMO/com/gmail/nossr50/skills/Unarmed.java index 5085e243b..6fd7f067d 100644 --- a/mcMMO/com/gmail/nossr50/skills/Unarmed.java +++ b/mcMMO/com/gmail/nossr50/skills/Unarmed.java @@ -4,8 +4,6 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.config.LoadProperties; @@ -14,10 +12,13 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; public class Unarmed { - public static void berserkActivationCheck(Player player, Plugin pluginx){ + public static void berserkActivationCheck(Player player) + { PlayerProfile PP = Users.getProfile(player); - if(player.getItemInHand().getTypeId() == 0){ - if(PP.getFistsPreparationMode()){ + if(player.getItemInHand().getTypeId() == 0) + { + if(PP.getFistsPreparationMode()) + { PP.setFistsPreparationMode(false); } int ticks = 2; @@ -27,9 +28,11 @@ public class Unarmed { ticks++; } - if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), LoadProperties.berserkCooldown)){ + if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), LoadProperties.berserkCooldown)) + { player.sendMessage(mcLocale.getString("Skills.BerserkOn")); - for(Player y : pluginx.getServer().getOnlinePlayers()){ + for(Player y : player.getWorld().getPlayers()) + { if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()})); } diff --git a/mcMMO/com/gmail/nossr50/skills/WoodCutting.java b/mcMMO/com/gmail/nossr50/skills/WoodCutting.java index 5b4616a5d..04eb6310d 100644 --- a/mcMMO/com/gmail/nossr50/skills/WoodCutting.java +++ b/mcMMO/com/gmail/nossr50/skills/WoodCutting.java @@ -8,8 +8,6 @@ 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.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; @@ -38,7 +36,7 @@ public class WoodCutting } } } - public static void treeFellerCheck(Player player, Block block, Plugin pluginx) + public static void treeFellerCheck(Player player, Block block) { PlayerProfile PP = Users.getProfile(player); if(m.isAxes(player.getItemInHand())) @@ -66,7 +64,7 @@ public class WoodCutting if(!PP.getTreeFellerMode() && Skills.cooldownOver(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown)) { player.sendMessage(mcLocale.getString("Skills.TreeFellerOn")); - for(Player y : pluginx.getServer().getOnlinePlayers()) + for(Player y : player.getWorld().getPlayers()) { if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) y.sendMessage(mcLocale.getString("Skills.TreeFellerPlayer", new Object[] {player.getName()}));