Class ProtectorAPI
java.lang.Object
io.github.lijinhong11.protector.api.ProtectorAPI
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
allowBreak
(org.bukkit.entity.Player player) Check if the player can break a blockstatic boolean
allowBreak
(org.bukkit.entity.Player player, org.bukkit.Location block) Check if the player can break a blockstatic boolean
allowInteract
(org.bukkit.entity.Player player) Check if the player can interact with a blockstatic boolean
allowInteract
(org.bukkit.entity.Player player, org.bukkit.Location block) Check if the player can interact with the blockstatic boolean
allowPlace
(org.bukkit.entity.Player player) Check if the player can place a blockstatic boolean
allowPlace
(org.bukkit.entity.Player player, org.bukkit.Location block) Check if the player can place a blockstatic @Nullable IBlockProtectionModule
findBlockModule
(org.bukkit.entity.Player p, org.bukkit.Location block) Find the block protection module that protects the blockstatic @Nullable IProtectionModule
findModule
(org.bukkit.Location location) Find the protection module that protects the protection rangestatic Collection
<IProtectionModule> Get all available protection modules.static @Nullable IProtectionModule
Get the first available protection modulestatic @Nullable IProtectionModule
getModuleByPluginName
(String pluginName) Find the protection module by plugin namestatic ProtectionAPIPlugin
Get the plugin instancestatic boolean
isEventFake
(@NotNull org.bukkit.event.Event event) Check the event is fakestatic void
register
(IBlockProtectionModule module) Register the block protection modulestatic void
register
(IProtectionModule module) Register the protection modulestatic void
registerFlag
(CustomFlag flag) Register a custom flag.static void
setPluginHost
(ProtectionAPIPlugin plugin) Set the plugin instance
-
Constructor Details
-
ProtectorAPI
public ProtectorAPI()
-
-
Method Details
-
register
Register the protection module- Parameters:
module
- the protection module
-
register
Register the block protection module- Parameters:
module
- the block protection module
-
setPluginHost
Set the plugin instance- Parameters:
plugin
- the plugin instance
-
getPluginHost
Get the plugin instance- Returns:
- the plugin instance
-
getFirstAvailableModule
Get the first available protection module- Returns:
- the first available protection module
-
getModuleByPluginName
Find the protection module by plugin name- Parameters:
pluginName
- the plugin name- Returns:
- the protection module
-
registerFlag
Register a custom flag. -
getAllAvailableProtectionModules
Get all available protection modules.- Returns:
- a list contains all available protection modules.
-
findModule
Find the protection module that protects the protection range- Parameters:
location
- the location in the protection range- Returns:
- the protection module
-
findBlockModule
@Nullable public static @Nullable IBlockProtectionModule findBlockModule(org.bukkit.entity.Player p, org.bukkit.Location block) Find the block protection module that protects the block- Parameters:
p
- the playerblock
- the block- Returns:
- the block protection module
-
isEventFake
public static boolean isEventFake(@NotNull @NotNull org.bukkit.event.Event event) Check the event is fake- Parameters:
event
- the event- Returns:
- true if the event is fake, false otherwise
-
allowBreak
public static boolean allowBreak(org.bukkit.entity.Player player) Check if the player can break a block- Parameters:
player
- the player- Returns:
- true if the player can break a block, false otherwise
-
allowBreak
public static boolean allowBreak(org.bukkit.entity.Player player, org.bukkit.Location block) Check if the player can break a block- Parameters:
player
- the playerblock
- the block- Returns:
- true if the player can break a block, false otherwise
-
allowPlace
public static boolean allowPlace(org.bukkit.entity.Player player) Check if the player can place a block- Parameters:
player
- the player- Returns:
- true if the player can place a block, false otherwise
-
allowPlace
public static boolean allowPlace(org.bukkit.entity.Player player, org.bukkit.Location block) Check if the player can place a block- Parameters:
player
- the playerblock
- the block- Returns:
- true if the player can place a block, false otherwise
-
allowInteract
public static boolean allowInteract(org.bukkit.entity.Player player) Check if the player can interact with a block- Parameters:
player
- the player- Returns:
- true if the player can interact with a block
-
allowInteract
public static boolean allowInteract(org.bukkit.entity.Player player, org.bukkit.Location block) Check if the player can interact with the block- Parameters:
player
- the playerblock
- the block- Returns:
- true if the player can interact with the block
-