Class InMemoryNotificationService

java.lang.Object
com.ultikits.ultitools.services.impl.InMemoryNotificationService
All Implemented Interfaces:
BaseService, NotificationService

public class InMemoryNotificationService extends Object implements NotificationService
  • Field Details

    • atedPlayer

      private static final Map<UUID,org.bukkit.boss.BossBar> atedPlayer
  • Constructor Details

    • InMemoryNotificationService

      public InMemoryNotificationService()
  • Method Details

    • 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
      服务版本号
    • sendBossBarNotification

      public boolean sendBossBarNotification(org.bukkit.entity.Player player, String message)
      Description copied from interface: NotificationService
      Send a boss bar notification to a player

      向玩家发送Boss bar通知

      Specified by:
      sendBossBarNotification in interface NotificationService
      Parameters:
      player - The player to send the boss bar to

      要发送Boss bar的玩家

      message - The message to send

      要发送的消息

      Returns:
      Whether the boss bar was sent successfully

      是否成功发送了Boss bar

    • sendBossBarNotification

      public boolean sendBossBarNotification(org.bukkit.entity.Player player, String message, int seconds)
      Description copied from interface: NotificationService
      Send a boss bar notification to a player

      向玩家发送Boss bar通知

      Specified by:
      sendBossBarNotification in interface NotificationService
      Parameters:
      player - The player to send the boss bar to

      要发送Boss bar的玩家

      message - The message to send

      要发送的消息

      seconds - The duration of the boss bar in seconds

      Boss bar的持续时间(秒)

      Returns:
      Whether the boss bar was sent successfully

      是否成功发送了Boss bar

    • sendBossBarNotification

      public boolean sendBossBarNotification(org.bukkit.entity.Player player, String message, int seconds, org.bukkit.Sound sound)
      Description copied from interface: NotificationService
      Send a boss bar notification to a player

      向玩家发送Boss bar通知

      Specified by:
      sendBossBarNotification in interface NotificationService
      Parameters:
      player - The player to send the boss bar to

      要发送Boss bar的玩家

      message - The message to send

      要发送的消息

      seconds - The duration of the boss bar in seconds

      Boss bar的持续时间(秒)

      sound - The sound to play when the boss bar is sent

      发送Boss bar时播放的声音

      Returns:
      Whether the boss bar was sent successfully

      是否成功发送了Boss bar

    • sendBossBarNotification

      public boolean sendBossBarNotification(org.bukkit.entity.Player player, String message, int seconds, org.bukkit.boss.BossBar bossBar)
      Description copied from interface: NotificationService
      Send a boss bar notification to a player

      向玩家发送Boss bar通知

      Specified by:
      sendBossBarNotification in interface NotificationService
      Parameters:
      player - The player to send the boss bar to

      要发送Boss bar的玩家

      message - The message to send

      要发送的消息

      seconds - The duration of the boss bar in seconds

      Boss bar的持续时间(秒)

      bossBar - The boss bar to send

      要发送的Boss bar

      Returns:
      Whether the boss bar was sent successfully

      是否成功发送了Boss bar

    • sendBossBarNotification

      public boolean sendBossBarNotification(org.bukkit.entity.Player player, String message, int seconds, org.bukkit.boss.BossBar bossBar, org.bukkit.Sound sound)
      Description copied from interface: NotificationService
      Send a boss bar notification to a player

      向玩家发送Boss bar通知

      Specified by:
      sendBossBarNotification in interface NotificationService
      Parameters:
      player - The player to send the boss bar to

      要发送Boss bar的玩家

      message - The message to send

      要发送的消息

      seconds - The duration of the boss bar in seconds

      Boss bar的持续时间(秒)

      bossBar - The boss bar to send

      要发送的Boss bar

      sound - The sound to play when the boss bar is sent

      发送Boss bar时播放的声音

      Returns:
      Whether the boss bar was sent successfully

      是否成功发送了Boss bar

    • processBossBarTick

      static InMemoryNotificationService.BossBarTickResult processBossBarTick(org.bukkit.boss.BossBar bossBar, org.bukkit.entity.Player player, int seconds)
      Process a single tick of the BossBar progress animation. This method is extracted from BukkitRunnable for testability.
      Parameters:
      bossBar - the BossBar to update
      player - the player viewing the BossBar
      seconds - the total duration in seconds
      Returns:
      the result containing whether to cancel and the new progress
    • getCachedBossBar

      static org.bukkit.boss.BossBar getCachedBossBar(UUID playerUUID)
      Get the cached BossBar for a player. Used for testing.
    • cacheBossBar

      static void cacheBossBar(UUID playerUUID, org.bukkit.boss.BossBar bossBar)
      Put a BossBar into cache. Used for testing.
    • clearBossBarCache

      static void clearBossBarCache()
      Clear all cached BossBars. Used for testing.
    • sendMessageNotification

      public boolean sendMessageNotification(org.bukkit.entity.Player player, String message)
      Description copied from interface: NotificationService
      Send a message notification to a player

      向玩家发送消息通知

      Specified by:
      sendMessageNotification in interface NotificationService
      Parameters:
      player - The player to send the message to

      要发送消息的玩家

      message - The message to send

      要发送的消息

      Returns:
      Whether the message was sent successfully

      是否成功发送了消息

    • sendMessageNotification

      public boolean sendMessageNotification(org.bukkit.entity.Player player, String message, org.bukkit.Sound sound)
      Description copied from interface: NotificationService
      Send a message notification to a player

      向玩家发送消息通知

      Specified by:
      sendMessageNotification in interface NotificationService
      Parameters:
      player - The player to send the message to

      要发送消息的玩家

      message - The message to send

      要发送的消息

      sound - The sound to play when the message is sent

      发送消息时播放的声音

      Returns:
      Whether the message was sent successfully

      是否成功发送了消息

    • sendSubTitleNotification

      public boolean sendSubTitleNotification(org.bukkit.entity.Player player, String subtitle)
      Description copied from interface: NotificationService
      Send a subtitle message notification to a player

      向玩家发送副标题消息通知

      Specified by:
      sendSubTitleNotification in interface NotificationService
      Parameters:
      player - The player to send the subtitle to

      要发送副标题的玩家

      subtitle - The subtitle to send

      要发送的副标题

      Returns:
      Whether the subtitle was sent successfully

      是否成功发送了副标题

    • sendSubTitleNotification

      public boolean sendSubTitleNotification(org.bukkit.entity.Player player, String subtitle, org.bukkit.Sound sound)
      Description copied from interface: NotificationService
      Send a subtitle message notification to a player

      向玩家发送副标题消息通知

      Specified by:
      sendSubTitleNotification in interface NotificationService
      Parameters:
      player - The player to send the subtitle to

      要发送副标题的玩家

      subtitle - The subtitle to send

      要发送的副标题

      sound - The sound to play when the subtitle is sent

      发送副标题时播放的声音

      Returns:
      Whether the subtitle was sent successfully

      是否成功发送了副标题

    • sendTitleNotification

      public boolean sendTitleNotification(org.bukkit.entity.Player player, String title, String subtitle)
      Description copied from interface: NotificationService
      Send a title message notification to a player

      向玩家发送标题消息通知

      Specified by:
      sendTitleNotification in interface NotificationService
      Parameters:
      player - The player to send the title to

      要发送标题的玩家

      title - The title to send

      要发送的标题

      subtitle - The subtitle to send

      要发送的副标题

      Returns:
      Whether the title was sent successfully

      是否成功发送了标题

    • sendTitleNotification

      public boolean sendTitleNotification(org.bukkit.entity.Player player, String title, String subtitle, org.bukkit.Sound sound)
      Description copied from interface: NotificationService
      Send a title message notification to a player

      向玩家发送标题消息通知

      Specified by:
      sendTitleNotification in interface NotificationService
      Parameters:
      player - The player to send the title to

      要发送标题的玩家

      title - The title to send

      要发送的标题

      subtitle - The subtitle to send

      要发送的副标题

      sound - The sound to play when the title is sent

      发送标题时播放的声音

      Returns:
      Whether the title was sent successfully

      是否成功发送了标题

    • sendTitleNotification

      public boolean sendTitleNotification(org.bukkit.entity.Player player, String title, String subtitle, org.bukkit.Sound sound, int fadeIn, int stay, int fadeOut)
      Description copied from interface: NotificationService
      Send a title message notification to a player

      向玩家发送标题消息通知

      Specified by:
      sendTitleNotification in interface NotificationService
      Parameters:
      player - The player to send the title to

      要发送标题的玩家

      title - The title to send

      要发送的标题

      subtitle - The subtitle to send

      要发送的副标题

      sound - The sound to play when the title is sent

      发送标题时播放的声音

      fadeIn - The time in ticks for the title to fade in

      标题淡入的时间(ticks)

      stay - The time in ticks for the title to stay

      标题停留的时间(ticks)

      fadeOut - The time in ticks for the title to fade out

      标题淡出的时间(ticks)

      Returns:
      Whether the title was sent successfully

      是否成功发送了标题

    • sendActionBarNotification

      public boolean sendActionBarNotification(org.bukkit.entity.Player player, String message)
      Specified by:
      sendActionBarNotification in interface NotificationService
    • sendToastNotification

      public boolean sendToastNotification(org.bukkit.entity.Player player, String icon, String message, Toast.Style style)
      Specified by:
      sendToastNotification in interface NotificationService