Fix some more small bugs

This commit is contained in:
Olof Larsson
2013-04-25 16:02:37 +02:00
parent c6757fae60
commit ea06c468fc
7 changed files with 43 additions and 24 deletions

View File

@ -423,8 +423,8 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
public String getNameAndSomething(String something)
{
String ret = this.role.getPrefix();
if (something.length() > 0)
String ret = this.getRole().getPrefix();
if (something != null && something.length() > 0)
{
ret += something+" ";
}
@ -440,7 +440,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
}
else
{
return this.getName();
return this.getNameAndSomething(null);
}
}
@ -557,7 +557,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
}
// Event
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, this, myFaction, MembershipChangeReason.LEAVE);
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(this.getSender(), this, myFaction, MembershipChangeReason.LEAVE);
membershipChangeEvent.run();
if (membershipChangeEvent.isCancelled()) return;

View File

@ -7,6 +7,7 @@ import com.massivecraft.mcore.mixin.Mixin;
import com.massivecraft.mcore.store.MStore;
import com.massivecraft.mcore.store.SenderColl;
import com.massivecraft.mcore.util.TimeUnit;
import com.massivecraft.mcore.util.Txt;
public class UPlayerColl extends SenderColl<UPlayer>
{
@ -64,11 +65,17 @@ public class UPlayerColl extends SenderColl<UPlayer>
public void clean()
{
FactionColl factionColl = FactionColls.get().get(this);
String universe = this.getUniverse();
for (UPlayer uplayer : this.getAll())
{
if (FactionColls.get().get(this).containsId(uplayer.getFactionId())) continue;
String factionId = uplayer.getFactionId();
if (factionColl.containsId(factionId)) continue;
Factions.get().log("Reset faction data (invalid faction) for player "+uplayer.getName());
uplayer.resetFactionData();
String message = Txt.parse("<i>Reset data for <h>%s <i>in <h>%s <i>universe. Unknown factionId <h>%s", uplayer.getDisplayName(), universe, factionId);
Factions.get().log(message);
}
}

View File

@ -17,12 +17,17 @@ public abstract class XColls<C extends Coll<E>, E> extends Colls<C, E>
if (o instanceof Entity)
{
return this.getForUniverse(((Entity<?>)o).getUniverse());
String universe = ((Entity<?>)o).getUniverse();
if (universe == null) return null;
return this.getForUniverse(universe);
}
if (o instanceof Coll)
{
return this.getForUniverse(((Coll<?>)o).getUniverse());
String universe = ((Coll<?>)o).getUniverse();
if (universe == null) return null;
return this.getForUniverse(universe);
}
if (SenderUtil.isNonplayer(o))