Class ChatData

java.lang.Object
studio.magemonkey.codex.mccore.chat.ChatData
All Implemented Interfaces:
ISavable

public class ChatData extends Object implements ISavable
Contains player data for the chat
  • Method Details

    • getChatTag

      public String getChatTag()
      Retrieves the player's chat tag (e.g. <[Prefix] DisplayName>)
      Returns:
      the player's chat tag
    • getDisplayName

      public String getDisplayName()
      Returns:
      player display name
    • setDisplayName

      public void setDisplayName(String displayName)
      Sets the player's display name
      Parameters:
      displayName - display name
    • getPrefix

      public Prefix getPrefix()
      Retrieves the current prefix used by the player
      Returns:
      prefix chosen by player or null if none are applied
    • getPrefix

      public Prefix getPrefix(String pluginName)
      Retrieves the current prefix for the given plugin
      Parameters:
      pluginName - name of the plugin
      Returns:
      prefix currently assigned by the plugin
    • getUnlockedPrefixes

      public List<Prefix> getUnlockedPrefixes(String pluginName)
      Retrieves a list of all prefixes unlocked through a plugin
      Parameters:
      pluginName - name of the plugin that gives the prefixes
      Returns:
      list of all unlocked prefixes from the plugin
    • unlockPrefix

      public boolean unlockPrefix(Prefix prefix, boolean apply)
      Unlocks the given prefix
      Parameters:
      prefix - prefix to unlock
      apply - whether or not to apply it right away
      Returns:
      true if successful, false if already unlocked
    • removePrefix

      public boolean removePrefix(String pluginName, String prefixText)
      Removes the prefix from the player, making them unable to use it anymore
      Parameters:
      pluginName - name of the plugin that gives the prefix
      prefixText - prefix text (with or without color)
      Returns:
      true if removed, false if it wasn't unlocked
    • removePrefixes

      public void removePrefixes(String pluginName)
      Removes all prefixes unlocked through the given plugin
      Parameters:
      pluginName - name of the plugin with the prefixes
    • setPluginPrefix

      public void setPluginPrefix(Prefix prefix)
      Sets the prefix for a plugin Use this only for game-changing prefixes. If it doesn't need to be displayed, use unlockPrefix(CPrefix, boolean) instead.
      Parameters:
      prefix - prefix data
    • clearPluginPrefix

      public void clearPluginPrefix(String pluginName)
      Clears the prefix assigned to the plugin with the given name
      Parameters:
      pluginName - name of the plugin with the prefix
    • hasPrefix

      public boolean hasPrefix(String prefixText)
      Checks if the prefix has been obtained for the given plugin
      Parameters:
      prefixText - the text of the prefix (with or without color)
      Returns:
      true if the prefix is unlocked
    • save

      public void save(org.bukkit.configuration.ConfigurationSection config, String base)
      Saves the player data to the config file
      Specified by:
      save in interface ISavable
      Parameters:
      config - config to save to
      base - base path