Updated readme, Fixed admin bypass command and corresponding permissions, Swapped colors for ally and truce, added new faction permissions, improved explosion protection and implemented firespread protection, fixed painbuild check order, flags can only be changed by server admins now and implemented type adapters for some enumerations for future changes to be non breaking. That it \:D /
This commit is contained in:
@ -3,17 +3,17 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdBypass extends FCommand
|
||||
public class CmdAdmin extends FCommand
|
||||
{
|
||||
public CmdBypass()
|
||||
public CmdAdmin()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("bypass");
|
||||
this.aliases.add("admin");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
|
||||
this.permission = Permission.BYPASS.node;
|
||||
this.permission = Permission.ADMIN.node;
|
||||
this.disableOnLock = false;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
@ -25,12 +25,11 @@ public class CmdBypass extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
fme.setIsAdminBypassing(this.argAsBool(0, ! fme.isAdminBypassing()));
|
||||
fme.setHasAdminMode(this.argAsBool(0, ! fme.hasAdminMode()));
|
||||
|
||||
// TODO: Move this to a transient field in the model??
|
||||
if ( fme.isAdminBypassing())
|
||||
if ( fme.hasAdminMode())
|
||||
{
|
||||
fme.msg("<i>You have enabled admin bypass mode. You will be able to build or destroy anywhere.");
|
||||
fme.msg("<i>You have enabled admin bypass mode.");
|
||||
P.p.log(fme.getName() + " has ENABLED admin bypass mode.");
|
||||
}
|
||||
else
|
@ -1,8 +1,8 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.FPerm;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class CmdAutoClaim extends FCommand
|
||||
{
|
||||
@ -33,16 +33,8 @@ public class CmdAutoClaim extends FCommand
|
||||
msg("<i>Auto-claiming of land disabled.");
|
||||
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;
|
||||
}
|
||||
|
||||
if ( ! FPerm.TERRITORY.has(fme, forFaction, true)) return;
|
||||
|
||||
fme.setAutoClaimFor(forFaction);
|
||||
|
||||
|
@ -8,8 +8,8 @@ import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.FFlag;
|
||||
import com.massivecraft.factions.struct.FPerm;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdDisband extends FCommand
|
||||
{
|
||||
@ -37,19 +37,7 @@ public class CmdDisband extends FCommand
|
||||
Faction faction = this.argAsFaction(0, fme == null ? null : myFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
boolean isMyFaction = fme == null ? false : faction == myFaction;
|
||||
|
||||
if (isMyFaction)
|
||||
{
|
||||
if ( ! assertMinRole(Rel.LEADER)) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! Permission.DISBAND_ANY.has(sender, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( ! FPerm.DISBAND.has(sender, faction, true)) return;
|
||||
|
||||
if (faction.getFlag(FFlag.PERMANENT))
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.FFlag;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdFlag extends FCommand
|
||||
{
|
||||
@ -12,6 +11,7 @@ public class CmdFlag extends FCommand
|
||||
{
|
||||
super();
|
||||
this.aliases.add("flag");
|
||||
this.aliases.add("flags");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction", "your");
|
||||
@ -59,26 +59,8 @@ public class CmdFlag extends FCommand
|
||||
Boolean targetValue = this.argAsBool(2);
|
||||
if (targetValue == null) return;
|
||||
|
||||
// Do the sender have the right to change flags for this faction?
|
||||
if (Permission.FLAG_ANY.has(sender))
|
||||
{
|
||||
// This sender may modify any flag for anyone
|
||||
}
|
||||
else if ( ! flag.isChangeable())
|
||||
{
|
||||
msg("<b>Only server operators can change this flag.");
|
||||
return;
|
||||
}
|
||||
else if (faction != myFaction)
|
||||
{
|
||||
msg("<b>You are not a member in that faction.");
|
||||
return;
|
||||
}
|
||||
else if (fme.getRole().isLessThan(Rel.OFFICER))
|
||||
{
|
||||
msg("<b>You must be faction leader or officer to change your faction flags.");
|
||||
return;
|
||||
}
|
||||
// Do the sender have the right to change flags?
|
||||
if ( ! Permission.FLAG_SET.has(sender, true)) return;
|
||||
|
||||
// Do the change
|
||||
msg(p.txt.titleize("Flag for " + faction.describeTo(fme, true)));
|
||||
|
@ -54,7 +54,7 @@ public class CmdJoin extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if( ! (faction.getOpen() || faction.isInvited(fme) || fme.isAdminBypassing()))
|
||||
if( ! (faction.getOpen() || faction.isInvited(fme) || fme.hasAdminMode()))
|
||||
{
|
||||
msg("<i>This faction requires invitation.");
|
||||
faction.msg("%s<i> tried to join your faction.", fme.describeTo(faction, true));
|
||||
|
@ -6,6 +6,7 @@ import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.FFlag;
|
||||
import com.massivecraft.factions.struct.FPerm;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdKick extends FCommand
|
||||
@ -41,31 +42,16 @@ public class CmdKick extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Conf.canLeaveWithNegativePower && you.getPower() < 0)
|
||||
{
|
||||
msg("<b>You cannot kick that member until their power is positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction yourFaction = you.getFaction();
|
||||
|
||||
// players with admin-level "disband" permission can bypass these requirements
|
||||
if ( ! Permission.KICK_ANY.has(sender))
|
||||
{
|
||||
if (yourFaction != myFaction)
|
||||
{
|
||||
msg("%s<b> is not a member of %s", you.describeTo(fme, true), myFaction.describeTo(fme));
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getRole().isAtLeast(fme.getRole()))
|
||||
{
|
||||
// TODO add more informative messages.
|
||||
msg("<b>Your rank is too low to kick this player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Conf.canLeaveWithNegativePower && you.getPower() < 0)
|
||||
{
|
||||
msg("<b>You cannot kick that member until their power is positive.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (fme != null && ! FPerm.KICK.has(fme, yourFaction)) return;
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if ( ! payForCommand(Conf.econCostKick, "to kick someone from the faction", "for kicking someone from the faction")) return;
|
||||
|
||||
|
@ -15,6 +15,7 @@ public class CmdPerm extends FCommand
|
||||
{
|
||||
super();
|
||||
this.aliases.add("perm");
|
||||
this.aliases.add("perms");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction", "your");
|
||||
@ -63,26 +64,20 @@ public class CmdPerm extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
Set<Rel> targetValue = FPerm.parseRelDeltas(TextUtil.implode(args.subList(2, args.size()), " "), faction.getPermittedRelations(perm));
|
||||
|
||||
// Do the sender have the right to change perms for this faction?
|
||||
if (Permission.PERM_ANY.has(sender))
|
||||
{
|
||||
// This sender may modify any perm for anyone
|
||||
}
|
||||
else if (faction != myFaction)
|
||||
{
|
||||
msg("<b>You are not a member in that faction.");
|
||||
return;
|
||||
}
|
||||
else if (fme.getRole().isLessThan(Rel.OFFICER))
|
||||
{
|
||||
msg("<b>You must be faction leader or officer to change your faction permissions.");
|
||||
return;
|
||||
}
|
||||
if ( ! FPerm.PERMS.has(sender, faction, true)) return;
|
||||
|
||||
// Do the change
|
||||
Set<Rel> targetValue = FPerm.parseRelDeltas(TextUtil.implode(args.subList(2, args.size()), " "), faction.getPermittedRelations(perm));
|
||||
|
||||
// The following is to make sure the leader always has the right to change perms if that is our goal.
|
||||
if (perm == FPerm.PERMS && FPerm.PERMS.getDefault().contains(Rel.LEADER))
|
||||
{
|
||||
targetValue.add(Rel.LEADER);
|
||||
}
|
||||
|
||||
faction.setPermittedRelations(perm, targetValue);
|
||||
|
||||
msg(p.txt.titleize("Perm for " + faction.describeTo(fme, true)));
|
||||
msg(FPerm.getStateHeaders());
|
||||
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
||||
|
@ -4,8 +4,8 @@ import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.FPerm;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdSethome extends FCommand
|
||||
{
|
||||
@ -38,19 +38,12 @@ public class CmdSethome extends FCommand
|
||||
if (faction == null) return;
|
||||
|
||||
// Can the player set the home for this faction?
|
||||
if (faction == myFaction)
|
||||
{
|
||||
if ( ! Permission.SETHOME_ANY.has(sender) && ! assertMinRole(Rel.OFFICER)) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Permission.SETHOME_ANY.has(sender, true)) return;
|
||||
}
|
||||
if ( ! FPerm.SETHOME.has(sender, faction, true)) return;
|
||||
|
||||
// Can the player set the faction home HERE?
|
||||
if
|
||||
(
|
||||
! Permission.BYPASS.has(me)
|
||||
! fme.hasAdminMode()
|
||||
&&
|
||||
Conf.homesMustBeInClaimedTerritory
|
||||
&&
|
||||
|
@ -7,8 +7,8 @@ import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.FPerm;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdUnclaim extends FCommand
|
||||
{
|
||||
@ -34,37 +34,8 @@ public class CmdUnclaim extends FCommand
|
||||
{
|
||||
FLocation flocation = new FLocation(fme);
|
||||
Faction otherFaction = Board.getFactionAt(flocation);
|
||||
|
||||
if (fme.isAdminBypassing())
|
||||
{
|
||||
Board.removeAt(flocation);
|
||||
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
|
||||
|
||||
otherFaction.msg("%s<i> unclaimed some of your land.", fme.describeTo(otherFaction, true));
|
||||
msg("<i>You unclaimed this land.");
|
||||
|
||||
if (Conf.logLandUnclaims)
|
||||
P.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertHasFaction())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Rel.OFFICER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( myFaction != otherFaction)
|
||||
{
|
||||
msg("<b>You don't own this land.");
|
||||
return;
|
||||
}
|
||||
if ( ! FPerm.TERRITORY.has(sender, otherFaction, true)) return;
|
||||
|
||||
//String moneyBack = "<i>";
|
||||
if (Econ.shouldBeUsed())
|
||||
|
@ -8,7 +8,7 @@ public class FCmdRoot extends FCommand
|
||||
{
|
||||
public CmdLeader cmdLeader = new CmdLeader();
|
||||
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
|
||||
public CmdBypass cmdBypass = new CmdBypass();
|
||||
public CmdAdmin cmdBypass = new CmdAdmin();
|
||||
public CmdChat cmdChat = new CmdChat();
|
||||
public CmdClaim cmdClaim = new CmdClaim();
|
||||
public CmdConfig cmdConfig = new CmdConfig();
|
||||
|
@ -387,7 +387,7 @@ public abstract class FCommand extends MCommand<P>
|
||||
// if economy is enabled and they're not on the bypass list, make 'em pay; returns true unless person can't afford the cost
|
||||
public boolean payForCommand(double cost, String toDoThis, String forDoingThis)
|
||||
{
|
||||
if ( ! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) return true;
|
||||
if ( ! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.hasAdminMode()) return true;
|
||||
|
||||
if(Conf.bankFactionPaysLandCosts && fme.hasFaction())
|
||||
{
|
||||
|
Reference in New Issue
Block a user