@@ -15,34 +15,35 @@ import org.bukkit.entity.Player
1515/* *
1616 * Sends an action bar message to the player.
1717 *
18- * @param string The action bar message to be sent.
18+ * @param message The action bar message to be sent.
1919 * @param time The duration for which the action bar message should be displayed.
2020 * @param timeUnit The time unit in which the duration is measured. (Default: [TimeUnit.TICKS])
2121 *
2222 * @throws IllegalArgumentException if the provided `time` parameter is negative.
2323 */
24- fun Player.sendActionBar (string : String , time : Int , timeUnit : TimeUnit = TimeUnit .TICKS ) {
24+ fun Player.sendActionBar (message : String , time : Int , timeUnit : TimeUnit = TimeUnit .TICKS ) {
2525 repeatingTask(
2626 1 ,
2727 timeUnit.toTicks(time.toLong()).toInt()
28- ) { this @sendActionBar.sendActionBar(string ) }
28+ ) { this @sendActionBar.sendActionBar(message ) }
2929}
3030
3131/* *
3232 * Sends an action bar message to the player.
3333 *
34- * @param string The message to be displayed in the action bar.
34+ * @param message The message to be displayed in the action bar.
3535 */
36- fun Player.sendActionBar (string : String ) {
37- this .spigot().sendMessage(ChatMessageType .ACTION_BAR , TextComponent (string ))
36+ fun Player.sendActionBar (message : String ) {
37+ this .spigot().sendMessage(ChatMessageType .ACTION_BAR , TextComponent (message ))
3838}
39+
3940/* *
4041 * Sends an action bar message to the player.
4142 *
42- * @param string The message to be displayed in the action bar.
43+ * @param message The message to be displayed in the action bar.
4344 * @param time The duration in ticks for which the message should be displayed.
4445 */
45- fun Player.sendActionBar (string : String , time : Int ) = sendActionBar(string , time, TimeUnit .TICKS )
46+ fun Player.sendActionBar (message : String , time : Int ) = sendActionBar(message , time, TimeUnit .TICKS )
4647
4748/* *
4849 * Sets the food level of the player to the maximum value (20).
@@ -114,17 +115,40 @@ fun Player.removeActivePotionEffects() {
114115/* *
115116 * Sends a message to the player.
116117 *
117- * @param component the message component to send
118+ * @param component The message component to send
118119 */
119120fun Player.sendMessage (component : Component ) = UndefinedAPI .adventure().player(this ).sendMessage(component)
120121
121122/* *
122123 * Sends an action bar message to the player.
123124 *
124- * @param component The message to be displayed as the action bar, represented as a [Component].
125+ * @param message The action bar message to be sent.
126+ * @param time The duration for which the action bar message should be displayed.
127+ * @param timeUnit The time unit in which the duration is measured. (Default: [TimeUnit.TICKS])
128+ *
129+ * @throws IllegalArgumentException if the provided `time` parameter is negative.
125130 */
126- fun Player.sendActionBar (component : Component ) = UndefinedAPI .adventure().player(this ).sendActionBar(component)
131+ fun Player.sendActionBar (message : Component , time : Int , timeUnit : TimeUnit = TimeUnit .TICKS ) {
132+ repeatingTask(
133+ 1 ,
134+ timeUnit.toTicks(time.toLong()).toInt()
135+ ) { this @sendActionBar.sendActionBar(message) }
136+ }
127137
138+ /* *
139+ * Sends an action bar message to the player.
140+ *
141+ * @param message The message to be displayed as the action bar, represented as a [Component].
142+ */
143+ fun Player.sendActionBar (message : Component ) = UndefinedAPI .adventure().player(this ).sendActionBar(message)
144+
145+ /* *
146+ * Sends an action bar message to the player.
147+ *
148+ * @param message The message to be displayed in the action bar.
149+ * @param time The duration in ticks for which the message should be displayed.
150+ */
151+ fun Player.sendActionBar (message : Component , time : Int ) = sendActionBar(message, time, TimeUnit .TICKS )
128152
129153fun Player.sendBlockUpdateArray (hashMap : HashMap <Location , BlockData >) {
130154 sendBlockUpdateArray(hashMap.keys.toList(), hashMap.values.toList())
0 commit comments