Class PlayerData
It is serialized and deserialized by the selected Data Handler.
To ignore a field from being serialized, use the transient keyword.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerData(String playerUUID)PlayerData(org.bukkit.entity.Player bindedPlayer)PlayerData(org.bukkit.OfflinePlayer bindedOfflinePlayer) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a job to the player's list of jobs.booleanDetermines whether the player can be added to a job.booleancanBeAddedToJob(Job job)Determines whether the player can be added to the given job.booleancanOpenLock(Lock lock)Determines if the player can open a specified lock.org.bukkit.OfflinePlayerReturns the OfflinePlayer object that is currently bound to this PlayerData instance.org.bukkit.entity.PlayerRetrieves the player object that is currently bound to this PlayerData instance.Retrieves the hologram for the tag of the player data.Retrieves the UUID of the player data.intGets the player's food levelintGets the player's pee levelRetrieves the list of jobs for the player data.Retrieves the player mode for the player data.Retrieves the UUID of the player data.intGets the player's poop levelRetrieves the selected player job.getTag()Retrieves the tag for the player data.intRetrieves the time online for the player data in seconds.intGets the player's water levelbooleanChecks if the player has permission to create jobs.booleanChecks if the player has permission to edit jobs.voidIncrease time online by 1 secondbooleanRetrieves the visibility of the tag for the player data.voidLoads the player data after it has been saved.voidPrepares the player data for saving.voidRemoves a job from the player's list of jobs.voidsetCurrentTagHologram(famiHologram currentTagHologram)Sets the hologram for the tag of the player data.voidsetFoodLevel(int foodLevel)Sets the player's food levelvoidsetPeeLevel(int peeLevel)Sets the player's pee levelvoidsetPlayerMode(PlayerMode playerMode)Sets the player mode.voidsetPoopLevel(int poopLevel)Sets the player's poop levelvoidsetSelectedPlayerJob(Job job)Sets the selected player job.voidSets the tag for the player data.voidsetWaterLevel(int waterLevel)Sets the player's water levelbooleanshouldDisplayJob(Job job)Determines whether a job should be displayed to a player in a boss menu.booleanshouldDisplayWorkingStep(Job job, int neededPermissionLevel)Determines whether a working step should be displayed to a player.voidupdatePlayer(org.bukkit.entity.Player player)Updates the player bound to this PlayerData instance.voidupdatePlayer(org.bukkit.OfflinePlayer player)Updates the player bound to this PlayerData instance.
-
Constructor Details
-
PlayerData
public PlayerData(org.bukkit.entity.Player bindedPlayer) -
PlayerData
public PlayerData(org.bukkit.OfflinePlayer bindedOfflinePlayer) -
PlayerData
-
-
Method Details
-
addJob
Adds a job to the player's list of jobs.This method does not check if the player is at maximum amount of jobs.
- Parameters:
job- The job to be added.
-
removeJob
Removes a job from the player's list of jobs.- Parameters:
job- The job to be removed.
-
setSelectedPlayerJob
Sets the selected player job.- Parameters:
job- The job to be set as the selected player job.
-
getSelectedPlayerJob
Retrieves the selected player job.- Returns:
- the selected player job
-
getPlayerJobs
Retrieves the list of jobs for the player data.This method returns a new ArrayList to prevent the original list from being modified.
- Returns:
- the list of jobs for the player data
-
setPlayerMode
Sets the player mode.- Parameters:
playerMode- The player mode to be set.
-
increaseTimeOnline
public void increaseTimeOnline()Increase time online by 1 second -
getTimeOnline
public int getTimeOnline()Retrieves the time online for the player data in seconds.- Returns:
- the time online of the player data
-
getPlayerMode
Retrieves the player mode for the player data.- Returns:
- the player mode of the player data
-
getTag
Retrieves the tag for the player data.- Returns:
- the tag of the player data
-
setTag
Sets the tag for the player data.- Parameters:
tag- The tag to be set.
-
isTagVisible
public boolean isTagVisible()Retrieves the visibility of the tag for the player data.- Returns:
- the visibility of the tag of the player data
-
getCurrentTagHologram
Retrieves the hologram for the tag of the player data.- Returns:
- the hologram of the tag of the player data
-
setCurrentTagHologram
Sets the hologram for the tag of the player data.- Parameters:
currentTagHologram- The hologram to be set.
-
prepareForSave
public void prepareForSave()Prepares the player data for saving.If the bindedPlayer field is not null, it retrieves the name of the player and assigns it to playerName.
If the bindedOfflinePlayer field is not null, it retrieves the name of the offline player and assigns it to playerName.
It retrieves the UUID of the player data as a String and assigns it to playerUUID.
If the selectedPlayerJob field is not null, it retrieves the name of the job and assigns it to selectedJobName.
Initializes playerJobNames as an empty ArrayList.
For each job in playerJobs, it retrieves the name of the job and adds it to playerJobNames.
-
loadAfterSave
public void loadAfterSave()Loads the player data after it has been saved.If the bindedPlayer field is not null, it retrieves the player object using the playerUUID and assigns it to bindedPlayer.
If the bindedOfflinePlayer field is not null, it retrieves the offline player object using the playerUUID and assigns it to bindedOfflinePlayer.
If the selectedJobName field is not null, it retrieves the job object using the selectedJobName and assigns it to selectedPlayerJob.
Initializes playerJobs as an empty ArrayList.
For each jobName in playerJobNames, it retrieves the job object using the jobName and adds it to playerJobs.
-
getDataUUID
Retrieves the UUID of the player data.- Returns:
- the UUID of the player data
-
getPlayerUUID
Retrieves the UUID of the player data.- Returns:
- the UUID of the player data
-
shouldDisplayJob
Determines whether a job should be displayed to a player in a boss menu.- Parameters:
job- The job to check for display.- Returns:
- True if the job should be displayed, false otherwise.
-
shouldDisplayWorkingStep
Determines whether a working step should be displayed to a player.- Parameters:
job- The job to check for display.neededPermissionLevel- The minimum permission level needed to display the working step.- Returns:
trueif the working step should be displayed,falseotherwise.
-
hasPermissionForEditingJobs
public boolean hasPermissionForEditingJobs()Checks if the player has permission to edit jobs.- Returns:
- true if the player has permission to edit jobs, false otherwise.
-
hasPermissionForCreatingJobs
public boolean hasPermissionForCreatingJobs()Checks if the player has permission to create jobs.- Returns:
- true if the player has permission to create jobs, false otherwise.
-
canBeAddedToJob
public boolean canBeAddedToJob()Determines whether the player can be added to a job.- Returns:
- true if the player can be added to a job, false otherwise.
-
canBeAddedToJob
Determines whether the player can be added to the given job.- Parameters:
job- The job to check for add-ability.- Returns:
- True if the player can be added to the job, false otherwise.
-
updatePlayer
public void updatePlayer(org.bukkit.entity.Player player)Updates the player bound to this PlayerData instance.- Parameters:
player- The player to be updated.
-
updatePlayer
public void updatePlayer(org.bukkit.OfflinePlayer player)Updates the player bound to this PlayerData instance.- Parameters:
player- The player to be updated.
-
getBindedPlayer
@Nullable public org.bukkit.entity.Player getBindedPlayer()Retrieves the player object that is currently bound to this PlayerData instance.- Returns:
- the player object that is currently bound, or null if no player is bound.
-
getBindedOfflinePlayer
@Nullable public org.bukkit.OfflinePlayer getBindedOfflinePlayer()Returns the OfflinePlayer object that is currently bound to this PlayerData instance.- Returns:
- the OfflinePlayer object that is currently bound, or null if no OfflinePlayer is bound.
-
getFoodLevel
public int getFoodLevel()Gets the player's food level- Returns:
- the player's food level (Higher is better)
-
setFoodLevel
public void setFoodLevel(int foodLevel)Sets the player's food level- Parameters:
foodLevel- the player's food level (Higher is better)
-
getWaterLevel
public int getWaterLevel()Gets the player's water level- Returns:
- the player's water level (Higher is better)
-
setWaterLevel
public void setWaterLevel(int waterLevel)Sets the player's water level- Parameters:
waterLevel- the player's water level (Higher is better)
-
getPoopLevel
public int getPoopLevel()Gets the player's poop level- Returns:
- the player's poop level (Lower is better)
-
setPoopLevel
public void setPoopLevel(int poopLevel)Sets the player's poop level- Parameters:
poopLevel- the player's poop level (Lower is better)
-
getPeeLevel
public int getPeeLevel()Gets the player's pee level- Returns:
- the player's pee level (Lower is better)
-
setPeeLevel
public void setPeeLevel(int peeLevel)Sets the player's pee level- Parameters:
peeLevel- the player's pee level (Lower is better)
-
canOpenLock
Determines if the player can open a specified lock.- Parameters:
lock- The lock to check against.- Returns:
- true if the player can open the lock, false otherwise.
-