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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HexNicksApiapi()Get the Nicks Api for accessing things such as event management and nickname lookup.static ConfigValuesconfig()Easier access for plugin config options with defaults for redundancy.static HexNickscore()Get an instance of the main class.@NotNull net.kyori.adventure.text.ComponentgetDisplayName(@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.booleanCheck if the plugin has a new update on Spigot.static HookManagerhooks()Check what plugins this plugin has hooked into.@NotNull FilejsonFile()Get the file where nicknames will be stored.static LoggingManagerlogging()Get the plugin's logging manager.voidPlugin shutdown logic.voidonEnable()Plugin startup logic.voidreload()Reload the plugin's configuration file.voidremoveNick(@NotNull org.bukkit.entity.Player player) Remove a nickname from the map and from Json storage.static com.github.Anon8281.universalScheduler.scheduling.schedulers.TaskSchedulerGet the plugin's scheduler.voidsetNick(@NotNull org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.Component nick) Set a user's nickname using an onlinePlayer.static StorageMethodstorage()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, toStringMethods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
onEnablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onEnablein classorg.bukkit.plugin.java.JavaPlugin
-
onDisable
public void onDisable()Plugin shutdown logic.- Specified by:
onDisablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onDisablein 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 eitherJsonStorageorSqlStorage.- Returns:
- nickname storage manager
-
logging
Get the plugin's logging manager.- Returns:
- logging manager
-
scheduler
public static com.github.Anon8281.universalScheduler.scheduling.schedulers.TaskScheduler scheduler()Get the plugin's scheduler. Depending on the type of server the plugin is running on, this could be a Folia scheduler or a Bukkit scheduler.- Returns:
- task scheduler
-
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
-