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

    Constructors
    Constructor
    Description
    Construct objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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.
    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
    inGroup(org.bukkit.OfflinePlayer player, String group)
    Check whether a player is in a group.
    Get the current instance of WorldGuard
    boolean
    onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args)
     
    void
     
    void
    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

      public static WorldGuardPlugin inst()
      Get the current instance of WorldGuard
      Returns:
      WorldGuardPlugin instance
    • onEnable

      public void onEnable()
      Called on plugin enable.
      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
    • onDisable

      public void onDisable()
      Specified by:
      onDisable in interface org.bukkit.plugin.Plugin
      Overrides:
      onDisable in class org.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 interface org.bukkit.command.CommandExecutor
      Overrides:
      onCommand in class org.bukkit.plugin.java.JavaPlugin
    • inGroup

      public boolean inGroup(org.bukkit.OfflinePlayer player, String group)
      Check whether a player is in a group. This calls the corresponding method in PermissionsResolverManager
      Parameters:
      player - The player to check
      group - The group
      Returns:
      whether player is in group
    • getGroups

      public String[] getGroups(org.bukkit.OfflinePlayer player)
      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

      public boolean hasPermission(org.bukkit.command.CommandSender sender, String perm)
      Checks permissions.
      Parameters:
      sender - The sender to check the permission on.
      perm - The permission to check the permission on.
      Returns:
      whether sender has perm
    • 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 - if sender doesn't have perm
    • getWorldEdit

      public com.sk89q.worldedit.bukkit.WorldEditPlugin getWorldEdit() throws com.sk89q.minecraft.util.commands.CommandException
      Gets 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 wrap
      silenced - 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

      public BukkitConfigurationManager getConfigManager()
      Internal method. Do not use as API.
    • createProtectionQuery

      public ProtectionQuery 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

      public void createDefaultConfiguration(File actual, String defaultName)
      Create a default configuration file from the .jar.
      Parameters:
      actual - The destination file
      defaultName - The name of the file inside the jar's defaults folder
    • getPlayerMoveListener

      public PlayerMoveListener getPlayerMoveListener()