Class OfflineWander
java.lang.Object
ua.mcchickenstudio.opencreative.wanders.OfflineWander
- Direct Known Subclasses:
Wander
OfflineWander
This class represents wander, that could be offline or online. Wander is a player, who plays on planets. He has nickname, description, gender, favorite worlds and last played world.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected @Nullable Stringprotected @Nullable OfflineWander.Genderprotected booleanprotected org.bukkit.Locationprotected intprotected Linksprotected @Nullable Stringprotected final @NotNull UUIDprotected int -
Constructor Summary
ConstructorsConstructorDescriptionOfflineWander(@NotNull UUID uuid) Constructor of offline wander by player's unique ID.OfflineWander(@NotNull org.bukkit.OfflinePlayer offlinePlayer) Constructor of offline wander by offline player. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddFavoriteWorld(int worldId) Adds specified planet's ID to favorite worlds.booleanAdds specified UUID to friends list.booleanClears all data and removes json file.boolean@Nullable StringReturns profile's description, or null - if not set.Returns set of favorite worlds IDs, marked by player.Returns set of friends UUIDs, picked by player.@Nullable OfflineWander.GenderReturns profile's gender, or null - if not set.@Nullable org.bukkit.LocationReturns last location of wander (where player was playing before leaving the server), or null - if not saved.intReturns ID of last visited planet by player, or -1 - if not saved.@Nullable StringReturns link of social media by ID, or null - if not set.@Nullable StringgetName()Returns custom name of wander, or null - if not set.@NotNull org.bukkit.OfflinePlayerReturns offline player associated with wander.@NotNull UUIDReturns unique ID of wander.intReturns amount of all visited worlds by player.inthashCode()booleanisOnline()Checks whether wander is playing on server.voidloadInfo()Loads information about wander from disk.booleanremoveFavoriteWorld(int worldId) Removes specified planet's ID from favorite worlds.booleanremoveFriend(@NotNull UUID friendUUID) Removes specified UUID from friends list.voidremoveLink(@NotNull String id) Removes social media link by ID.voidsaveData()Saves wander's information to disk.voidsetDescription(@NotNull String description) Sets profile's description.booleansetGender(@NotNull OfflineWander.Gender gender) Sets profile's gender.voidsetLastPlayedWorldId(int lastPlayedWorldId) Sets last visited world ID.voidSets link of social media by ID.voidSets profile's custom name.voidsetVisits(int visits) Sets amount of visits.booleanChecks whether hints should be hidden from player.toString()
-
Field Details
-
uuid
-
name
-
description
-
gender
-
favoriteWorlds
-
lastPlayedWorldId
@Since(5.6) protected int lastPlayedWorldId -
visits
@Since(6.0) protected int visits -
links
-
hideHints
@Since(5.6) protected boolean hideHints -
friends
-
lastLocation
@Since(5.8) protected org.bukkit.Location lastLocation
-
-
Constructor Details
-
OfflineWander
Constructor of offline wander by player's unique ID.- Parameters:
uuid- unique ID of player.
-
OfflineWander
public OfflineWander(@NotNull @NotNull org.bukkit.OfflinePlayer offlinePlayer) Constructor of offline wander by offline player.- Parameters:
offlinePlayer- offline player.
-
-
Method Details
-
getOfflinePlayer
@NotNull public @NotNull org.bukkit.OfflinePlayer getOfflinePlayer()Returns offline player associated with wander.- Returns:
- offline player.
-
isOnline
public boolean isOnline()Checks whether wander is playing on server.- Returns:
- true - player is online, false - offline.
-
getUniqueId
Returns unique ID of wander.- Returns:
- unique ID of player.
-
getName
Returns custom name of wander, or null - if not set.- Returns:
- name of wander, or null.
-
getDescription
Returns profile's description, or null - if not set.- Returns:
- description, or null.
-
getGender
Returns profile's gender, or null - if not set.- Returns:
- gender, or null.
-
getLastLocation
@Nullable public @Nullable org.bukkit.Location getLastLocation()Returns last location of wander (where player was playing before leaving the server), or null - if not saved.- Returns:
- last location, or null.
-
getLink
-
setLink
-
removeLink
Removes social media link by ID.- Parameters:
id- type of social media.
-
getLastPlayedWorldId
public int getLastPlayedWorldId()Returns ID of last visited planet by player, or -1 - if not saved.- Returns:
- last visited planet's ID, or -1.
-
getVisits
public int getVisits()Returns amount of all visited worlds by player.- Returns:
- amount of visited worlds.
-
shouldHideHints
public boolean shouldHideHints()Checks whether hints should be hidden from player.- Returns:
- true - should be hidden, false - show them.
-
getFavoriteWorlds
-
getFriends
-
setLastPlayedWorldId
public void setLastPlayedWorldId(int lastPlayedWorldId) Sets last visited world ID.- Parameters:
lastPlayedWorldId- id of visited planet.
-
setVisits
public void setVisits(int visits) Sets amount of visits.- Parameters:
visits- new amount to set.
-
setName
Sets profile's custom name.- Parameters:
name- new name to set.
-
setDescription
Sets profile's description.- Parameters:
description- new description to set.
-
addFriend
Adds specified UUID to friends list.- Parameters:
friendUUID- unique ID of friend.- Returns:
- true - was added, false - already added, or friend's UUID is same with wander.
-
removeFriend
Removes specified UUID from friends list.- Parameters:
friendUUID- unique ID of friend.- Returns:
- true - was removed, false - not removed, or friend's UUID is same with wander.
-
addFavoriteWorld
public boolean addFavoriteWorld(int worldId) Adds specified planet's ID to favorite worlds.- Parameters:
worldId- id of planet.- Returns:
- true - was added, false - already added.
-
removeFavoriteWorld
public boolean removeFavoriteWorld(int worldId) Removes specified planet's ID from favorite worlds.- Parameters:
worldId- id of planet.- Returns:
- true - was removed, false - not added yet.
-
setGender
Sets profile's gender.- Parameters:
gender- new gender to set.- Returns:
- true - was changed, false - its already current gender.
-
clearData
public boolean clearData()Clears all data and removes json file.- Returns:
- true - was removed, false - failde to remove.
-
loadInfo
public void loadInfo()Loads information about wander from disk. -
saveData
public void saveData()Saves wander's information to disk. -
equals
-
hashCode
-
toString
-