Initial Commit
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class T2CodeTemplate {
|
||||
public static Long onLoadHeader(String prefix, List autor, String version, String spigot, String discord) {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
// send.console(prefix +" §4===================== " + prefix + " §4=====================");
|
||||
send.console(prefix + " §4 _______ §7___ §4_____ ");
|
||||
send.console(prefix + " §4 |__ __|§7__ \\ §4/ ____|");
|
||||
send.console(prefix + " §4 | | §7 ) §4| | ");
|
||||
send.console(prefix + " §4 | | §7 / /§4| | ");
|
||||
send.console(prefix + " §4 | | §7/ /_§4| |____ ");
|
||||
send.console(prefix + " §4 |_| §7|____|§4\\_____|");
|
||||
send.console(prefix + " §4 §e------------------");
|
||||
send.console(prefix + " §4 §e| §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
send.console(prefix + " §4 §e| §2Version: §6" + version);
|
||||
send.console(prefix + " §4 §e| §2Spigot: §6" + spigot);
|
||||
send.console(prefix + " §4 §e| §2Discord: §6" + discord);
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
//onLoadSeparateStroke(prefix);
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static Long onLoadHeader(String prefix) {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
send.console(prefix + "§4===================== " + prefix + " §4=====================");
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_, String version) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
send.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
// send.console(prefix +" §4===================== " + prefix + "§4=====================");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
send.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
// send.console(prefix +" §4===================== " + prefix + "§4=====================");
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, List autor, String version, String spigot, String discord) {
|
||||
//send.console(prefix + "§4===================== " + prefix + " §7- §6" + version + " §4=====================");
|
||||
//send.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
//send.console(prefix + " §2Version: §6" + version);
|
||||
//send.console(prefix + " §2Spigot: §6" + spigot);
|
||||
//send.console(prefix + " §2Discord: §6" + discord);
|
||||
//send.console(prefix + " §4Plugin successfully disabled.");
|
||||
//send.console(prefix + "§4===================== " + prefix + " §7- §6" + version + " §4=====================");
|
||||
send.console(prefix + " §2Version: §6" + version);
|
||||
send.console(prefix + " §4Plugin successfully disabled.");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, List autor, String pluginVersion, String publicVersion) {
|
||||
send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
send.sender(sender, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
|
||||
if (publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
send.sender(sender, prefix + " §2Version: §6" + pluginVersion);
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, player);
|
||||
}
|
||||
}
|
||||
send.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
send.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class TextBuilder {
|
||||
|
||||
private final String text;
|
||||
private String hover;
|
||||
private String click;
|
||||
private ClickEvent.Action action;
|
||||
|
||||
public TextBuilder(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public TextBuilder addHover(String hover) {
|
||||
this.hover = hover;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextBuilder addClickEvent(ClickEvent.Action clickEventAction, String value) {
|
||||
this.action = clickEventAction;
|
||||
this.click = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextComponent build() {
|
||||
TextComponent textComponent = new TextComponent();
|
||||
textComponent.setText(this.text);
|
||||
if (this.hover != null) {
|
||||
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(this.hover).create()));
|
||||
}
|
||||
if (this.click != null && (this.action != null)) {
|
||||
textComponent.setClickEvent(new ClickEvent(action, this.click));
|
||||
}
|
||||
return textComponent;
|
||||
}
|
||||
|
||||
public enum ClickEventType {
|
||||
OPEN_URL, OPEN_FILE, RUN_COMMAND, SUGGEST_COMMAND, CHANGE_PAGE, COPY_TO_CLIPBOARD
|
||||
}
|
||||
}
|
64
src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java
Normal file
64
src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class send {
|
||||
|
||||
/**
|
||||
* Spigot
|
||||
*/
|
||||
|
||||
public static void console(String msg) {
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, String msg) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void title(Player player, String msg, String msg2) {
|
||||
player.sendTitle(msg, msg2);
|
||||
}
|
||||
|
||||
public static void title(Player player, String msg, String msg2, int i, int i1, int i2) {
|
||||
player.sendTitle(msg, msg2, i, i1, i2);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
|
||||
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")) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
return;
|
||||
}
|
||||
if (plugin.getConfig().getInt("Plugin.Debug") >= stage) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
}
|
||||
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
Bukkit.getConsoleSender().sendMessage(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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user