mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-30 06:03:59 +01:00
Add in a place for people to store their custom data.
This commit is contained in:
parent
43f9f304a6
commit
b484b6bb38
@ -24,6 +24,7 @@ import com.massivecraft.mcore.store.Entity;
|
|||||||
import com.massivecraft.mcore.util.MUtil;
|
import com.massivecraft.mcore.util.MUtil;
|
||||||
import com.massivecraft.mcore.util.SenderUtil;
|
import com.massivecraft.mcore.util.SenderUtil;
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
import com.massivecraft.mcore.xlib.gson.JsonObject;
|
||||||
|
|
||||||
|
|
||||||
public class Faction extends Entity<Faction> implements EconomyParticipator
|
public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||||
@ -54,6 +55,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
this.setRelationWishes(that.relationWishes);
|
this.setRelationWishes(that.relationWishes);
|
||||||
this.setFlags(that.flags);
|
this.setFlags(that.flags);
|
||||||
this.setPerms(that.perms);
|
this.setPerms(that.perms);
|
||||||
|
this.setCustomData(that.getCustomData());
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -125,6 +127,11 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
// Null means default for the universe.
|
// Null means default for the universe.
|
||||||
private Map<FPerm, Set<Rel>> perms = null;
|
private Map<FPerm, Set<Rel>> perms = null;
|
||||||
|
|
||||||
|
// Custom Data - Since JsonObject is mutable there is not point to using fancy getters/setters.
|
||||||
|
private JsonObject customData = null;
|
||||||
|
public JsonObject getCustomData() { return this.customData; }
|
||||||
|
public void setCustomData(JsonObject customData) { this.customData = customData; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FIELD: id
|
// FIELD: id
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.entity;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.mcore.store.SenderEntity;
|
import com.massivecraft.mcore.store.SenderEntity;
|
||||||
|
import com.massivecraft.mcore.xlib.gson.JsonObject;
|
||||||
|
|
||||||
public class MPlayer extends SenderEntity<MPlayer>
|
public class MPlayer extends SenderEntity<MPlayer>
|
||||||
{
|
{
|
||||||
@ -23,6 +24,7 @@ public class MPlayer extends SenderEntity<MPlayer>
|
|||||||
{
|
{
|
||||||
this.mapAutoUpdating = that.mapAutoUpdating;
|
this.mapAutoUpdating = that.mapAutoUpdating;
|
||||||
this.usingAdminMode = that.usingAdminMode;
|
this.usingAdminMode = that.usingAdminMode;
|
||||||
|
this.setCustomData(that.getCustomData());
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -32,6 +34,7 @@ public class MPlayer extends SenderEntity<MPlayer>
|
|||||||
{
|
{
|
||||||
if (this.isMapAutoUpdating()) return false;
|
if (this.isMapAutoUpdating()) return false;
|
||||||
if (this.isUsingAdminMode()) return false;
|
if (this.isUsingAdminMode()) return false;
|
||||||
|
if (this.getCustomData() != null && this.getCustomData().entrySet().size() > 0) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,4 +59,9 @@ public class MPlayer extends SenderEntity<MPlayer>
|
|||||||
}
|
}
|
||||||
public void setUsingAdminMode(boolean usingAdminMode) { this.usingAdminMode = usingAdminMode; this.changed(); }
|
public void setUsingAdminMode(boolean usingAdminMode) { this.usingAdminMode = usingAdminMode; this.changed(); }
|
||||||
|
|
||||||
|
// Custom Data - Since JsonObject is mutable there is not point to using fancy getters/setters.
|
||||||
|
private JsonObject customData = null;
|
||||||
|
public JsonObject getCustomData() { return this.customData; }
|
||||||
|
public void setCustomData(JsonObject customData) { this.customData = customData; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import com.massivecraft.mcore.store.SenderEntity;
|
|||||||
import com.massivecraft.mcore.util.MUtil;
|
import com.massivecraft.mcore.util.MUtil;
|
||||||
import com.massivecraft.mcore.util.SenderUtil;
|
import com.massivecraft.mcore.util.SenderUtil;
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
import com.massivecraft.mcore.xlib.gson.JsonObject;
|
||||||
|
|
||||||
|
|
||||||
public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipator
|
public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipator
|
||||||
@ -49,6 +50,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
this.setTitle(that.title);
|
this.setTitle(that.title);
|
||||||
this.setPowerBoost(that.powerBoost);
|
this.setPowerBoost(that.powerBoost);
|
||||||
this.setPower(that.power);
|
this.setPower(that.power);
|
||||||
|
this.setCustomData(that.getCustomData());
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -60,6 +62,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
// Role means nothing without a faction.
|
// Role means nothing without a faction.
|
||||||
// Title means nothing without a faction.
|
// Title means nothing without a faction.
|
||||||
if (this.getPowerRounded() != (int) Math.round(UConf.get(this).defaultPlayerPower)) return false;
|
if (this.getPowerRounded() != (int) Math.round(UConf.get(this).defaultPlayerPower)) return false;
|
||||||
|
if (this.getCustomData() != null && this.getCustomData().entrySet().size() > 0) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -134,6 +137,11 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
public Faction getAutoClaimFaction() { return this.autoClaimFaction; }
|
public Faction getAutoClaimFaction() { return this.autoClaimFaction; }
|
||||||
public void setAutoClaimFaction(Faction autoClaimFaction) { this.autoClaimFaction = autoClaimFaction; }
|
public void setAutoClaimFaction(Faction autoClaimFaction) { this.autoClaimFaction = autoClaimFaction; }
|
||||||
|
|
||||||
|
// Custom Data - Since JsonObject is mutable there is not point to using fancy getters/setters.
|
||||||
|
private JsonObject customData = null;
|
||||||
|
public JsonObject getCustomData() { return this.customData; }
|
||||||
|
public void setCustomData(JsonObject customData) { this.customData = customData; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FIELDS: MULTIVERSE PROXY
|
// FIELDS: MULTIVERSE PROXY
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
Loading…
Reference in New Issue
Block a user