Class Towny

java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
com.palmergames.bukkit.towny.Towny
All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter, org.bukkit.command.TabExecutor, org.bukkit.plugin.Plugin

public class Towny extends org.bukkit.plugin.java.JavaPlugin
Main class for Towny
Author:
Shade, ElgarL, LlmDl
  • Constructor Details

    • Towny

      public Towny()
  • Method Details

    • onEnable

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

      public void loadFoundation(boolean reload)
    • loadConfig

      public void loadConfig(boolean reload)
    • loadLocalization

      public void loadLocalization(boolean reload)
    • loadPermissions

      public void loadPermissions(boolean reload)
    • onDisable

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

      public String getVersion()
    • isError

      public boolean isError()
      Returns:
      the error
    • isError

      @Internal public boolean isError(@NotNull TownyInitException.TownyError error)
    • addError

      @Internal public void addError(@NotNull TownyInitException.TownyError error)
    • removeError

      @Internal public boolean removeError(@NotNull TownyInitException.TownyError error)
    • getErrors

      @Internal @NotNull public @NotNull Collection<TownyInitException.TownyError> getErrors()
    • hasCache

      public boolean hasCache(org.bukkit.entity.Player player)
    • deleteCache

      public void deleteCache(Resident resident)
    • deleteCache

      public void deleteCache(org.bukkit.entity.Player player)
    • deleteCache

      public void deleteCache(UUID uuid)
    • getCache

      public PlayerCache getCache(org.bukkit.entity.Player player)
      Fetch the current players cache Creates a new one, if one doesn't exist.
      Parameters:
      player - - Player to get the current cache from.
      Returns:
      the current (or new) cache for this player.
    • getCacheOrNull

      public PlayerCache getCacheOrNull(@NotNull @NotNull UUID uuid)
      Parameters:
      uuid - - UUID of the player to get the cache for.
      Returns:
      The cache, or null if it doesn't exist.
    • resetCache

      public void resetCache()
      Resets all Online player caches, retaining their location info.
    • updateCache

      public void updateCache(WorldCoord worldCoord)
      Resets all Online player caches if their location equals this one
      Parameters:
      worldCoord - - the location to check for
    • updateCache

      public void updateCache()
      Resets all Online player caches if their location has changed
    • updateCache

      public void updateCache(org.bukkit.entity.Player player)
      Resets a specific players cache if their location has changed
      Parameters:
      player - - Player, whose cache is to be updated.
    • resetCache

      public void resetCache(org.bukkit.entity.Player player)
      Resets a specific players cache
      Parameters:
      player - - Player, whose cache is to be reset.
    • setPlayerMode

      public void setPlayerMode(org.bukkit.entity.Player player, String[] modes, boolean notify)
    • removePlayerMode

      public void removePlayerMode(org.bukkit.entity.Player player)
      Remove ALL current modes (and set the defaults)
      Parameters:
      player - - player, whose modes are to be reset (all removed).
    • getPlayerMode

      public List<String> getPlayerMode(org.bukkit.entity.Player player)
      Fetch a list of all the players current modes.
      Parameters:
      player - - player, whose modes are to be listed, taken.
      Returns:
      list of modes
    • getPlayerMode

      public List<String> getPlayerMode(String name)
    • hasPlayerMode

      public boolean hasPlayerMode(org.bukkit.entity.Player player, String mode)
      Check if the player has a specific mode.
      Parameters:
      player - - Player to be checked
      mode - - Mode to be checked for within player.
      Returns:
      true if the mode is present.
    • hasPlayerMode

      public boolean hasPlayerMode(UUID uuid, String mode)
    • hasPlayerMode

      public boolean hasPlayerMode(String name, String mode)
    • getConfigPath

      public String getConfigPath()
    • getSetting

      public Object getSetting(String root)
    • getPlugin

      @NotNull public static @NotNull Towny getPlugin()
      Returns:
      the Towny instance
    • getAdventure

      public static net.kyori.adventure.platform.bukkit.BukkitAudiences getAdventure()
    • isTownyVersionSupported

      public static boolean isTownyVersionSupported(String version)
      Check if the version of Towny is newer than or equal to the supplied version. Used by other plugins to determine if Towny is of the required version level.
      Parameters:
      version - String version ie: "0.99.1.0"
      Returns:
      true if Towny's version is sufficient.
      Since:
      0.99.0.10.
    • isMinecraftVersionStillSupported

      public static boolean isMinecraftVersionStillSupported()
    • isFolia

      @Internal public boolean isFolia()
    • getScheduler

      @NotNull public @NotNull TaskScheduler getScheduler()
    • getServerWorld

      @Deprecated public org.bukkit.World getServerWorld(String name) throws NotRegisteredException
      Deprecated.
      since 0.100.2.13, unused by Towny for many years. Use BukkitTools.getWorld(String) instead.
      Parameters:
      name - Name of the World.
      Returns:
      a World
      Throws:
      NotRegisteredException - if the world doesn't exist.