From 7b47d32a969c29613ab1dce8a916f71d57df6df3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 14 Aug 2012 14:09:49 -0700 Subject: [PATCH] Citizens compatibility. Bug fix for Woodcutting/custom trees. --- Changelog.txt | 2 ++ .../com/gmail/nossr50/skills/archery/ArcheryManager.java | 5 +++++ .../java/com/gmail/nossr50/skills/gathering/WoodCutting.java | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 7222883f3..054ffdcfb 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,6 +8,8 @@ Key: - Removal Version 1.3.11 + + Added compatibility with bow-wielding NPCs from Citizens/NPC mods + = Fixed bug where mcMMO could throw NPE errors if trees cut down were from a custom mod and had an id of 17 = Fixed bug where mcMMO would ignore other block-protection plugins for various abilities Version 1.3.10 diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java index dbad1e72e..c9111cf10 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -18,6 +18,11 @@ public class ArcheryManager { public ArcheryManager (Player player) { this.player = player; this.profile = Users.getProfile(player); + + //Compatibility with Citizens, Citizens NPCs won't create a profile so we'll check for it here + if(this.profile == null) + return; + this.skillLevel = profile.getSkillLevel(SkillType.ARCHERY); this.permissionsInstance = Permissions.getInstance(); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index 7d0657514..4e6ec3899 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -385,6 +385,11 @@ public class WoodCutting { } else { TreeSpecies species = TreeSpecies.getByData(block.getData()); + + //Apparently species can be null in certain cases (custom server mods?) + //https://github.com/mcMMO-Dev/mcMMO/issues/229 + if(species == null) + return; switch (species) { case GENERIC: