Make UtilEnt#GetMetadata infer needed type
This commit is contained in:
parent
eb566d3363
commit
66e5339eab
@ -1025,14 +1025,15 @@ public class UtilEnt
|
||||
}
|
||||
|
||||
// Nicer than doing entity.getMetadata(key).get(0);
|
||||
public static Object GetMetadata(Entity entity, String key)
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T GetMetadata(Entity entity, String key)
|
||||
{
|
||||
if (!entity.hasMetadata(key))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return entity.getMetadata(key).get(0).value();
|
||||
return (T) entity.getMetadata(key).get(0).value();
|
||||
}
|
||||
|
||||
public static void removeMetadata(Entity entity, String key)
|
||||
|
@ -268,7 +268,7 @@ public class MountManager extends MiniDbClientPlugin<MountOwnerData>
|
||||
{
|
||||
if (UtilEnt.GetMetadata(entry.getKey(), "DISMOUNT_TIME") != null)
|
||||
{
|
||||
Long dismount = (Long) UtilEnt.GetMetadata(entry.getKey(), "DISMOUNT_TIME");
|
||||
Long dismount = UtilEnt.GetMetadata(entry.getKey(), "DISMOUNT_TIME");
|
||||
if (UtilTime.elapsed(dismount.longValue(), MAX_TIME_DISMOUNTED))
|
||||
{
|
||||
mountIterator.remove();
|
||||
|
Loading…
Reference in New Issue
Block a user