Managed to get rid of some commands. This needs to be rethought even more though.
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdAutoClaim extends FCommand
|
||||
@ -12,48 +11,32 @@ public class CmdAutoClaim extends FCommand
|
||||
this.aliases.add("autoclaim");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
this.optionalArgs.put("faction", "your");
|
||||
|
||||
this.permission = Permission.AUTOCLAIM.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
boolean enabled = this.argAsBool(0, ! fme.isAutoClaimEnabled());
|
||||
|
||||
fme.setIsAutoClaimEnabled(enabled);
|
||||
|
||||
if ( ! enabled)
|
||||
Faction forFaction = this.argAsFaction(0, myFaction);
|
||||
if (forFaction == null || (forFaction == myFaction && fme.getAutoClaimFor() == myFaction))
|
||||
{
|
||||
fme.setAutoClaimFor(null);
|
||||
msg("<i>Auto-claiming of land disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
FLocation flocation = new FLocation(fme);
|
||||
|
||||
if (Conf.worldsNoClaiming.contains(flocation.getWorldName()))
|
||||
{
|
||||
msg("<b>Sorry, this world has land claiming disabled.");
|
||||
fme.setIsAutoClaimEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFaction.getLandRounded() >= myFaction.getPowerRounded())
|
||||
{
|
||||
msg("<b>You can't claim more land! You need more power!");
|
||||
fme.setIsAutoClaimEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
msg("<i>Auto-claiming of land enabled.");
|
||||
fme.attemptClaim(myFaction, me.getLocation(), false);
|
||||
|
||||
fme.setAutoClaimFor(forFaction);
|
||||
|
||||
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme));
|
||||
fme.attemptClaim(forFaction, me.getLocation(), true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdAutoSafeclaim extends FCommand
|
||||
{
|
||||
|
||||
public CmdAutoSafeclaim()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("autosafe");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
|
||||
this.permission = Permission.MANAGE_SAFE_ZONE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
this.setHelpShort("Auto-claim land for the safezone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
boolean enabled = this.argAsBool(0, ! fme.isAutoSafeClaimEnabled());
|
||||
|
||||
fme.setIsAutoSafeClaimEnabled(enabled);
|
||||
|
||||
if ( ! enabled)
|
||||
{
|
||||
msg("<i>Auto-claiming of safe zone disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
msg("<i>Auto-claiming of safe zone enabled.");
|
||||
|
||||
FLocation playerFlocation = new FLocation(fme);
|
||||
|
||||
if (!Board.getFactionAt(playerFlocation).isSafeZone())
|
||||
{
|
||||
Board.setFactionAt(Factions.i.getSafeZone(), playerFlocation);
|
||||
msg("<i>This land is now a safe zone.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdAutoWarclaim extends FCommand
|
||||
{
|
||||
|
||||
public CmdAutoWarclaim()
|
||||
{
|
||||
super();
|
||||
aliases.add("autowar");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
|
||||
this.permission = Permission.MANAGE_WAR_ZONE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
this.setHelpShort("Auto-claim land for the warzone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
boolean enabled = this.argAsBool(0, ! fme.isAutoWarClaimEnabled());
|
||||
|
||||
fme.setIsAutoWarClaimEnabled(enabled);
|
||||
|
||||
if ( ! enabled)
|
||||
{
|
||||
msg("<i>Auto-claiming of war zone disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
msg("<i>Auto-claiming of war zone enabled.");
|
||||
|
||||
FLocation playerFlocation = new FLocation(fme);
|
||||
|
||||
if (!Board.getFactionAt(playerFlocation).isWarZone())
|
||||
{
|
||||
Board.setFactionAt(Factions.i.getWarZone(), playerFlocation);
|
||||
msg("<i>This land is now a war zone.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -18,7 +18,7 @@ public class CmdClaim extends FCommand
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
|
@ -160,11 +160,7 @@ public class CmdHelp extends FCommand
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add("Finally some commands for the server admins:");
|
||||
pageLines.add( p.cmdBase.cmdBypass.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdSafeclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdAutoSafeclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdWarclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdAutoWarclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdWarunclaimall.getUseageTemplate(true) );
|
||||
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."));
|
||||
helpPages.add(pageLines);
|
||||
|
@ -1,50 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdSafeclaim extends FCommand
|
||||
{
|
||||
|
||||
public CmdSafeclaim()
|
||||
{
|
||||
this.aliases.add("safeclaim");
|
||||
this.aliases.add("safe");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("radius", "0");
|
||||
|
||||
this.permission = Permission.MANAGE_SAFE_ZONE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
this.setHelpShort("Claim land for the safezone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
// The current location of the player
|
||||
FLocation playerFlocation = new FLocation(fme);
|
||||
|
||||
int radius = this.argAsInt(0, 0);
|
||||
if (radius < 0) radius = 0;
|
||||
|
||||
FLocation from = playerFlocation.getRelative(radius, radius);
|
||||
FLocation to = playerFlocation.getRelative(-radius, -radius);
|
||||
|
||||
for (FLocation locToClaim : FLocation.getArea(from, to))
|
||||
{
|
||||
Board.setFactionAt(Factions.i.getSafeZone(), locToClaim);
|
||||
}
|
||||
|
||||
msg("<i>You claimed <h>%d chunks<i> for the <a>safe zone<i>.", (1+radius*2)*(1+radius*2));
|
||||
}
|
||||
|
||||
}
|
@ -36,56 +36,6 @@ public class CmdUnclaimall extends FCommand
|
||||
{
|
||||
if ( ! Econ.modifyMoney(fme , refund, "to unclaim all faction land", "for unclaiming all faction land")) return;
|
||||
}
|
||||
|
||||
//String moneyBack = "<i>";
|
||||
/*if (Econ.shouldBeUsed())
|
||||
{
|
||||
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
|
||||
// a real refund
|
||||
if (refund > 0.0)
|
||||
{
|
||||
if(Conf.bankFactionPaysLandCosts)
|
||||
{
|
||||
Faction faction = myFaction;
|
||||
faction.addMoney(refund);
|
||||
moneyBack = " "+faction.getTag()+" <i>received a refund of <h>"+Econ.moneyString(refund)+"<i>.";
|
||||
}
|
||||
else
|
||||
{
|
||||
Econ.addMoney(fme.getName(), refund);
|
||||
moneyBack = " They received a refund of <h>"+Econ.moneyString(refund)+"<i>.";
|
||||
}
|
||||
}
|
||||
// wait, you're charging people to unclaim land? outrageous
|
||||
else if (refund < 0.0)
|
||||
{
|
||||
if(Conf.bankFactionPaysLandCosts)
|
||||
{
|
||||
Faction faction = myFaction;
|
||||
if(!faction.removeMoney(-refund))
|
||||
{
|
||||
msg("<b>Unclaiming all faction land will cost <h>"+Econ.moneyString(-refund)+"<b>, which your faction can't currently afford.");
|
||||
return;
|
||||
}
|
||||
moneyBack = " It cost "+faction.getTag()+" "+Econ.moneyString(refund)+".";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Econ.deductMoney(fme.getName(), -refund))
|
||||
{
|
||||
msg("<b>Unclaiming all faction land will cost <h>"+Econ.moneyString(-refund)+"<b>, which you can't currently afford.");
|
||||
return;
|
||||
}
|
||||
moneyBack = "<i> It cost them <h>"+Econ.moneyString(refund)+"<i>.";
|
||||
}
|
||||
moneyBack = "<i> It cost them <h>"+Econ.moneyString(refund)+"<i>.";
|
||||
}
|
||||
// no refund
|
||||
else
|
||||
{
|
||||
moneyBack = "";
|
||||
}
|
||||
}*/
|
||||
|
||||
Board.unclaimAll(myFaction.getId());
|
||||
myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true));
|
||||
|
@ -1,48 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdWarclaim extends FCommand
|
||||
{
|
||||
|
||||
public CmdWarclaim()
|
||||
{
|
||||
this.aliases.add("warclaim");
|
||||
this.aliases.add("war");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("radius", "0");
|
||||
|
||||
this.permission = Permission.MANAGE_WAR_ZONE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
this.setHelpShort("Claim land for the warzone");
|
||||
}
|
||||
|
||||
public void perform()
|
||||
{
|
||||
// The current location of the player
|
||||
FLocation playerFlocation = new FLocation(fme);
|
||||
|
||||
int radius = this.argAsInt(0, 0);
|
||||
if (radius < 0) radius = 0;
|
||||
|
||||
FLocation from = playerFlocation.getRelative(radius, radius);
|
||||
FLocation to = playerFlocation.getRelative(-radius, -radius);
|
||||
|
||||
for (FLocation locToClaim : FLocation.getArea(from, to))
|
||||
{
|
||||
Board.setFactionAt(Factions.i.getWarZone(), locToClaim);
|
||||
}
|
||||
|
||||
msg("<i>You claimed <h>%d chunks<i> for the <a>war zone<i>.", (1+radius*2)*(1+radius*2));
|
||||
}
|
||||
}
|
@ -8,8 +8,6 @@ public class FCmdRoot extends FCommand
|
||||
{
|
||||
public CmdAdmin cmdAdmin = new CmdAdmin();
|
||||
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
|
||||
public CmdAutoSafeclaim cmdAutoSafeclaim = new CmdAutoSafeclaim();
|
||||
public CmdAutoWarclaim cmdAutoWarclaim = new CmdAutoWarclaim();
|
||||
public CmdBoom cmdBoom = new CmdBoom();
|
||||
public CmdBypass cmdBypass = new CmdBypass();
|
||||
public CmdChat cmdChat = new CmdChat();
|
||||
@ -40,7 +38,6 @@ public class FCmdRoot extends FCommand
|
||||
public CmdRelationEnemy cmdRelationEnemy = new CmdRelationEnemy();
|
||||
public CmdRelationNeutral cmdRelationNeutral = new CmdRelationNeutral();
|
||||
public CmdReload cmdReload = new CmdReload();
|
||||
public CmdSafeclaim cmdSafeclaim = new CmdSafeclaim();
|
||||
public CmdSafeunclaimall cmdSafeunclaimall = new CmdSafeunclaimall();
|
||||
public CmdSaveAll cmdSaveAll = new CmdSaveAll();
|
||||
public CmdSethome cmdSethome = new CmdSethome();
|
||||
@ -50,7 +47,6 @@ public class FCmdRoot extends FCommand
|
||||
public CmdUnclaim cmdUnclaim = new CmdUnclaim();
|
||||
public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall();
|
||||
public CmdVersion cmdVersion = new CmdVersion();
|
||||
public CmdWarclaim cmdWarclaim = new CmdWarclaim();
|
||||
public CmdWarunclaimall cmdWarunclaimall = new CmdWarunclaimall();
|
||||
|
||||
public FCmdRoot()
|
||||
@ -77,8 +73,6 @@ public class FCmdRoot extends FCommand
|
||||
|
||||
this.addSubCommand(this.cmdAdmin);
|
||||
this.addSubCommand(this.cmdAutoClaim);
|
||||
this.addSubCommand(this.cmdAutoSafeclaim);
|
||||
this.addSubCommand(this.cmdAutoWarclaim);
|
||||
this.addSubCommand(this.cmdBoom);
|
||||
this.addSubCommand(this.cmdBypass);
|
||||
this.addSubCommand(this.cmdChat);
|
||||
@ -109,7 +103,6 @@ public class FCmdRoot extends FCommand
|
||||
this.addSubCommand(this.cmdRelationEnemy);
|
||||
this.addSubCommand(this.cmdRelationNeutral);
|
||||
this.addSubCommand(this.cmdReload);
|
||||
this.addSubCommand(this.cmdSafeclaim);
|
||||
this.addSubCommand(this.cmdSafeunclaimall);
|
||||
this.addSubCommand(this.cmdSaveAll);
|
||||
this.addSubCommand(this.cmdSethome);
|
||||
@ -119,7 +112,6 @@ public class FCmdRoot extends FCommand
|
||||
this.addSubCommand(this.cmdUnclaim);
|
||||
this.addSubCommand(this.cmdUnclaimall);
|
||||
this.addSubCommand(this.cmdVersion);
|
||||
this.addSubCommand(this.cmdWarclaim);
|
||||
this.addSubCommand(this.cmdWarunclaimall);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user