Package dev.majek.hexnicks
Class HexNicks
java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
dev.majek.hexnicks.HexNicks
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor
,org.bukkit.command.TabCompleter
,org.bukkit.command.TabExecutor
,org.bukkit.plugin.Plugin
public final class HexNicks
extends org.bukkit.plugin.java.JavaPlugin
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic HexNicksApi
api()
Get the Nicks Api for accessing things such as event management and nickname lookup.static ConfigValues
config()
Easier access for plugin config options with defaults for redundancy.static HexNicks
core()
Get an instance of the main class.@NotNull net.kyori.adventure.text.Component
getDisplayName
(@NotNull org.bukkit.entity.Player player) Get a nickname from a player's display name.Get the map that stores unique ids keyed to nicknames.boolean
Check if the plugin has a new update on Spigot.static HookManager
hooks()
Check what plugins this plugin has hooked into.@NotNull File
jsonFile()
Get the file where nicknames will be stored.static LoggingManager
logging()
Get the plugin's logging manager.void
Plugin shutdown logic.void
onEnable()
Plugin startup logic.void
reload()
Reload the plugin's configuration file.void
removeNick
(@NotNull org.bukkit.entity.Player player) Remove a nickname from the map and from Json storage.void
setNick
(@NotNull org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.Component nick) Set a user's nickname using an onlinePlayer
.static StorageMethod
storage()
Get the storage method the plugin is using for nickname storage.Methods 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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.bukkit.plugin.Plugin
getComponentLogger, getLog4JLogger, getSLF4JLogger
-
Constructor Details
-
HexNicks
public HexNicks()Initialize plugin. Logging must be instantiated before other managers.
-
-
Method Details
-
onEnable
public void onEnable()Plugin startup logic.- Specified by:
onEnable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onEnable
in classorg.bukkit.plugin.java.JavaPlugin
-
onDisable
public void onDisable()Plugin shutdown logic.- Specified by:
onDisable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onDisable
in classorg.bukkit.plugin.java.JavaPlugin
-
core
Get an instance of the main class. Use this for things like managing nicknames.- Returns:
- main class
-
api
Get the Nicks Api for accessing things such as event management and nickname lookup.- Returns:
- api methods
-
config
Easier access for plugin config options with defaults for redundancy.- Returns:
- config values
-
hooks
Check what plugins this plugin has hooked into.- Returns:
- plugin hook manager
-
storage
Get the storage method the plugin is using for nickname storage. This will return eitherJsonStorage
orSqlStorage
.- Returns:
- nickname storage manager
-
logging
Get the plugin's logging manager.- Returns:
- logging manager
-
reload
public void reload()Reload the plugin's configuration file. -
jsonFile
Get the file where nicknames will be stored.- Returns:
- json file
-
getNickMap
Get the map that stores unique ids keyed to nicknames.- Returns:
- nickname map
-
getDisplayName
@NotNull public @NotNull net.kyori.adventure.text.Component getDisplayName(@NotNull @NotNull org.bukkit.entity.Player player) Get a nickname from a player's display name. If you want their nickname from storage usestorage()
- Parameters:
player
- the player- Returns:
- nickname/display name
-
setNick
public void setNick(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.Component nick) Set a user's nickname using an onlinePlayer
. This will immediately be saved to Json.- Parameters:
player
- the playernick
- the player's new nickname
-
removeNick
public void removeNick(@NotNull @NotNull org.bukkit.entity.Player player) Remove a nickname from the map and from Json storage. It will be asynchronously removed from the file.- Parameters:
player
- the player whose nickname to remove
-
hasUpdate
public boolean hasUpdate()Check if the plugin has a new update on Spigot.- Returns:
- whether there's an update
-