Class InMemeryTeleportService

java.lang.Object
com.ultikits.ultitools.services.impl.InMemeryTeleportService
All Implemented Interfaces:
BaseService, TeleportService

public class InMemeryTeleportService extends Object implements TeleportService
传送服务实现类
Version:
1.0.0
Author:
wisdomme
  • Field Details

    • teleportingPlayers

      private static final Map<UUID,Boolean> teleportingPlayers
    • locationMap

      private static final Map<UUID,String> locationMap
    • inMemoryLocationRecord

      private static final Map<UUID,org.bukkit.Location> inMemoryLocationRecord
    • schedulerInitialized

      private static volatile boolean schedulerInitialized
  • Constructor Details

    • InMemeryTeleportService

      public InMemeryTeleportService()
  • Method Details

    • initScheduler

      static void initScheduler()
      Initialize the movement check scheduler. Called lazily to avoid static initializer issues in tests.
    • checkAllPlayersMovement

      static void checkAllPlayersMovement()
      Check movement for all teleporting players. This method is extracted from BukkitRunnable for testability.
    • checkPlayerMovement

      static boolean checkPlayerMovement(UUID playerUUID)
      Check if a single player has moved during teleport delay. This method is extracted from BukkitRunnable for testability.
      Parameters:
      playerUUID - the UUID of the player to check
      Returns:
      true if the player moved (teleport should be cancelled), false otherwise
    • teleport

      public void teleport(org.bukkit.entity.Player player, org.bukkit.Location location)
      Description copied from interface: TeleportService
      Teleport player instantly.

      立即传送玩家

      Specified by:
      teleport in interface TeleportService
      Parameters:
      player - player
      玩家
      location - location
      地点
    • delayTeleport

      public void delayTeleport(org.bukkit.entity.Player player, org.bukkit.Location location, int delay)
      Description copied from interface: TeleportService
      Delay teleport player.

      延迟传送玩家

      Specified by:
      delayTeleport in interface TeleportService
      Parameters:
      player - player
      玩家
      location - location
      地点
      delay - delay
      延迟
    • processDelayTeleportTick

      static InMemeryTeleportService.DelayTeleportResult processDelayTeleportTick(org.bukkit.entity.Player player, org.bukkit.Location location, float time)
      Process a single tick of the delay teleport countdown. This method is extracted from BukkitRunnable for testability.
      Parameters:
      player - the player being teleported
      location - the target location
      time - the current remaining time
      Returns:
      the result containing whether to cancel and the new remaining time
    • setTeleportingStatus

      static void setTeleportingStatus(UUID playerUUID, boolean status)
      Set a player's teleporting status. Used for testing.
    • getTeleportingStatus

      static Boolean getTeleportingStatus(UUID playerUUID)
      Get a player's teleporting status. Used for testing.
    • clearTeleportingData

      static void clearTeleportingData()
      Clear all teleporting data. Used for testing.
    • getLastTeleportLocation

      public Optional<org.bukkit.Location> getLastTeleportLocation(UUID uuid)
      Description copied from interface: TeleportService
      Get last teleport location of the player (before teleport).

      获取上次玩家使用此传送服务的地点(传送前)

      Specified by:
      getLastTeleportLocation in interface TeleportService
      Parameters:
      uuid - player uuid
      玩家UUID
      Returns:
      last teleport location
      上次传送地点
    • getName

      public String getName()
      Description copied from interface: BaseService
      Get service name, this name will appear in the console or in the game.

      获取服务的名称,此名称将会出现在控制台或者游戏中

      Specified by:
      getName in interface BaseService
      Returns:
      Service name
      服务的名称
    • getAuthor

      public String getAuthor()
      Specified by:
      getAuthor in interface BaseService
      Returns:
      Author name
      作者名称
    • getVersion

      public int getVersion()
      Description copied from interface: BaseService
      Version number, used to compare the version number of the registered service, currently not in use.

      用于对比注册服务的版本号,目前没啥卵用嘿嘿嘿

      Specified by:
      getVersion in interface BaseService
      Returns:
      service version
      服务版本号