2014-11-07 18:49:54 +01:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
2014-11-11 16:28:53 +01:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.P;
|
|
|
|
import com.massivecraft.factions.integration.Econ;
|
2014-11-07 18:49:54 +01:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
|
|
|
|
|
|
|
public class CmdDelFWarp extends FCommand {
|
|
|
|
|
|
|
|
public CmdDelFWarp() {
|
|
|
|
super();
|
|
|
|
this.aliases.add("delwarp");
|
|
|
|
this.aliases.add("dw");
|
|
|
|
this.aliases.add("deletewarp");
|
|
|
|
this.requiredArgs.add("warp name");
|
|
|
|
this.senderMustBeMember = true;
|
|
|
|
this.senderMustBeModerator = true;
|
|
|
|
this.senderMustBePlayer = true;
|
|
|
|
this.permission = Permission.SETWARP.node;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
String warp = argAsString(0);
|
|
|
|
if (myFaction.isWarp(warp)) {
|
2014-11-11 16:28:53 +01:00
|
|
|
if (!transact(fme)) {
|
|
|
|
return;
|
|
|
|
}
|
2014-11-07 18:49:54 +01:00
|
|
|
myFaction.removeWarp(warp);
|
|
|
|
fme.msg("<i>Deleted warp <a>%s", warp);
|
|
|
|
} else {
|
|
|
|
fme.msg("<i>Couldn't find warp <a>%s", warp);
|
|
|
|
}
|
|
|
|
}
|
2014-11-11 16:28:53 +01:00
|
|
|
|
|
|
|
private boolean transact(FPlayer player) {
|
|
|
|
return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.delwarp", 5), "to delete warp", "for deleting warp");
|
|
|
|
}
|
2014-11-07 18:49:54 +01:00
|
|
|
}
|