Class AdvancedCoreUser
java.lang.Object
com.bencodez.advancedcore.api.user.AdvancedCoreUser
The Class User.
-
Constructor Summary
ConstructorsConstructorDescriptionAdvancedCoreUser(AdvancedCorePlugin plugin, AdvancedCoreUser user) Instantiates a new user from an existing user.AdvancedCoreUser(AdvancedCorePlugin plugin, String playerName) Deprecated.AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid) Deprecated.AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid, boolean loadName) Deprecated.AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid, boolean loadName, boolean loadData) Deprecated.AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid, String playerName) Deprecated.AdvancedCoreUser(AdvancedCorePlugin plugin, org.bukkit.entity.Player player) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOfflineRewards(Reward reward, HashMap<String, String> placeholders) Adds offline rewards to be given when the player next logs in.voidaddPermission(String permission) Adds a permission to the player.voidaddPermission(String permission, long delay) Adds a permission to the player with a delay.voidaddTimedReward(Reward reward, HashMap<String, String> placeholders, long epochMilli) Adds a timed reward to be given at a specific time.voidAdds an unclaimed choice reward.voidcache()Caches the user data.voidCaches the user data asynchronously.voidCaches the user data if needed.voidChecks and processes delayed/timed rewards.voidCheck offline rewards.voidClears the user cache.voidClears the temporary cache.voidcloseInv()Closes the player's inventory.voidDeprecated.voidForces running of offline rewards without processing checks.getCache()Gets the user data cache.getChoicePreference(String rewardName) Gets the user's choice preference for a reward.Gets the choice preference data.getData()Gets the user data.Gets the input method.Gets the Java UUID object.longGets the last online time in milliseconds.intGets the number of days since the player's last login.org.bukkit.OfflinePlayerGets the offline player.Gets the offline rewards list.org.bukkit.entity.PlayerGets the player.org.bukkit.inventory.ItemStackGets the player's head as an ItemStack.Gets the player name.intgetRepeatAmount(Reward reward) Gets the repeat amount for a reward.Gets the timed rewards map.Gets the unclaimed choices list.Gets the user data instance.getUUID()Gets the uuid.voidgiveExp(int exp) Give exp.voidgiveExpLevels(int num) Gives experience levels to the player.voidgiveItem(ItemBuilder builder) Gives an item to the player from an ItemBuilder.voidgiveItem(org.bukkit.inventory.ItemStack item) Give item.voidGives an item to the player with placeholders.voidgiveItems(org.bukkit.inventory.ItemStack... item) Gives multiple items to the player.voidgiveMoney(double m) Give user money, needs vault installedvoidgiveMoney(int money) Give money.voidgivePotionEffect(String potionName, int duration, int amplifier) Give potion effect.voidgiveReward(Reward reward, RewardOptions rewardOptions) Gives a reward to the user.voidgiveReward(org.bukkit.configuration.file.FileConfiguration data, String path, RewardOptions rewardOptions) Gives a reward from a configuration file.booleanChecks if the user has unclaimed choices.booleanCheck if player joined beforebooleanhasPermission(String perm) Checks if the user has a permission.booleanhasPermission(String perm, boolean offlineCheck) Checks if the user has a permission.booleanisBanned()Checks if the player is banned.booleanChecks if the player is a Bedrock user.booleanisCached()Checks if the user data is cached.booleanChecks if world checking is enabled for the user.booleanChecks if the player is in a specific world.booleanChecks if the player is in any of the specified worlds.booleanisOnline()Checks if is online.booleanChecks if the player is vanished.voidLoads the user cache.voidloadData()Loads the user data.voidloadTimedDelayedTimer(long time) Loads a timer for delayed/timed rewards.voidplayEffect(String effectName, int data, int particles, int radius) Play particle effect.voidplayParticle(String effectName, int data, int particles, int radius) Plays a particle effect for the player.voidplayParticleEffect(String effectName, int data, int particles, int radius) Deprecated.voidPlay sound.voidpreformCommand(String command, HashMap<String, String> placeholders) Performs a command as the player with placeholders.voidPerforms commands as the player with placeholders.voidremove()Removes the user from storage.voidremovePermission(String permission) Removes a permission from the player.voidRemoves an unclaimed choice reward.voidsendActionBar(String msg, int delay) Send action bar.voidsendBossBar(String msg, String color, String style, double progress, int delay) Send boss bar.voidSend json.voidSends JSON messages to the player.voidsendJson(net.md_5.bungee.api.chat.TextComponent message) Send json.voidsendMessage(String msg) Send message.voidsendMessage(String[] msg) Send message.voidsendMessage(String msg, String toReplace, String replace) Sends a message with a single placeholder replacement to the player.voidsendMessage(String msg, HashMap<String, String> placeholders) Sends a message with placeholders to the player.voidsendMessage(ArrayList<String> msg) Send message.voidSends a message with placeholders to the player.voidSend title.voidsetBedrockUser(boolean isBedrock) Sets whether the player is a Bedrock user.voidsetCheckWorld(boolean b) Sets whether to check the world for the user.voidsetChoicePreference(String reward, String preference) Sets the user's choice preference for a reward.voidsetInputMethod(String inputMethod) Sets the input method for the user.voidsetLastOnline(long online) Sets the last online time for the user.voidsetOfflineRewards(ArrayList<String> offlineRewards) Sets the offline rewards list.voidsetPlayerName(String playerName) Sets the player name.voidsetRepeatAmount(Reward reward, int amount) Sets the repeat amount for a reward.voidsetTimedRewards(HashMap<String, Long> timed) Sets the timed rewards map.voidsetUnClaimedChoice(ArrayList<String> rewards) Sets the unclaimed choice rewards list.voidSets the uuid.Enables temporary caching for this user.voidupdateName(boolean force) Updates the player name in storage.voidupdateTempCacheWithColumns(ArrayList<com.bencodez.simpleapi.sql.Column> cols) Updates the temporary cache with specific columns.Sets the user data fetch mode.
-
Constructor Details
-
AdvancedCoreUser
Instantiates a new user from an existing user.- Parameters:
plugin- the pluginuser- the user to copy from
-
AdvancedCoreUser
Deprecated.Instantiates a new user.- Parameters:
plugin- the pluginplayer- the player
-
AdvancedCoreUser
Deprecated.Instantiates a new user.- Parameters:
plugin- the pluginplayerName- the player name
-
AdvancedCoreUser
Deprecated.Instantiates a new user.- Parameters:
plugin- the pluginuuid- the uuid
-
AdvancedCoreUser
Deprecated.Instantiates a new user.- Parameters:
plugin- the pluginuuid- the uuidloadName- the load name
-
AdvancedCoreUser
@Deprecated public AdvancedCoreUser(AdvancedCorePlugin plugin, UUID uuid, boolean loadName, boolean loadData) Deprecated.Instantiates a new user.- Parameters:
plugin- the pluginuuid- the uuidloadName- the load nameloadData- the load data
-
AdvancedCoreUser
Deprecated.Instantiates a new user.- Parameters:
plugin- the pluginuuid- the uuidplayerName- the player name
-
-
Method Details
-
addOfflineRewards
Adds offline rewards to be given when the player next logs in.- Parameters:
reward- the rewardplaceholders- the placeholders
-
addPermission
Adds a permission to the player.- Parameters:
permission- the permission
-
addPermission
Adds a permission to the player with a delay.- Parameters:
permission- the permissiondelay- the delay in milliseconds
-
addTimedReward
Adds a timed reward to be given at a specific time.- Parameters:
reward- the rewardplaceholders- the placeholdersepochMilli- the epoch time in milliseconds when the reward should be given
-
addUnClaimedChoiceReward
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
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
Gets the user data cache.- Returns:
- the cache
-
getChoicePreference
Gets the user's choice preference for a reward.- Parameters:
rewardName- the reward name- Returns:
- the choice preference
-
getChoicePreferenceData
Gets the choice preference data.- Returns:
- the choice preference data list
-
getData
Gets the user data.- Returns:
- the user data
-
getInputMethod
Gets the input method.- Returns:
- the input method string
-
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
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
Gets the player name.- Returns:
- the player name
-
getRepeatAmount
Gets the repeat amount for a reward.- Parameters:
reward- the reward- Returns:
- the repeat amount
-
getTimedRewards
Gets the timed rewards map.- Returns:
- the timed rewards
-
getUnClaimedChoices
Gets the unclaimed choices list.- Returns:
- the unclaimed choices
-
getUserData
Gets the user data instance.- Returns:
- the user data
-
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
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
Gives an item to the player with placeholders.- Parameters:
itemStack- the item stackplaceholders- 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
Give potion effect.- Parameters:
potionName- the potion nameduration- the durationamplifier- 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 datapath- the path to the rewardrewardOptions- the reward options
-
giveReward
Gives a reward to the user.- Parameters:
reward- the rewardrewardOptions- 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
Checks if the user has a permission.- Parameters:
perm- the permission- Returns:
- true if the user has the permission
-
hasPermission
Checks if the user has a permission.- Parameters:
perm- the permissionofflineCheck- 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
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
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
Play particle effect.- Parameters:
effectName- the effect namedata- the dataparticles- the particlesradius- the radius
-
playParticle
Plays a particle effect for the player.- Parameters:
effectName- the particle effect namedata- the data valueparticles- the number of particlesradius- the radius
-
playParticleEffect
Deprecated.Plays a particle effect for the player.- Parameters:
effectName- the particle effect namedata- the data valueparticles- the number of particlesradius- the radius
-
playSound
Play sound.- Parameters:
soundName- the sound namevolume- the volumepitch- the pitch
-
preformCommand
Performs commands as the player with placeholders.- Parameters:
commands- the list of commandsplaceholders- the placeholders
-
preformCommand
Performs a command as the player with placeholders.- Parameters:
command- the commandplaceholders- the placeholders
-
remove
public void remove()Removes the user from storage. -
removePermission
Removes a permission from the player.- Parameters:
permission- the permission
-
removeUnClaimedChoiceReward
Removes an unclaimed choice reward.- Parameters:
name- the reward name
-
sendActionBar
Send action bar.- Parameters:
msg- the msgdelay- the delay
-
sendBossBar
Send boss bar.- Parameters:
msg- the msgcolor- the colorstyle- the styleprogress- the progressdelay- the delay
-
sendJson
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 messagesjavascript- whether to process javascript placeholders
-
sendJson
public void sendJson(net.md_5.bungee.api.chat.TextComponent message) Send json.- Parameters:
message- the message
-
sendMessage
Send message.- Parameters:
msg- the msg
-
sendMessage
Sends a message with placeholders to the player.- Parameters:
msg- the message listplaceholders- the placeholders
-
sendMessage
Send message.- Parameters:
msg- the msg
-
sendMessage
Sends a message with placeholders to the player.- Parameters:
msg- the messageplaceholders- the placeholders
-
sendMessage
Sends a message with a single placeholder replacement to the player.- Parameters:
msg- the messagetoReplace- the placeholder to replacereplace- the replacement value
-
sendMessage
Send message.- Parameters:
msg- the msg
-
sendTitle
Send title.- Parameters:
title- the titlesubTitle- the sub titlefadeIn- the fade inshowTime- the show timefadeOut- 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
Sets the user's choice preference for a reward.- Parameters:
reward- the reward namepreference- the preference
-
setInputMethod
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
Sets the offline rewards list.- Parameters:
offlineRewards- the offline rewards
-
setPlayerName
Sets the player name.- Parameters:
playerName- the player name
-
setRepeatAmount
Sets the repeat amount for a reward.- Parameters:
reward- the rewardamount- the repeat amount
-
setTimedRewards
Sets the timed rewards map.- Parameters:
timed- the timed rewards
-
setUnClaimedChoice
Sets the unclaimed choice rewards list.- Parameters:
rewards- the unclaimed rewards
-
dontCache
Deprecated.Sets the user to not cache data. -
setUUID
Sets the uuid.- Parameters:
uuid- the new uuid
-
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
Updates the temporary cache with specific columns.- Parameters:
cols- the columns to update
-