All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.skillw.pouvoir.util.script.MessageUtil.kt Maven / Gradle / Ivy

There is a newer version: 1.6.7-beta-6
Show newest version
package com.skillw.pouvoir.util.script

import com.skillw.pouvoir.util.isStaticClass
import org.bukkit.Bukkit
import org.bukkit.command.CommandSender
import taboolib.library.reflex.Reflex.Companion.invokeMethod
import taboolib.module.chat.colored

/**
 * 给脚本用的
 *
 * ClassName : com.skillw.pouvoir.util Created by Glom_ on 2021-03-25
 * 20:25:13 Copyright 2021 user. 
 */
object MessageUtil {


    @JvmStatic
    fun message(sender: CommandSender, msg: String) {
        sender.sendMessage(msg.colored())
    }


    @JvmStatic
    fun warning(msg: Any?) {
        Bukkit.getLogger().warning(msg.toString().colored())
    }


    @JvmStatic
    fun info(msg: Any?) {
        Bukkit.getLogger().info(msg.toString().colored())
    }


    @JvmStatic
    fun debug(msg: Any?) {
        info("&9[&eDebug&9] &7${msg}")
    }


    @JvmStatic
    fun Any.information(key: String): String {
        return "&f$key  ${
            if (isStaticClass()) "&7= &6${
                this.invokeMethod>("getRepresentedClass")
                    ?.invokeMethod("getName")
            }" else "&7: &6${javaClass.name}"
        }"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy