Class OfflineWander

java.lang.Object
ua.mcchickenstudio.opencreative.wanders.OfflineWander
Direct Known Subclasses:
Wander

public class OfflineWander extends Object

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.
  • Field Details

    • uuid

      @Since(5.6) @NotNull protected final @NotNull UUID uuid
    • name

      @Since(5.6) @Nullable protected @Nullable String name
    • description

      @Since(5.6) @Nullable protected @Nullable String description
    • gender

      @Since(5.6) @Nullable protected @Nullable OfflineWander.Gender gender
    • favoriteWorlds

      @Since(5.6) @Nullable protected @Nullable Set<Integer> favoriteWorlds
    • lastPlayedWorldId

      @Since(5.6) protected int lastPlayedWorldId
    • visits

      @Since(6.0) protected int visits
    • hideHints

      @Since(5.6) protected boolean hideHints
    • friends

      @Since(5.8) @Nullable protected @Nullable List<UUID> friends
    • lastLocation

      @Since(5.8) protected org.bukkit.Location lastLocation
  • Constructor Details

    • OfflineWander

      public OfflineWander(@NotNull @NotNull UUID uuid)
      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

      @NotNull public @NotNull UUID getUniqueId()
      Returns unique ID of wander.
      Returns:
      unique ID of player.
    • getName

      @Nullable public @Nullable String getName()
      Returns custom name of wander, or null - if not set.
      Returns:
      name of wander, or null.
    • getDescription

      @Nullable public @Nullable String getDescription()
      Returns profile's description, or null - if not set.
      Returns:
      description, or null.
    • getGender

      @Nullable public @Nullable OfflineWander.Gender 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

      @Nullable public @Nullable String getLink(@NotNull @NotNull String id)
      Returns link of social media by ID, or null - if not set.
      Parameters:
      id - type of social media.
      Returns:
      link, or null.
    • setLink

      public void setLink(@NotNull @NotNull String id, @NotNull @NotNull String link)
      Sets link of social media by ID.
      Parameters:
      id - type of social media.
      link - link to set.
    • removeLink

      public void removeLink(@NotNull @NotNull String id)
      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

      @NotNull public @NotNull Set<Integer> getFavoriteWorlds()
      Returns set of favorite worlds IDs, marked by player.
      Returns:
      set of favorite worlds IDs.
    • getFriends

      @NotNull public @NotNull List<UUID> getFriends()
      Returns set of friends UUIDs, picked by player.
      Returns:
      list of friends UUIDs.
    • 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

      public void setName(@NotNull @NotNull String name)
      Sets profile's custom name.
      Parameters:
      name - new name to set.
    • setDescription

      public void setDescription(@NotNull @NotNull String description)
      Sets profile's description.
      Parameters:
      description - new description to set.
    • addFriend

      public boolean addFriend(@NotNull @NotNull UUID friendUUID)
      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

      public boolean removeFriend(@NotNull @NotNull UUID friendUUID)
      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

      public boolean setGender(@NotNull @NotNull OfflineWander.Gender gender)
      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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object