Class OfflinePlayerMock

java.lang.Object
be.seeseemelk.mockbukkit.entity.OfflinePlayerMock
All Implemented Interfaces:
org.bukkit.configuration.serialization.ConfigurationSerializable, org.bukkit.entity.AnimalTamer, org.bukkit.OfflinePlayer, org.bukkit.permissions.ServerOperator

public class OfflinePlayerMock extends Object implements org.bukkit.OfflinePlayer
Mock implementation of an OfflinePlayer. Not interchangeable with PlayerMock.
See Also:
  • Constructor Details

    • OfflinePlayerMock

      public OfflinePlayerMock(@NotNull @NotNull UUID uuid, @Nullable @Nullable String name)
      Constructs a new OfflinePlayerMock on the provided ServerMock with a specified UUID and name.
      Parameters:
      uuid - The UUID of the player.
      name - The name of the player.
    • OfflinePlayerMock

      public OfflinePlayerMock(@Nullable @Nullable String name)
      Constructs a new OfflinePlayerMock on the provided ServerMock with a random UUID and specified name.
      Parameters:
      name - The name of the player.
  • Method Details

    • join

      @NotNull public @NotNull PlayerMock join(@NotNull @NotNull ServerMock server)
      Makes this offline player join the server. A new PlayerMock will be constructed, and added to the server. Will throw an IllegalStateException if the player is already online.
      Parameters:
      server - The server to join.
      Returns:
      The created PlayerMock.
    • isOnline

      public boolean isOnline()
      Specified by:
      isOnline in interface org.bukkit.OfflinePlayer
    • isConnected

      public boolean isConnected()
      Specified by:
      isConnected in interface org.bukkit.OfflinePlayer
    • getName

      @Nullable public @Nullable String getName()
      Specified by:
      getName in interface org.bukkit.entity.AnimalTamer
      Specified by:
      getName in interface org.bukkit.OfflinePlayer
    • getUniqueId

      @NotNull public @NotNull UUID getUniqueId()
      Specified by:
      getUniqueId in interface org.bukkit.entity.AnimalTamer
      Specified by:
      getUniqueId in interface org.bukkit.OfflinePlayer
    • isOp

      public boolean isOp()
      Specified by:
      isOp in interface org.bukkit.permissions.ServerOperator
    • setOp

      public void setOp(boolean value)
      Specified by:
      setOp in interface org.bukkit.permissions.ServerOperator
    • serialize

      @NotNull public @NotNull Map<String,Object> serialize()
      Specified by:
      serialize in interface org.bukkit.configuration.serialization.ConfigurationSerializable
    • isBanned

      public boolean isBanned()
      Specified by:
      isBanned in interface org.bukkit.OfflinePlayer
    • ban

      @Nullable public @Nullable org.bukkit.BanEntry<com.destroystokyo.paper.profile.PlayerProfile> ban(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source)
      Specified by:
      ban in interface org.bukkit.OfflinePlayer
    • ban

      @Nullable public @Nullable org.bukkit.BanEntry<com.destroystokyo.paper.profile.PlayerProfile> ban(@Nullable @Nullable String reason, @Nullable @Nullable Instant expires, @Nullable @Nullable String source)
      Specified by:
      ban in interface org.bukkit.OfflinePlayer
    • ban

      @Nullable public @Nullable org.bukkit.BanEntry<com.destroystokyo.paper.profile.PlayerProfile> ban(@Nullable @Nullable String reason, @Nullable @Nullable Duration duration, @Nullable @Nullable String source)
      Specified by:
      ban in interface org.bukkit.OfflinePlayer
    • isWhitelisted

      public boolean isWhitelisted()
      Specified by:
      isWhitelisted in interface org.bukkit.OfflinePlayer
    • setWhitelisted

      public void setWhitelisted(boolean value)
      Specified by:
      setWhitelisted in interface org.bukkit.OfflinePlayer
    • getPlayer

      @Nullable public @Nullable org.bukkit.entity.Player getPlayer()
      Specified by:
      getPlayer in interface org.bukkit.OfflinePlayer
    • getFirstPlayed

      public long getFirstPlayed()
      Specified by:
      getFirstPlayed in interface org.bukkit.OfflinePlayer
    • getLastPlayed

      @Deprecated(since="1.13") public long getLastPlayed()
      Deprecated.
      Specified by:
      getLastPlayed in interface org.bukkit.OfflinePlayer
    • hasPlayedBefore

      public boolean hasPlayedBefore()
      Specified by:
      hasPlayedBefore in interface org.bukkit.OfflinePlayer
    • getRespawnLocation

      @Nullable public @Nullable org.bukkit.Location getRespawnLocation()
      Specified by:
      getRespawnLocation in interface org.bukkit.OfflinePlayer
    • getBedSpawnLocation

      @Nullable public @Nullable org.bukkit.Location getBedSpawnLocation()
      Specified by:
      getBedSpawnLocation in interface org.bukkit.OfflinePlayer
    • getLastLogin

      public long getLastLogin()
      Specified by:
      getLastLogin in interface org.bukkit.OfflinePlayer
    • getLastSeen

      public long getLastSeen()
      Specified by:
      getLastSeen in interface org.bukkit.OfflinePlayer
    • incrementStatistic

      public void incrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic)
      Specified by:
      incrementStatistic in interface org.bukkit.OfflinePlayer
    • decrementStatistic

      public void decrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic)
      Specified by:
      decrementStatistic in interface org.bukkit.OfflinePlayer
    • incrementStatistic

      public void incrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, int amount)
      Specified by:
      incrementStatistic in interface org.bukkit.OfflinePlayer
    • decrementStatistic

      public void decrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, int amount)
      Specified by:
      decrementStatistic in interface org.bukkit.OfflinePlayer
    • setStatistic

      public void setStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, int newValue)
      Specified by:
      setStatistic in interface org.bukkit.OfflinePlayer
    • getStatistic

      public int getStatistic(@NotNull @NotNull org.bukkit.Statistic statistic)
      Specified by:
      getStatistic in interface org.bukkit.OfflinePlayer
    • incrementStatistic

      public void incrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.Material material)
      Specified by:
      incrementStatistic in interface org.bukkit.OfflinePlayer
    • decrementStatistic

      public void decrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.Material material)
      Specified by:
      decrementStatistic in interface org.bukkit.OfflinePlayer
    • getStatistic

      public int getStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.Material material)
      Specified by:
      getStatistic in interface org.bukkit.OfflinePlayer
    • incrementStatistic

      public void incrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.Material material, int amount)
      Specified by:
      incrementStatistic in interface org.bukkit.OfflinePlayer
    • decrementStatistic

      public void decrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.Material material, int amount)
      Specified by:
      decrementStatistic in interface org.bukkit.OfflinePlayer
    • setStatistic

      public void setStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.Material material, int newValue)
      Specified by:
      setStatistic in interface org.bukkit.OfflinePlayer
    • incrementStatistic

      public void incrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.entity.EntityType entityType)
      Specified by:
      incrementStatistic in interface org.bukkit.OfflinePlayer
    • decrementStatistic

      public void decrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.entity.EntityType entityType)
      Specified by:
      decrementStatistic in interface org.bukkit.OfflinePlayer
    • getStatistic

      public int getStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.entity.EntityType entityType)
      Specified by:
      getStatistic in interface org.bukkit.OfflinePlayer
    • incrementStatistic

      public void incrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.entity.EntityType entityType, int amount)
      Specified by:
      incrementStatistic in interface org.bukkit.OfflinePlayer
    • decrementStatistic

      public void decrementStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.entity.EntityType entityType, int amount)
      Specified by:
      decrementStatistic in interface org.bukkit.OfflinePlayer
    • setStatistic

      public void setStatistic(@NotNull @NotNull org.bukkit.Statistic statistic, @NotNull @NotNull org.bukkit.entity.EntityType entityType, int newValue)
      Specified by:
      setStatistic in interface org.bukkit.OfflinePlayer
    • getLastDeathLocation

      @Nullable public @Nullable org.bukkit.Location getLastDeathLocation()
      Specified by:
      getLastDeathLocation in interface org.bukkit.OfflinePlayer
    • getLocation

      @Nullable public @Nullable org.bukkit.Location getLocation()
      Specified by:
      getLocation in interface org.bukkit.OfflinePlayer
    • getPlayerProfile

      @NotNull public @NotNull com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile()
      Specified by:
      getPlayerProfile in interface org.bukkit.OfflinePlayer