Package com.palmergames.bukkit.towny
Class Towny
java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
com.palmergames.bukkit.towny.Towny
- All Implemented Interfaces:
io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner,net.kyori.adventure.key.Namespaced,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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddeleteCache(Resident resident) voiddeleteCache(UUID uuid) voiddeleteCache(org.bukkit.entity.Player player) getCache(org.bukkit.entity.Player player) Fetch the current players cache Creates a new one, if one doesn't exist.getCacheOrNull(@NotNull UUID uuid) @NotNull Collection<TownyInitException.TownyError> getPlayerMode(String name) getPlayerMode(org.bukkit.entity.Player player) Deprecated.static @NotNull Towny@NotNull TaskSchedulerorg.bukkit.WorldgetServerWorld(String name) Deprecated.since 0.100.2.13, unused by Towny for many years.getSetting(String root) booleanhasCache(org.bukkit.entity.Player player) booleanhasPlayerMode(String name, String mode) booleanhasPlayerMode(UUID uuid, String mode) booleanhasPlayerMode(org.bukkit.entity.Player player, String mode) Check if the player has a specific mode.booleanisError()booleanbooleanisFolia()static booleanstatic booleanisTownyVersionSupported(String version) Check if the version of Towny is newer than or equal to the supplied version.voidloadConfig(boolean reload) voidloadFoundation(boolean reload) voidloadLocalization(boolean reload) voidloadPermissions(boolean reload) voidvoidonEnable()booleanvoidremovePlayerMode(org.bukkit.entity.Player player) Deprecated.since 0.100.4.6, useResidentModeHandler.clearModes(Player)instead.voidremovePlayerModes(org.bukkit.entity.Player player) Deprecated.since 0.100.4.6, useResidentModeHandler.clearModes(Player)instead.voidResets all Online player caches, retaining their location info.voidresetCache(org.bukkit.entity.Player player) Resets a specific players cachevoidsetPlayerMode(org.bukkit.entity.Player player, String[] modes, boolean notify) Deprecated.since 0.100.4.6, useResidentModeHandler.toggleModes(Player, String[], boolean)instead.voidResets all Online player caches if their location has changedvoidupdateCache(WorldCoord worldCoord) Resets all Online player caches if their location equals this onevoidupdateCache(org.bukkit.entity.Player player) Resets a specific players cache if their location has changedMethods 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, onCommand, onLoad, onTabComplete, registerCommand, registerCommand, registerCommand, registerCommand, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toStringMethods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCode, namespaceMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bukkit.plugin.Plugin
getComponentLogger, getDataPath, getLog4JLogger, getSLF4JLogger
-
Constructor Details
-
Towny
public Towny()
-
-
Method Details
-
onEnable
public void onEnable()- Specified by:
onEnablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onEnablein classorg.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:
onDisablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onDisablein classorg.bukkit.plugin.java.JavaPlugin
-
getVersion
-
isError
public boolean isError()- Returns:
- the error
-
isError
-
addError
-
removeError
-
getErrors
-
hasCache
public boolean hasCache(org.bukkit.entity.Player player) -
deleteCache
-
deleteCache
public void deleteCache(org.bukkit.entity.Player player) -
deleteCache
-
getCache
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
- Parameters:
uuid- - UUID of the player to get the cache for.- Returns:
- The cache, or
nullif it doesn't exist.
-
resetCache
public void resetCache()Resets all Online player caches, retaining their location info. -
updateCache
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
@Deprecated public void setPlayerMode(org.bukkit.entity.Player player, String[] modes, boolean notify) Deprecated.since 0.100.4.6, useResidentModeHandler.toggleModes(Player, String[], boolean)instead.- Parameters:
player- Player to act upon.modes- String[] of mode names to toggle.notify- whether to notify the player of their modes afterwards.
-
removePlayerMode
Deprecated.since 0.100.4.6, useResidentModeHandler.clearModes(Player)instead.Remove ALL current modes (and set the defaults)- Parameters:
player- Player, whose modes are to be reset (all removed).
-
removePlayerModes
Deprecated.since 0.100.4.6, useResidentModeHandler.clearModes(Player)instead.Remove ALL current modes.- Parameters:
player- - player, whose modes are to be reset (all removed).
-
getPlayerMode
Deprecated.since 0.100.4.6, useResidentModeHandler.getModes(Player)instead.Fetch a list of all the players current modes.- Parameters:
player- - player, whose modes are to be listed, taken.- Returns:
- list of modes
-
getPlayerMode
-
hasPlayerMode
Check if the player has a specific mode.- Parameters:
player- - Player to be checkedmode- - Mode to be checked for within player.- Returns:
- true if the mode is present.
-
hasPlayerMode
-
hasPlayerMode
-
getConfigPath
-
getSetting
-
getPlugin
- Returns:
- the Towny instance
-
isTownyVersionSupported
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
-
getServerWorld
Deprecated.since 0.100.2.13, unused by Towny for many years. UseBukkitTools.getWorld(String)instead.- Parameters:
name- Name of the World.- Returns:
- a World
- Throws:
NotRegisteredException- if the world doesn't exist.
-
ResidentModeHandler.getModes(Player)instead.