Interface GameUtils


  • public interface GameUtils
    遊戲內工具類
    • Method Detail

      • getTimeWithUnit

        String getTimeWithUnit​(long sec)
        根據秒數獲取 時間顯示文字: x 時 x 分 x秒
        Parameters:
        sec - 秒
        Returns:
        時間顯示文字
      • getTimer

        String getTimer​(long sec)
        根據秒數獲取 時間顯示格式: 00:00
        Parameters:
        sec - 秒
        Returns:
        時間顯示格式: 00:00
      • 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 - 每次傳送間隔