Fixed getIntData()
This commit is contained in:
parent
b5fd777474
commit
a6502b6a1f
1 changed files with 4 additions and 2 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue