Package com.sk89q.worldguard.bukkit
Class WorldGuardPlugin
java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
com.sk89q.worldguard.bukkit.WorldGuardPlugin
- All Implemented Interfaces:
io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner
,org.bukkit.command.CommandExecutor
,org.bukkit.command.TabCompleter
,org.bukkit.command.TabExecutor
,org.bukkit.plugin.Plugin
public class WorldGuardPlugin
extends org.bukkit.plugin.java.JavaPlugin
The main class for WorldGuard as a Bukkit plugin.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkPermission
(org.bukkit.command.CommandSender sender, String perm) Checks permissions and throws an exception if permission is not met.void
createDefaultConfiguration
(File actual, String defaultName) Create a default configuration file from the .jar.Return a protection query helper object that can be used by another plugin to test whether WorldGuard permits an action at a particular place.Internal method.String[]
getGroups
(org.bukkit.OfflinePlayer player) Get the groups of a player.com.sk89q.worldedit.bukkit.WorldEditPlugin
Gets a copy of the WorldEdit plugin.boolean
hasPermission
(org.bukkit.command.CommandSender sender, String perm) Checks permissions.boolean
Check whether a player is in a group.static WorldGuardPlugin
inst()
Get the current instance of WorldGuardboolean
onCommand
(org.bukkit.command.CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args) void
void
onEnable()
Called on plugin enable.org.bukkit.command.CommandSender
unwrapActor
(com.sk89q.worldedit.extension.platform.Actor sender) com.sk89q.worldedit.extension.platform.Actor
wrapCommandSender
(org.bukkit.command.CommandSender sender) com.sk89q.worldguard.LocalPlayer
wrapOfflinePlayer
(org.bukkit.OfflinePlayer player) Wrap a player as a LocalPlayer.com.sk89q.worldguard.LocalPlayer
wrapPlayer
(org.bukkit.entity.Player player) Wrap a player as a LocalPlayer.com.sk89q.worldguard.LocalPlayer
wrapPlayer
(org.bukkit.entity.Player player, boolean silenced) Wrap a player as a LocalPlayer.Methods inherited from class org.bukkit.plugin.java.JavaPlugin
getClassLoader, getCommand, getConfig, getDataFolder, getDefaultBiomeProvider, getDefaultWorldGenerator, getDescription, getFile, getLifecycleManager, getLogger, getPlugin, getPluginLoader, getPluginMeta, getProvidingPlugin, getResource, getServer, getTextResource, init, init, isEnabled, isNaggable, onLoad, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toString
Methods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.bukkit.plugin.Plugin
getComponentLogger, getDataPath, getLog4JLogger, getSLF4JLogger
-
Constructor Details
-
WorldGuardPlugin
public WorldGuardPlugin()Construct objects. Actual loading occurs when the plugin is enabled, so this merely instantiates the objects.
-
-
Method Details
-
inst
Get the current instance of WorldGuard- Returns:
- WorldGuardPlugin instance
-
onEnable
public void onEnable()Called on plugin enable.- Specified by:
onEnable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onEnable
in classorg.bukkit.plugin.java.JavaPlugin
-
onDisable
public void onDisable()- Specified by:
onDisable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onDisable
in classorg.bukkit.plugin.java.JavaPlugin
-
onCommand
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args) - Specified by:
onCommand
in interfaceorg.bukkit.command.CommandExecutor
- Overrides:
onCommand
in classorg.bukkit.plugin.java.JavaPlugin
-
inGroup
Check whether a player is in a group. This calls the corresponding method in PermissionsResolverManager- Parameters:
player
- The player to checkgroup
- The group- Returns:
- whether
player
is ingroup
-
getGroups
Get the groups of a player. This calls the corresponding method in PermissionsResolverManager.- Parameters:
player
- The player to check- Returns:
- The names of each group the playe is in.
-
hasPermission
Checks permissions.- Parameters:
sender
- The sender to check the permission on.perm
- The permission to check the permission on.- Returns:
- whether
sender
hasperm
-
checkPermission
public void checkPermission(org.bukkit.command.CommandSender sender, String perm) throws com.sk89q.minecraft.util.commands.CommandPermissionsException Checks permissions and throws an exception if permission is not met.- Parameters:
sender
- The sender to check the permission on.perm
- The permission to check the permission on.- Throws:
com.sk89q.minecraft.util.commands.CommandPermissionsException
- ifsender
doesn't haveperm
-
getWorldEdit
public com.sk89q.worldedit.bukkit.WorldEditPlugin getWorldEdit() throws com.sk89q.minecraft.util.commands.CommandExceptionGets a copy of the WorldEdit plugin.- Returns:
- The WorldEditPlugin instance
- Throws:
com.sk89q.minecraft.util.commands.CommandException
- If there is no WorldEditPlugin available
-
wrapPlayer
public com.sk89q.worldguard.LocalPlayer wrapPlayer(org.bukkit.entity.Player player) Wrap a player as a LocalPlayer.- Parameters:
player
- The player to wrap- Returns:
- The wrapped player
-
wrapPlayer
public com.sk89q.worldguard.LocalPlayer wrapPlayer(org.bukkit.entity.Player player, boolean silenced) Wrap a player as a LocalPlayer.- Parameters:
player
- The player to wrapsilenced
- True to silence messages- Returns:
- The wrapped player
-
wrapCommandSender
public com.sk89q.worldedit.extension.platform.Actor wrapCommandSender(org.bukkit.command.CommandSender sender) -
unwrapActor
public org.bukkit.command.CommandSender unwrapActor(com.sk89q.worldedit.extension.platform.Actor sender) -
wrapOfflinePlayer
public com.sk89q.worldguard.LocalPlayer wrapOfflinePlayer(org.bukkit.OfflinePlayer player) Wrap a player as a LocalPlayer.This implementation is incomplete -- permissions cannot be checked.
- Parameters:
player
- The player to wrap- Returns:
- The wrapped player
-
getConfigManager
Internal method. Do not use as API. -
createProtectionQuery
Return a protection query helper object that can be used by another plugin to test whether WorldGuard permits an action at a particular place.- Returns:
- an instance
-
createDefaultConfiguration
Create a default configuration file from the .jar.- Parameters:
actual
- The destination filedefaultName
- The name of the file inside the jar's defaults folder
-
getPlayerMoveListener
-