mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-28 05:05:25 +01:00
Merge with master
This commit is contained in:
commit
57c4b70dad
@ -512,6 +512,24 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canClaimForFaction(Faction forFaction)
|
||||||
|
{
|
||||||
|
if (forFaction.isNone()) return false;
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
this.isAdminBypassing()
|
||||||
|
|| (forFaction == this.getFaction() && this.getRole().isAtLeast(Role.MODERATOR))
|
||||||
|
|| (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer()))
|
||||||
|
|| (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer()))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure)
|
public boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure)
|
||||||
{
|
{
|
||||||
String error = null;
|
String error = null;
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class CmdAutoClaim extends FCommand
|
public class CmdAutoClaim extends FCommand
|
||||||
{
|
{
|
||||||
@ -26,13 +27,23 @@ public class CmdAutoClaim extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
Faction forFaction = this.argAsFaction(0, myFaction);
|
Faction forFaction = this.argAsFaction(0, myFaction);
|
||||||
if (forFaction == null || (forFaction == myFaction && fme.getAutoClaimFor() == myFaction))
|
if (forFaction == null || forFaction == fme.getAutoClaimFor())
|
||||||
{
|
{
|
||||||
fme.setAutoClaimFor(null);
|
fme.setAutoClaimFor(null);
|
||||||
msg("<i>Auto-claiming of land disabled.");
|
msg("<i>Auto-claiming of land disabled.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! fme.canClaimForFaction(forFaction))
|
||||||
|
{
|
||||||
|
if (myFaction == forFaction)
|
||||||
|
msg("<b>You must be <h>%s<b> to claim land.", Role.MODERATOR.toString());
|
||||||
|
else
|
||||||
|
msg("<b>You can't claim land for <h>%s<b>.", forFaction.describeTo(fme));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fme.setAutoClaimFor(forFaction);
|
fme.setAutoClaimFor(forFaction);
|
||||||
|
|
||||||
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme));
|
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme));
|
||||||
|
@ -166,7 +166,7 @@ public abstract class FCommand extends MCommand<P>
|
|||||||
|
|
||||||
if (msg && ret == null)
|
if (msg && ret == null)
|
||||||
{
|
{
|
||||||
this.msg("<b>No player \"<p>%s<b>\" could not be found.", name);
|
this.msg("<b>No player \"<p>%s<b>\" could be found.", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user