code changes | update status 80%

This commit is contained in:
JaTiTV 2022-07-07 13:48:08 +02:00
parent d5669d82d4
commit 41c2c95b36
21 changed files with 135 additions and 77 deletions

View File

@ -19,9 +19,9 @@ public final class Main extends JavaPlugin {
return plugin.getDataFolder(); return plugin.getDataFolder();
} }
public static String version; private static String version;
public static List<String> autor; private static List<String> autor;
public static Main plugin; private static Main plugin;
public static HashMap<String, AliasObject> aliasHashMap = new HashMap<>(); public static HashMap<String, AliasObject> aliasHashMap = new HashMap<>();
public static HashMap<String, SubAliasObject> subAliasHashMap = new HashMap<>(); public static HashMap<String, SubAliasObject> subAliasHashMap = new HashMap<>();
public static ArrayList<String> allAliases = new ArrayList<>(); public static ArrayList<String> allAliases = new ArrayList<>();
@ -79,4 +79,16 @@ public final class Main extends JavaPlugin {
return false; return false;
} }
} }
public static Main getPlugin() {
return plugin;
}
public static String getVersion() {
return version;
}
public static List<String> getAutor() {
return autor;
}
} }

View File

@ -62,11 +62,6 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
if (sender instanceof Player) { if (sender instanceof Player) {
Player p = (Player) sender; Player p = (Player) sender;
send.debugmsg(Main.plugin, "------------");
send.debugmsg(Main.plugin, "tab a: " + 0);
send.debugmsg(Main.plugin, "tab a: " + args.length);
send.debugmsg(Main.plugin, "tab a: " + Arrays.toString(args));
send.debugmsg(Main.plugin, "tab a: " + arg1.toString());
if (args.length == 1) { if (args.length == 1) {
for (String command : arg1.keySet()) { for (String command : arg1.keySet()) {
Boolean passend = true; Boolean passend = true;

View File

@ -7,12 +7,14 @@ import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate; import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI; import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class Commands { public class Commands {
public static void info(CommandSender sender) { public static void info(CommandSender sender) {
T2CodeTemplate.sendInfo(sender, Util.getPrefix(),Util.getSpigot(),Util.getDiscord(),Main.autor,Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion); T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.getAutor(), Main.getVersion(),
UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion);
} }
public static void reload(CommandSender sender) { public static void reload(CommandSender sender) {
@ -21,6 +23,7 @@ public class Commands {
send.console(Util.getPrefix() + " §6Plugin reload..."); send.console(Util.getPrefix() + " §6Plugin reload...");
send.console(Util.getPrefix() + "§8-------------------------------"); send.console(Util.getPrefix() + "§8-------------------------------");
Load.loadReload(); Load.loadReload();
Main.getPlugin().onEnable();
if (sender instanceof Player) sender.sendMessage(SelectMessages.reloadEnd); if (sender instanceof Player) sender.sendMessage(SelectMessages.reloadEnd);
send.console(Util.getPrefix() + "§8-------------------------------"); send.console(Util.getPrefix() + "§8-------------------------------");
send.console(Util.getPrefix() + " §2Plugin successfully reloaded."); send.console(Util.getPrefix() + " §2Plugin successfully reloaded.");

View File

@ -259,7 +259,6 @@ public class ExecuteAlias {
private static void aliasMessage(AliasObject alias, Player player) { private static void aliasMessage(AliasObject alias, Player player) {
for (String msg : alias.messages) { for (String msg : alias.messages) {
String text; String text;
String hover;
if (PluginCheck.papi()) { if (PluginCheck.papi()) {
text = Replace.replace(prefix, player, replacePlayer(msg, player)); text = Replace.replace(prefix, player, replacePlayer(msg, player));
} else { } else {

View File

@ -21,9 +21,12 @@ public class RegisterCommands extends Command {
@Override @Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) { public boolean execute(CommandSender sender, String commandLabel, String[] args) {
send.debugmsg(Main.plugin, "tabevent");
AliasObject alias = Main.aliasHashMap.get(this.alias); AliasObject alias = Main.aliasHashMap.get(this.alias);
if (alias == null) {
send.error(Main.getPlugin(), "The alias " + this.alias + " does not exist.");
return false;
}
if (!alias.aliasEnable) { if (!alias.aliasEnable) {
send.sender(sender, SelectMessages.aliasDisabled); send.sender(sender, SelectMessages.aliasDisabled);
return true; return true;

View File

@ -11,8 +11,6 @@ import org.bukkit.plugin.Plugin;
import java.util.*; import java.util.*;
public class TabEvent implements Listener { public class TabEvent implements Listener {
Plugin plugin = Main.plugin;
private static HashMap<String, String> arg1 = new HashMap<String, String>(); private static HashMap<String, String> arg1 = new HashMap<String, String>();
@EventHandler @EventHandler

View File

@ -0,0 +1,36 @@
package net.t2code.alias.Spigot.config.alias;
import net.t2code.alias.Spigot.Main;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
public class AliasConfigConverter {
/**
* Converter 1.1
*
* @param yamlConfiguration
* @param config_gui
*/
public static void convertAliasList(YamlConfiguration yamlConfiguration, File config_gui) {
yamlConfiguration.set("Alias.AliasList", Collections.singletonList(config_gui.getName().replace(".yml", "")));
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.error(Main.getPlugin(), "");
send.warning(Main.getPlugin(), "The " + config_gui.getName() + " file is converted to the new config format.");
send.warning(Main.getPlugin(), "The alias is no longer the filename, this is now adjustable in the file under 'Alias.AliasList'!");
send.warning(Main.getPlugin(), "This allows a function to have multiple alias commands without creating multiple files!");
send.error(Main.getPlugin(), "");
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
}

View File

@ -1,4 +1,4 @@
package net.t2code.alias.Spigot.config.config; package net.t2code.alias.Spigot.config.alias;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Util; import net.t2code.alias.Util;

View File

@ -1,14 +1,16 @@
package net.t2code.alias.Spigot.config.config; package net.t2code.alias.Spigot.config.alias;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.config.SelectConfig;
import net.t2code.alias.Spigot.system.AliasRegister; import net.t2code.alias.Spigot.system.AliasRegister;
import net.t2code.alias.Spigot.objects.AliasObject; import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.util.Collections; import java.io.IOException;
import java.util.List; import java.util.List;
public class SelectAlias { public class SelectAlias {
@ -22,17 +24,22 @@ public class SelectAlias {
File[] fileArray = f.listFiles(); File[] fileArray = f.listFiles();
for (File config_gui : fileArray) { for (File config_gui : fileArray) {
if (config_gui.getName().equals("X_aliasDeclaration_X.yml")) continue; if (config_gui.getName().equals("X_aliasDeclaration_X.yml")) continue;
String sub = config_gui.getName().substring(config_gui.getName().length() - 4); String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
YamlConfiguration yamlConfiguration;
if (sub.equals(".yml")) { if (sub.equals(".yml")) {
try {
yamlConfiguration = YamlConfiguration.loadConfiguration(config_gui);
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config_gui); } catch (Exception ex) {
continue;
}
Boolean aliasEnable = yamlConfiguration.getBoolean("Alias.Enable"); Boolean aliasEnable = yamlConfiguration.getBoolean("Alias.Enable");
List<String> aliasList; List<String> aliasList;
if (yamlConfiguration.get("Alias.AliasList") != null) { if (SelectConfig.isConfigVersion < 3 && yamlConfiguration.get("Alias.AliasList") == null) {
AliasConfigConverter.convertAliasList(yamlConfiguration, config_gui);
}
aliasList = yamlConfiguration.getStringList("Alias.AliasList"); aliasList = yamlConfiguration.getStringList("Alias.AliasList");
} else aliasList = Collections.singletonList(config_gui.getName().toLowerCase());
Boolean permNecessary = yamlConfiguration.getBoolean("Alias.Permission.Necessary"); Boolean permNecessary = yamlConfiguration.getBoolean("Alias.Permission.Necessary");
Boolean costEnable = yamlConfiguration.getBoolean("Alias.Cost.Enable"); Boolean costEnable = yamlConfiguration.getBoolean("Alias.Cost.Enable");
@ -69,13 +76,16 @@ public class SelectAlias {
AliasObject alias = new AliasObject(aliasEnable, aliasList, permNecessary, costEnable, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand, AliasObject alias = new AliasObject(aliasEnable, aliasList, permNecessary, costEnable, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands, command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands,
adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages); adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
for (String al : aliasList) { for (String al : aliasList) {
send.debugmsg(Main.plugin,"put " + al);
Main.aliasHashMap.put(al, alias); Main.aliasHashMap.put(al, alias);
} }
} }
send.console(Prefix + " §aAlias file §e" + config_gui.getName() + " §awas loaded");
} }
AliasRegister.onRegister(); AliasRegister.onRegister();
} }
private YamlConfiguration loadFile(File file) throws InvalidConfigurationException {
return YamlConfiguration.loadConfiguration(file);
}
} }

View File

@ -10,25 +10,24 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
public class CreateConfig { public class CreateConfig {
public static Integer ConfigVersion = 2;
public static void configCreate() { public static void configCreate() {
long long_ = System.currentTimeMillis(); long long_ = System.currentTimeMillis();
if (new File(Main.getPath(), "config.yml").exists()) { if (new File(Main.getPath(), "config.yml").exists()) {
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated..."); if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
} else send.console(Util.getPrefix() + " §4config.yml are created..."); } else send.console(Util.getPrefix() + " §4config.yml are created...");
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
yamlConfiguration.set("ConfigVersion", ConfigVersion);
Config.set("Plugin.language", "english", yamlConfiguration); Config.set("Plugin.language", "english", yamlConfiguration);
Config.set("BungeeCord.Enable", false, yamlConfiguration); Config.set("BungeeCord.Enable", false, yamlConfiguration);
Config.set("BungeeCord.ThisServer", "server", yamlConfiguration); Config.set("BungeeCord.ThisServer", "server", yamlConfiguration);
Config.set("Buy.Message", true, yamlConfiguration); Config.set("Buy.Message", true, yamlConfiguration);
Config.set("SubAlias.TabComplete", true, yamlConfiguration);
try { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);

View File

@ -4,20 +4,24 @@ import net.t2code.alias.Spigot.Main;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException;
public class SelectConfig { public class SelectConfig {
public static Integer ConfigVersion; private static Integer ConfigVersion = 3;
public static Integer isConfigVersion;
public static Boolean UpdateCheckOnJoin; public static Boolean UpdateCheckOnJoin;
public static String language; public static String language;
public static Boolean Bungee; public static Boolean Bungee;
public static String thisServer; public static String thisServer;
public static Boolean buyMessage; public static Boolean buyMessage;
public static Boolean subAliasTab;
public static void onSelect() { public static void onSelect() {
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
ConfigVersion =yamlConfiguration.getInt("ConfigVersion"); isConfigVersion = yamlConfiguration.getInt("ConfigVersion");
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin"); UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
language = yamlConfiguration.getString("Plugin.language"); language = yamlConfiguration.getString("Plugin.language");
@ -25,5 +29,16 @@ public class SelectConfig {
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer"); thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
buyMessage = yamlConfiguration.getBoolean("Buy.Message"); buyMessage = yamlConfiguration.getBoolean("Buy.Message");
subAliasTab = yamlConfiguration.getBoolean("SubAlias.TabComplete");
}
public static void setConfigVersion() {
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
yamlConfiguration.set("ConfigVersion", ConfigVersion);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
} }
} }

View File

@ -11,10 +11,9 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
public class LanguagesCreate { public class LanguagesCreate {
private static Plugin plugin = Main.plugin;
public static void langCreate() { public static void langCreate() {
send.debug(plugin,"§4Language files are created / updated..."); send.debug(Main.getPlugin(),"§4Language files are created / updated...");
long long_ = System.currentTimeMillis(); long long_ = System.currentTimeMillis();
/** /**
@ -38,7 +37,7 @@ public class LanguagesCreate {
try { try {
yamlConfigurationEN.save(messagesEN); yamlConfigurationEN.save(messagesEN);
} catch (IOException e) { } catch (IOException e) {
send.warning(plugin,e.getMessage()); send.warning(Main.getPlugin(),e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
@ -64,7 +63,7 @@ public class LanguagesCreate {
try { try {
yamlConfigurationDE.save(messagesDE); yamlConfigurationDE.save(messagesDE);
} catch (IOException e) { } catch (IOException e) {
send.warning(plugin,e.getMessage()); send.warning(Main.getPlugin(),e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -26,8 +26,8 @@ public class SelectMessages {
public static void onSelect(String Prefix) { public static void onSelect(String Prefix) {
send.debug(Main.plugin, "§4Select language..."); send.debug(Main.getPlugin(), "§4Select language...");
Long long_ = Long.valueOf(System.currentTimeMillis()); long long_ = System.currentTimeMillis();
File msg; File msg;
@ -52,7 +52,7 @@ public class SelectMessages {
buy = replace(yamlConfiguration.getString("Cost.Buy")); buy = replace(yamlConfiguration.getString("Cost.Buy"));
noMoney = replace(yamlConfiguration.getString("Cost.NoMoney")); noMoney = replace(yamlConfiguration.getString("Cost.NoMoney"));
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} }
private static String replace(String text) { private static String replace(String text) {

View File

@ -1,4 +1,4 @@
package net.t2code.alias.Spigot.config.config; package net.t2code.alias.Spigot.config.subAlias;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Util; import net.t2code.alias.Util;

View File

@ -1,4 +1,4 @@
package net.t2code.alias.Spigot.config.config; package net.t2code.alias.Spigot.config.subAlias;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.objects.SubAliasObject; import net.t2code.alias.Spigot.objects.SubAliasObject;
@ -28,14 +28,13 @@ public class SelectSubAlias {
Boolean aliasEnable = yamlConfiguration.getBoolean("SubAlias.Enable"); Boolean aliasEnable = yamlConfiguration.getBoolean("SubAlias.Enable");
List<String> subAliasList = yamlConfiguration.getStringList("SubAlias.SubAliasList"); List<String> subAliasList = yamlConfiguration.getStringList("SubAlias.SubAliasList");
String subAliasFor = yamlConfiguration.getString("SubAlias.SubAliasFor"); String subAliasFor = yamlConfiguration.getString("SubAlias.SubAliasFor");
String[] imp = subAliasFor.split(" ");
if (!Main.allAliases.contains(imp[0])) {
send.error(Main.plugin, "Den Alias " + imp[0] + " in der Datei " + config_gui.getName() + " existiert nicht!");
}
int subAliasArg = 0; int subAliasArg = 0;
if (subAliasFor != null) { if (subAliasFor != null) {
String[] imp = subAliasFor.split(" ");
if (!Main.allAliases.contains(imp[0])) {
send.error(Main.getPlugin(), "Den Alias " + imp[0] + " in der Datei " + config_gui.getName() + " existiert nicht!");
}
String[] args = subAliasFor.split(" "); String[] args = subAliasFor.split(" ");
send.debugmsg(Main.plugin, config_gui.getName() + " " +String.valueOf(args.length));
subAliasArg = args.length - 1; subAliasArg = args.length - 1;
} }
Boolean permNecessary = yamlConfiguration.getBoolean("SubAlias.Permission.Necessary"); Boolean permNecessary = yamlConfiguration.getBoolean("SubAlias.Permission.Necessary");
@ -78,6 +77,7 @@ public class SelectSubAlias {
} }
Main.allSubAliases.addAll(subAliasList); Main.allSubAliases.addAll(subAliasList);
Main.allForSubAliases.add(subAliasFor); Main.allForSubAliases.add(subAliasFor);
send.console(Prefix + " §aSubAlias file §e" + config_gui.getName() + " §awas loaded");
} }
} }
} }

View File

@ -13,7 +13,6 @@ import java.lang.reflect.Field;
public class AliasRegister { public class AliasRegister {
public static void onRegister() { public static void onRegister() {
Plugin plugin = Main.plugin;
for (String alias : Main.allAliases) { for (String alias : Main.allAliases) {
if (Main.aliasHashMap.get(alias) != null) { if (Main.aliasHashMap.get(alias) != null) {
if (alias.equals(" ")) continue; if (alias.equals(" ")) continue;
@ -27,7 +26,7 @@ public class AliasRegister {
e.printStackTrace(); e.printStackTrace();
} }
} }
} else send.warning(plugin, " §4AliasHashmap is null! - " + alias); } else send.warning(Main.getPlugin(), " §4AliasHashmap is null! - " + alias);
} }
} }
} }

View File

@ -9,7 +9,7 @@ public class AliasRegisterPermissions {
public static void onPermRegister() { public static void onPermRegister() {
for (String alias : Main.allAliases){ for (String alias : Main.allAliases){
if (Bukkit.getPluginManager().getPermission("t2code.alias.use." + alias.toLowerCase()) == null) { if (Bukkit.getPluginManager().getPermission("t2code.alias.use." + alias.toLowerCase()) == null) {
Register.permission("t2code.alias.use." + alias.toLowerCase(), Main.plugin); Register.permission("t2code.alias.use." + alias.toLowerCase(), Main.getPlugin());
} }
} }
} }

View File

@ -30,10 +30,10 @@ public class BCommandSenderReciver {
} }
if (sender instanceof Player) { if (sender instanceof Player) {
Player player = (Player) sender; Player player = (Player) sender;
player.sendPluginMessage(Main.plugin, "t2codealias:bungee", stream.toByteArray()); player.sendPluginMessage(Main.getPlugin(), "t2codealias:bungee", stream.toByteArray());
}else { }else {
for(Player player : Bukkit.getOnlinePlayers()){ for(Player player : Bukkit.getOnlinePlayers()){
player.sendPluginMessage(Main.plugin, "t2codealias:bungee", stream.toByteArray()); player.sendPluginMessage(Main.getPlugin(), "t2codealias:bungee", stream.toByteArray());
return; return;
} }
} }

View File

@ -17,19 +17,6 @@ public class JoinEvent implements Listener {
@EventHandler @EventHandler
public void onJoinEvent(PlayerLoginEvent event) { public void onJoinEvent(PlayerLoginEvent event) {
Player player = event.getPlayer(); UpdateAPI.join(Main.getPlugin(),Util.getPrefix(), "t2code.alias.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
new BukkitRunnable() {
@Override
public void run() {
String publicVersion = UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion;
if (player.hasPermission("alias.updatemsg") || player.isOp()) {
if (!Main.version.equals(publicVersion)) {
if (SelectLibConfig.UpdateCheckOnJoin) {
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, publicVersion, player);
}
}
}
}
}.runTaskLater(Main.plugin, 200L);
} }
} }

View File

@ -3,9 +3,13 @@ package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter; import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter;
import net.t2code.alias.Spigot.cmdManagement.TabEvent; import net.t2code.alias.Spigot.cmdManagement.TabEvent;
import net.t2code.alias.Spigot.config.alias.CreateExampleAliasConfig;
import net.t2code.alias.Spigot.config.alias.SelectAlias;
import net.t2code.alias.Spigot.config.config.*; import net.t2code.alias.Spigot.config.config.*;
import net.t2code.alias.Spigot.config.languages.LanguagesCreate; import net.t2code.alias.Spigot.config.languages.LanguagesCreate;
import net.t2code.alias.Spigot.config.languages.SelectMessages; import net.t2code.alias.Spigot.config.languages.SelectMessages;
import net.t2code.alias.Spigot.config.subAlias.CreateExampleSubAliasConfig;
import net.t2code.alias.Spigot.config.subAlias.SelectSubAlias;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate; import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
@ -19,11 +23,11 @@ import java.io.File;
import java.util.List; import java.util.List;
public class Load { public class Load {
static Plugin plugin = Main.plugin; private static Main plugin = Main.getPlugin();
public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) { public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord); Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
Main.plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter()); plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
loadReload(); loadReload();
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord); UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin); Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
@ -59,21 +63,20 @@ public class Load {
LanguagesCreate.langCreate(); LanguagesCreate.langCreate();
SelectConfig.onSelect(); SelectConfig.onSelect();
SelectMessages.onSelect(Util.getPrefix()); SelectMessages.onSelect(Util.getPrefix());
T2CodeTemplate.onLoadSeparateStroke(Util.getPrefix());
SelectAlias.onSelect(); SelectAlias.onSelect();
T2CodeTemplate.onLoadSeparateStroke(Util.getPrefix());
SelectSubAlias.onSelect(); SelectSubAlias.onSelect();
SelectConfig.setConfigVersion();
if (SelectConfig.subAliasTab) {
Register.listener(new TabEvent(), plugin); Register.listener(new TabEvent(), plugin);
}
if (SelectConfig.Bungee) { if (SelectConfig.Bungee) {
Main.plugin.getServer().getMessenger().registerOutgoingPluginChannel(Main.plugin, "BungeeCord"); plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "t2codealias:bungee"); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2codealias:bungee");
} }
AliasRegisterPermissions.onPermRegister(); AliasRegisterPermissions.onPermRegister();
send.debugmsg(plugin, Main.aliasHashMap.toString());
send.debugmsg(plugin, Main.allAliases.toString());
send.debugmsg(plugin, Main.subAliasHashMap.toString());
send.debugmsg(plugin, Main.allSubAliases.toString());
} }
} }

View File

@ -1,7 +1,7 @@
package net.t2code.alias; package net.t2code.alias;
public class Util { public class Util {
private static String requiredT2CodeLibVersion = "12.4_dev-1"; private static String requiredT2CodeLibVersion = "12.4";
private static String Prefix = "§8[§4T2Code§7-§aAlias§8]"; private static String Prefix = "§8[§4T2Code§7-§aAlias§8]";
private static Integer SpigotID = 96389; private static Integer SpigotID = 96389;
private static Integer BstatsID = 12517; private static Integer BstatsID = 12517;