2021-12-21 04:57:29 +00:00
package de.jatitv.commandguiv2.Spigot ;
//s<ds
2022-01-16 02:03:04 +00:00
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig ;
2021-12-21 04:57:29 +00:00
import de.jatitv.commandguiv2.Spigot.system.Load ;
import de.jatitv.commandguiv2.Spigot.Objekte.Object ;
2022-01-16 02:03:04 +00:00
import de.jatitv.commandguiv2.Spigot.system.database.MySQL ;
2021-12-21 04:57:29 +00:00
import de.jatitv.commandguiv2.Util ;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate ;
import net.t2code.lib.Spigot.Lib.messages.send ;
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck ;
import org.bukkit.Bukkit ;
import org.bukkit.plugin.Plugin ;
import org.bukkit.plugin.java.JavaPlugin ;
import java.io.File ;
import java.util.* ;
import java.util.logging.Level ;
import java.util.logging.Logger ;
public final class Main extends JavaPlugin {
public static ArrayList < String > bungeejoinplayers = new ArrayList < > ( ) ;
public static File getPath ( ) {
return plugin . getDataFolder ( ) ;
}
private static Boolean enable = false ;
public static String prefix = " §8[§4C§9GUI§8] " ;
public static String version ;
public static List < String > autor ;
public static Main plugin ;
public static List plugins ;
public static String update_version = null ;
public static Boolean PaPi = false ;
public static Boolean PlotSquaredGUI = false ;
2022-01-13 02:28:06 +00:00
public static Boolean LuckyBox = false ;
2021-12-21 04:57:29 +00:00
public static Boolean PlugManGUI = false ;
public static HashMap < String , Object > guiHashMap = new HashMap < > ( ) ;
public static ArrayList < String > allAliases = new ArrayList < > ( ) ;
@Override
public void onEnable ( ) {
plugins = Arrays . asList ( getServer ( ) . getPluginManager ( ) . getPlugins ( ) ) ;
// Plugin startup logic
// Plugin startup logic
Logger logger = this . getLogger ( ) ;
plugin = this ;
autor = plugin . getDescription ( ) . getAuthors ( ) ;
version = plugin . getDescription ( ) . getVersion ( ) ;
2022-01-01 02:40:54 +00:00
if ( pluginNotFound ( " T2CodeLib " , 96388 , Util . getRequiredT2CodeLibVersion ( ) ) ) return ;
2021-12-21 04:57:29 +00:00
getServer ( ) . getMessenger ( ) . registerOutgoingPluginChannel ( this , " BungeeCord " ) ;
if ( PluginCheck . papi ( ) ) {
PaPi = true ;
}
2022-01-01 02:40:54 +00:00
Load . onLoad ( prefix , autor , version , Util . getSpigot ( ) , Util . getSpigotID ( ) , Util . getDiscord ( ) , Util . getBstatsID ( ) ) ;
2021-12-21 04:57:29 +00:00
enable = true ;
}
public static void addonLoad ( ) {
2022-01-13 02:28:06 +00:00
if ( PluginCheck . plotSquaredGUI ( ) ) {
2021-12-21 04:57:29 +00:00
PlotSquaredGUI = true ;
addonEnable ( Bukkit . getPluginManager ( ) . getPlugin ( " PlotSquaredGUI " ) ) ;
2022-01-13 02:28:06 +00:00
} if ( PluginCheck . luckyBox ( ) ) {
LuckyBox = true ;
addonEnable ( Bukkit . getPluginManager ( ) . getPlugin ( " T2C-LuckyBox " ) ) ;
2021-12-21 04:57:29 +00:00
}
2022-01-13 02:28:06 +00:00
if ( PluginCheck . plugManGUI ( ) ) {
2021-12-21 04:57:29 +00:00
PlugManGUI = true ;
addonEnable ( Bukkit . getPluginManager ( ) . getPlugin ( " PlugManGUI " ) ) ;
}
}
public static void addonEnable ( Plugin plugin ) {
send . console ( prefix + " §aAddon for: §e " + plugin . getName ( ) + " §7 - Version: " + plugin . getDescription ( ) . getVersion ( ) + " §aloaded successfully! " ) ;
}
public static Boolean pluginNotFound ( String pl , Integer spigotID ) {
if ( Bukkit . getPluginManager ( ) . getPlugin ( pl ) = = null ) {
plugin . getLogger ( ) . log ( Level . SEVERE , " Plugin can not be loaded! " ) ;
Bukkit . getConsoleSender ( ) . sendMessage ( prefix + " §e " + pl + " §4could not be found. Please download it here: " +
" §6https://spigotmc.org/resources/ " + pl + " . " + spigotID + " §4to be able to use this plugin. " ) ;
Main . plugin . getPluginLoader ( ) . disablePlugin ( Main . plugin ) ;
return true ;
} else return false ;
}
public static Boolean pluginNotFound ( String pl , Integer spigotID , double ver ) {
if ( Bukkit . getPluginManager ( ) . getPlugin ( pl ) = = null ) {
plugin . getLogger ( ) . log ( Level . SEVERE , " Plugin can not be loaded! " ) ;
Bukkit . getConsoleSender ( ) . sendMessage ( prefix + " §e " + pl + " §4could not be found. Please download it here: " +
" §6https://spigotmc.org/resources/ " + pl + " . " + spigotID + " §4to be able to use this plugin. " ) ;
Main . plugin . getPluginLoader ( ) . disablePlugin ( Main . plugin ) ;
return true ;
} else {
2021-12-22 20:20:55 +00:00
if ( Double . parseDouble ( Bukkit . getPluginManager ( ) . getPlugin ( pl ) . getDescription ( ) . getVersion ( ) ) < ver ) {
2021-12-21 04:57:29 +00:00
plugin . getLogger ( ) . log ( Level . SEVERE , " Plugin can not be loaded! " ) ;
Bukkit . getConsoleSender ( ) . sendMessage ( prefix + " §e " + pl + " §4is out of date! This plugin requires at least version §2 " + ver + " §4of §6 " + pl + " §4Please update it here: §6https://spigotmc.org/resources/ " + pl + " . " + spigotID + " §4to use this version of " + plugin . getDescription ( ) . getName ( ) + " . " ) ;
Main . plugin . getPluginLoader ( ) . disablePlugin ( Main . plugin ) ;
return true ;
}
return false ;
}
}
@Override
public void onDisable ( ) {
// Plugin shutdown logic
2022-01-01 02:40:54 +00:00
if ( enable ) T2CodeTemplate . onDisable ( prefix , autor , version , Util . getSpigot ( ) , Util . getDiscord ( ) ) ;
2022-01-16 02:03:04 +00:00
MySQL . close ( ) ;
2021-12-21 04:57:29 +00:00
}
}