From d091ab9765c2ff4c5e4a4640f8e71df1bdd1afe7 Mon Sep 17 00:00:00 2001 From: jack lin Date: Fri, 18 Jul 2014 18:01:00 +1200 Subject: [PATCH 1/5] Fix NPE in Methods http://pastebin.com/9J0qAWTh --- src/com/projectkorra/ProjectKorra/Methods.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/projectkorra/ProjectKorra/Methods.java b/src/com/projectkorra/ProjectKorra/Methods.java index e62d441a..b17763ad 100644 --- a/src/com/projectkorra/ProjectKorra/Methods.java +++ b/src/com/projectkorra/ProjectKorra/Methods.java @@ -610,7 +610,8 @@ public class Methods { public static String getBoundAbility(Player player) { BendingPlayer bPlayer = getBendingPlayer(player.getName()); - + if (bPlayer == null) return null; + int slot = player.getInventory().getHeldItemSlot() + 1; return bPlayer.abilities.get(slot); } From 7d9419d319cc4fbbaf9ff915fa8c9a96a153c51f Mon Sep 17 00:00:00 2001 From: jack lin Date: Fri, 18 Jul 2014 18:02:06 +1200 Subject: [PATCH 2/5] Fix another NPE in Methods http://pastebin.com/sqiqfjin --- src/com/projectkorra/ProjectKorra/Methods.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/com/projectkorra/ProjectKorra/Methods.java b/src/com/projectkorra/ProjectKorra/Methods.java index b17763ad..5e394b71 100644 --- a/src/com/projectkorra/ProjectKorra/Methods.java +++ b/src/com/projectkorra/ProjectKorra/Methods.java @@ -539,6 +539,8 @@ public class Methods { public static boolean canBendPassive(String player, Element element) { BendingPlayer bPlayer = getBendingPlayer(player); Player p = Bukkit.getPlayer(player); + if (bPlayer == null) return false; + if (p == null) return false; if (!p.hasPermission("bending." + element.toString().toLowerCase() + ".passive")) return false; if (!bPlayer.isToggled) return false; if (!bPlayer.hasElement(element)) return false; From fbf533f49d52fec3ce956d185eb6118f9f362030 Mon Sep 17 00:00:00 2001 From: jack lin Date: Fri, 18 Jul 2014 18:02:52 +1200 Subject: [PATCH 3/5] Fix attempt NPE in Methods http://pastie.org/9383324 --- src/com/projectkorra/ProjectKorra/Methods.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/projectkorra/ProjectKorra/Methods.java b/src/com/projectkorra/ProjectKorra/Methods.java index 5e394b71..02a3ae18 100644 --- a/src/com/projectkorra/ProjectKorra/Methods.java +++ b/src/com/projectkorra/ProjectKorra/Methods.java @@ -502,6 +502,7 @@ public class Methods { public static boolean canBend(String player, String ability) { BendingPlayer bPlayer = getBendingPlayer(player); Player p = Bukkit.getPlayer(player); + if (bPlayer == null) return false; if (!bPlayer.isToggled) return false; if (p == null) return false; if (!p.hasPermission("bending.ability." + ability)) return false; From cf004c55925b9816cb5e29d3f53a74cf9899cf9d Mon Sep 17 00:00:00 2001 From: jack lin Date: Fri, 18 Jul 2014 18:11:03 +1200 Subject: [PATCH 4/5] Removed "this" keyword for static access --- src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java b/src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java index a4b7c5f2..a2750060 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java @@ -117,7 +117,7 @@ public class IceSpike { public IceSpike(Player player, Location origin, int damage, Vector throwing, long aoecooldown) { - this.cooldown = aoecooldown; + cooldown = aoecooldown; this.player = player; this.origin = origin; location = origin.clone(); From 55594db605f41672a729698b5943bd8c8680d0f0 Mon Sep 17 00:00:00 2001 From: jack lin Date: Fri, 18 Jul 2014 18:27:00 +1200 Subject: [PATCH 5/5] Moved an If check under its element --- src/com/projectkorra/ProjectKorra/PKListener.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/projectkorra/ProjectKorra/PKListener.java b/src/com/projectkorra/ProjectKorra/PKListener.java index f79e0972..5ec86ad5 100644 --- a/src/com/projectkorra/ProjectKorra/PKListener.java +++ b/src/com/projectkorra/ProjectKorra/PKListener.java @@ -274,10 +274,6 @@ public class PKListener implements Listener { if (!player.isSneaking() && Methods.canBend(player.getName(), abil)) { - if (abil.equalsIgnoreCase("AirShield")) { - new AirShield(player); - } - if (Methods.isAirAbility(abil)) { if (Methods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) { return; @@ -297,6 +293,10 @@ public class PKListener implements Listener { if (abil.equalsIgnoreCase("AirSwipe")) { AirSwipe.charge(player); } + if (abil.equalsIgnoreCase("AirShield")) { + new AirShield(player); + } + } if (Methods.isWaterAbility(abil)) {