Added a permanent power command
This commit is contained in:
parent
7ebed6db9c
commit
2ac96f4278
@ -26,6 +26,7 @@ permissions:
|
|||||||
factions.kit.halfmod: true
|
factions.kit.halfmod: true
|
||||||
factions.disband.any: true
|
factions.disband.any: true
|
||||||
factions.setpermanent: true
|
factions.setpermanent: true
|
||||||
|
factions.setpermanentpower: true
|
||||||
factions.setpeaceful: true
|
factions.setpeaceful: true
|
||||||
factions.sethome.any: true
|
factions.sethome.any: true
|
||||||
factions.money.*: true
|
factions.money.*: true
|
||||||
@ -175,6 +176,8 @@ permissions:
|
|||||||
description: designate a faction as peaceful
|
description: designate a faction as peaceful
|
||||||
factions.setpermanent:
|
factions.setpermanent:
|
||||||
description: designate a faction as permanent
|
description: designate a faction as permanent
|
||||||
|
factions.setpermanentpower:
|
||||||
|
description: set permanent power for a faction
|
||||||
factions.power:
|
factions.power:
|
||||||
description: show player power info
|
description: show player power info
|
||||||
factions.power.any:
|
factions.power.any:
|
||||||
|
@ -129,6 +129,12 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
return Econ.getMethod().getAccount(aid);
|
return Econ.getMethod().getAccount(aid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIELD: permanentPower
|
||||||
|
private Integer permanentPower;
|
||||||
|
public Integer getPermanentPower() { return this.permanentPower; }
|
||||||
|
public void setPermanentPower(Integer permanentPower) { this.permanentPower = permanentPower; }
|
||||||
|
public boolean hasPermanentPower() { return this.permanentPower != null; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Construct
|
// Construct
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -247,6 +253,11 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
//----------------------------------------------//
|
//----------------------------------------------//
|
||||||
public double getPower()
|
public double getPower()
|
||||||
{
|
{
|
||||||
|
if (this.hasPermanentPower())
|
||||||
|
{
|
||||||
|
return this.getPermanentPower();
|
||||||
|
}
|
||||||
|
|
||||||
double ret = 0;
|
double ret = 0;
|
||||||
for (FPlayer fplayer : this.getFPlayers())
|
for (FPlayer fplayer : this.getFPlayers())
|
||||||
{
|
{
|
||||||
@ -261,6 +272,11 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
|
|
||||||
public double getPowerMax()
|
public double getPowerMax()
|
||||||
{
|
{
|
||||||
|
if (this.hasPermanentPower())
|
||||||
|
{
|
||||||
|
return this.getPermanentPower();
|
||||||
|
}
|
||||||
|
|
||||||
double ret = 0;
|
double ret = 0;
|
||||||
for (FPlayer fplayer : this.getFPlayers())
|
for (FPlayer fplayer : this.getFPlayers())
|
||||||
{
|
{
|
||||||
|
@ -169,6 +169,7 @@ public class CmdHelp extends FCommand
|
|||||||
pageLines.add(p.txt.parse("<i>More commands for server admins:"));
|
pageLines.add(p.txt.parse("<i>More commands for server admins:"));
|
||||||
pageLines.add( p.cmdBase.cmdPeaceful.getUseageTemplate(true) );
|
pageLines.add( p.cmdBase.cmdPeaceful.getUseageTemplate(true) );
|
||||||
pageLines.add( p.cmdBase.cmdPermanent.getUseageTemplate(true) );
|
pageLines.add( p.cmdBase.cmdPermanent.getUseageTemplate(true) );
|
||||||
|
pageLines.add( p.cmdBase.cmdPermanentPower.getUseageTemplate(true) );
|
||||||
pageLines.add(p.txt.parse("<i>Peaceful factions are protected from PvP and land capture."));
|
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.cmdLock.getUseageTemplate(true) );
|
||||||
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate(true) );
|
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate(true) );
|
||||||
|
50
src/com/massivecraft/factions/cmd/CmdPermanentPower.java
Normal file
50
src/com/massivecraft/factions/cmd/CmdPermanentPower.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
|
||||||
|
public class CmdPermanentPower extends FCommand
|
||||||
|
{
|
||||||
|
public CmdPermanentPower()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.aliases.add("permanentpower");
|
||||||
|
|
||||||
|
this.requiredArgs.add("faction");
|
||||||
|
this.optionalArgs.put("power", "reset");
|
||||||
|
|
||||||
|
this.permission = Permission.SET_PERMANENTPOWER.node;
|
||||||
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
senderMustBePlayer = false;
|
||||||
|
senderMustBeMember = false;
|
||||||
|
senderMustBeModerator = false;
|
||||||
|
senderMustBeAdmin = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform()
|
||||||
|
{
|
||||||
|
Faction targetFaction = this.argAsFaction(0);
|
||||||
|
if (targetFaction == null) return;
|
||||||
|
|
||||||
|
Integer targetPower = this.argAsInt(1);
|
||||||
|
|
||||||
|
targetFaction.setPermanentPower(targetPower);
|
||||||
|
|
||||||
|
String change = "removed permanentpower status from";
|
||||||
|
if(targetFaction.hasPermanentPower())
|
||||||
|
{
|
||||||
|
change = "added permanentpower status to";
|
||||||
|
}
|
||||||
|
|
||||||
|
msg("<i>You %s <h>%s<i>.", change, targetFaction.describeTo(fme));
|
||||||
|
|
||||||
|
// Inform all players
|
||||||
|
for (FPlayer fplayer : targetFaction.getFPlayersWhereOnline(true))
|
||||||
|
{
|
||||||
|
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+"<i> "+change+" your faction.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,7 @@ public class FCmdRoot extends FCommand
|
|||||||
public CmdOwnerList cmdOwnerList = new CmdOwnerList();
|
public CmdOwnerList cmdOwnerList = new CmdOwnerList();
|
||||||
public CmdPeaceful cmdPeaceful = new CmdPeaceful();
|
public CmdPeaceful cmdPeaceful = new CmdPeaceful();
|
||||||
public CmdPermanent cmdPermanent = new CmdPermanent();
|
public CmdPermanent cmdPermanent = new CmdPermanent();
|
||||||
|
public CmdPermanentPower cmdPermanentPower = new CmdPermanentPower();
|
||||||
public CmdPower cmdPower = new CmdPower();
|
public CmdPower cmdPower = new CmdPower();
|
||||||
public CmdRelationAlly cmdRelationAlly = new CmdRelationAlly();
|
public CmdRelationAlly cmdRelationAlly = new CmdRelationAlly();
|
||||||
public CmdRelationEnemy cmdRelationEnemy = new CmdRelationEnemy();
|
public CmdRelationEnemy cmdRelationEnemy = new CmdRelationEnemy();
|
||||||
@ -98,6 +99,7 @@ public class FCmdRoot extends FCommand
|
|||||||
this.addSubCommand(this.cmdOwnerList);
|
this.addSubCommand(this.cmdOwnerList);
|
||||||
this.addSubCommand(this.cmdPeaceful);
|
this.addSubCommand(this.cmdPeaceful);
|
||||||
this.addSubCommand(this.cmdPermanent);
|
this.addSubCommand(this.cmdPermanent);
|
||||||
|
this.addSubCommand(this.cmdPermanentPower);
|
||||||
this.addSubCommand(this.cmdPower);
|
this.addSubCommand(this.cmdPower);
|
||||||
this.addSubCommand(this.cmdRelationAlly);
|
this.addSubCommand(this.cmdRelationAlly);
|
||||||
this.addSubCommand(this.cmdRelationEnemy);
|
this.addSubCommand(this.cmdRelationEnemy);
|
||||||
|
@ -45,6 +45,7 @@ public enum Permission
|
|||||||
OWNERLIST("ownerlist"),
|
OWNERLIST("ownerlist"),
|
||||||
SET_PEACEFUL("setpeaceful"),
|
SET_PEACEFUL("setpeaceful"),
|
||||||
SET_PERMANENT("setpermanent"),
|
SET_PERMANENT("setpermanent"),
|
||||||
|
SET_PERMANENTPOWER("setpermanentpower"),
|
||||||
POWER("power"),
|
POWER("power"),
|
||||||
POWER_ANY("power.any"),
|
POWER_ANY("power.any"),
|
||||||
RELATION("relation"),
|
RELATION("relation"),
|
||||||
|
Loading…
Reference in New Issue
Block a user