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:
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
deleteCache
(Resident resident) void
deleteCache
(UUID uuid) void
deleteCache
(org.bukkit.entity.Player player) static net.kyori.adventure.platform.bukkit.BukkitAudiences
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 TaskScheduler
org.bukkit.World
getServerWorld
(String name) Deprecated.since 0.100.2.13, unused by Towny for many years.getSetting
(String root) boolean
hasCache
(org.bukkit.entity.Player player) boolean
hasPlayerMode
(String name, String mode) boolean
hasPlayerMode
(UUID uuid, String mode) boolean
hasPlayerMode
(org.bukkit.entity.Player player, String mode) Check if the player has a specific mode.boolean
isError()
boolean
boolean
isFolia()
static boolean
static boolean
isTownyVersionSupported
(String version) Check if the version of Towny is newer than or equal to the supplied version.void
loadConfig
(boolean reload) void
loadFoundation
(boolean reload) void
loadLocalization
(boolean reload) void
loadPermissions
(boolean reload) void
void
onEnable()
boolean
void
removePlayerMode
(org.bukkit.entity.Player player) Deprecated.since 0.100.4.6, useResidentModeHandler.clearModes(Player)
instead.void
removePlayerModes
(org.bukkit.entity.Player player) Deprecated.since 0.100.4.6, useResidentModeHandler.clearModes(Player)
instead.void
Resets all Online player caches, retaining their location info.void
resetCache
(org.bukkit.entity.Player player) Resets a specific players cachevoid
setPlayerMode
(org.bukkit.entity.Player player, String[] modes, boolean notify) Deprecated.since 0.100.4.6, useResidentModeHandler.toggleModes(Player, String[], boolean)
instead.void
Resets all Online player caches if their location has changedvoid
updateCache
(WorldCoord worldCoord) Resets all Online player caches if their location equals this onevoid
updateCache
(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, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, isEnabled, isNaggable, onCommand, onLoad, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toString
Methods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCode
-
Constructor Details
-
Towny
public Towny()
-
-
Method Details
-
onEnable
public void onEnable()- Specified by:
onEnable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onEnable
in 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:
onDisable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onDisable
in 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
null
if 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
-
getAdventure
public static net.kyori.adventure.platform.bukkit.BukkitAudiences getAdventure() -
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.