more Components instead of Strings (#44)

Closes #36
This commit is contained in:
Jannis Kramer
2022-03-29 16:31:19 +02:00
committed by GitHub
parent 4a561950ee
commit 8b094e3344
9 changed files with 89 additions and 20 deletions

View File

@@ -3,6 +3,7 @@
package net.axay.kspigot.extensions
import net.axay.kspigot.main.PluginInstance
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.Component.text
import org.bukkit.Bukkit
import org.bukkit.NamespacedKey
@@ -41,6 +42,13 @@ val pluginManager get() = Bukkit.getPluginManager()
*/
fun broadcast(msg: String) = Bukkit.getServer().broadcast(text(msg))
/**
* Broadcasts a message ([msg]) on the server.
* @return the number of recipients
* @see Bukkit.broadcastMessage
*/
fun broadcast(msg: Component) = Bukkit.getServer().broadcast(msg)
/**
* Shortcut to get the ConsoleSender.
* @see Bukkit.getConsoleSender