146 lines
8.5 KiB
Java
146 lines
8.5 KiB
Java
package net.t2code.t2codelib.SPIGOT.api.messages;
|
|
|
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
import java.util.List;
|
|
|
|
public class T2Ctemplate {
|
|
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord) {
|
|
return onLoadHeader(prefix, autor, version, spigot, discord, null, null);
|
|
}
|
|
|
|
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium) {
|
|
return onLoadHeader(prefix, autor, version, spigot, discord, isPremium, null);
|
|
}
|
|
|
|
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
|
|
Long long_ = System.currentTimeMillis();
|
|
T2Csend.console(prefix + " <dark_red> _______ </dark_red><gray>___ </gray><dark_red>_____ </dark_red>");
|
|
T2Csend.console(prefix + " <dark_red> |__ __|</dark_red><gray>__ \\ </gray><dark_red>/ ____|</dark_red>");
|
|
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray> ) </gray><dark_red>| | </dark_red>");
|
|
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray> / /</gray><dark_red>| | </dark_red>");
|
|
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray>/ /_</gray><dark_red>| |____ </dark_red>");
|
|
T2Csend.console(prefix + " <dark_red> |_| </dark_red><gray>|____|</gray><dark_red>\\_____|</dark_red>");
|
|
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
|
|
T2Csend.console(prefix + " §4 §e║ §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
|
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + version);
|
|
T2Csend.console(prefix + " §4 §e║ §2Spigot: §6" + spigot);
|
|
T2Csend.console(prefix + " §4 §e║ §2Discord: §6" + discord);
|
|
if (isPremium != null) {
|
|
if (isPremium) {
|
|
T2Csend.console(prefix + " §4 §e║ §6Premium: §2true");
|
|
} else T2Csend.console(prefix + " §4 §e║ §6Premium: §4false");
|
|
if (isVerify != null) {
|
|
if (isVerify) {
|
|
T2Csend.console(prefix + " §4 §e║ §6Verify: §2true");
|
|
} else T2Csend.console(prefix + " §4 §e║ §6Verify: §4false");
|
|
} else T2Csend.console(prefix + " §4 §e║ §6Verify: §4false");
|
|
}
|
|
|
|
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
|
|
if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) {
|
|
T2Csend.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! Some features may not be working as expected. Please report all" +
|
|
" bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!");
|
|
onLoadSeparateStroke(prefix);
|
|
if (!SelectLibConfig.getT2cTestDevelopment()){
|
|
try {
|
|
Thread.sleep(5000);
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
return long_;
|
|
}
|
|
|
|
public static Long onLoadHeader(String prefix) {
|
|
Long long_ = System.currentTimeMillis();
|
|
T2Csend.console(prefix + "§4===================== " + prefix + " §4=====================");
|
|
return long_;
|
|
}
|
|
|
|
public static void onLoadSeparateStroke(String prefix) {
|
|
T2Csend.console(prefix + " §8-------------------------------");
|
|
}
|
|
|
|
public static void onLoadFooter(String prefix, Long long_, String v) {
|
|
onLoadFooter(prefix,long_);
|
|
}
|
|
public static void onLoadFooter(String prefix, Long long_) {
|
|
onLoadSeparateStroke(prefix);
|
|
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
}
|
|
|
|
/**
|
|
* @param prefix
|
|
* @param autor
|
|
* @param spigot
|
|
* @param discord
|
|
*
|
|
* @deprecated reason this method is deprecated <br/>
|
|
* {will be removed in next version} <br/>
|
|
* use {@link #onDisable(Plugin)} instead like this:
|
|
*
|
|
*
|
|
* <blockquote><pre>
|
|
* onDisable(getPlugin())
|
|
* </pre></blockquote>
|
|
*
|
|
*/
|
|
@Deprecated
|
|
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
|
T2Csend.console(prefix + " §2Version: §6" + version);
|
|
T2Csend.console(prefix + " §4Plugin successfully disabled.");
|
|
}
|
|
|
|
public static void onDisable(String prefix, Plugin plugin) {
|
|
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
|
|
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + plugin.getDescription().getVersion());
|
|
T2Csend.console(prefix + " §4 §e║ §2Autors: §6" + plugin.getDescription().getAuthors());
|
|
T2Csend.console(prefix + " §4 §e║ §4Plugin successfully disabled.");
|
|
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
|
|
}
|
|
|
|
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
|
|
String pluginVersion = plugin.getDescription().getVersion();
|
|
String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
|
|
boolean update = !publicVersion.equalsIgnoreCase(pluginVersion);
|
|
boolean player = sender instanceof Player;
|
|
|
|
String stPlugin = "<dark_red>║</dark_red> <yellow>Plugin:</yellow> <gold>[pl]</gold>".replace("[pl]", plugin.getName());
|
|
String stVersion = "<dark_red>║</dark_red> <yellow>Version:</yellow> <gold>[ver]</gold>".replace("[ver]", pluginVersion);
|
|
String stAutor = "<dark_red>║</dark_red> <yellow>Autor(s):</yellow> <gold>[autor]</gold>".replace("[autor]", plugin.getDescription().getAuthors().toString());
|
|
String stNVersion = "<dark_red>║</dark_red> <yellow>Newest Version:</yellow> <gold>[nver]</gold>".replace("[nver]", publicVersion);
|
|
String stStable = "<dark_red>║</dark_red> <yellow>Stable version available:</yellow> [up]".replace("[up]", update ? "<dark_green>YES</dark_green>" : "<red>no</red>");
|
|
String stLinkPlayer = "<dark_red>║</dark_red> <yellow><hover:show_text:'<green>Go to the Spigot page</green>'><click:open_url:'[slink]'>Spigot</click></hover></yellow> "
|
|
.replace("[slink]", "https://www.spigotmc.org/resources/" + spigotID)
|
|
+ "<dark_red>-</dark_red> <dark_purple><hover:show_text:'<green>Go to the T2Code Support Discord</green>'><click:open_url:'[dlink]'>Discord</click></hover></dark_purple>"
|
|
.replace("[dlink]", discord);
|
|
String stLinkConsole = "<dark_red>║</dark_red> <yellow>Spigot:</yellow> <gold>https://www.spigotmc.org/resources/" + spigotID + "</gold>"
|
|
+ "<br><dark_red>║</dark_red> <yellow>Discord:</yellow> <gold>" + discord + "</gold>";
|
|
String stLink = player ? stLinkPlayer : stLinkConsole;
|
|
String pr = premiumVerified != null ? "<br><dark_red>║</dark_red> <yellow>Premium verified:</yellow> [pr]".replace("[pr]", premiumVerified ? "<dark_green>YES</dark_green>" : "<red>NO</red>") : "";
|
|
|
|
String stMSG = text == null || text.equals("") ? "" : "<br><dark_red>║</dark_red> " + text + "<br>";
|
|
T2Csend.sender(sender, "<dark_red>╔════════════════════════════════</dark_red>"
|
|
+ "<br>" + stPlugin
|
|
+ stMSG
|
|
+ stVersion
|
|
+ "<br>" + stAutor
|
|
+ "<br>" + stNVersion
|
|
+ "<br>" + stStable
|
|
+ "<br>" + stLink
|
|
+ pr
|
|
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
|
}
|
|
|
|
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, String text) {
|
|
sendInfo(sender, plugin, spigotID, discord, null, text);
|
|
}
|
|
}
|