A few minor bugfixes and tweaks.

This commit is contained in:
Olof Larsson 2013-04-25 12:04:01 +02:00
parent 18e6c778b9
commit 8fd088e291
7 changed files with 60 additions and 52 deletions

View File

@ -31,6 +31,7 @@ public class CmdFactionsAutoClaim extends FCommand
return;
}
// FPerm
if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
usender.setAutoClaimFaction(forFaction);

View File

@ -37,7 +37,7 @@ public class CmdFactionsClaim extends FCommand
if (forFaction == null) return;
// FPerm
if (!FPerm.TERRITORY.has(sender, forFaction, true)) return;
if (forFaction.isNormal() && !FPerm.TERRITORY.has(sender, forFaction, true)) return;
// Validate
if (radius < 1)

View File

@ -24,7 +24,7 @@ public class CmdFactionsDescription extends FCommand
public void perform()
{
// Args
String newDescription = this.argConcatFrom(1);
String newDescription = this.argConcatFrom(0);
// Event
FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, usenderFaction, newDescription);
@ -33,7 +33,7 @@ public class CmdFactionsDescription extends FCommand
newDescription = event.getNewDescription();
// Apply
usenderFaction.setDescription(this.argConcatFrom(1));
usenderFaction.setDescription(newDescription);
// Inform
usenderFaction.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender), usenderFaction.getDescription());

View File

@ -30,13 +30,12 @@ public class CmdFactionsMap extends FCommand
if (this.arg(0, ARBoolean.get(), !msender.isMapAutoUpdating()))
{
// Turn on
msender.setMapAutoUpdating(true);
msg("<i>Map auto update <green>ENABLED.");
// And show the map once
showMap();
// Turn on
msender.setMapAutoUpdating(true);
msg("<i>Map auto update <green>ENABLED.");
}
else
{

View File

@ -58,7 +58,7 @@ public class CmdFactionsUnclaimall extends FCommand
}
// Inform
usenderFaction.msg("%s<i> unclaimed <h>5 <i> of your <h>200 <i>faction land. You now have <h>23 <i>land left.", usender.describeTo(usenderFaction, true), countSuccess, countTotal, countFail);
usenderFaction.msg("%s<i> unclaimed <h>%d <i>of your <h>%d <i>faction land. You now have <h>%d <i>land claimed.", usender.describeTo(usenderFaction, true), countSuccess, countTotal, countFail);
// Log
if (MConf.get().logLandUnclaims)

View File

@ -18,10 +18,10 @@ import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipC
import com.massivecraft.factions.util.RelationUtil;
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;
import com.massivecraft.mcore.util.Txt;
public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipator
@ -212,10 +212,10 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
// Update index
Faction oldFaction = FactionColls.get().get(this).get(oldFactionId);
Faction faction = FactionColls.get().get(this).get(factionId);
Faction faction = this.getFaction();
oldFaction.uplayers.remove(this);
faction.uplayers.add(this);
if (oldFaction != null) oldFaction.uplayers.remove(this);
if (faction != null) faction.uplayers.add(this);
// Mark as changed
this.changed();
@ -611,24 +611,12 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
{
int ownedLand = newFaction.getLandCount();
if (!uconf.claimingFromOthersAllowed && oldFaction.isNormal())
{
msg("<b>You may not claim land from others.");
return false;
}
if (mconf.worldsNoClaiming.contains(ps.getWorld()))
{
msg("<b>Sorry, this world has land claiming disabled.");
return false;
}
if (oldFaction.getRelationTo(newFaction).isAtLeast(Rel.TRUCE))
{
msg("<b>You can't claim this land due to your relation with the current owner.");
return false;
}
if (newFaction.getUPlayers().size() < uconf.claimsRequireMinFactionMembers)
{
msg("Factions must have at least <h>%s<b> members to claim land.", uconf.claimsRequireMinFactionMembers);
@ -647,6 +635,20 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
return false;
}
if (oldFaction.isNormal())
{
if (!uconf.claimingFromOthersAllowed)
{
msg("<b>You may not claim land from others.");
return false;
}
if (oldFaction.getRelationTo(newFaction).isAtLeast(Rel.TRUCE))
{
msg("<b>You can't claim this land due to your relation with the current owner.");
return false;
}
if
(
uconf.claimsMustBeConnected
@ -678,6 +680,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
return false;
}
}
}
// Event
FactionsEventChunkChange event = new FactionsEventChunkChange(sender, chunk, newFaction);
@ -705,7 +708,8 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
for (UPlayer informee : informees)
{
informee.msg("<h>%s<i> did %s %s <i>for <h>%s<i> from <h>%s<i>.", this.describeTo(informee, true), event.getType().toString().toLowerCase(), chunk.toString(PSFormatSlug.get()), newFaction.describeTo(informee), oldFaction.describeTo(informee));
String chunkString = Txt.parse("<h>%s <h>%d %d", Mixin.getWorldDisplayName(chunk.getWorld()), chunk.getChunkX(), chunk.getChunkZ());
informee.msg("<h>%s<i> did %s %s <i>for <h>%s<i> from <h>%s<i>.", this.describeTo(informee, true), event.getType().toString().toLowerCase(), chunkString, newFaction.describeTo(informee), oldFaction.describeTo(informee));
}
return true;

View File

@ -486,11 +486,15 @@ public class FactionsListenerMain implements Listener
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockMonsters(EntityTargetEvent event)
{
// If a monster is targeting something ...
// If a monster ...
if ( ! Const.ENTITY_TYPES_MONSTERS.contains(event.getEntityType())) return;
// ... is targeting something ...
Entity target = event.getTarget();
if (target == null) return;
// ... at a place where monsters are forbidden ...
PS ps = PS.valueOf(event.getTarget());
PS ps = PS.valueOf(target);
Faction faction = BoardColls.get().getFactionAt(ps);
if (faction.getFlag(FFlag.MONSTERS)) return;