Skip to content

Accessing Protection System

Bartłomiej Stępień edited this page Sep 13, 2023 · 2 revisions

Accessing Protection System

Eagle Factions provides a protection system that is used to determine if a player can do things inside claimed territories (but not only).

To use Protection System yourself you can use ProtectionManager interface.

ProtectionManager protectionManager = eagleFactions.getProtectionManager();

ProtectionManager contains many useful protection methods, take look here to get to know them.

For example, if you would want to know if player can break a block in a given location, you could you the following code:

ProtectionResult result = protectionManager.canBreak(blockSnapshot, player, shouldNotify); // shouldNotify tells the protection system to send player a message about not having access to given block
if (result.hasAccess()) {
   // player can break this block! :D
} else {
   // player cannot break this block :(
}
Clone this wiki locally