Rename admin mode to override. Improve Rel names system.
This commit is contained in:
@@ -193,7 +193,7 @@ public class MFlag extends Entity<MFlag> implements Prioritized, Registerable, N
|
||||
|
||||
// Is this flag editable by players?
|
||||
// With this we mean standard non administrator players.
|
||||
// All flags can be changed using /f admin.
|
||||
// All flags can be changed using /f override.
|
||||
// Example: true (if players want to turn mob spawning on I guess they should be able to)
|
||||
private boolean editable = false;
|
||||
public boolean isEditable() { return this.editable; }
|
||||
@@ -201,7 +201,7 @@ public class MFlag extends Entity<MFlag> implements Prioritized, Registerable, N
|
||||
|
||||
// Is this flag visible to players?
|
||||
// With this we mean standard non administrator players.
|
||||
// All flags can be seen using /f admin.
|
||||
// All flags can be seen using /f override.
|
||||
// Some flags can be rendered meaningless by settings in Factions or external plugins.
|
||||
// Say we set "editable" to false and "standard" to true for the "open" flag to force all factions being open.
|
||||
// In such case we might want to hide the open flag by setting "visible" false.
|
||||
|
@@ -245,7 +245,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
||||
|
||||
// Is this perm editable by players?
|
||||
// With this we mean standard non administrator players.
|
||||
// All perms can be changed using /f admin.
|
||||
// All perms can be changed using /f override.
|
||||
// Example: true (all perms are editable by default)
|
||||
private boolean editable = false;
|
||||
public boolean isEditable() { return this.editable; }
|
||||
@@ -253,7 +253,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
||||
|
||||
// Is this perm visible to players?
|
||||
// With this we mean standard non administrator players.
|
||||
// All perms can be seen using /f admin.
|
||||
// All perms can be seen using /f override.
|
||||
// Some perms can be rendered meaningless by settings in Factions or external plugins.
|
||||
// Say we set "editable" to false.
|
||||
// In such case we might want to hide the perm by setting "visible" false.
|
||||
@@ -296,9 +296,9 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
||||
String ret = Txt.parse("%s<b> does not allow you to %s<b>.", hostFaction.describeTo(mplayer, true), this.getDesc());
|
||||
|
||||
Player player = mplayer.getPlayer();
|
||||
if (player != null && Perm.ADMIN.has(player))
|
||||
if (player != null && Perm.OVERRIDE.has(player))
|
||||
{
|
||||
ret += Txt.parse("\n<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getTemplate(false).toPlain(true));
|
||||
ret += Txt.parse("\n<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsOverride.getTemplate(false).toPlain(true));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -355,7 +355,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
||||
if (mplayer == null) throw new NullPointerException("mplayer");
|
||||
if (hostFaction == null) throw new NullPointerException("hostFaction");
|
||||
|
||||
if (mplayer.isUsingAdminMode()) return true;
|
||||
if (mplayer.isOverriding()) return true;
|
||||
|
||||
Rel rel = mplayer.getRelationTo(hostFaction);
|
||||
if (hostFaction.isPermitted(this, rel)) return true;
|
||||
@@ -371,7 +371,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
||||
if (mplayer == null) throw new NullPointerException("mplayer");
|
||||
if (ps == null) throw new NullPointerException("ps");
|
||||
|
||||
if (mplayer.isUsingAdminMode()) return true;
|
||||
if (mplayer.isOverriding()) return true;
|
||||
|
||||
TerritoryAccess ta = BoardColl.get().getTerritoryAccessAt(ps);
|
||||
Faction hostFaction = ta.getHostFaction();
|
||||
|
@@ -30,6 +30,7 @@ import com.massivecraft.massivecore.store.SenderEntity;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import com.massivecraft.massivecore.xlib.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipator
|
||||
@@ -57,7 +58,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
this.setPowerBoost(that.powerBoost);
|
||||
this.setPower(that.power);
|
||||
this.setMapAutoUpdating(that.mapAutoUpdating);
|
||||
this.setUsingAdminMode(that.usingAdminMode);
|
||||
this.setOverriding(that.overriding);
|
||||
this.setTerritoryInfoTitles(that.territoryInfoTitles);
|
||||
|
||||
return this;
|
||||
@@ -73,7 +74,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
if (this.hasPowerBoost()) return false;
|
||||
if (this.getPowerRounded() != (int) Math.round(MConf.get().defaultPlayerPower)) return false;
|
||||
// if (this.isMapAutoUpdating()) return false; // Just having an auto updating map is not in itself reason enough for database storage.
|
||||
if (this.isUsingAdminMode()) return false;
|
||||
if (this.isOverriding()) return false;
|
||||
if (this.isTerritoryInfoTitles() != MConf.get().territoryInfoTitlesDefault) return false;
|
||||
|
||||
return true;
|
||||
@@ -156,9 +157,10 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
// Null means false
|
||||
private Boolean mapAutoUpdating = null;
|
||||
|
||||
// Is this player using admin mode?
|
||||
// Is this player overriding?
|
||||
// Null means false
|
||||
private Boolean usingAdminMode = null;
|
||||
@SerializedName(value = "usingAdminMode")
|
||||
private Boolean overriding = null;
|
||||
|
||||
// Does this player use titles for territory info?
|
||||
// Null means default specified in MConf.
|
||||
@@ -533,35 +535,35 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELD: usingAdminMode
|
||||
// FIELD: overriding
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean isUsingAdminMode()
|
||||
public boolean isOverriding()
|
||||
{
|
||||
if (this.usingAdminMode == null) return false;
|
||||
if (this.usingAdminMode == false) return false;
|
||||
if (this.overriding == null) return false;
|
||||
if (this.overriding == false) return false;
|
||||
|
||||
// Deactivate admin mode if we don't have permissions for it.
|
||||
if (this.getSender() != null && !Perm.ADMIN.has(this.getSender(), false))
|
||||
if (this.getSender() != null && ! Perm.OVERRIDE.has(this.getSender(), false))
|
||||
{
|
||||
this.setUsingAdminMode(false);
|
||||
this.setOverriding(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setUsingAdminMode(Boolean usingAdminMode)
|
||||
public void setOverriding(Boolean overriding)
|
||||
{
|
||||
// Clean input
|
||||
Boolean target = usingAdminMode;
|
||||
Boolean target = overriding;
|
||||
if (MUtil.equals(target, false)) target = null;
|
||||
|
||||
// Detect Nochange
|
||||
if (MUtil.equals(this.usingAdminMode, target)) return;
|
||||
if (MUtil.equals(this.overriding, target)) return;
|
||||
|
||||
// Apply
|
||||
this.usingAdminMode = target;
|
||||
this.overriding = target;
|
||||
|
||||
// Mark as changed
|
||||
this.changed();
|
||||
|
Reference in New Issue
Block a user