This commit is contained in:
Olof Larsson
2011-10-23 22:08:57 +02:00
parent ac6870b770
commit 21783ef9d4
24 changed files with 149 additions and 712 deletions

View File

@ -1,44 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.Permission;
public class CmdBoom extends FCommand
{
public CmdBoom()
{
super();
this.aliases.add("noboom");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flip");
this.permission = Permission.NO_BOOM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeOfficer = true;
senderMustBeLeader = false;
}
@Override
public void perform()
{
if ( ! myFaction.isPeaceful())
{
fme.msg("<b>This command is only usable by factions which are specially designated as peaceful.");
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.econCostNoBoom, "to toggle explosions", "for toggling explosions")) return;
myFaction.setPeacefulExplosionsEnabled(this.argAsBool(0, ! myFaction.getPeacefulExplosionsEnabled()));
String enabled = myFaction.noExplosionsInTerritory() ? "disabled" : "enabled";
// Inform
myFaction.msg("%s<i> has "+enabled+" explosions in your faction's territory.", fme.describeTo(myFaction));
}
}

View File

@ -113,7 +113,6 @@ public class CmdHelp extends FCommand
pageLines = new ArrayList<String>();
pageLines.add( p.cmdBase.cmdMap.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdBoom.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"));
@ -125,6 +124,7 @@ public class CmdHelp extends FCommand
pageLines.add( p.cmdBase.cmdDisband.getUseageTemplate(true) );
pageLines.add("");
pageLines.add( p.cmdBase.cmdRelationAlly.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdRelationTruce.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdRelationNeutral.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdRelationEnemy.getUseageTemplate(true) );
pageLines.add(p.txt.parse("<i>Set the relation you WISH to have with another faction."));
@ -163,15 +163,11 @@ public class CmdHelp extends FCommand
pageLines.add(p.txt.parse("<c>/f claim safezone <i>claim land for the Safe Zone"));
pageLines.add(p.txt.parse("<c>/f claim warzone <i>claim land for the War Zone"));
pageLines.add(p.txt.parse("<c>/f autoclaim [safezone|warzone] <i>take a guess"));
pageLines.add( p.cmdBase.cmdSafeunclaimall.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."));
pageLines.add( p.cmdBase.cmdPeaceful.getUseageTemplate(true) );
helpPages.add(pageLines);
pageLines = new ArrayList<String>();
pageLines.add(p.txt.parse("<i>More commands for server admins:"));
pageLines.add( p.cmdBase.cmdPeaceful.getUseageTemplate(true) );
pageLines.add(p.txt.parse("<i>Peaceful factions are protected from PvP and land capture."));
pageLines.add( p.cmdBase.cmdLock.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate(true) );

View File

@ -13,6 +13,7 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.FactionFlag;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Rel;
import com.massivecraft.factions.zcore.util.SmokeUtil;
@ -79,7 +80,7 @@ public class CmdHome extends FCommand
(
Conf.homesTeleportAllowedEnemyDistance > 0
&&
! faction.isSafeZone()
faction.getFlag(FactionFlag.PVP)
&&
(
! fme.isInOwnTerritory()

View File

@ -1,63 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.Permission;
public class CmdPeaceful extends FCommand
{
public CmdPeaceful()
{
super();
this.aliases.add("peaceful");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.SET_PEACEFUL.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeOfficer = false;
senderMustBeLeader = false;
}
@Override
public void perform()
{
Faction faction = this.argAsFaction(0);
if (faction == null) return;
String change;
if (faction.isPeaceful())
{
change = "removed peaceful status from";
faction.setPeaceful(false);
}
else
{
change = "granted peaceful status to";
faction.setPeaceful(true);
}
// Inform all players
for (FPlayer fplayer : FPlayers.i.getOnline())
{
if (fplayer.getFaction() == faction)
{
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+"<i> has "+change+" your faction.");
}
else
{
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "<i>\".");
}
}
SpoutFeatures.updateAppearances(faction);
}
}

View File

@ -6,7 +6,7 @@ public class CmdRelationTruce extends FRelationCommand
{
public CmdRelationTruce()
{
aliases.add("neutral");
targetRelation = Rel.NEUTRAL;
aliases.add("truce");
targetRelation = Rel.TRUCE;
}
}

View File

@ -1,41 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
public class CmdSafeunclaimall extends FCommand
{
public CmdSafeunclaimall()
{
this.aliases.add("safeunclaimall");
this.aliases.add("safedeclaimall");
//this.requiredArgs.add("");
//this.optionalArgs.put("radius", "0");
this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeOfficer = false;
senderMustBeLeader = false;
this.setHelpShort("Unclaim all safezone land");
}
@Override
public void perform()
{
Board.unclaimAll(Factions.i.getSafeZone().getId());
msg("<i>You unclaimed ALL safe zone land.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed all safe zones.");
}
}

View File

@ -56,9 +56,9 @@ public class CmdShow extends FCommand
}
String peaceStatus = "";
if (faction.isPeaceful())
if (faction.getFlag(FactionFlag.PEACEFUL))
{
peaceStatus = " "+Conf.colorNeutral+"This faction is Peaceful";
peaceStatus = " "+Conf.colorTruce+"This faction is Peaceful";
}
msg("<a>Joining: <i>"+(faction.getOpen() ? "no invitation is needed" : "invitation is required")+peaceStatus);

View File

@ -35,41 +35,6 @@ public class CmdUnclaim extends FCommand
FLocation flocation = new FLocation(fme);
Faction otherFaction = Board.getFactionAt(flocation);
if (otherFaction.isSafeZone())
{
if (Permission.MANAGE_SAFE_ZONE.has(sender))
{
Board.removeAt(flocation);
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
msg("<i>Safe zone was unclaimed.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
}
else
{
msg("<b>This is a safe zone. You lack permissions to unclaim.");
}
return;
}
else if (otherFaction.isWarZone())
{
if (Permission.MANAGE_WAR_ZONE.has(sender))
{
Board.removeAt(flocation);
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
msg("<i>War zone was unclaimed.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
}
else
{
msg("<b>This is a war zone. You lack permissions to unclaim.");
}
return;
}
if (fme.isAdminBypassing())
{
Board.removeAt(flocation);
@ -114,52 +79,6 @@ public class CmdUnclaim extends FCommand
{
if ( ! Econ.modifyMoney(fme , refund, "to unclaim this land", "for unclaiming this land")) return;
}
/*
// 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 this land will cost <h>%s<b> which your faction can't currently afford.", Econ.moneyString(-refund));
return;
}
moneyBack = " It cost "+faction.getTag()+" <h>"+Econ.moneyString(refund)+"<i>.";
}
else
{
if (!Econ.deductMoney(fme.getName(), -refund))
{
msg("<b>Unclaiming this land will cost <h>%s<b> which you can't currently afford.", Econ.moneyString(-refund));
return;
}
moneyBack = " It cost them <h>"+Econ.moneyString(refund)+"<i>.";
}
}
// no refund
else
{
moneyBack = "";
}
*/
}
Board.removeAt(flocation);

View File

@ -1,41 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
public class CmdWarunclaimall extends FCommand
{
public CmdWarunclaimall()
{
this.aliases.add("warunclaimall");
this.aliases.add("wardeclaimall");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.MANAGE_WAR_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeOfficer = false;
senderMustBeLeader = false;
this.setHelpShort("unclaim all warzone land");
}
@Override
public void perform()
{
Board.unclaimAll(Factions.i.getWarZone().getId());
msg("<i>You unclaimed ALL war zone land.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed all war zones.");
}
}

View File

@ -8,7 +8,6 @@ public class FCmdRoot extends FCommand
{
public CmdLeader cmdLeader = new CmdLeader();
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
public CmdBoom cmdBoom = new CmdBoom();
public CmdBypass cmdBypass = new CmdBypass();
public CmdChat cmdChat = new CmdChat();
public CmdClaim cmdClaim = new CmdClaim();
@ -32,13 +31,12 @@ public class FCmdRoot extends FCommand
public CmdOpen cmdOpen = new CmdOpen();
public CmdOwner cmdOwner = new CmdOwner();
public CmdOwnerList cmdOwnerList = new CmdOwnerList();
public CmdPeaceful cmdPeaceful = new CmdPeaceful();
public CmdPower cmdPower = new CmdPower();
public CmdRelationAlly cmdRelationAlly = new CmdRelationAlly();
public CmdRelationEnemy cmdRelationEnemy = new CmdRelationEnemy();
public CmdRelationNeutral cmdRelationNeutral = new CmdRelationNeutral();
public CmdRelationTruce cmdRelationTruce = new CmdRelationTruce();
public CmdReload cmdReload = new CmdReload();
public CmdSafeunclaimall cmdSafeunclaimall = new CmdSafeunclaimall();
public CmdSaveAll cmdSaveAll = new CmdSaveAll();
public CmdSethome cmdSethome = new CmdSethome();
public CmdShow cmdShow = new CmdShow();
@ -47,7 +45,6 @@ public class FCmdRoot extends FCommand
public CmdUnclaim cmdUnclaim = new CmdUnclaim();
public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall();
public CmdVersion cmdVersion = new CmdVersion();
public CmdWarunclaimall cmdWarunclaimall = new CmdWarunclaimall();
public FCmdRoot()
{
@ -73,7 +70,6 @@ public class FCmdRoot extends FCommand
this.addSubCommand(this.cmdLeader);
this.addSubCommand(this.cmdAutoClaim);
this.addSubCommand(this.cmdBoom);
this.addSubCommand(this.cmdBypass);
this.addSubCommand(this.cmdChat);
this.addSubCommand(this.cmdClaim);
@ -97,13 +93,12 @@ public class FCmdRoot extends FCommand
this.addSubCommand(this.cmdOpen);
this.addSubCommand(this.cmdOwner);
this.addSubCommand(this.cmdOwnerList);
this.addSubCommand(this.cmdPeaceful);
this.addSubCommand(this.cmdPower);
this.addSubCommand(this.cmdRelationAlly);
this.addSubCommand(this.cmdRelationEnemy);
this.addSubCommand(this.cmdRelationNeutral);
this.addSubCommand(this.cmdRelationTruce);
this.addSubCommand(this.cmdReload);
this.addSubCommand(this.cmdSafeunclaimall);
this.addSubCommand(this.cmdSaveAll);
this.addSubCommand(this.cmdSethome);
this.addSubCommand(this.cmdShow);
@ -112,7 +107,6 @@ public class FCmdRoot extends FCommand
this.addSubCommand(this.cmdUnclaim);
this.addSubCommand(this.cmdUnclaimall);
this.addSubCommand(this.cmdVersion);
this.addSubCommand(this.cmdWarunclaimall);
}
@Override

View File

@ -5,6 +5,7 @@ import org.bukkit.ChatColor;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.FactionFlag;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Rel;
@ -63,13 +64,13 @@ public abstract class FRelationCommand extends FCommand
myFaction.msg(currentRelationColor+them.getTag()+"<i> were informed that you wish to be "+targetRelation.getColor()+targetRelation);
}
if ( targetRelation != Rel.NEUTRAL && them.isPeaceful())
if ( targetRelation != Rel.NEUTRAL && them.getFlag(FactionFlag.PEACEFUL))
{
them.msg("<i>This will have no effect while your faction is peaceful.");
myFaction.msg("<i>This will have no effect while their faction is peaceful.");
}
if ( targetRelation != Rel.NEUTRAL && myFaction.isPeaceful())
if ( targetRelation != Rel.NEUTRAL && myFaction.getFlag(FactionFlag.PEACEFUL))
{
them.msg("<i>This will have no effect while their faction is peaceful.");
myFaction.msg("<i>This will have no effect while your faction is peaceful.");