From ffd71c42a779a2191b17c640b18416411a054c6e Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 7 Mar 2011 13:32:46 -0800 Subject: [PATCH] All changes up to 0.8.11 - Memory leak fixed! --- mcMMO/com/gmail/nossr50/mcCombat.java | 13 ++++++++----- mcMMO/com/gmail/nossr50/mcTimer.java | 2 +- mcMMO/com/gmail/nossr50/mcm.java | 3 ++- mcMMO/plugin.yml | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mcMMO/com/gmail/nossr50/mcCombat.java b/mcMMO/com/gmail/nossr50/mcCombat.java index ec9b878cd..2c6dce4a3 100644 --- a/mcMMO/com/gmail/nossr50/mcCombat.java +++ b/mcMMO/com/gmail/nossr50/mcCombat.java @@ -36,6 +36,9 @@ public class mcCombat { return; } Player defender = (Player)x; + //This may help compatability with NPC mods + if(mcUsers.getProfile(defender) == null) + mcUsers.addUser(defender); if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){ if(mcParty.getInstance().inSameParty(defender, attacker)){ event.setCancelled(true); @@ -833,10 +836,10 @@ public class mcCombat { } } public void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){ - if(mcm.getInstance().isSwords(defender.getItemInHand()) + if(defender != null && mcm.getInstance().isSwords(defender.getItemInHand()) && event.getDamage() > 0 && mcPermissions.getInstance().swords(defender)){ - if(mcUsers.getProfile(defender).getSwordsInt() >= 50 && mcUsers.getProfile(defender).getSwordsInt() < 250){ + if(defender != null && mcUsers.getProfile(defender).getSwordsInt() >= 50 && mcUsers.getProfile(defender).getSwordsInt() < 250){ if(Math.random() * 100 > 95){ event.setCancelled(true); defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*"); @@ -848,7 +851,7 @@ public class mcCombat { return; } } - if(mcUsers.getProfile(defender).getSwordsInt() >= 250 && mcUsers.getProfile(defender).getSwordsInt() < 450){ + if(defender != null && mcUsers.getProfile(defender).getSwordsInt() >= 250 && mcUsers.getProfile(defender).getSwordsInt() < 450){ if(Math.random() * 100 > 90){ event.setCancelled(true); defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*"); @@ -860,7 +863,7 @@ public class mcCombat { return; } } - if(mcUsers.getProfile(defender).getSwordsInt() >= 450 && mcUsers.getProfile(defender).getSwordsInt() < 775){ + if(defender != null && mcUsers.getProfile(defender).getSwordsInt() >= 450 && mcUsers.getProfile(defender).getSwordsInt() < 775){ if(Math.random() * 100 > 85){ event.setCancelled(true); defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*"); @@ -872,7 +875,7 @@ public class mcCombat { return; } } - if(mcUsers.getProfile(defender).getSwordsInt() >= 775){ + if(defender != null && mcUsers.getProfile(defender).getSwordsInt() >= 775){ if(Math.random() * 100 > 80){ event.setCancelled(true); defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*"); diff --git a/mcMMO/com/gmail/nossr50/mcTimer.java b/mcMMO/com/gmail/nossr50/mcTimer.java index f4fcbcafa..5e9b1e331 100644 --- a/mcMMO/com/gmail/nossr50/mcTimer.java +++ b/mcMMO/com/gmail/nossr50/mcTimer.java @@ -57,6 +57,6 @@ public class mcTimer extends TimerTask{ } else { thecount = 1; } - //mcCombat.getInstance().bleedSimulate(); + mcCombat.getInstance().bleedSimulate(); } } diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index 7eeff17f1..410e58a9e 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -321,6 +321,7 @@ public class mcm { if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcc)){ event.setCancelled(true); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.YELLOW+"mcMMO Commands"+ChatColor.RED+"[]---"); + player.sendMessage("/"+mcLoadProperties.stats+ChatColor.RED+" - View your mcMMO stats"); if(mcPermissions.getInstance().party(player)){ player.sendMessage(ChatColor.GREEN+"--PARTY COMMANDS--"); player.sendMessage("/"+mcLoadProperties.party+" [party name] "+ChatColor.RED+"- Create/Join designated party"); @@ -346,7 +347,7 @@ public class mcm { if(mcPermissions.getInstance().whois(player)) player.sendMessage("/"+mcLoadProperties.whois+" [playername] "+ChatColor.RED+"- View detailed player info"); if(mcPermissions.getInstance().mmoedit(player)){ - player.sendMessage("/"+mcLoadProperties.mmoedit+" [skill] [newvalue] "+ChatColor.RED+"Modify the designated skill value"); + //player.sendMessage("/"+mcLoadProperties.mmoedit+" [skill] [newvalue] "+ChatColor.RED+"Modify the designated skill value"); player.sendMessage("/"+mcLoadProperties.mmoedit+" [playername] [skill] [newvalue] "+ChatColor.RED+"- Modify target"); } if(mcPermissions.getInstance().mcgod(player)) diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index ff0ef1003..de9de5df8 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.8.11 WIP B16 \ No newline at end of file +version: 0.8.11 \ No newline at end of file