2011-08-05 10:50:47 +02:00
|
|
|
package com.massivecraft.factions.commands;
|
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
|
|
|
import com.massivecraft.factions.Faction;
|
2011-10-08 22:03:44 +02:00
|
|
|
import com.massivecraft.factions.P;
|
2011-08-05 10:50:47 +02:00
|
|
|
import com.massivecraft.factions.struct.Role;
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public class FCommandNoBoom extends FCommand {
|
2011-08-05 10:50:47 +02:00
|
|
|
|
|
|
|
public FCommandNoBoom() {
|
|
|
|
aliases.add("noboom");
|
|
|
|
|
|
|
|
helpDescription = "Peaceful factions only: toggle explosions";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasPermission(CommandSender sender) {
|
2011-10-08 22:03:44 +02:00
|
|
|
return P.hasPermPeacefulExplosionToggle(sender);
|
2011-08-05 10:50:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
if ( ! assertHasFaction()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( isLocked() ) {
|
|
|
|
sendLockMessage();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! assertMinRole(Role.MODERATOR)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-10-09 14:53:38 +02:00
|
|
|
Faction myFaction = fme.getFaction();
|
2011-08-05 10:50:47 +02:00
|
|
|
|
|
|
|
if (!myFaction.isPeaceful()) {
|
2011-10-09 14:53:38 +02:00
|
|
|
fme.sendMessage("This command is only usable by factions which are specially designated as peaceful.");
|
2011-08-05 10:50:47 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
|
|
|
if (!payForCommand(Conf.econCostNoBoom)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
myFaction.setPeacefulExplosions();
|
|
|
|
|
|
|
|
String enabled = myFaction.noExplosionsInTerritory() ? "disabled" : "enabled";
|
|
|
|
|
|
|
|
// Inform
|
2011-10-09 14:53:38 +02:00
|
|
|
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" has "+enabled+" explosions in your faction's territory.");
|
2011-08-05 10:50:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|