Add an event for when a faction's perms change.

Closes #974.
This commit is contained in:
Pokechu22
2015-11-22 18:12:13 -08:00
committed by Olof Larsson
parent d7a6ee4ff8
commit d010cb8a4a
2 changed files with 57 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ import com.massivecraft.factions.cmd.type.TypeRel;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsPermChange;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.type.primitive.TypeBoolean;
@@ -60,6 +61,12 @@ public class CmdFactionsPermSet extends FactionsCommand
return;
}
// Event
EventFactionsPermChange event = new EventFactionsPermChange(sender, faction, perm, rel, value);
event.run();
if (event.isCancelled()) return;
value = event.getNewValue();
// No change
if (faction.getPermitted(perm).contains(rel) == value)
{