Interface GameUtils
-
public interface GameUtils
遊戲內工具類
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetTimer(long sec)根據秒數獲取 時間顯示格式: 00:00StringgetTimeWithUnit(long sec)根據秒數獲取 時間顯示文字: x 時 x 分 x秒voidnoLagTeleport(List<GamePlayer> gamePlayers, long period, Location... locations)逐步循環傳送voidnoLagTeleport(List<GamePlayer> gamePlayers, List<Location> locations, long period)逐步循環傳送voidplaySound(Player player, String[] soundString)播放聲效 [0] 為聲效(可自定義) [1] 為 pitch [2] 為 volume<T> voidunLagIterate(Collection<T> collection, Consumer<T> task, long period)逐步循環操作
-
-
-
Method Detail
-
getTimeWithUnit
String getTimeWithUnit(long sec)
根據秒數獲取 時間顯示文字: x 時 x 分 x秒- Parameters:
sec- 秒- Returns:
- 時間顯示文字
-
playSound
void playSound(Player player, String[] soundString)
播放聲效- [0] 為聲效(可自定義)
- [1] 為 pitch
- [2] 為 volume
- Parameters:
player- 玩家soundString- 聲音文字,格式如上
-
unLagIterate
<T> void unLagIterate(Collection<T> collection, Consumer<T> task, long period)
逐步循環操作- Type Parameters:
T- 物件形態- Parameters:
collection- 集合物件task- 對每個物件的迭代處理period- 每次處理間隔
-
noLagTeleport
void noLagTeleport(List<GamePlayer> gamePlayers, List<Location> locations, long period)
逐步循環傳送- Parameters:
gamePlayers- 遊戲玩家列表locations- 傳送位置列表period- 每次傳送間隔
-
noLagTeleport
void noLagTeleport(List<GamePlayer> gamePlayers, long period, Location... locations)
逐步循環傳送- Parameters:
gamePlayers- 遊戲玩家列表period- 傳送位置列表locations- 每次傳送間隔
-
-