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

Main plugin class.

Use core() to access core plugin utilities such as nickname storage.

Use api() to access api utilities such as event management.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    api()
    Get the Nicks Api for accessing things such as event management and nickname lookup.
    Easier access for plugin config options with defaults for redundancy.
    static HexNicks
    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.
    @NotNull Map<UUID,net.kyori.adventure.text.Component>
    Get the map that stores unique ids keyed to nicknames.
    boolean
    Check if the plugin has a new update on Spigot.
    Check what plugins this plugin has hooked into.
    @NotNull File
    Get the file where nicknames will be stored.
    Get the plugin's logging manager.
    void
    Plugin shutdown logic.
    void
    Plugin startup logic.
    void
    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 online Player.
    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 interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
    • onDisable

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

      public static HexNicks core()
      Get an instance of the main class. Use this for things like managing nicknames.
      Returns:
      main class
    • api

      public static HexNicksApi api()
      Get the Nicks Api for accessing things such as event management and nickname lookup.
      Returns:
      api methods
    • config

      public static ConfigValues config()
      Easier access for plugin config options with defaults for redundancy.
      Returns:
      config values
    • hooks

      public static HookManager hooks()
      Check what plugins this plugin has hooked into.
      Returns:
      plugin hook manager
    • storage

      public static StorageMethod storage()
      Get the storage method the plugin is using for nickname storage. This will return either JsonStorage or SqlStorage.
      Returns:
      nickname storage manager
    • logging

      public static LoggingManager logging()
      Get the plugin's logging manager.
      Returns:
      logging manager
    • reload

      public void reload()
      Reload the plugin's configuration file.
    • jsonFile

      @NotNull public @NotNull File jsonFile()
      Get the file where nicknames will be stored.
      Returns:
      json file
    • getNickMap

      @NotNull public @NotNull Map<UUID,net.kyori.adventure.text.Component> 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 use storage()
      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 online Player. This will immediately be saved to Json.
      Parameters:
      player - the player
      nick - 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