2013-04-22 21:00:00 +02:00
|
|
|
package com.massivecraft.factions.entity;
|
|
|
|
|
2013-08-23 08:10:44 +02:00
|
|
|
import com.massivecraft.factions.Perm;
|
2013-04-22 21:00:00 +02:00
|
|
|
import com.massivecraft.mcore.store.SenderEntity;
|
|
|
|
|
|
|
|
public class MPlayer extends SenderEntity<MPlayer>
|
|
|
|
{
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// META
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
public static MPlayer get(Object oid)
|
|
|
|
{
|
|
|
|
return MPlayerColl.get().get(oid);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public MPlayer load(MPlayer that)
|
|
|
|
{
|
2013-04-24 15:14:15 +02:00
|
|
|
this.mapAutoUpdating = that.mapAutoUpdating;
|
|
|
|
this.usingAdminMode = that.usingAdminMode;
|
2013-04-22 21:00:00 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isDefault()
|
|
|
|
{
|
2013-04-24 15:14:15 +02:00
|
|
|
if (this.isMapAutoUpdating()) return false;
|
|
|
|
if (this.isUsingAdminMode()) return false;
|
2013-04-22 21:00:00 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// FIELDS
|
|
|
|
// -------------------------------------------- //
|
2013-04-23 09:17:30 +02:00
|
|
|
|
2013-04-24 15:14:15 +02:00
|
|
|
private boolean mapAutoUpdating = false;
|
|
|
|
public boolean isMapAutoUpdating() { return this.mapAutoUpdating; }
|
|
|
|
public void setMapAutoUpdating(boolean mapAutoUpdating) { this.mapAutoUpdating = mapAutoUpdating; this.changed(); }
|
|
|
|
|
|
|
|
private boolean usingAdminMode = false;
|
2013-08-23 08:10:44 +02:00
|
|
|
public boolean isUsingAdminMode()
|
|
|
|
{
|
|
|
|
if (this.usingAdminMode && this.getSender() != null && !Perm.ADMIN.has(this.getSender(), false))
|
|
|
|
{
|
|
|
|
// If we are using admin mode but don't have permissions for it we deactivate it.
|
|
|
|
this.setUsingAdminMode(false);
|
|
|
|
}
|
|
|
|
return this.usingAdminMode;
|
|
|
|
}
|
2013-04-24 15:14:15 +02:00
|
|
|
public void setUsingAdminMode(boolean usingAdminMode) { this.usingAdminMode = usingAdminMode; this.changed(); }
|
2013-04-22 21:00:00 +02:00
|
|
|
|
|
|
|
}
|