This commit is contained in:
JaTiTV 2022-11-15 23:51:17 +01:00
parent a40edcd290
commit d266098541
12 changed files with 147 additions and 134 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>AliasBungee</artifactId> <artifactId>AliasBungee</artifactId>
<version>1.0.7</version> <version>1.0.8</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>T2C-AliasBungee</name> <name>T2C-AliasBungee</name>
@ -79,7 +79,7 @@
<dependency> <dependency>
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>12.0</version> <version>13.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>

View File

@ -5,7 +5,7 @@ import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.alias.Bungee.objects.AliasObjekt; import net.t2code.alias.Bungee.objects.AliasObjekt;
import net.t2code.alias.Bungee.system.Load; import net.t2code.alias.Bungee.system.Load;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.lib.Bungee.Lib.messages.BT2CodeTemplate; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBtemplate;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -18,11 +18,11 @@ public final class Main extends Plugin {
return plugin.getDataFolder(); return plugin.getDataFolder();
} }
public static String prefix = Util.Prefix; public static String prefix = Util.getPrefix();
public static Integer spigotID = Util.SpigotID; public static Integer spigotID = Util.getSpigotID();
public static Integer bstatsID = Util.BstatsID; public static Integer bstatsID = Util.getBstatsID();
public static String spigot = Util.Spigot; public static String spigot = Util.getSpigot();
public static String discord = Util.Discord; public static String discord = Util.getDiscord();
public static String version; public static String version;
@ -52,20 +52,31 @@ public final class Main extends Plugin {
aliasHashMap.clear(); aliasHashMap.clear();
allAliases.clear(); allAliases.clear();
if (enable) return; if (enable) return;
BT2CodeTemplate.onDisable(prefix, autor, version, spigot, discord); T2CBtemplate.onDisable(prefix, autor, version, spigot, discord);
} }
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) { public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
if (ProxyServer.getInstance().getPluginManager().getPlugin(pl) == null) { if (ProxyServer.getInstance().getPluginManager().getPlugin(pl) == null) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!"); plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: " + ProxyServer.getInstance().getConsole().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."); "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
// BMain.plugin.getPluginLoader().disablePlugin(BMain.plugin);
Main.plugin.onDisable(); Main.plugin.onDisable();
return true; return true;
} else { } else {
if (Double.parseDouble(Objects.requireNonNull(ProxyServer.getInstance().getPluginManager().getPlugin(pl)).getDescription().getVersion()) < ver) { String plVer = ProxyServer.getInstance().getPluginManager().getPlugin(pl).getDescription().getVersion();
if (ver.contains("_")) {
if (!plVer.equals(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2" + ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
return true;
}
return false;
}
String[] split = plVer.split("_");
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!"); plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix() + " §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() + "."); ProxyServer.getInstance().getConsole().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.onDisable(); Main.plugin.onDisable();
return true; return true;
} }

View File

@ -6,7 +6,7 @@ import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.TabExecutor; import net.md_5.bungee.api.plugin.TabExecutor;
import net.t2code.alias.Bungee.Main; import net.t2code.alias.Bungee.Main;
import net.t2code.alias.Bungee.config.languages.SelectMessages; import net.t2code.alias.Bungee.config.languages.SelectMessages;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -26,7 +26,7 @@ public class Alias_CmdExecuter extends Command implements TabExecutor {
// Command // Command
if (sender.hasPermission("t2code.alias.command.info")) { if (sender.hasPermission("t2code.alias.command.info")) {
Commands.info(sender); Commands.info(sender);
} else Bsend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias info") } else T2CBsend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias info")
.replace("[perm]", "t2code.alias.command.info")); .replace("[perm]", "t2code.alias.command.info"));
} else { } else {
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
@ -34,7 +34,7 @@ public class Alias_CmdExecuter extends Command implements TabExecutor {
case "rl": case "rl":
if (sender.hasPermission("t2code.alias.command.reload")) { if (sender.hasPermission("t2code.alias.command.reload")) {
Commands.reload(sender); Commands.reload(sender);
} else Bsend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias reload") } else T2CBsend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias reload")
.replace("[perm]", "t2code.alias.command.reload")); .replace("[perm]", "t2code.alias.command.reload"));
break; break;
case "info": case "info":
@ -42,7 +42,7 @@ public class Alias_CmdExecuter extends Command implements TabExecutor {
case "version": case "version":
if (sender.hasPermission("t2code.alias.command.info")) { if (sender.hasPermission("t2code.alias.command.info")) {
Commands.info(sender); Commands.info(sender);
} else Bsend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias info") } else T2CBsend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias info")
.replace("[perm]", "t2code.alias.command.info")); .replace("[perm]", "t2code.alias.command.info"));
break; break;
} }

View File

@ -6,33 +6,31 @@ import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.alias.Bungee.Main; import net.t2code.alias.Bungee.Main;
import net.t2code.alias.Bungee.config.languages.SelectMessages; import net.t2code.alias.Bungee.config.languages.SelectMessages;
import net.t2code.alias.Bungee.system.Load; import net.t2code.alias.Bungee.system.Load;
import net.t2code.lib.Bungee.Lib.messages.BT2CodeTemplate; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBtemplate;
import net.t2code.lib.Bungee.Lib.update.BUpdateAPI;
public class Commands { public class Commands {
private static Plugin plugin = Main.plugin; private static Plugin plugin = Main.plugin;
private static String prefix = Main.prefix; private static String prefix = Main.prefix;
private static String autor = Main.autor; private static String autor = Main.autor;
private static String version = Main.version;
private static String spigot = Main.spigot; private static String spigot = Main.spigot;
private static String discord = Main.discord; private static String discord = Main.discord;
public static void info(CommandSender sender) { public static void info(CommandSender sender) {
BT2CodeTemplate.sendInfo(sender,prefix,spigot,discord,autor,version, BUpdateAPI.bungeePluginVersionen.get(plugin.getDescription().getName()).publicVersion); T2CBtemplate.sendInfo(sender,plugin,prefix,spigot,discord,autor);
} }
public static void reload(CommandSender sender) { public static void reload(CommandSender sender) {
if (sender instanceof ProxiedPlayer) sender.sendMessage(SelectMessages.reloadStart); if (sender instanceof ProxiedPlayer) sender.sendMessage(SelectMessages.reloadStart);
Bsend.console(Main.prefix + "§8-------------------------------"); T2CBsend.console(Main.prefix + "§8-------------------------------");
Bsend.console(Main.prefix + " §6Plugin reload..."); T2CBsend.console(Main.prefix + " §6Plugin reload...");
Bsend.console(Main.prefix + "§8-------------------------------"); T2CBsend.console(Main.prefix + "§8-------------------------------");
Load.loadReload(); Load.loadReload();
if (sender instanceof ProxiedPlayer) sender.sendMessage(SelectMessages.reloadEnd); if (sender instanceof ProxiedPlayer) sender.sendMessage(SelectMessages.reloadEnd);
Bsend.console(Main.prefix + "§8-------------------------------"); T2CBsend.console(Main.prefix + "§8-------------------------------");
Bsend.console(Main.prefix + " §2Plugin successfully reloaded."); T2CBsend.console(Main.prefix + " §2Plugin successfully reloaded.");
Bsend.console(Main.prefix + "§8-------------------------------"); T2CBsend.console(Main.prefix + "§8-------------------------------");
} }
} }

View File

@ -7,10 +7,10 @@ import net.md_5.bungee.api.plugin.Command;
import net.t2code.alias.Bungee.Main; import net.t2code.alias.Bungee.Main;
import net.t2code.alias.Bungee.config.languages.SelectMessages; import net.t2code.alias.Bungee.config.languages.SelectMessages;
import net.t2code.alias.Bungee.objects.AliasObjekt; import net.t2code.alias.Bungee.objects.AliasObjekt;
import net.t2code.lib.Bungee.Lib.commands.Bcmd; import net.t2code.t2codelib.BUNGEE.api.commands.T2CBcmd;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBreplace;
import net.t2code.lib.Bungee.Lib.replace.BReplace; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.lib.Spigot.Lib.messages.TextBuilder; import net.t2code.t2codelib.SPIGOT.api.messages.T2CtextBuilder;
public class RegisterCommands extends Command { public class RegisterCommands extends Command {
private final String alias; private final String alias;
@ -26,7 +26,7 @@ public class RegisterCommands extends Command {
AliasObjekt Alias = Main.aliasHashMap.get(alias); AliasObjekt Alias = Main.aliasHashMap.get(alias);
if (!Alias.aliasEnable) { if (!Alias.aliasEnable) {
Bsend.sender(sender, SelectMessages.aliasDisabled); T2CBsend.sender(sender, SelectMessages.aliasDisabled);
return; return;
} }
if (sender instanceof ProxiedPlayer) { if (sender instanceof ProxiedPlayer) {
@ -46,25 +46,25 @@ public class RegisterCommands extends Command {
if (Alias.adminCommandEnable) { if (Alias.adminCommandEnable) {
for (String cmd : Alias.adminCommands) { for (String cmd : Alias.adminCommands) {
if (Alias.adminCommandAsConsole) { if (Alias.adminCommandAsConsole) {
Bcmd.Console(cmd.replace("[player]", player.getName())); T2CBcmd.Console(cmd.replace("[player]", player.getName()));
} else { } else {
Bcmd.Player(player, cmd.replace("[player]", player.getName())); T2CBcmd.Player(player, cmd.replace("[player]", player.getName()));
} }
} }
} }
if (Alias.adminMessageEnable) { if (Alias.adminMessageEnable) {
for (String msg : Alias.adminMessages) { for (String msg : Alias.adminMessages) {
String text = BReplace.replace(prefix, msg); String text = T2CBreplace.replace(prefix, msg);
String hover = BReplace.replace(prefix, Alias.adminHover); String hover = T2CBreplace.replace(prefix, Alias.adminHover);
if (Alias.adminTextBuilder) { if (Alias.adminTextBuilder) {
TextBuilder textBuilder = new TextBuilder(text); T2CtextBuilder textBuilder = new T2CtextBuilder(text);
textBuilder.addHover(hover); textBuilder.addHover(hover);
if (Alias.adminClickEvent) { if (Alias.adminClickEvent) {
textBuilder.addClickEvent(ClickEvent.Action.valueOf(Alias.adminAction), Alias.adminActionValue); textBuilder.addClickEvent(ClickEvent.Action.valueOf(Alias.adminAction), Alias.adminActionValue);
} }
player.sendMessage(textBuilder.build()); player.sendMessage(textBuilder.build());
} else { } else {
Bsend.player(player, text); T2CBsend.player(player, text);
} }
} }
} }
@ -73,7 +73,7 @@ public class RegisterCommands extends Command {
} }
if (Alias.permNecessary) { if (Alias.permNecessary) {
if (!(player.hasPermission("t2code.alias.use." + alias.toLowerCase()) || player.hasPermission("t2code.alias.admin"))) { if (!(player.hasPermission("t2code.alias.use." + alias.toLowerCase()) || player.hasPermission("t2code.alias.admin"))) {
Bsend.player(player, SelectMessages.noPermissionForCommand.replace("[cmd]", "/" + alias.toLowerCase()) T2CBsend.player(player, SelectMessages.noPermissionForCommand.replace("[cmd]", "/" + alias.toLowerCase())
.replace("[perm]", "t2code.alias.use." + alias.toLowerCase())); .replace("[perm]", "t2code.alias.use." + alias.toLowerCase()));
return; return;
} }
@ -81,25 +81,25 @@ public class RegisterCommands extends Command {
if (Alias.command_Enable) { if (Alias.command_Enable) {
for (String cmd : Alias.command) { for (String cmd : Alias.command) {
if (Alias.commandAsConsole) { if (Alias.commandAsConsole) {
Bcmd.Console(cmd.replace("[player]", player.getName())); T2CBcmd.Console(cmd.replace("[player]", player.getName()));
} else { } else {
Bcmd.Player(player, cmd.replace("[player]", player.getName())); T2CBcmd.Player(player, cmd.replace("[player]", player.getName()));
} }
} }
} }
if (Alias.messageEnable) { if (Alias.messageEnable) {
for (String msg : Alias.messages) { for (String msg : Alias.messages) {
String text = BReplace.replace(prefix, msg); String text = T2CBreplace.replace(prefix, msg);
String hover = BReplace.replace(prefix, Alias.hover); String hover = T2CBreplace.replace(prefix, Alias.hover);
if (Alias.textBuilder) { if (Alias.textBuilder) {
TextBuilder textBuilder = new TextBuilder(text); T2CtextBuilder textBuilder = new T2CtextBuilder(text);
textBuilder.addHover(hover); textBuilder.addHover(hover);
if (Alias.clickEvent) { if (Alias.clickEvent) {
textBuilder.addClickEvent(ClickEvent.Action.valueOf(Alias.action), Alias.actionValue); textBuilder.addClickEvent(ClickEvent.Action.valueOf(Alias.action), Alias.actionValue);
} }
player.sendMessage(textBuilder.build()); player.sendMessage(textBuilder.build());
} else { } else {
Bsend.player(player, text); T2CBsend.player(player, text);
} }
} }
} }
@ -107,15 +107,15 @@ public class RegisterCommands extends Command {
if (Alias.consoleEnable) { if (Alias.consoleEnable) {
if (Alias.consoleCommandEnable) { if (Alias.consoleCommandEnable) {
for (String cmd : Alias.consoleCommands) { for (String cmd : Alias.consoleCommands) {
Bcmd.Console(cmd.replace("[player]", sender.getName())); T2CBcmd.Console(cmd.replace("[player]", sender.getName()));
} }
} }
if (Alias.consoleMessageEnable) { if (Alias.consoleMessageEnable) {
for (String msg : Alias.consoleMessages) { for (String msg : Alias.consoleMessages) {
Bsend.console(BReplace.replace(prefix, msg)); T2CBsend.console(T2CBreplace.replace(prefix, msg));
} }
} }
} else Bsend.sender(sender, SelectMessages.onlyForPlayer); } else T2CBsend.sender(sender, SelectMessages.onlyForPlayer);
} }
return; return;
} }

View File

@ -4,8 +4,8 @@ import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider; import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration; import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.alias.Bungee.Main; import net.t2code.alias.Bungee.Main;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.lib.Bungee.Lib.yamlConfiguration.BConfig; import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfig;
import java.io.File; import java.io.File;
@ -15,7 +15,7 @@ public class CreateConfig {
public static Integer ConfigVersion = 1; public static Integer ConfigVersion = 1;
public static void configCreate() throws IOException { public static void configCreate() throws IOException {
Long long_ = Long.valueOf(System.currentTimeMillis()); long long_ = System.currentTimeMillis();
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
if (!config.exists()) { if (!config.exists()) {
@ -26,10 +26,10 @@ public class CreateConfig {
configuration.set("ConfigVersion", ConfigVersion); configuration.set("ConfigVersion", ConfigVersion);
//BConfig.set("Plugin.UpdateCheckOnJoin", true, configuration); //BConfig.set("Plugin.UpdateCheckOnJoin", true, configuration);
BConfig.set("Plugin.language", "english", configuration); T2CBconfig.set("Plugin.language", "english", configuration);
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config); ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config);
Bsend.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); T2CBsend.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} }
} }

View File

@ -4,8 +4,8 @@ import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider; import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration; import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.alias.Bungee.Main; import net.t2code.alias.Bungee.Main;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.lib.Bungee.Lib.yamlConfiguration.BConfig; import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfig;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -51,7 +51,7 @@ public class CreateExampleAliasConfig {
private static List<String> ConsoleMessages = Arrays.asList(); private static List<String> ConsoleMessages = Arrays.asList();
public static void configCreate() throws IOException { public static void configCreate() throws IOException {
Long long_ = Long.valueOf(System.currentTimeMillis()); long long_ = System.currentTimeMillis();
File directory = new File(Main.getPath(), "Alias"); File directory = new File(Main.getPath(), "Alias");
if (!directory.exists()) { if (!directory.exists()) {
@ -65,46 +65,46 @@ public class CreateExampleAliasConfig {
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config); Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
BConfig.set("Alias.Enable", Enable, configuration); T2CBconfig.set("Alias.Enable", Enable, configuration);
BConfig.set("Alias.Permission.Necessary", PermNecessary, configuration); T2CBconfig.set("Alias.Permission.Necessary", PermNecessary, configuration);
BConfig.set("Alias.Protection.Server.Enable", false, configuration); T2CBconfig.set("Alias.Protection.Server.Enable", false, configuration);
BConfig.set("Alias.Protection.Server.Mode", "blacklist", configuration); T2CBconfig.set("Alias.Protection.Server.Mode", "blacklist", configuration);
BConfig.set("Alias.Protection.Server.List", Arrays.asList("Server1", "Server2"), configuration); T2CBconfig.set("Alias.Protection.Server.List", Arrays.asList("Server1", "Server2"), configuration);
BConfig.set("Alias.Command.Enable", CommandEnable, configuration); T2CBconfig.set("Alias.Command.Enable", CommandEnable, configuration);
BConfig.set("Alias.Command.CommandAsConsole", CommandAsConsole, configuration); T2CBconfig.set("Alias.Command.CommandAsConsole", CommandAsConsole, configuration);
BConfig.set("Alias.Command.Commands", Commands, configuration); T2CBconfig.set("Alias.Command.Commands", Commands, configuration);
BConfig.set("Alias.Message.Enable", MessageEnable, configuration); T2CBconfig.set("Alias.Message.Enable", MessageEnable, configuration);
BConfig.set("Alias.Message.Messages", Messages, configuration); T2CBconfig.set("Alias.Message.Messages", Messages, configuration);
BConfig.set("Alias.Message.TextBuilder.Enable", TextBuilder, configuration); T2CBconfig.set("Alias.Message.TextBuilder.Enable", TextBuilder, configuration);
BConfig.set("Alias.Message.TextBuilder.Hover", Hover, configuration); T2CBconfig.set("Alias.Message.TextBuilder.Hover", Hover, configuration);
BConfig.set("Alias.Message.TextBuilder.ClickEvent.Enable", ClickEvent, configuration); T2CBconfig.set("Alias.Message.TextBuilder.ClickEvent.Enable", ClickEvent, configuration);
BConfig.set("Alias.Message.TextBuilder.ClickEvent.Action", Action, configuration); T2CBconfig.set("Alias.Message.TextBuilder.ClickEvent.Action", Action, configuration);
BConfig.set("Alias.Message.TextBuilder.ClickEvent.ActionValue", ActionValue, configuration); T2CBconfig.set("Alias.Message.TextBuilder.ClickEvent.ActionValue", ActionValue, configuration);
BConfig.set("Alias.Admin.Enable", AdminEnable, configuration); T2CBconfig.set("Alias.Admin.Enable", AdminEnable, configuration);
BConfig.set("Alias.Admin.Permission", AdminPermission, configuration); T2CBconfig.set("Alias.Admin.Permission", AdminPermission, configuration);
BConfig.set("Alias.Admin.Command.Enable", AdminCommandEnable, configuration); T2CBconfig.set("Alias.Admin.Command.Enable", AdminCommandEnable, configuration);
BConfig.set("Alias.Admin.Command.CommandAsConsole", AdminCommandAsConsole, configuration); T2CBconfig.set("Alias.Admin.Command.CommandAsConsole", AdminCommandAsConsole, configuration);
BConfig.set("Alias.Admin.Command.Commands", AdminCommands, configuration); T2CBconfig.set("Alias.Admin.Command.Commands", AdminCommands, configuration);
BConfig.set("Alias.Admin.Message.Enable", AdminMessageEnable, configuration); T2CBconfig.set("Alias.Admin.Message.Enable", AdminMessageEnable, configuration);
BConfig.set("Alias.Admin.Message.Messages", AdminMessages, configuration); T2CBconfig.set("Alias.Admin.Message.Messages", AdminMessages, configuration);
BConfig.set("Alias.Admin.Message.TextBuilder.Enable", AdminTextBuilder, configuration); T2CBconfig.set("Alias.Admin.Message.TextBuilder.Enable", AdminTextBuilder, configuration);
BConfig.set("Alias.Admin.Message.TextBuilder.Hover", AdminHover, configuration); T2CBconfig.set("Alias.Admin.Message.TextBuilder.Hover", AdminHover, configuration);
BConfig.set("Alias.Admin.Message.TextBuilder.ClickEvent.Enable", AdminClickEvent, configuration); T2CBconfig.set("Alias.Admin.Message.TextBuilder.ClickEvent.Enable", AdminClickEvent, configuration);
BConfig.set("Alias.Admin.Message.TextBuilder.ClickEvent.Action", AdminAction, configuration); T2CBconfig.set("Alias.Admin.Message.TextBuilder.ClickEvent.Action", AdminAction, configuration);
BConfig.set("Alias.Admin.Message.TextBuilder.ClickEvent.ActionValue", AdminActionValue, configuration); T2CBconfig.set("Alias.Admin.Message.TextBuilder.ClickEvent.ActionValue", AdminActionValue, configuration);
BConfig.set("Alias.Console.Enable", ConsoleEnable, configuration); T2CBconfig.set("Alias.Console.Enable", ConsoleEnable, configuration);
BConfig.set("Alias.Console.Command.Enable", ConsoleCommandEnable, configuration); T2CBconfig.set("Alias.Console.Command.Enable", ConsoleCommandEnable, configuration);
BConfig.set("Alias.Console.Command.Commands", ConsoleCommands, configuration); T2CBconfig.set("Alias.Console.Command.Commands", ConsoleCommands, configuration);
BConfig.set("Alias.Console.Message.Enable", ConsoleMessageEnable, configuration); T2CBconfig.set("Alias.Console.Message.Enable", ConsoleMessageEnable, configuration);
BConfig.set("Alias.Console.Message.Messages", ConsoleMessages, configuration); T2CBconfig.set("Alias.Console.Message.Messages", ConsoleMessages, configuration);
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config); ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config);
Bsend.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); T2CBsend.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} }
} }

View File

@ -5,8 +5,8 @@ import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider; import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration; import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.alias.Bungee.Main; import net.t2code.alias.Bungee.Main;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.lib.Bungee.Lib.yamlConfiguration.BConfig; import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfig;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -15,7 +15,7 @@ public class LanguagesCreate {
private static Plugin plugin = Main.plugin; private static Plugin plugin = Main.plugin;
public static void langCreate() throws IOException { public static void langCreate() throws IOException {
Bsend.debug(plugin, "§4Language files are created / updated..."); T2CBsend.debug(plugin, "§4Language files are created / updated...");
Long long_ = Long.valueOf(System.currentTimeMillis()); Long long_ = Long.valueOf(System.currentTimeMillis());
/** /**
@ -33,11 +33,11 @@ public class LanguagesCreate {
} }
Configuration configurationEN = ConfigurationProvider.getProvider(YamlConfiguration.class).load(messagesEN); Configuration configurationEN = ConfigurationProvider.getProvider(YamlConfiguration.class).load(messagesEN);
BConfig.set("Plugin.OnlyForPlayer", MSG.EN_OnlyForPlayer, configurationEN); T2CBconfig.set("Plugin.OnlyForPlayer", MSG.EN_OnlyForPlayer, configurationEN);
BConfig.set("Plugin.AliasDisabled", MSG.EN_Disabled, configurationEN); T2CBconfig.set("Plugin.AliasDisabled", MSG.EN_Disabled, configurationEN);
BConfig.set("Plugin.Reload.Start", MSG.EN_ReloadStart, configurationEN); T2CBconfig.set("Plugin.Reload.Start", MSG.EN_ReloadStart, configurationEN);
BConfig.set("Plugin.Reload.End", MSG.EN_ReloadEnd, configurationEN); T2CBconfig.set("Plugin.Reload.End", MSG.EN_ReloadEnd, configurationEN);
BConfig.set("Plugin.ForCommand", MSG.EN_NoPermissionForCommand, configurationEN); T2CBconfig.set("Plugin.ForCommand", MSG.EN_NoPermissionForCommand, configurationEN);
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configurationEN, messagesEN); ConfigurationProvider.getProvider(YamlConfiguration.class).save(configurationEN, messagesEN);
@ -53,14 +53,14 @@ public class LanguagesCreate {
} }
Configuration configurationDE = ConfigurationProvider.getProvider(YamlConfiguration.class).load(messagesDE); Configuration configurationDE = ConfigurationProvider.getProvider(YamlConfiguration.class).load(messagesDE);
BConfig.set("Plugin.OnlyForPlayer", MSG.DE_OnlyForPlayer, configurationDE); T2CBconfig.set("Plugin.OnlyForPlayer", MSG.DE_OnlyForPlayer, configurationDE);
BConfig.set("Plugin.AliasDisabled", MSG.DE_Disabled, configurationDE); T2CBconfig.set("Plugin.AliasDisabled", MSG.DE_Disabled, configurationDE);
BConfig.set("Plugin.Reload.Start", MSG.DE_ReloadStart, configurationDE); T2CBconfig.set("Plugin.Reload.Start", MSG.DE_ReloadStart, configurationDE);
BConfig.set("Plugin.Reload.End", MSG.DE_ReloadEnd, configurationDE); T2CBconfig.set("Plugin.Reload.End", MSG.DE_ReloadEnd, configurationDE);
BConfig.set("Plugin.ForCommand", MSG.DE_NoPermissionForCommand, configurationDE); T2CBconfig.set("Plugin.ForCommand", MSG.DE_NoPermissionForCommand, configurationDE);
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configurationEN, messagesDE); ConfigurationProvider.getProvider(YamlConfiguration.class).save(configurationEN, messagesDE);
Bsend.console(Main.prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); T2CBsend.console(Main.prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
} }
} }

View File

@ -6,8 +6,8 @@ import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.alias.Bungee.Main; import net.t2code.alias.Bungee.Main;
import net.t2code.alias.Bungee.config.config.SelectConfig; import net.t2code.alias.Bungee.config.config.SelectConfig;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.lib.Bungee.Lib.yamlConfiguration.BConfig; import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfig;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -28,26 +28,26 @@ public class SelectMessages {
public static void onSelect(String Prefix)throws IOException { public static void onSelect(String Prefix)throws IOException {
File msg = new File(Main.getPath(), "languages/" + SelectConfig.language + ".yml"); File msg = new File(Main.getPath(), "languages/" + SelectConfig.language + ".yml");
Bsend.debug(Main.plugin, "§4Select language..."); T2CBsend.debug(Main.plugin, "§4Select language...");
Long long_ = Long.valueOf(System.currentTimeMillis()); Long long_ = Long.valueOf(System.currentTimeMillis());
if (!msg.isFile()) { if (!msg.isFile()) {
Bsend.console(Prefix); T2CBsend.console(Prefix);
Bsend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); T2CBsend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Bsend.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found."); T2CBsend.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found.");
Bsend.console(Prefix + " §6The default language §eEnglish §6is used!"); T2CBsend.console(Prefix + " §6The default language §eEnglish §6is used!");
Bsend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); T2CBsend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Bsend.console(Prefix); T2CBsend.console(Prefix);
msg = new File(Main.getPath(), "languages/" + "english.yml"); msg = new File(Main.getPath(), "languages/" + "english.yml");
selectMSG = "english"; selectMSG = "english";
} else selectMSG = SelectConfig.language; } else selectMSG = SelectConfig.language;
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(msg); Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(msg);
onlyForPlayer = BConfig.select(prefix, "Plugin.OnlyForPlayer", configuration); onlyForPlayer = T2CBconfig.select(prefix, "Plugin.OnlyForPlayer", configuration);
aliasDisabled = BConfig.select(prefix, "Plugin.AliasDisabled", configuration); aliasDisabled = T2CBconfig.select(prefix, "Plugin.AliasDisabled", configuration);
reloadStart = BConfig.select(prefix, "Plugin.Reload.Start", configuration); reloadStart = T2CBconfig.select(prefix, "Plugin.Reload.Start", configuration);
reloadEnd = BConfig.select(prefix, "Plugin.Reload.End", configuration); reloadEnd = T2CBconfig.select(prefix, "Plugin.Reload.End", configuration);
noPermissionForCommand = BConfig.select(prefix, "Plugin.ForCommand", configuration); noPermissionForCommand = T2CBconfig.select(prefix, "Plugin.ForCommand", configuration);
Bsend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); T2CBsend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
} }
} }

View File

@ -4,7 +4,7 @@ import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.alias.Bungee.Main; import net.t2code.alias.Bungee.Main;
import net.t2code.alias.Bungee.cmdManagement.RegisterCommands; import net.t2code.alias.Bungee.cmdManagement.RegisterCommands;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
public class AliasRegister { public class AliasRegister {
public static void onRegister() { public static void onRegister() {
@ -12,10 +12,10 @@ public class AliasRegister {
for (String alias : Main.allAliases) { for (String alias : Main.allAliases) {
if (Main.aliasHashMap.get(alias) != null) { if (Main.aliasHashMap.get(alias) != null) {
if (Main.aliasHashMap.get(alias).aliasEnable) { if (Main.aliasHashMap.get(alias).aliasEnable) {
Bsend.debug(plugin, "Alias register 1.18_R1"); T2CBsend.debug(plugin, "Alias register 1.18_R1");
ProxyServer.getInstance().getPluginManager().registerCommand(Main.plugin, new RegisterCommands(alias)); ProxyServer.getInstance().getPluginManager().registerCommand(Main.plugin, new RegisterCommands(alias));
} }
} else Bsend.warning(plugin, " §4AliasHashmap is null!"); } else T2CBsend.warning(plugin, " §4AliasHashmap is null!");
} }
} }
} }

View File

@ -10,9 +10,9 @@ import net.t2code.alias.Bungee.config.config.SelectAlias;
import net.t2code.alias.Bungee.config.config.SelectConfig; import net.t2code.alias.Bungee.config.config.SelectConfig;
import net.t2code.alias.Bungee.config.languages.LanguagesCreate; import net.t2code.alias.Bungee.config.languages.LanguagesCreate;
import net.t2code.alias.Bungee.config.languages.SelectMessages; import net.t2code.alias.Bungee.config.languages.SelectMessages;
import net.t2code.lib.Bungee.Lib.messages.BT2CodeTemplate; import net.t2code.alias.Util;
import net.t2code.lib.Bungee.Lib.update.BUpdateAPI; import net.t2code.t2codelib.BUNGEE.api.messages.T2CBtemplate;
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
import java.io.File; import java.io.File;
@ -21,13 +21,14 @@ import java.io.IOException;
public class Load { public class Load {
static Plugin plugin = Main.plugin; static Plugin plugin = Main.plugin;
public static void onLoad(String prefix, String autor, String version, String spigot, int spigotID, String discord, int bstatsID) { public static void onLoad(String prefix, String autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
Long long_ = BT2CodeTemplate.onLoadHeader(prefix,autor,version,spigot,discord); Long long_ = T2CBtemplate.onLoadHeader(prefix,autor,version,spigot,discord);
if (!Main.getPath().exists()) Main.getPath().mkdir(); if (!Main.getPath().exists()) Main.getPath().mkdir();
ProxyServer.getInstance().getPluginManager().registerCommand(Main.plugin, new Alias_CmdExecuter()); ProxyServer.getInstance().getPluginManager().registerCommand(Main.plugin, new Alias_CmdExecuter());
loadReload(); loadReload();
BUpdateAPI.onUpdateCheckTimer(plugin, prefix, spigot, discord, spigotID);
BT2CodeTemplate.onLoadFooter(prefix, long_); T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix,discord,spigotID, Util.getGit());
T2CBtemplate.onLoadFooter(prefix, long_);
Metrics metrics = new Metrics(plugin, bstatsID); Metrics metrics = new Metrics(plugin, bstatsID);
} }

View File

@ -4,15 +4,18 @@ import lombok.Getter;
public class Util { public class Util {
@Getter @Getter
public static double requiredT2CodeLibVersion = 12.0; private static String requiredT2CodeLibVersion = "13.4";
@Getter @Getter
public static String Prefix = "§8[§4T2Code§7-§aAlias§5Bungee§8]"; private static String prefix = "§8[§4T2Code§7-§aAlias§5Bungee§8]";
@Getter @Getter
public static Integer SpigotID = 99316; private static Integer spigotID = 99316;
@Getter @Getter
public static Integer BstatsID = 13992; private static String git= "JaTiTV/T2Code-Alias-Bungee";
@Getter @Getter
public static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID; private static Integer bstatsID = 13992;
@Getter @Getter
public static String Discord = "http://dc.t2code.net"; private static String spigot = "https://www.spigotmc.org/resources/" + spigotID;
@Getter
private static String discord = "http://dc.t2code.net";
} }