Make "PluginInstance" available internally
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package net.axay.kspigot.extensions
|
||||
|
||||
import net.axay.kspigot.main.KSpigotMainInstance
|
||||
import net.axay.kspigot.main.PluginInstance
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.NamespacedKey
|
||||
import org.bukkit.command.CommandSender
|
||||
@@ -46,4 +46,4 @@ val console get() = Bukkit.getConsoleSender()
|
||||
/**
|
||||
* Shortcut for creating a new [NamespacedKey]
|
||||
*/
|
||||
fun pluginKey(key: String) = NamespacedKey(KSpigotMainInstance, key)
|
||||
fun pluginKey(key: String) = NamespacedKey(PluginInstance, key)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package net.axay.kspigot.extensions.bukkit
|
||||
|
||||
import net.axay.kspigot.main.KSpigotMainInstance
|
||||
import net.axay.kspigot.main.PluginInstance
|
||||
import org.bukkit.command.CommandExecutor
|
||||
import org.bukkit.command.TabCompleter
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.bukkit.command.TabCompleter
|
||||
* @return If the command was registered successfully.
|
||||
*/
|
||||
fun CommandExecutor.register(commandName: String): Boolean {
|
||||
KSpigotMainInstance.getCommand(commandName)?.let {
|
||||
PluginInstance.getCommand(commandName)?.let {
|
||||
it.setExecutor(this)
|
||||
if (this is TabCompleter)
|
||||
it.tabCompleter = this
|
||||
|
@@ -1,28 +1,28 @@
|
||||
package net.axay.kspigot.extensions.bukkit
|
||||
|
||||
import net.axay.kspigot.main.KSpigotMainInstance
|
||||
import net.axay.kspigot.main.PluginInstance
|
||||
import net.md_5.bungee.api.ChatColor
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.plugin.Plugin
|
||||
|
||||
/** @see printColoredPrefix */
|
||||
fun CommandSender.print(text: String, plugin: Plugin? = KSpigotMainInstance) =
|
||||
fun CommandSender.print(text: String, plugin: Plugin? = PluginInstance) =
|
||||
printColoredPrefix(text, ChatColor.RESET, plugin?.name ?: "INFO", ChatColor.GRAY)
|
||||
|
||||
/** @see printColoredPrefix */
|
||||
fun CommandSender.info(text: String, plugin: Plugin? = KSpigotMainInstance) =
|
||||
fun CommandSender.info(text: String, plugin: Plugin? = PluginInstance) =
|
||||
printColoredPrefix(text, ChatColor.WHITE, plugin?.name ?: "INFO", ChatColor.DARK_AQUA)
|
||||
|
||||
/** @see printColoredPrefix */
|
||||
fun CommandSender.success(text: String, plugin: Plugin? = KSpigotMainInstance) =
|
||||
fun CommandSender.success(text: String, plugin: Plugin? = PluginInstance) =
|
||||
printColoredPrefix(text, ChatColor.GREEN, plugin?.name ?: "SUCCESS", ChatColor.DARK_AQUA)
|
||||
|
||||
/** @see printColoredPrefix */
|
||||
fun CommandSender.warn(text: String, plugin: Plugin? = KSpigotMainInstance) =
|
||||
fun CommandSender.warn(text: String, plugin: Plugin? = PluginInstance) =
|
||||
printColoredPrefix(text, ChatColor.WHITE, plugin?.name?.plus(" - WARN") ?: "WARN", ChatColor.YELLOW)
|
||||
|
||||
/** @see printColoredPrefix */
|
||||
fun CommandSender.error(text: String, plugin: Plugin? = KSpigotMainInstance) =
|
||||
fun CommandSender.error(text: String, plugin: Plugin? = PluginInstance) =
|
||||
printColoredPrefix(text, ChatColor.RED, plugin?.name?.plus(" - ERROR") ?: "ERROR", ChatColor.DARK_RED)
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,7 @@ package net.axay.kspigot.extensions.bukkit
|
||||
import net.axay.kspigot.annotations.NMS_General
|
||||
import net.axay.kspigot.chat.literalText
|
||||
import net.axay.kspigot.extensions.onlinePlayers
|
||||
import net.axay.kspigot.main.KSpigotMainInstance
|
||||
import net.axay.kspigot.main.PluginInstance
|
||||
import net.axay.kspigot.pluginmessages.PluginMessageConnect
|
||||
import net.md_5.bungee.api.ChatMessageType
|
||||
import org.bukkit.Location
|
||||
@@ -73,28 +73,28 @@ fun Player.feedSaturate() {
|
||||
* Hides the player for all [onlinePlayers].
|
||||
*/
|
||||
fun Player.disappear() {
|
||||
onlinePlayers.filter { it != this }.forEach { it.hidePlayer(KSpigotMainInstance, this) }
|
||||
onlinePlayers.filter { it != this }.forEach { it.hidePlayer(PluginInstance, this) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the player for all [onlinePlayers].
|
||||
*/
|
||||
fun Player.appear() {
|
||||
onlinePlayers.filter { it != this }.forEach { it.showPlayer(KSpigotMainInstance, this) }
|
||||
onlinePlayers.filter { it != this }.forEach { it.showPlayer(PluginInstance, this) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides all online players from this player.
|
||||
*/
|
||||
fun Player.hideOnlinePlayers() {
|
||||
onlinePlayers.filter { it != this }.forEach { this.hidePlayer(KSpigotMainInstance, it) }
|
||||
onlinePlayers.filter { it != this }.forEach { this.hidePlayer(PluginInstance, it) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows all online players to this player.
|
||||
*/
|
||||
fun Player.showOnlinePlayers() {
|
||||
onlinePlayers.filter { it != this }.forEach { this.showPlayer(KSpigotMainInstance, it) }
|
||||
onlinePlayers.filter { it != this }.forEach { this.showPlayer(PluginInstance, it) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user