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"))
|
if (!mname.startsWith("get"))
|
||||||
throw new UnsupportedOperationException("Can only use getIntData from a getXYZ method");
|
throw new UnsupportedOperationException("Can only use getIntData from a getXYZ method");
|
||||||
Object obj = getLoadedPlayers().get(uuid).data.get(mname.substring("get".length()).toLowerCase());
|
Object obj = getLoadedPlayers().get(uuid).data.get(mname.substring("get".length()).toLowerCase());
|
||||||
if (!(obj instanceof Integer))
|
if (obj instanceof Short)
|
||||||
throw new UnsupportedOperationException("The retrieved object isn't a number: " + obj);
|
return (T) obj;
|
||||||
|
if (!(Integer.class.isAssignableFrom(obj.getClass())))
|
||||||
|
throw new UnsupportedOperationException("The retrieved object isn't an integer: " + obj);
|
||||||
Integer int_ = (Integer) obj;
|
Integer int_ = (Integer) obj;
|
||||||
if (Short.class.isAssignableFrom(cl))
|
if (Short.class.isAssignableFrom(cl))
|
||||||
return (T) (Object) int_.shortValue();
|
return (T) (Object) int_.shortValue();
|
||||||
|
|
Loading…
Reference in a new issue