From bf2d8ee1a174774e8e1f5e9cc40715de3697f53e Mon Sep 17 00:00:00 2001 From: bluefireoly Date: Wed, 28 Oct 2020 21:13:56 +0100 Subject: [PATCH] Added simple builder function for NamespacedKey --- .../net/axay/kspigot/extensions/GeneralExtensions.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/net/axay/kspigot/extensions/GeneralExtensions.kt b/src/main/kotlin/net/axay/kspigot/extensions/GeneralExtensions.kt index 7ed62255..bf074ccc 100644 --- a/src/main/kotlin/net/axay/kspigot/extensions/GeneralExtensions.kt +++ b/src/main/kotlin/net/axay/kspigot/extensions/GeneralExtensions.kt @@ -1,6 +1,8 @@ package net.axay.kspigot.extensions +import net.axay.kspigot.main.KSpigotMainInstance import org.bukkit.Bukkit +import org.bukkit.NamespacedKey import org.bukkit.entity.Player /** @@ -32,4 +34,9 @@ fun broadcast(msg: String) = Bukkit.broadcastMessage(msg) * Shortcut to get the ConsoleSender. * @see Bukkit.getConsoleSender */ -val console get() = Bukkit.getConsoleSender() \ No newline at end of file +val console get() = Bukkit.getConsoleSender() + +/** + * Shortcut for creating a new [NamespacedKey] + */ +fun pluginKey(key: String) = NamespacedKey(KSpigotMainInstance, key) \ No newline at end of file