these changes fixes a few startup errors related to non-attached factions lacking universe.
This commit is contained in:
parent
80eb506499
commit
82e380cd3d
BIN
capes/ally.png
BIN
capes/ally.png
Binary file not shown.
Before Width: | Height: | Size: 574 B |
BIN
capes/capes.psd
BIN
capes/capes.psd
Binary file not shown.
BIN
capes/enemy.png
BIN
capes/enemy.png
Binary file not shown.
Before Width: | Height: | Size: 484 B |
BIN
capes/member.png
BIN
capes/member.png
Binary file not shown.
Before Width: | Height: | Size: 588 B |
Binary file not shown.
Before Width: | Height: | Size: 437 B |
Binary file not shown.
Before Width: | Height: | Size: 369 B |
@ -43,11 +43,11 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
@Override
|
||||
public Faction load(Faction that)
|
||||
{
|
||||
this.tag = that.tag;
|
||||
this.setTag(that.tag);
|
||||
this.setDescription(that.description);
|
||||
this.home = that.home;
|
||||
this.setHome(that.home);
|
||||
this.setPowerBoost(that.powerBoost);
|
||||
this.open = that.open;
|
||||
this.setOpen(that.open);
|
||||
this.setInvitedPlayerIds(that.invitedPlayerIds);
|
||||
this.setRelationWishes(that.relationWish);
|
||||
this.setFlags(that.flagOverrides);
|
||||
@ -238,6 +238,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
public void setHome(PS home)
|
||||
{
|
||||
this.home = home;
|
||||
this.changed();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -255,10 +256,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
|
||||
public void setPowerBoost(Double powerBoost)
|
||||
{
|
||||
if (powerBoost == null || powerBoost == 0)
|
||||
{
|
||||
powerBoost = null;
|
||||
}
|
||||
if (powerBoost == null || powerBoost == 0) powerBoost = null;
|
||||
this.powerBoost = powerBoost;
|
||||
this.changed();
|
||||
}
|
||||
@ -470,13 +468,16 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
target.putAll(flags);
|
||||
}
|
||||
|
||||
Iterator<Entry<FFlag, Boolean>> iter = target.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
if (this.attached() && Factions.get().isDatabaseInitialized())
|
||||
{
|
||||
Entry<FFlag, Boolean> entry = iter.next();
|
||||
if (entry.getKey().getDefault(this) == entry.getValue())
|
||||
Iterator<Entry<FFlag, Boolean>> iter = target.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
iter.remove();
|
||||
Entry<FFlag, Boolean> entry = iter.next();
|
||||
if (entry.getKey().getDefault(this) == entry.getValue())
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -542,13 +543,16 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<Entry<FPerm, Set<Rel>>> iter = target.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
if (this.attached() && Factions.get().isDatabaseInitialized())
|
||||
{
|
||||
Entry<FPerm, Set<Rel>> entry = iter.next();
|
||||
if (entry.getKey().getDefault(this).equals(entry.getValue()))
|
||||
Iterator<Entry<FPerm, Set<Rel>>> iter = target.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
iter.remove();
|
||||
Entry<FPerm, Set<Rel>> entry = iter.next();
|
||||
if (entry.getKey().getDefault(this).equals(entry.getValue()))
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ import com.massivecraft.mcore.mixin.Mixin;
|
||||
import com.massivecraft.mcore.ps.PS;
|
||||
import com.massivecraft.mcore.ps.PSFormatSlug;
|
||||
import com.massivecraft.mcore.store.SenderEntity;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
import com.massivecraft.mcore.util.SenderUtil;
|
||||
|
||||
|
||||
@ -186,24 +185,18 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
||||
// This setter is so long because it search for default/null case and takes care of updating the faction member index
|
||||
public void setFactionId(String factionId)
|
||||
{
|
||||
// Avoid null input
|
||||
if (factionId == null) factionId = this.getDefaultFactionId();
|
||||
|
||||
// Get the old value
|
||||
String oldFactionId = this.getFactionId();
|
||||
|
||||
// Ignore nochange
|
||||
if (factionId.equals(oldFactionId)) return;
|
||||
// Get the raw old value
|
||||
String oldFactionId = this.factionId;
|
||||
|
||||
// Apply change
|
||||
if (factionId.equals(this.getDefaultFactionId())) factionId = null;
|
||||
this.factionId = factionId;
|
||||
|
||||
// Next we must be attached and inited
|
||||
if (!this.attached()) return;
|
||||
if (!this.getColl().inited()) return;
|
||||
if (!Factions.get().isDatabaseInitialized()) return;
|
||||
|
||||
if (oldFactionId == null) oldFactionId = this.getDefaultFactionId();
|
||||
|
||||
// Update index
|
||||
Faction oldFaction = FactionColls.get().get(this).get(oldFactionId);
|
||||
Faction faction = FactionColls.get().get(this).get(factionId);
|
||||
@ -237,7 +230,6 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
||||
|
||||
public void setRole(Rel role)
|
||||
{
|
||||
if (role == null || MUtil.equals(role, this.getDefaultRole())) role = null;
|
||||
this.role = role;
|
||||
this.changed();
|
||||
}
|
||||
@ -328,8 +320,6 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
||||
|
||||
public void setPower(Double power)
|
||||
{
|
||||
if (power == null || MUtil.equals(power, this.getDefaultPower())) power = null;
|
||||
power = this.getLimitedPower(power);
|
||||
this.power = power;
|
||||
this.changed();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user