More null debug
This commit is contained in:
parent
0b7fe8d2c6
commit
4df6669131
@ -24,16 +24,19 @@ public class MixinPlayed extends Mixin
|
||||
|
||||
public boolean isOnline(Object senderObject)
|
||||
{
|
||||
if (senderObject == null) throw new NullPointerException("senderObject");
|
||||
return IdUtil.isOnline(senderObject);
|
||||
}
|
||||
|
||||
public boolean isOffline(Object senderObject)
|
||||
{
|
||||
if (senderObject == null) throw new NullPointerException("senderObject");
|
||||
return ! this.isOnline(senderObject);
|
||||
}
|
||||
|
||||
public Long getFirstPlayed(Object senderObject)
|
||||
{
|
||||
if (senderObject == null) throw new NullPointerException("senderObject");
|
||||
if (MUtil.isNpc(senderObject)) return null;
|
||||
|
||||
UUID uuid = IdUtil.getUuid(senderObject);
|
||||
@ -49,6 +52,7 @@ public class MixinPlayed extends Mixin
|
||||
|
||||
public Long getLastPlayed(Object senderObject)
|
||||
{
|
||||
if (senderObject == null) throw new NullPointerException("senderObject");
|
||||
//if (this.isOnline(senderObject)) return System.currentTimeMillis();
|
||||
// We do in fact NOT want this commented out behavior
|
||||
// It's important we can check the previous played time on join!
|
||||
@ -68,12 +72,14 @@ public class MixinPlayed extends Mixin
|
||||
|
||||
public boolean hasPlayedBefore(Object senderObject)
|
||||
{
|
||||
if (senderObject == null) throw new NullPointerException("senderObject");
|
||||
Long firstPlayed = this.getFirstPlayed(senderObject);
|
||||
return firstPlayed != null && firstPlayed != 0;
|
||||
}
|
||||
|
||||
public String getIp(Object senderObject)
|
||||
{
|
||||
if (senderObject == null) throw new NullPointerException("senderObject");
|
||||
CommandSender sender = IdUtil.getSender(senderObject);
|
||||
if (MUtil.isntPlayer(senderObject)) return null;
|
||||
return MUtil.getIp(sender);
|
||||
|
@ -39,6 +39,12 @@ public class EntityInternal<E extends EntityInternal<E>> implements Identified
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
public String getIdOrThrow()
|
||||
{
|
||||
String id = this.getId();
|
||||
if (id == null) throw new NullPointerException("id");
|
||||
return id;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ATTACH AND DETACH
|
||||
|
@ -190,32 +190,32 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
|
||||
|
||||
public boolean isOnline()
|
||||
{
|
||||
return MixinPlayed.get().isOnline(this.getId());
|
||||
return MixinPlayed.get().isOnline(this.getIdOrThrow());
|
||||
}
|
||||
|
||||
public boolean isOffline()
|
||||
{
|
||||
return MixinPlayed.get().isOffline(this.getId());
|
||||
return MixinPlayed.get().isOffline(this.getIdOrThrow());
|
||||
}
|
||||
|
||||
public Long getLastPlayed()
|
||||
{
|
||||
return MixinPlayed.get().getLastPlayed(this.getId());
|
||||
return MixinPlayed.get().getLastPlayed(this.getIdOrThrow());
|
||||
}
|
||||
|
||||
public Long getFirstPlayed()
|
||||
{
|
||||
return MixinPlayed.get().getFirstPlayed(this.getId());
|
||||
return MixinPlayed.get().getFirstPlayed(this.getIdOrThrow());
|
||||
}
|
||||
|
||||
public boolean hasPlayedBefore()
|
||||
{
|
||||
return MixinPlayed.get().hasPlayedBefore(this.getId());
|
||||
return MixinPlayed.get().hasPlayedBefore(this.getIdOrThrow());
|
||||
}
|
||||
|
||||
public String getIp()
|
||||
{
|
||||
return MixinPlayed.get().getIp(this.getId());
|
||||
return MixinPlayed.get().getIp(this.getIdOrThrow());
|
||||
}
|
||||
|
||||
public boolean isVisible()
|
||||
|
@ -800,6 +800,7 @@ public class IdUtil implements Listener, Runnable
|
||||
|
||||
public static boolean isOnline(Object senderObject)
|
||||
{
|
||||
if (senderObject == null) throw new NullPointerException("senderObject");
|
||||
// Fix the id ...
|
||||
String id = getId(senderObject);
|
||||
if (id == null) return false;
|
||||
|
Loading…
Reference in New Issue
Block a user