package net.t2code.t2codelib.SPIGOT.api.messages; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.Nullable; import java.util.logging.Level; public class T2Csend { /** * Spigot */ public static void console(String msg) { if (msg == null || msg.contains("[empty]")) return; T2ChoverModule.moduleConsole(msg); } public static void player(Player player, String msg) { if (msg == null || msg.contains("[empty]")) return; T2ChoverModule.modulePlayer(msg, player); } public static void title(Player player, @Nullable String title, @Nullable String subtitle) { player.sendTitle(title, subtitle); } public static void title(Player player, @Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut) { player.sendTitle(title, subtitle, fadeIn, stay, fadeOut); } public static void sender(CommandSender sender, String msg) { if (msg == null || msg.contains("[empty]")) return; T2ChoverModule.moduleSender(msg, sender); } public static void debug(Plugin plugin, String msg) { debug(plugin, msg, null); } public static void debug(Plugin plugin, String msg, Integer stage) { // if (!new File(Main.getPath(), "config.yml").exists()) return; if (stage == null) { if (plugin.getConfig().getBoolean("Plugin.Debug") || plugin.getConfig().getBoolean("plugin.debug") || plugin.getConfig().getBoolean("Debug") || plugin.getConfig().getBoolean("debug")){ info(plugin, ""); Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg); } return; } if (plugin.getConfig().getInt("Plugin.Debug") >= stage || plugin.getConfig().getInt("plugin.debug") >= stage || plugin.getConfig().getInt("Debug") >= stage || plugin.getConfig().getInt("debug") >= stage) { info(plugin, ""); Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg); } } public static void debugmsg(Plugin plugin, String msg) { warning(plugin, ""); Bukkit.getConsoleSender().sendMessage("§e[" + plugin.getDescription().getPrefix() + "] §5DEBUG-MSG: §6" + msg); } public static void info(Plugin plugin, String msg) { plugin.getLogger().log(Level.INFO, msg); } public static void warning(Plugin plugin, String msg) { plugin.getLogger().log(Level.WARNING, msg); } public static void error(Plugin plugin, String msg) { plugin.getLogger().log(Level.SEVERE, msg); } }