2021-11-28 01:13:21 +00:00
package net.t2code.lib.Spigot.Lib.messages ;
import net.md_5.bungee.api.chat.ClickEvent ;
import net.md_5.bungee.api.chat.TextComponent ;
2021-12-31 04:23:57 +00:00
import net.t2code.lib.Spigot.Lib.replace.Replace ;
2021-11-28 01:13:21 +00:00
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 {
2022-01-16 05:56:58 +00:00
public static Long onLoadHeader ( String prefix , List < String > autor , String version , String spigot , String discord ) {
return onLoadHeader ( prefix , autor , version , spigot , discord , null ) ;
}
public static Long onLoadHeader ( String prefix , List < String > autor , String version , String spigot , String discord , Boolean isPremium ) {
Long long_ = System . currentTimeMillis ( ) ;
2021-11-28 01:13:21 +00:00
// 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 ) ;
2022-01-16 05:56:58 +00:00
if ( isPremium ! = null ) {
if ( isPremium ) {
send . console ( prefix + " §4 §e| §6Premium: §2true " ) ;
} else send . console ( prefix + " §4 §e| §6Premium: §4false " ) ;
}
2021-11-28 01:13:21 +00:00
send . console ( prefix + " §4 §e------------------- " ) ;
2021-12-03 09:21:26 +00:00
if ( version . toLowerCase ( ) . contains ( " dev " ) | | version . toLowerCase ( ) . contains ( " snapshot " ) | | version . toLowerCase ( ) . contains ( " beta " ) ) {
2021-12-31 00:33:59 +00:00
send . 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! " ) ;
2021-12-03 09:21:26 +00:00
send . console ( prefix + " §4 §e------------------- " ) ;
2021-12-31 00:33:59 +00:00
try {
Thread . sleep ( 5000 ) ;
} catch ( InterruptedException e ) {
e . printStackTrace ( ) ;
}
2021-12-03 09:21:26 +00:00
}
2021-11-28 01:13:21 +00:00
//onLoadSeparateStroke(prefix);
return long_ ;
}
public static Long onLoadHeader ( String prefix ) {
2022-01-16 05:56:58 +00:00
Long long_ = System . currentTimeMillis ( ) ;
2021-11-28 01:13:21 +00:00
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 ) ;
2022-01-16 05:56:58 +00:00
send . console ( prefix + " §2Plugin loaded successfully. " + " §7- §e " + ( System . currentTimeMillis ( ) - long_ ) + " ms " ) ;
2021-11-28 01:13:21 +00:00
// send.console(prefix +" §4===================== " + prefix + "§4=====================");
}
public static void onLoadFooter ( String prefix , Long long_ ) {
onLoadSeparateStroke ( prefix ) ;
2022-01-16 05:56:58 +00:00
send . console ( prefix + " §2Plugin loaded successfully. " + " §7- §e " + ( System . currentTimeMillis ( ) - long_ ) + " ms " ) ;
2021-11-28 01:13:21 +00:00
// send.console(prefix +" §4===================== " + prefix + "§4=====================");
}
2022-01-16 05:56:58 +00:00
public static void onDisable ( String prefix , List < String > autor , String version , String spigot , String discord ) {
2021-11-28 01:13:21 +00:00
//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. " ) ;
}
2022-01-16 05:56:58 +00:00
public static void sendInfo ( CommandSender sender , String prefix , String spigot , String discord , List < String > autor , String pluginVersion , String publicVersion , Boolean isPremium ) {
2021-11-28 01:13:21 +00:00
send . sender ( sender , prefix + " §4======= " + prefix + " §4======= " ) ;
send . sender ( sender , prefix + " §2Autor: §6 " + String . valueOf ( autor ) . replace ( " [ " , " " ) . replace ( " ] " , " " ) ) ;
2021-12-31 04:23:57 +00:00
if ( sender instanceof Player ) {
2021-11-28 01:13:21 +00:00
2021-12-31 04:23:57 +00:00
TextComponent comp2 = new TextBuilder ( prefix + " §2Version: §6 " + pluginVersion )
2022-01-16 05:56:58 +00:00
. addHover ( " §8Click to copy " ) . addClickEvent ( ClickEvent . Action . COPY_TO_CLIPBOARD , Replace . removeColorCode ( prefix ) + " - " + pluginVersion ) . build ( ) ;
2021-12-31 04:23:57 +00:00
sender . spigot ( ) . sendMessage ( comp2 ) ;
if ( ! publicVersion . equalsIgnoreCase ( pluginVersion ) ) {
UpdateAPI . sendUpdateMsg ( prefix , spigot , discord , pluginVersion , publicVersion , ( Player ) sender ) ;
}
TextComponent comp3 = new TextBuilder ( prefix + " §2Spigot: §6 " + spigot )
. addHover ( " §8Open Spigot " ) . addClickEvent ( ClickEvent . Action . OPEN_URL , spigot ) . build ( ) ;
sender . spigot ( ) . sendMessage ( comp3 ) ;
TextComponent comp4 = new TextBuilder ( prefix + " §2Discord: §6 " + discord )
. addHover ( " §8Open Discord " ) . addClickEvent ( ClickEvent . Action . OPEN_URL , discord ) . build ( ) ;
sender . spigot ( ) . sendMessage ( comp4 ) ;
2021-11-28 01:13:21 +00:00
} else {
2021-12-31 04:23:57 +00:00
if ( publicVersion . equalsIgnoreCase ( pluginVersion ) ) {
send . sender ( sender , prefix + " §2Version: §6 " + pluginVersion ) ;
} else {
UpdateAPI . sendUpdateMsg ( prefix , spigot , discord , pluginVersion , publicVersion ) ;
2021-11-28 01:13:21 +00:00
}
2021-12-31 04:23:57 +00:00
send . sender ( sender , prefix + " §2Spigot: §6 " + spigot ) ;
send . sender ( sender , prefix + " §2Discord: §6 " + discord ) ;
2021-11-28 01:13:21 +00:00
}
2022-01-16 05:56:58 +00:00
if ( isPremium ! = null ) {
if ( isPremium ) {
send . sender ( sender , prefix + " §6Premium: §2true " ) ;
} else send . sender ( sender , prefix + " §6Premium: §4false " ) ;
}
2021-11-28 01:13:21 +00:00
send . sender ( sender , prefix + " §4======= " + prefix + " §4======= " ) ;
}
2022-01-16 05:56:58 +00:00
public static void sendInfo ( CommandSender sender , String prefix , String spigot , String discord , List < String > autor , String pluginVersion , String publicVersion ) {
sendInfo ( sender , prefix , spigot , discord , autor , pluginVersion , publicVersion , null ) ;
}
2021-11-28 01:13:21 +00:00
}