From 88ab232ccdd77574f78a8cd79fb7a00bd944337e Mon Sep 17 00:00:00 2001 From: TheYeti Date: Thu, 8 Mar 2012 12:11:09 -0800 Subject: [PATCH] Undo Taming fix, attempt fix of block interact NPE --- Changelog.txt | 2 +- .../com/gmail/nossr50/listeners/mcPlayerListener.java | 8 +++++++- src/main/java/com/gmail/nossr50/skills/Taming.java | 9 +-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 07bfcdf0f..3b4e5f3fe 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -16,7 +16,7 @@ Version 2.0.00-dev = Fixed issue with Blast Mining not seeing TNT for detonation due to snow ! Changed Call of the Wild to activate on left-click rather than right-click ! Changed Blast Mining to track based on Entity ID vs. Location - = Fix Taming to hopefully properly handle offline players....again + = Attempted fix of block interaction returning NPE's Version 1.3.02 + Added in game guides for Mining, Excavation, and Acrobatics. Simply type /skillname ? to access them diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index d716aa965..c57bccad3 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -156,7 +156,13 @@ public class mcPlayerListener implements Listener Action action = event.getAction(); Block block = event.getClickedBlock(); ItemStack is = player.getItemInHand(); - Material mat = block.getType(); + Material mat; + if (block.equals(null)) { + mat = Material.AIR; + } + else { + mat = block.getType(); + } /* * Ability checks diff --git a/src/main/java/com/gmail/nossr50/skills/Taming.java b/src/main/java/com/gmail/nossr50/skills/Taming.java index 152091cdc..093c87286 100644 --- a/src/main/java/com/gmail/nossr50/skills/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/Taming.java @@ -104,14 +104,7 @@ public class Taming { DamageCause cause = event.getCause(); Wolf wolf = (Wolf) event.getEntity(); - Player master; - if ( wolf.getOwner() instanceof Player ) { - master = (Player) wolf.getOwner(); - } - else { - OfflinePlayer oMaster = (OfflinePlayer) wolf.getOwner(); - master = (Player) oMaster.getPlayer(); - } + Player master = (Player) wolf.getOwner(); int skillLevel = Users.getProfile(master).getSkillLevel(SkillType.TAMING); switch(cause)