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
|
@Override
|
||||||
public Faction load(Faction that)
|
public Faction load(Faction that)
|
||||||
{
|
{
|
||||||
this.tag = that.tag;
|
this.setTag(that.tag);
|
||||||
this.setDescription(that.description);
|
this.setDescription(that.description);
|
||||||
this.home = that.home;
|
this.setHome(that.home);
|
||||||
this.setPowerBoost(that.powerBoost);
|
this.setPowerBoost(that.powerBoost);
|
||||||
this.open = that.open;
|
this.setOpen(that.open);
|
||||||
this.setInvitedPlayerIds(that.invitedPlayerIds);
|
this.setInvitedPlayerIds(that.invitedPlayerIds);
|
||||||
this.setRelationWishes(that.relationWish);
|
this.setRelationWishes(that.relationWish);
|
||||||
this.setFlags(that.flagOverrides);
|
this.setFlags(that.flagOverrides);
|
||||||
@ -238,6 +238,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
public void setHome(PS home)
|
public void setHome(PS home)
|
||||||
{
|
{
|
||||||
this.home = home;
|
this.home = home;
|
||||||
|
this.changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -255,10 +256,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
|
|
||||||
public void setPowerBoost(Double powerBoost)
|
public void setPowerBoost(Double powerBoost)
|
||||||
{
|
{
|
||||||
if (powerBoost == null || powerBoost == 0)
|
if (powerBoost == null || powerBoost == 0) powerBoost = null;
|
||||||
{
|
|
||||||
powerBoost = null;
|
|
||||||
}
|
|
||||||
this.powerBoost = powerBoost;
|
this.powerBoost = powerBoost;
|
||||||
this.changed();
|
this.changed();
|
||||||
}
|
}
|
||||||
@ -470,13 +468,16 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
target.putAll(flags);
|
target.putAll(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<Entry<FFlag, Boolean>> iter = target.entrySet().iterator();
|
if (this.attached() && Factions.get().isDatabaseInitialized())
|
||||||
while (iter.hasNext())
|
|
||||||
{
|
{
|
||||||
Entry<FFlag, Boolean> entry = iter.next();
|
Iterator<Entry<FFlag, Boolean>> iter = target.entrySet().iterator();
|
||||||
if (entry.getKey().getDefault(this) == entry.getValue())
|
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();
|
if (this.attached() && Factions.get().isDatabaseInitialized())
|
||||||
while (iter.hasNext())
|
|
||||||
{
|
{
|
||||||
Entry<FPerm, Set<Rel>> entry = iter.next();
|
Iterator<Entry<FPerm, Set<Rel>>> iter = target.entrySet().iterator();
|
||||||
if (entry.getKey().getDefault(this).equals(entry.getValue()))
|
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.PS;
|
||||||
import com.massivecraft.mcore.ps.PSFormatSlug;
|
import com.massivecraft.mcore.ps.PSFormatSlug;
|
||||||
import com.massivecraft.mcore.store.SenderEntity;
|
import com.massivecraft.mcore.store.SenderEntity;
|
||||||
import com.massivecraft.mcore.util.MUtil;
|
|
||||||
import com.massivecraft.mcore.util.SenderUtil;
|
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
|
// 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)
|
public void setFactionId(String factionId)
|
||||||
{
|
{
|
||||||
// Avoid null input
|
// Get the raw old value
|
||||||
if (factionId == null) factionId = this.getDefaultFactionId();
|
String oldFactionId = this.factionId;
|
||||||
|
|
||||||
// Get the old value
|
|
||||||
String oldFactionId = this.getFactionId();
|
|
||||||
|
|
||||||
// Ignore nochange
|
|
||||||
if (factionId.equals(oldFactionId)) return;
|
|
||||||
|
|
||||||
// Apply change
|
// Apply change
|
||||||
if (factionId.equals(this.getDefaultFactionId())) factionId = null;
|
|
||||||
this.factionId = factionId;
|
this.factionId = factionId;
|
||||||
|
|
||||||
// Next we must be attached and inited
|
// Next we must be attached and inited
|
||||||
if (!this.attached()) return;
|
if (!this.attached()) return;
|
||||||
if (!this.getColl().inited()) return;
|
|
||||||
if (!Factions.get().isDatabaseInitialized()) return;
|
if (!Factions.get().isDatabaseInitialized()) return;
|
||||||
|
|
||||||
|
if (oldFactionId == null) oldFactionId = this.getDefaultFactionId();
|
||||||
|
|
||||||
// Update index
|
// Update index
|
||||||
Faction oldFaction = FactionColls.get().get(this).get(oldFactionId);
|
Faction oldFaction = FactionColls.get().get(this).get(oldFactionId);
|
||||||
Faction faction = FactionColls.get().get(this).get(factionId);
|
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)
|
public void setRole(Rel role)
|
||||||
{
|
{
|
||||||
if (role == null || MUtil.equals(role, this.getDefaultRole())) role = null;
|
|
||||||
this.role = role;
|
this.role = role;
|
||||||
this.changed();
|
this.changed();
|
||||||
}
|
}
|
||||||
@ -328,8 +320,6 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
public void setPower(Double power)
|
public void setPower(Double power)
|
||||||
{
|
{
|
||||||
if (power == null || MUtil.equals(power, this.getDefaultPower())) power = null;
|
|
||||||
power = this.getLimitedPower(power);
|
|
||||||
this.power = power;
|
this.power = power;
|
||||||
this.changed();
|
this.changed();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user