From 714f829f3edabd43ac5656c3ec15fcb0489fb3b6 Mon Sep 17 00:00:00 2001 From: TheYeti Date: Thu, 8 Mar 2012 11:33:27 -0800 Subject: [PATCH] Fix for CraftOfflinePlayer in Taming yet again --- Changelog.txt | 1 + src/main/java/com/gmail/nossr50/skills/Taming.java | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 9aab4bd56..07bfcdf0f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -16,6 +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 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/skills/Taming.java b/src/main/java/com/gmail/nossr50/skills/Taming.java index 9dabaf404..152091cdc 100644 --- a/src/main/java/com/gmail/nossr50/skills/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/Taming.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.skills; import org.bukkit.Material; +import org.bukkit.OfflinePlayer; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -103,7 +104,14 @@ public class Taming { DamageCause cause = event.getCause(); Wolf wolf = (Wolf) event.getEntity(); - Player master = (Player) wolf.getOwner(); + Player master; + if ( wolf.getOwner() instanceof Player ) { + master = (Player) wolf.getOwner(); + } + else { + OfflinePlayer oMaster = (OfflinePlayer) wolf.getOwner(); + master = (Player) oMaster.getPlayer(); + } int skillLevel = Users.getProfile(master).getSkillLevel(SkillType.TAMING); switch(cause)