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;
|
2018-10-23 01:42:57 +02:00
|
|
|
import com.massivecraft.factions.SavageFactions;
|
2014-11-07 18:49:54 +01:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
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);
|
|
|
|
if (myFaction.isWarp(warp)) {
|
2018-11-07 17:14:42 +01:00
|
|
|
if (!transact(fme)) {
|
2014-11-11 16:28:53 +01:00
|
|
|
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) {
|
2018-11-07 17:14:42 +01:00
|
|
|
return !SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SavageFactions.plugin.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
|
|
|
}
|