Class InMemeryTeleportService
java.lang.Object
com.ultikits.ultitools.services.impl.InMemeryTeleportService
- All Implemented Interfaces:
BaseService,TeleportService
传送服务实现类
- Version:
- 1.0.0
- Author:
- wisdomme
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classResult object for delay teleport tick processing. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidCheck movement for all teleporting players.(package private) static booleancheckPlayerMovement(UUID playerUUID) Check if a single player has moved during teleport delay.(package private) static voidClear all teleporting data.voiddelayTeleport(org.bukkit.entity.Player player, org.bukkit.Location location, int delay) Delay teleport player.Optional<org.bukkit.Location> getLastTeleportLocation(UUID uuid) Get last teleport location of the player (before teleport).getName()Get service name, this name will appear in the console or in the game.(package private) static BooleangetTeleportingStatus(UUID playerUUID) Get a player's teleporting status.intVersion number, used to compare the version number of the registered service, currently not in use.(package private) static voidInitialize the movement check scheduler.(package private) static InMemeryTeleportService.DelayTeleportResultprocessDelayTeleportTick(org.bukkit.entity.Player player, org.bukkit.Location location, float time) Process a single tick of the delay teleport countdown.(package private) static voidsetTeleportingStatus(UUID playerUUID, boolean status) Set a player's teleporting status.voidteleport(org.bukkit.entity.Player player, org.bukkit.Location location) Teleport player instantly.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ultikits.ultitools.interfaces.BaseService
getResourceFolderName
-
Field Details
-
teleportingPlayers
-
locationMap
-
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
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:TeleportServiceTeleport player instantly.立即传送玩家
- Specified by:
teleportin interfaceTeleportService- Parameters:
player- player
玩家location- location
地点
-
delayTeleport
public void delayTeleport(org.bukkit.entity.Player player, org.bukkit.Location location, int delay) Description copied from interface:TeleportServiceDelay teleport player.延迟传送玩家
- Specified by:
delayTeleportin interfaceTeleportService- 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 teleportedlocation- the target locationtime- the current remaining time- Returns:
- the result containing whether to cancel and the new remaining time
-
setTeleportingStatus
Set a player's teleporting status. Used for testing. -
getTeleportingStatus
Get a player's teleporting status. Used for testing. -
clearTeleportingData
static void clearTeleportingData()Clear all teleporting data. Used for testing. -
getLastTeleportLocation
Description copied from interface:TeleportServiceGet last teleport location of the player (before teleport).获取上次玩家使用此传送服务的地点(传送前)
- Specified by:
getLastTeleportLocationin interfaceTeleportService- Parameters:
uuid- player uuid
玩家UUID- Returns:
- last teleport location
上次传送地点
-
getName
Description copied from interface:BaseServiceGet service name, this name will appear in the console or in the game.获取服务的名称,此名称将会出现在控制台或者游戏中
- Specified by:
getNamein interfaceBaseService- Returns:
- Service name
服务的名称
-
getAuthor
- Specified by:
getAuthorin interfaceBaseService- Returns:
- Author name
作者名称
-
getVersion
public int getVersion()Description copied from interface:BaseServiceVersion number, used to compare the version number of the registered service, currently not in use.用于对比注册服务的版本号,目前没啥卵用嘿嘿嘿
- Specified by:
getVersionin interfaceBaseService- Returns:
- service version
服务版本号
-