REMOVED owned plots
This commit is contained in:
@ -113,8 +113,6 @@ public class CmdHelp extends FCommand
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( p.cmdBase.cmdMap.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdOwner.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdOwnerList.getUseageTemplate(true) );
|
||||
pageLines.add(p.txt.parse("<i>Claimed land with ownership set is further protected so"));
|
||||
pageLines.add(p.txt.parse("<i>that only the owner(s), faction admin, and possibly the"));
|
||||
pageLines.add(p.txt.parse("<i>faction moderators have full access."));
|
||||
|
@ -1,115 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
|
||||
public class CmdOwner extends FCommand
|
||||
{
|
||||
|
||||
public CmdOwner()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("owner");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("player name", "you");
|
||||
|
||||
this.permission = Permission.OWNER.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
// TODO: Fix colors!
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
boolean hasBypass = fme.isAdminBypassing();
|
||||
|
||||
if ( ! hasBypass && ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Conf.ownedAreasEnabled)
|
||||
{
|
||||
fme.msg("<b>Sorry, but owned areas are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction)
|
||||
{
|
||||
fme.msg("<b>Sorry, but you have reached the server's <h>limit of %d <b>owned areas per faction.", Conf.ownedAreasLimitPerFaction);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! hasBypass && !assertMinRole(Conf.ownedAreasModeratorsCanSet ? Rel.OFFICER : Rel.LEADER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FLocation flocation = new FLocation(fme);
|
||||
|
||||
Faction factionHere = Board.getFactionAt(flocation);
|
||||
if (factionHere != myFaction)
|
||||
{
|
||||
if ( ! hasBypass)
|
||||
{
|
||||
fme.msg("<b>This land is not claimed by your faction, so you can't set ownership of it.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! factionHere.isNormal())
|
||||
{
|
||||
fme.msg("<b>This land is not claimed by a faction. Ownership is not possible.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
|
||||
if (target == null) return;
|
||||
|
||||
String playerName = target.getName();
|
||||
|
||||
if (target.getFaction() != myFaction)
|
||||
{
|
||||
fme.msg("%s<i> is not a member of this faction.", playerName);
|
||||
return;
|
||||
}
|
||||
|
||||
// if no player name was passed, and this claim does already have owners set, clear them
|
||||
if (args.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation))
|
||||
{
|
||||
myFaction.clearClaimOwnership(flocation);
|
||||
SpoutFeatures.updateOwnerListLoc(flocation);
|
||||
fme.msg("<i>You have cleared ownership for this claimed area.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFaction.isPlayerInOwnerList(playerName, flocation))
|
||||
{
|
||||
myFaction.removePlayerAsOwner(playerName, flocation);
|
||||
SpoutFeatures.updateOwnerListLoc(flocation);
|
||||
fme.msg("<i>You have removed ownership of this claimed land from %s<i>.", playerName);
|
||||
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.econCostOwner, "to set ownership of claimed land", "for setting ownership of claimed land")) return;
|
||||
|
||||
myFaction.setPlayerAsOwner(playerName, flocation);
|
||||
SpoutFeatures.updateOwnerListLoc(flocation);
|
||||
|
||||
fme.msg("<i>You have added %s<i> to the owner list for this claimed land.", playerName);
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class CmdOwnerList extends FCommand
|
||||
{
|
||||
|
||||
public CmdOwnerList()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("ownerlist");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.OWNERLIST.node;
|
||||
this.disableOnLock = false;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
boolean hasBypass = fme.isAdminBypassing();
|
||||
|
||||
if ( ! hasBypass && ! assertHasFaction())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Conf.ownedAreasEnabled)
|
||||
{
|
||||
fme.msg("<b>Owned areas are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
FLocation flocation = new FLocation(fme);
|
||||
|
||||
if (Board.getFactionAt(flocation) != myFaction)
|
||||
{
|
||||
if (!hasBypass)
|
||||
{
|
||||
fme.msg("<b>This land is not claimed by your faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction = Board.getFactionAt(flocation);
|
||||
if (!myFaction.isNormal())
|
||||
{
|
||||
fme.msg("<i>This land is not claimed by any faction, thus no owners.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String owners = myFaction.getOwnerListString(flocation);
|
||||
|
||||
if (owners == null || owners.isEmpty())
|
||||
{
|
||||
fme.msg("<i>No owners are set here; everyone in the faction has access.");
|
||||
return;
|
||||
}
|
||||
|
||||
fme.msg("<i>Current owner(s) of this land: %s", owners);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import java.util.Set;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.FactionPerm;
|
||||
import com.massivecraft.factions.struct.FPerm;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
@ -46,23 +46,23 @@ public class CmdPerm extends FCommand
|
||||
|
||||
if ( ! this.argIsSet(1))
|
||||
{
|
||||
for (FactionPerm perm : FactionPerm.values())
|
||||
for (FPerm perm : FPerm.values())
|
||||
{
|
||||
msg(perm.getStateInfo(faction.getPerm(perm), true));
|
||||
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
FactionPerm perm = this.argAsFactionPerm(1);
|
||||
FPerm perm = this.argAsFactionPerm(1);
|
||||
if (perm == null) return;
|
||||
if ( ! this.argIsSet(2))
|
||||
{
|
||||
msg(perm.getStateInfo(faction.getPerm(perm), true));
|
||||
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Awesomesause parser for deltas...
|
||||
Set<Rel> targetValue = FactionPerm.parseRelDeltas(TextUtil.implode(args.subList(2, args.size()), " "), faction.getPerm(perm));
|
||||
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))
|
||||
@ -81,8 +81,8 @@ public class CmdPerm extends FCommand
|
||||
}
|
||||
|
||||
// Do the change
|
||||
faction.setPerm(perm, targetValue);
|
||||
msg(perm.getStateInfo(faction.getPerm(perm), true));
|
||||
faction.setPermittedRelations(perm, targetValue);
|
||||
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,8 +29,6 @@ public class FCmdRoot extends FCommand
|
||||
public CmdOfficer cmdOfficer = new CmdOfficer();
|
||||
public CmdMoney cmdMoney = new CmdMoney();
|
||||
public CmdOpen cmdOpen = new CmdOpen();
|
||||
public CmdOwner cmdOwner = new CmdOwner();
|
||||
public CmdOwnerList cmdOwnerList = new CmdOwnerList();
|
||||
public CmdPerm cmdPerm = new CmdPerm();
|
||||
public CmdPower cmdPower = new CmdPower();
|
||||
public CmdRelationAlly cmdRelationAlly = new CmdRelationAlly();
|
||||
@ -92,8 +90,6 @@ public class FCmdRoot extends FCommand
|
||||
this.addSubCommand(this.cmdOfficer);
|
||||
this.addSubCommand(this.cmdMoney);
|
||||
this.addSubCommand(this.cmdOpen);
|
||||
this.addSubCommand(this.cmdOwner);
|
||||
this.addSubCommand(this.cmdOwnerList);
|
||||
this.addSubCommand(this.cmdPerm);
|
||||
this.addSubCommand(this.cmdPower);
|
||||
this.addSubCommand(this.cmdRelationAlly);
|
||||
|
@ -13,7 +13,7 @@ import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.FactionFlag;
|
||||
import com.massivecraft.factions.struct.FactionPerm;
|
||||
import com.massivecraft.factions.struct.FPerm;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
import com.massivecraft.factions.zcore.MCommand;
|
||||
|
||||
@ -310,13 +310,13 @@ public abstract class FCommand extends MCommand<P>
|
||||
}
|
||||
|
||||
// FACTION PERM ======================
|
||||
public FactionPerm strAsFactionPerm(String name, FactionPerm def, boolean msg)
|
||||
public FPerm strAsFactionPerm(String name, FPerm def, boolean msg)
|
||||
{
|
||||
FactionPerm ret = def;
|
||||
FPerm ret = def;
|
||||
|
||||
if (name != null)
|
||||
{
|
||||
FactionPerm perm = FactionPerm.parse(name);
|
||||
FPerm perm = FPerm.parse(name);
|
||||
if (perm != null)
|
||||
{
|
||||
ret = perm;
|
||||
@ -330,15 +330,15 @@ public abstract class FCommand extends MCommand<P>
|
||||
|
||||
return ret;
|
||||
}
|
||||
public FactionPerm argAsFactionPerm(int idx, FactionPerm def, boolean msg)
|
||||
public FPerm argAsFactionPerm(int idx, FPerm def, boolean msg)
|
||||
{
|
||||
return this.strAsFactionPerm(this.argAsString(idx), def, msg);
|
||||
}
|
||||
public FactionPerm argAsFactionPerm(int idx, FactionPerm def)
|
||||
public FPerm argAsFactionPerm(int idx, FPerm def)
|
||||
{
|
||||
return this.argAsFactionPerm(idx, def, true);
|
||||
}
|
||||
public FactionPerm argAsFactionPerm(int idx)
|
||||
public FPerm argAsFactionPerm(int idx)
|
||||
{
|
||||
return this.argAsFactionPerm(idx, null);
|
||||
}
|
||||
|
Reference in New Issue
Block a user