A few minor bugfixes and tweaks.
This commit is contained in:
parent
18e6c778b9
commit
8fd088e291
@ -31,6 +31,7 @@ public class CmdFactionsAutoClaim extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FPerm
|
||||||
if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
|
if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
|
||||||
|
|
||||||
usender.setAutoClaimFaction(forFaction);
|
usender.setAutoClaimFaction(forFaction);
|
||||||
|
@ -37,7 +37,7 @@ public class CmdFactionsClaim extends FCommand
|
|||||||
if (forFaction == null) return;
|
if (forFaction == null) return;
|
||||||
|
|
||||||
// FPerm
|
// FPerm
|
||||||
if (!FPerm.TERRITORY.has(sender, forFaction, true)) return;
|
if (forFaction.isNormal() && !FPerm.TERRITORY.has(sender, forFaction, true)) return;
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if (radius < 1)
|
if (radius < 1)
|
||||||
|
@ -24,7 +24,7 @@ public class CmdFactionsDescription extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
String newDescription = this.argConcatFrom(1);
|
String newDescription = this.argConcatFrom(0);
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, usenderFaction, newDescription);
|
FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, usenderFaction, newDescription);
|
||||||
@ -33,7 +33,7 @@ public class CmdFactionsDescription extends FCommand
|
|||||||
newDescription = event.getNewDescription();
|
newDescription = event.getNewDescription();
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
usenderFaction.setDescription(this.argConcatFrom(1));
|
usenderFaction.setDescription(newDescription);
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
usenderFaction.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender), usenderFaction.getDescription());
|
usenderFaction.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender), usenderFaction.getDescription());
|
||||||
|
@ -30,13 +30,12 @@ public class CmdFactionsMap extends FCommand
|
|||||||
|
|
||||||
if (this.arg(0, ARBoolean.get(), !msender.isMapAutoUpdating()))
|
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
|
// And show the map once
|
||||||
showMap();
|
showMap();
|
||||||
|
|
||||||
|
// Turn on
|
||||||
|
msender.setMapAutoUpdating(true);
|
||||||
|
msg("<i>Map auto update <green>ENABLED.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ public class CmdFactionsUnclaimall extends FCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inform
|
// 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
|
// Log
|
||||||
if (MConf.get().logLandUnclaims)
|
if (MConf.get().logLandUnclaims)
|
||||||
|
@ -18,10 +18,10 @@ import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipC
|
|||||||
import com.massivecraft.factions.util.RelationUtil;
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
import com.massivecraft.mcore.mixin.Mixin;
|
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.store.SenderEntity;
|
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;
|
||||||
|
|
||||||
|
|
||||||
public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipator
|
public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipator
|
||||||
@ -212,10 +212,10 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
// 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 = this.getFaction();
|
||||||
|
|
||||||
oldFaction.uplayers.remove(this);
|
if (oldFaction != null) oldFaction.uplayers.remove(this);
|
||||||
faction.uplayers.add(this);
|
if (faction != null) faction.uplayers.add(this);
|
||||||
|
|
||||||
// Mark as changed
|
// Mark as changed
|
||||||
this.changed();
|
this.changed();
|
||||||
@ -611,24 +611,12 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
{
|
{
|
||||||
int ownedLand = newFaction.getLandCount();
|
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()))
|
if (mconf.worldsNoClaiming.contains(ps.getWorld()))
|
||||||
{
|
{
|
||||||
msg("<b>Sorry, this world has land claiming disabled.");
|
msg("<b>Sorry, this world has land claiming disabled.");
|
||||||
return false;
|
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)
|
if (newFaction.getUPlayers().size() < uconf.claimsRequireMinFactionMembers)
|
||||||
{
|
{
|
||||||
msg("Factions must have at least <h>%s<b> members to claim land.", uconf.claimsRequireMinFactionMembers);
|
msg("Factions must have at least <h>%s<b> members to claim land.", uconf.claimsRequireMinFactionMembers);
|
||||||
@ -647,35 +635,50 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if
|
if (oldFaction.isNormal())
|
||||||
(
|
|
||||||
uconf.claimsMustBeConnected
|
|
||||||
&& newFaction.getLandCountInWorld(ps.getWorld()) > 0
|
|
||||||
&& !BoardColls.get().isConnectedPs(ps, newFaction)
|
|
||||||
&& (!uconf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !oldFaction.isNormal())
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (uconf.claimsCanBeUnconnectedIfOwnedByOtherFaction)
|
if (!uconf.claimingFromOthersAllowed)
|
||||||
{
|
{
|
||||||
msg("<b>You can only claim additional land which is connected to your first claim or controlled by another faction!");
|
msg("<b>You may not claim land from others.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (oldFaction.getRelationTo(newFaction).isAtLeast(Rel.TRUCE))
|
||||||
{
|
{
|
||||||
msg("<b>You can only claim additional land which is connected to your first claim!");
|
msg("<b>You can't claim this land due to your relation with the current owner.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
uconf.claimsMustBeConnected
|
||||||
|
&& newFaction.getLandCountInWorld(ps.getWorld()) > 0
|
||||||
|
&& !BoardColls.get().isConnectedPs(ps, newFaction)
|
||||||
|
&& (!uconf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !oldFaction.isNormal())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (uconf.claimsCanBeUnconnectedIfOwnedByOtherFaction)
|
||||||
|
{
|
||||||
|
msg("<b>You can only claim additional land which is connected to your first claim or controlled by another faction!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg("<b>You can only claim additional land which is connected to your first claim!");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!oldFaction.hasLandInflation())
|
||||||
|
{
|
||||||
|
msg("%s<i> owns this land and is strong enough to keep it.", oldFaction.getName(this));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! BoardColls.get().isBorderPs(ps))
|
||||||
|
{
|
||||||
|
msg("<b>You must start claiming land at the border of the territory.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!oldFaction.hasLandInflation())
|
|
||||||
{
|
|
||||||
msg("%s<i> owns this land and is strong enough to keep it.", oldFaction.getName(this));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! BoardColls.get().isBorderPs(ps))
|
|
||||||
{
|
|
||||||
msg("<b>You must start claiming land at the border of the territory.");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +708,8 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
for (UPlayer informee : informees)
|
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;
|
return true;
|
||||||
|
@ -486,11 +486,15 @@ public class FactionsListenerMain implements Listener
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void blockMonsters(EntityTargetEvent event)
|
public void blockMonsters(EntityTargetEvent event)
|
||||||
{
|
{
|
||||||
// If a monster is targeting something ...
|
// If a monster ...
|
||||||
if ( ! Const.ENTITY_TYPES_MONSTERS.contains(event.getEntityType())) return;
|
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 ...
|
// ... at a place where monsters are forbidden ...
|
||||||
PS ps = PS.valueOf(event.getTarget());
|
PS ps = PS.valueOf(target);
|
||||||
Faction faction = BoardColls.get().getFactionAt(ps);
|
Faction faction = BoardColls.get().getFactionAt(ps);
|
||||||
if (faction.getFlag(FFlag.MONSTERS)) return;
|
if (faction.getFlag(FFlag.MONSTERS)) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user