Boolean database conversion methods
This commit is contained in:
parent
a9f159cc70
commit
337031fc11
@ -168,6 +168,21 @@ public class Entity<E extends Entity<E>>
|
||||
return false;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONVENIENCE: DATABASE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean convertGet(Boolean wrapper)
|
||||
{
|
||||
return wrapper != null ? wrapper.booleanValue() : false;
|
||||
}
|
||||
|
||||
public Boolean convertSet(boolean primitive)
|
||||
{
|
||||
this.changed();
|
||||
return primitive ? Boolean.TRUE : null;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// STANDARDS
|
||||
// -------------------------------------------- //
|
||||
|
@ -12,6 +12,7 @@ import com.massivecraft.massivecore.Named;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.PermUtil;
|
||||
|
||||
public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E> implements Named
|
||||
{
|
||||
@ -59,6 +60,18 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
|
||||
return (SenderColl<E>) super.getColl();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONVENIENCE: DATABASE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean convertGet(Boolean wrapper, String permission)
|
||||
{
|
||||
// Permission requirement
|
||||
if ( ! PermUtil.has(this.getSender(), permission)) return false;
|
||||
|
||||
return super.convertGet(wrapper);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// TYPE
|
||||
// -------------------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user