Eliminated plugin and kSpigot parameters

This commit is contained in:
bluefireoly
2020-10-12 17:01:01 +02:00
parent 6b2f95c7fa
commit 29bd82803d
11 changed files with 63 additions and 69 deletions

View File

@@ -1,27 +1,28 @@
package net.axay.kspigot.extensions.bukkit
import net.axay.kspigot.main.KSpigotMainInstance
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? = null)
fun CommandSender.print(text: String, plugin: Plugin? = KSpigotMainInstance)
= printColoredPrefix(text, ChatColor.RESET, plugin?.name ?: "INFO", ChatColor.GRAY)
/** @see printColoredPrefix */
fun CommandSender.info(text: String, plugin: Plugin? = null)
fun CommandSender.info(text: String, plugin: Plugin? = KSpigotMainInstance)
= printColoredPrefix(text, ChatColor.WHITE, plugin?.name ?: "INFO", ChatColor.DARK_AQUA)
/** @see printColoredPrefix */
fun CommandSender.success(text: String, plugin: Plugin? = null)
fun CommandSender.success(text: String, plugin: Plugin? = KSpigotMainInstance)
= printColoredPrefix(text, ChatColor.GREEN, plugin?.name ?: "SUCCESS", ChatColor.DARK_AQUA)
/** @see printColoredPrefix */
fun CommandSender.warn(text: String, plugin: Plugin? = null)
fun CommandSender.warn(text: String, plugin: Plugin? = KSpigotMainInstance)
= printColoredPrefix(text, ChatColor.WHITE, plugin?.name?.plus(" - WARN") ?: "WARN", ChatColor.YELLOW)
/** @see printColoredPrefix */
fun CommandSender.error(text: String, plugin: Plugin? = null)
fun CommandSender.error(text: String, plugin: Plugin? = KSpigotMainInstance)
= printColoredPrefix(text, ChatColor.RED, plugin?.name?.plus(" - ERROR") ?: "ERROR", ChatColor.DARK_RED)
/**

View File

@@ -2,12 +2,12 @@ package net.axay.kspigot.extensions.bukkit
import net.axay.kspigot.annotations.NMS_General
import net.axay.kspigot.extensions.onlinePlayers
import net.axay.kspigot.main.KSpigotMainInstance
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.attribute.Attribute
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld
import org.bukkit.entity.*
import org.bukkit.plugin.Plugin
/**
* Checks if the entity is completely in water.
@@ -72,15 +72,15 @@ fun Player.feedSaturate() {
/**
* Hides the player for all [onlinePlayers].
*/
fun Player.disappear(plugin: Plugin) {
onlinePlayers.filter { it != this }.forEach { it.hidePlayer(plugin, this) }
fun Player.disappear() {
onlinePlayers.filter { it != this }.forEach { it.hidePlayer(KSpigotMainInstance, this) }
}
/**
* Shows the player for all [onlinePlayers].
*/
fun Player.appear(plugin: Plugin) {
onlinePlayers.filter { it != this }.forEach { it.showPlayer(plugin, this) }
fun Player.appear() {
onlinePlayers.filter { it != this }.forEach { it.showPlayer(KSpigotMainInstance, this) }
}
/**