68e1313776
New conf.json settings: "peacefulTerritoryDisablePVP" (default true) prevents PvP damage for anyone inside a peaceful faction's territory "peacefulTerritoryDisableMonsters" (default false) provides protection against monsters spawning or attacking inside a peaceful faction's territory "peacefulMembersDisablePowerLoss" (default true) which keeps members of peaceful factions from suffering power loss when they die. New commands: /f peaceful [faction tag] - toggle the indicated faction's "peaceful" status /f noboom - enable/disable explosions inside your faction's territory; only available to faction admin and faction moderators for peaceful factions New permission nodes: factions.setPeaceful - ability to use the /f peaceful command (admins) factions.peacefulExplosionToggle - ability to use /f noboom (everyone)
59 lines
1.4 KiB
Java
59 lines
1.4 KiB
Java
package com.massivecraft.factions.commands;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import com.massivecraft.factions.Conf;
|
|
import com.massivecraft.factions.Faction;
|
|
import com.massivecraft.factions.Factions;
|
|
import com.massivecraft.factions.struct.Role;
|
|
|
|
public class FCommandNoBoom extends FBaseCommand {
|
|
|
|
public FCommandNoBoom() {
|
|
aliases.add("noboom");
|
|
|
|
helpDescription = "Peaceful factions only: toggle explosions";
|
|
}
|
|
|
|
@Override
|
|
public boolean hasPermission(CommandSender sender) {
|
|
return Factions.hasPermPeacefulExplosionToggle(sender);
|
|
}
|
|
|
|
@Override
|
|
public void perform() {
|
|
if ( ! assertHasFaction()) {
|
|
return;
|
|
}
|
|
|
|
if( isLocked() ) {
|
|
sendLockMessage();
|
|
return;
|
|
}
|
|
|
|
if ( ! assertMinRole(Role.MODERATOR)) {
|
|
return;
|
|
}
|
|
|
|
Faction myFaction = me.getFaction();
|
|
|
|
if (!myFaction.isPeaceful()) {
|
|
me.sendMessage("This command is only usable by factions which are specially designated as peaceful.");
|
|
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
|
|
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" has "+enabled+" explosions in your faction's territory.");
|
|
}
|
|
|
|
}
|