Factions/src/com/massivecraft/factions/commands/FCommandPeaceful.java

46 lines
1.1 KiB
Java
Raw Normal View History

New "peaceful" status for factions which can only be set by server admins/moderators. Members of peaceful factions cannot deal or receive PvP damage (unless in a war zone which has friendly fire enabled), cannot claim land from another faction and likewise can't have their land claimed, and cannot be considered as ally or enemy of any other faction. Faction admins and moderators of peaceful factions can enable/disable all explosions inside their faction's territory at will. The main purpose of this is to provide a way for more peaceful players who don't want to take part in faction wars (or just want to take a break from them) to still have fun on the server. It is also meant to allow groups of players to make protected buildings, monuments, grand constructions, and so forth without having to worry about another faction destroying them. 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)
2011-08-05 10:50:47 +02:00
package com.massivecraft.factions.commands;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
public class FCommandPeaceful extends FBaseCommand {
public FCommandPeaceful() {
aliases.add("peaceful");
senderMustBePlayer = false;
requiredParameters.add("faction tag");
helpDescription = "Designate a faction as peaceful";
}
@Override
public boolean hasPermission(CommandSender sender) {
return Factions.hasPermSetPeaceful(sender);
}
@Override
public void perform() {
if( parameters.size() > 0) {
Faction faction = Faction.findByTag(parameters.get(0));
if (faction == null) {
sendMessage("No faction found with the tag \"" + parameters.get(0) + "\"");
return;
}
if( faction != null && faction.isPeaceful() ) {
sendMessage("Faction \"" + parameters.get(0) + "\" peaceful designation removed");
faction.setPeaceful(false);
} else {
sendMessage("Faction \"" + faction.getTag() + "\" has been designated as peaceful");
faction.setPeaceful(true);
}
}
}
}