Class AdvancedCoreUser

java.lang.Object
com.bencodez.advancedcore.api.user.AdvancedCoreUser

public class AdvancedCoreUser extends Object
The Class User.
  • Constructor Details

    • AdvancedCoreUser

      public AdvancedCoreUser(AdvancedCorePlugin plugin, AdvancedCoreUser user)
      Instantiates a new user from an existing user.
      Parameters:
      plugin - the plugin
      user - the user to copy from
    • AdvancedCoreUser

      @Deprecated public AdvancedCoreUser(AdvancedCorePlugin plugin, org.bukkit.entity.Player player)
      Deprecated.
      Instantiates a new user.
      Parameters:
      plugin - the plugin
      player - the player
    • AdvancedCoreUser

      @Deprecated public AdvancedCoreUser(AdvancedCorePlugin plugin, String playerName)
      Deprecated.
      Instantiates a new user.
      Parameters:
      plugin - the plugin
      playerName - the player name
    • AdvancedCoreUser

      @Deprecated public AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid)
      Deprecated.
      Instantiates a new user.
      Parameters:
      plugin - the plugin
      uuid - the uuid
    • AdvancedCoreUser

      @Deprecated public AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid, boolean loadName)
      Deprecated.
      Instantiates a new user.
      Parameters:
      plugin - the plugin
      uuid - the uuid
      loadName - the load name
    • AdvancedCoreUser

      @Deprecated public AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid, boolean loadName, boolean loadData)
      Deprecated.
      Instantiates a new user.
      Parameters:
      plugin - the plugin
      uuid - the uuid
      loadName - the load name
      loadData - the load data
    • AdvancedCoreUser

      @Deprecated public AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid, String playerName)
      Deprecated.
      Instantiates a new user.
      Parameters:
      plugin - the plugin
      uuid - the uuid
      playerName - the player name
  • Method Details

    • addOfflineRewards

      public void addOfflineRewards(Reward reward, HashMap<String,String> placeholders)
      Adds offline rewards to be given when the player next logs in.
      Parameters:
      reward - the reward
      placeholders - the placeholders
    • addPermission

      public void addPermission(String permission)
      Adds a permission to the player.
      Parameters:
      permission - the permission
    • addPermission

      public void addPermission(String permission, long delay)
      Adds a permission to the player with a delay.
      Parameters:
      permission - the permission
      delay - the delay in milliseconds
    • addTimedReward

      public void addTimedReward(Reward reward, HashMap<String,String> placeholders, long epochMilli)
      Adds a timed reward to be given at a specific time.
      Parameters:
      reward - the reward
      placeholders - the placeholders
      epochMilli - the epoch time in milliseconds when the reward should be given
    • addUnClaimedChoiceReward

      public void addUnClaimedChoiceReward(String name)
      Adds an unclaimed choice reward.
      Parameters:
      name - the reward name
    • cache

      public void cache()
      Caches the user data.
    • cacheAsync

      public void cacheAsync()
      Caches the user data asynchronously.
    • cacheIfNeeded

      public void cacheIfNeeded()
      Caches the user data if needed.
    • checkDelayedTimedRewards

      public void checkDelayedTimedRewards()
      Checks and processes delayed/timed rewards.
    • checkOfflineRewards

      public void checkOfflineRewards()
      Check offline rewards.
    • clearCache

      public void clearCache()
      Clears the user cache.
    • clearTempCache

      public void clearTempCache()
      Clears the temporary cache.
    • closeInv

      public void closeInv()
      Closes the player's inventory.
    • userDataFetechMode

      public AdvancedCoreUser userDataFetechMode(UserDataFetchMode mode)
      Sets the user data fetch mode.
      Parameters:
      mode - the fetch mode
      Returns:
      this user instance
    • forceRunOfflineRewards

      public void forceRunOfflineRewards()
      Forces running of offline rewards without processing checks.
    • getCache

      public UserDataCache getCache()
      Gets the user data cache.
      Returns:
      the cache
    • getChoicePreference

      public String getChoicePreference(String rewardName)
      Gets the user's choice preference for a reward.
      Parameters:
      rewardName - the reward name
      Returns:
      the choice preference
    • getChoicePreferenceData

      public ArrayList<String> getChoicePreferenceData()
      Gets the choice preference data.
      Returns:
      the choice preference data list
    • getData

      public UserData getData()
      Gets the user data.
      Returns:
      the user data
    • getInputMethod

      public String getInputMethod()
      Gets the input method.
      Returns:
      the input method string
    • getJavaUUID

      public UUID getJavaUUID()
      Gets the Java UUID object.
      Returns:
      the Java UUID
    • getLastOnline

      public long getLastOnline()
      Gets the last online time in milliseconds.
      Returns:
      the last online time
    • getNumberOfDaysSinceLogin

      public int getNumberOfDaysSinceLogin()
      Gets the number of days since the player's last login.
      Returns:
      the number of days since login
    • getOfflinePlayer

      public org.bukkit.OfflinePlayer getOfflinePlayer()
      Gets the offline player.
      Returns:
      the offline player
    • getOfflineRewards

      public ArrayList<String> getOfflineRewards()
      Gets the offline rewards list.
      Returns:
      the offline rewards
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Gets the player.
      Returns:
      the player
    • getPlayerHead

      public org.bukkit.inventory.ItemStack getPlayerHead()
      Gets the player's head as an ItemStack.
      Returns:
      the player head
    • getPlayerName

      public String getPlayerName()
      Gets the player name.
      Returns:
      the player name
    • getRepeatAmount

      public int getRepeatAmount(Reward reward)
      Gets the repeat amount for a reward.
      Parameters:
      reward - the reward
      Returns:
      the repeat amount
    • getTimedRewards

      public HashMap<String,Long> getTimedRewards()
      Gets the timed rewards map.
      Returns:
      the timed rewards
    • getUnClaimedChoices

      public ArrayList<String> getUnClaimedChoices()
      Gets the unclaimed choices list.
      Returns:
      the unclaimed choices
    • getUserData

      public UserData getUserData()
      Gets the user data instance.
      Returns:
      the user data
    • getUUID

      public String getUUID()
      Gets the uuid.
      Returns:
      the uuid
    • giveExp

      public void giveExp(int exp)
      Give exp.
      Parameters:
      exp - the exp
    • giveExpLevels

      public void giveExpLevels(int num)
      Gives experience levels to the player.
      Parameters:
      num - the number of levels to give
    • giveItem

      public void giveItem(ItemBuilder builder)
      Gives an item to the player from an ItemBuilder.
      Parameters:
      builder - the item builder
    • giveItem

      public void giveItem(org.bukkit.inventory.ItemStack item)
      Give item.
      Parameters:
      item - the item
    • giveItem

      public void giveItem(org.bukkit.inventory.ItemStack itemStack, HashMap<String,String> placeholders)
      Gives an item to the player with placeholders.
      Parameters:
      itemStack - the item stack
      placeholders - the placeholders
    • giveItems

      public void giveItems(org.bukkit.inventory.ItemStack... item)
      Gives multiple items to the player.
      Parameters:
      item - the items to give
    • giveMoney

      public void giveMoney(double m)
      Give user money, needs vault installed
      Parameters:
      m - Amount of money to give
    • giveMoney

      public void giveMoney(int money)
      Give money.
      Parameters:
      money - the money
    • givePotionEffect

      public void givePotionEffect(String potionName, int duration, int amplifier)
      Give potion effect.
      Parameters:
      potionName - the potion name
      duration - the duration
      amplifier - the amplifier
    • giveReward

      public void giveReward(org.bukkit.configuration.file.FileConfiguration data, String path, RewardOptions rewardOptions)
      Gives a reward from a configuration file.
      Parameters:
      data - the configuration data
      path - the path to the reward
      rewardOptions - the reward options
    • giveReward

      public void giveReward(Reward reward, RewardOptions rewardOptions)
      Gives a reward to the user.
      Parameters:
      reward - the reward
      rewardOptions - the reward options
    • hasChoices

      public boolean hasChoices()
      Checks if the user has unclaimed choices.
      Returns:
      true if the user has choices
    • hasLoggedOnBefore

      public boolean hasLoggedOnBefore()
      Check if player joined before
      Returns:
      true, if successful
    • hasPermission

      public boolean hasPermission(String perm)
      Checks if the user has a permission.
      Parameters:
      perm - the permission
      Returns:
      true if the user has the permission
    • hasPermission

      public boolean hasPermission(String perm, boolean offlineCheck)
      Checks if the user has a permission.
      Parameters:
      perm - the permission
      offlineCheck - whether to check offline permissions
      Returns:
      true if the user has the permission
    • isBanned

      public boolean isBanned()
      Checks if the player is banned.
      Returns:
      true if the player is banned
    • isBedrockUser

      public boolean isBedrockUser()
      Checks if the player is a Bedrock user.
      Returns:
      true if the player is a Bedrock user
    • setBedrockUser

      public void setBedrockUser(boolean isBedrock)
      Sets whether the player is a Bedrock user.
      Parameters:
      isBedrock - true if the player is a Bedrock user
    • isCached

      public boolean isCached()
      Checks if the user data is cached.
      Returns:
      true if cached
    • isCheckWorld

      public boolean isCheckWorld()
      Checks if world checking is enabled for the user.
      Returns:
      true if world checking is enabled
    • isInWorld

      public boolean isInWorld(ArrayList<String> worlds)
      Checks if the player is in any of the specified worlds.
      Parameters:
      worlds - the list of world names
      Returns:
      true if the player is in one of the worlds
    • isInWorld

      public boolean isInWorld(String world)
      Checks if the player is in a specific world.
      Parameters:
      world - the world name
      Returns:
      true if the player is in the world
    • isOnline

      public boolean isOnline()
      Checks if is online.
      Returns:
      true, if is online
    • isVanished

      public boolean isVanished()
      Checks if the player is vanished.
      Returns:
      true if the player is vanished
    • loadCache

      public void loadCache()
      Loads the user cache.
    • loadData

      public void loadData()
      Loads the user data.
    • loadTimedDelayedTimer

      public void loadTimedDelayedTimer(long time)
      Loads a timer for delayed/timed rewards.
      Parameters:
      time - the time in milliseconds
    • playEffect

      public void playEffect(String effectName, int data, int particles, int radius)
      Play particle effect.
      Parameters:
      effectName - the effect name
      data - the data
      particles - the particles
      radius - the radius
    • playParticle

      public void playParticle(String effectName, int data, int particles, int radius)
      Plays a particle effect for the player.
      Parameters:
      effectName - the particle effect name
      data - the data value
      particles - the number of particles
      radius - the radius
    • playParticleEffect

      @Deprecated public void playParticleEffect(String effectName, int data, int particles, int radius)
      Deprecated.
      Plays a particle effect for the player.
      Parameters:
      effectName - the particle effect name
      data - the data value
      particles - the number of particles
      radius - the radius
    • playSound

      public void playSound(String soundName, float volume, float pitch)
      Play sound.
      Parameters:
      soundName - the sound name
      volume - the volume
      pitch - the pitch
    • preformCommand

      public void preformCommand(ArrayList<String> commands, HashMap<String,String> placeholders)
      Performs commands as the player with placeholders.
      Parameters:
      commands - the list of commands
      placeholders - the placeholders
    • preformCommand

      public void preformCommand(String command, HashMap<String,String> placeholders)
      Performs a command as the player with placeholders.
      Parameters:
      command - the command
      placeholders - the placeholders
    • remove

      public void remove()
      Removes the user from storage.
    • removePermission

      public void removePermission(String permission)
      Removes a permission from the player.
      Parameters:
      permission - the permission
    • removeUnClaimedChoiceReward

      public void removeUnClaimedChoiceReward(String name)
      Removes an unclaimed choice reward.
      Parameters:
      name - the reward name
    • sendActionBar

      public void sendActionBar(String msg, int delay)
      Send action bar.
      Parameters:
      msg - the msg
      delay - the delay
    • sendBossBar

      public void sendBossBar(String msg, String color, String style, double progress, int delay)
      Send boss bar.
      Parameters:
      msg - the msg
      color - the color
      style - the style
      progress - the progress
      delay - the delay
    • sendJson

      public void sendJson(ArrayList<net.md_5.bungee.api.chat.TextComponent> messages)
      Send json.
      Parameters:
      messages - the messages
    • sendJson

      public void sendJson(ArrayList<net.md_5.bungee.api.chat.TextComponent> messages, boolean javascript)
      Sends JSON messages to the player.
      Parameters:
      messages - the text component messages
      javascript - whether to process javascript placeholders
    • sendJson

      public void sendJson(net.md_5.bungee.api.chat.TextComponent message)
      Send json.
      Parameters:
      message - the message
    • sendMessage

      public void sendMessage(ArrayList<String> msg)
      Send message.
      Parameters:
      msg - the msg
    • sendMessage

      public void sendMessage(ArrayList<String> msg, HashMap<String,String> placeholders)
      Sends a message with placeholders to the player.
      Parameters:
      msg - the message list
      placeholders - the placeholders
    • sendMessage

      public void sendMessage(String msg)
      Send message.
      Parameters:
      msg - the msg
    • sendMessage

      public void sendMessage(String msg, HashMap<String,String> placeholders)
      Sends a message with placeholders to the player.
      Parameters:
      msg - the message
      placeholders - the placeholders
    • sendMessage

      public void sendMessage(String msg, String toReplace, String replace)
      Sends a message with a single placeholder replacement to the player.
      Parameters:
      msg - the message
      toReplace - the placeholder to replace
      replace - the replacement value
    • sendMessage

      public void sendMessage(String[] msg)
      Send message.
      Parameters:
      msg - the msg
    • sendTitle

      public void sendTitle(String title, String subTitle, int fadeIn, int showTime, int fadeOut)
      Send title.
      Parameters:
      title - the title
      subTitle - the sub title
      fadeIn - the fade in
      showTime - the show time
      fadeOut - the fade out
    • setCheckWorld

      public void setCheckWorld(boolean b)
      Sets whether to check the world for the user.
      Parameters:
      b - true to enable world checking
    • setChoicePreference

      public void setChoicePreference(String reward, String preference)
      Sets the user's choice preference for a reward.
      Parameters:
      reward - the reward name
      preference - the preference
    • setInputMethod

      public void setInputMethod(String inputMethod)
      Sets the input method for the user.
      Parameters:
      inputMethod - the input method
    • setLastOnline

      public void setLastOnline(long online)
      Sets the last online time for the user.
      Parameters:
      online - the last online time in milliseconds
    • setOfflineRewards

      public void setOfflineRewards(ArrayList<String> offlineRewards)
      Sets the offline rewards list.
      Parameters:
      offlineRewards - the offline rewards
    • setPlayerName

      public void setPlayerName(String playerName)
      Sets the player name.
      Parameters:
      playerName - the player name
    • setRepeatAmount

      public void setRepeatAmount(Reward reward, int amount)
      Sets the repeat amount for a reward.
      Parameters:
      reward - the reward
      amount - the repeat amount
    • setTimedRewards

      public void setTimedRewards(HashMap<String,Long> timed)
      Sets the timed rewards map.
      Parameters:
      timed - the timed rewards
    • setUnClaimedChoice

      public void setUnClaimedChoice(ArrayList<String> rewards)
      Sets the unclaimed choice rewards list.
      Parameters:
      rewards - the unclaimed rewards
    • dontCache

      @Deprecated public void dontCache()
      Deprecated.
      Sets the user to not cache data.
    • setUUID

      public void setUUID(String uuid)
      Sets the uuid.
      Parameters:
      uuid - the new uuid
    • tempCache

      public AdvancedCoreUser tempCache()
      Enables temporary caching for this user.
      Returns:
      this user instance
    • updateName

      public void updateName(boolean force)
      Updates the player name in storage.
      Parameters:
      force - whether to force the update
    • updateTempCacheWithColumns

      public void updateTempCacheWithColumns(ArrayList<com.bencodez.simpleapi.sql.Column> cols)
      Updates the temporary cache with specific columns.
      Parameters:
      cols - the columns to update