From a6502b6a1f4208d26806ec2854bad485c4b6cbc2 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 12 Nov 2016 20:30:49 +0100 Subject: [PATCH] Fixed getIntData() --- src/main/java/buttondevteam/lib/TBMCPlayer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/buttondevteam/lib/TBMCPlayer.java b/src/main/java/buttondevteam/lib/TBMCPlayer.java index bdb02c5..80cd053 100644 --- a/src/main/java/buttondevteam/lib/TBMCPlayer.java +++ b/src/main/java/buttondevteam/lib/TBMCPlayer.java @@ -157,8 +157,10 @@ public class TBMCPlayer implements AutoCloseable { if (!mname.startsWith("get")) throw new UnsupportedOperationException("Can only use getIntData from a getXYZ method"); Object obj = getLoadedPlayers().get(uuid).data.get(mname.substring("get".length()).toLowerCase()); - if (!(obj instanceof Integer)) - throw new UnsupportedOperationException("The retrieved object isn't a number: " + obj); + if (obj instanceof Short) + return (T) obj; + if (!(Integer.class.isAssignableFrom(obj.getClass()))) + throw new UnsupportedOperationException("The retrieved object isn't an integer: " + obj); Integer int_ = (Integer) obj; if (Short.class.isAssignableFrom(cl)) return (T) (Object) int_.shortValue();