2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-08-05 10:50:47 +02:00
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
2011-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2014-12-08 00:12:52 +01:00
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
2011-10-09 18:35:39 +02:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
public class CmdBoom extends FCommand {
|
2014-08-05 17:17:27 +02:00
|
|
|
|
2019-12-02 19:55:38 +01:00
|
|
|
/**
|
|
|
|
* @author FactionsUUID Team
|
|
|
|
*/
|
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
public CmdBoom() {
|
|
|
|
super();
|
|
|
|
this.aliases.add("noboom");
|
|
|
|
this.aliases.add("explosions");
|
|
|
|
this.aliases.add("toggleexplosions");
|
|
|
|
|
|
|
|
//this.requiredArgs.add("");
|
|
|
|
this.optionalArgs.put("on/off", "flip");
|
|
|
|
|
|
|
|
this.requirements = new CommandRequirements.Builder(Permission.NO_BOOM)
|
|
|
|
.playerOnly()
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform(CommandContext context) {
|
|
|
|
if (!context.faction.isPeaceful()) {
|
|
|
|
context.msg(TL.COMMAND_BOOM_PEACEFULONLY);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
|
|
|
if (!context.payForCommand(Conf.econCostNoBoom, TL.COMMAND_BOOM_TOTOGGLE, TL.COMMAND_BOOM_FORTOGGLE)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
context.faction.setPeacefulExplosionsEnabled(context.argAsBool(0, !context.faction.getPeacefulExplosionsEnabled()));
|
|
|
|
|
|
|
|
String enabled = context.faction.noExplosionsInTerritory() ? TL.GENERIC_DISABLED.toString() : TL.GENERIC_ENABLED.toString();
|
|
|
|
|
|
|
|
// Inform
|
|
|
|
context.faction.msg(TL.COMMAND_BOOM_ENABLED, context.fPlayer.describeTo(context.faction), enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_BOOM_DESCRIPTION;
|
|
|
|
}
|
2011-08-05 10:50:47 +02:00
|
|
|
}
|