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;
|
2014-11-07 18:49:54 +01:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2018-08-21 20:02:16 +02:00
|
|
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
2014-12-08 00:12:52 +01:00
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
2014-11-07 18:49:54 +01:00
|
|
|
|
|
|
|
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);
|
2018-08-21 20:02:16 +02:00
|
|
|
if (!this.hasAccess(PermissableAction.WARP)){
|
|
|
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage warps");
|
|
|
|
return;
|
|
|
|
}
|
2014-11-07 18:49:54 +01:00
|
|
|
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);
|
2014-12-08 00:12:52 +01:00
|
|
|
fme.msg(TL.COMMAND_DELFWARP_DELETED, warp);
|
2014-11-07 18:49:54 +01:00
|
|
|
} else {
|
2014-12-08 00:12:52 +01:00
|
|
|
fme.msg(TL.COMMAND_DELFWARP_INVALID, warp);
|
2014-11-07 18:49:54 +01:00
|
|
|
}
|
|
|
|
}
|
2014-11-11 16:28:53 +01:00
|
|
|
|
|
|
|
private boolean transact(FPlayer player) {
|
2014-12-10 00:16:42 +01:00
|
|
|
return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString());
|
2014-11-11 16:28:53 +01:00
|
|
|
}
|
2015-01-22 00:58:33 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_DELFWARP_DESCRIPTION;
|
|
|
|
}
|
2014-11-07 18:49:54 +01:00
|
|
|
}
|