diff --git a/pom.xml b/pom.xml index 2e9bc69..162d207 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.t2code Alias - 1.0.9 + 1.0.10 jar T2C-Alias diff --git a/src/main/java/net/t2code/alias/Spigot/Main.java b/src/main/java/net/t2code/alias/Spigot/Main.java index 1e1f1da..f0c60c9 100644 --- a/src/main/java/net/t2code/alias/Spigot/Main.java +++ b/src/main/java/net/t2code/alias/Spigot/Main.java @@ -21,9 +21,7 @@ public final class Main extends JavaPlugin { public static String version; public static List autor; - public static Main plugin; - public static HashMap aliasHashMap = new HashMap<>(); public static ArrayList allAliases = new ArrayList<>(); diff --git a/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterCommands.java b/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterCommands.java index cad67e1..efbf5b1 100644 --- a/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterCommands.java +++ b/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterCommands.java @@ -176,15 +176,14 @@ public class RegisterCommands extends Command { for (String cmd : alias.consoleCommands) { if (alias.consoleBungeeCommand) { if (SelectConfig.Bungee) { - BCommandSenderReciver.sendToBungee(sender, cmd.replace("[player]", sender.getName()), true); + BCommandSenderReciver.sendToBungee(sender, cmd, true); } else { send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config."); send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config."); } } else { - Cmd.console(cmd.replace("[player]", sender.getName())); + Cmd.console(cmd); } - } } if (alias.consoleMessageEnable) { diff --git a/src/main/java/net/t2code/alias/Spigot/config/config/CreateConfig.java b/src/main/java/net/t2code/alias/Spigot/config/config/CreateConfig.java index 2d88cf8..7df2ead 100644 --- a/src/main/java/net/t2code/alias/Spigot/config/config/CreateConfig.java +++ b/src/main/java/net/t2code/alias/Spigot/config/config/CreateConfig.java @@ -18,7 +18,6 @@ public class CreateConfig { if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated..."); } else send.console(Util.getPrefix() + " §4config.yml are created..."); - File config = new File(Main.getPath(), "config.yml"); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); diff --git a/src/main/java/net/t2code/alias/Spigot/config/config/CreateExampleAliasConfig.java b/src/main/java/net/t2code/alias/Spigot/config/config/CreateExampleAliasConfig.java index 6d34e99..b66f198 100644 --- a/src/main/java/net/t2code/alias/Spigot/config/config/CreateExampleAliasConfig.java +++ b/src/main/java/net/t2code/alias/Spigot/config/config/CreateExampleAliasConfig.java @@ -8,24 +8,17 @@ import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; -import java.util.List; public class CreateExampleAliasConfig { - public static void configCreate() { long long_ = System.currentTimeMillis(); - 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..."); - } else send.console(Util.getPrefix() + " §4config.yml are created..."); - + send.console(Util.getPrefix() + " §4Alias/aliasexample.yml are created..."); File config = new File(Main.getPath(), "Alias/aliasexample.yml"); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); - Config.set("Alias.Enable", true, yamlConfiguration); Config.set("Alias.Permission.Necessary", true, yamlConfiguration); @@ -73,6 +66,6 @@ public class CreateExampleAliasConfig { } catch (IOException e) { e.printStackTrace(); } - send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + send.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); } } diff --git a/src/main/java/net/t2code/alias/Spigot/config/config/SelectAlias.java b/src/main/java/net/t2code/alias/Spigot/config/config/SelectAlias.java index 06f1eac..6506dd3 100644 --- a/src/main/java/net/t2code/alias/Spigot/config/config/SelectAlias.java +++ b/src/main/java/net/t2code/alias/Spigot/config/config/SelectAlias.java @@ -18,6 +18,7 @@ public class SelectAlias { File f = new File(Main.getPath() + "/Alias/"); File[] fileArray = f.listFiles(); for (File config_gui : fileArray) { + if (config_gui.getName().equals("X_aliasDeclaration_X.yml")) return; String sub = config_gui.getName().substring(config_gui.getName().length() - 4); if (sub.equals(".yml")) { Main.allAliases.add(config_gui.getName().replace(".yml", "")); diff --git a/src/main/java/net/t2code/alias/Spigot/system/Load.java b/src/main/java/net/t2code/alias/Spigot/system/Load.java index 48259db..642954e 100644 --- a/src/main/java/net/t2code/alias/Spigot/system/Load.java +++ b/src/main/java/net/t2code/alias/Spigot/system/Load.java @@ -32,7 +32,6 @@ public class Load { } public static void loadReload() { - if (!new File(Main.getPath(), "config.yml").exists()) { try { CreateExampleAliasConfig.configCreate(); @@ -40,7 +39,11 @@ public class Load { e.printStackTrace(); } } - + try { + plugin.saveResource("Alias/X_aliasDeclaration_X.yml",true); + } catch (Exception e) { + e.printStackTrace(); + } CreateConfig.configCreate(); LanguagesCreate.langCreate(); SelectConfig.onSelect(); @@ -53,4 +56,5 @@ public class Load { } AliasRegisterPermissions.onPermRegister(); } + } diff --git a/src/main/resources/Alias/X_aliasDeclaration_X.yml b/src/main/resources/Alias/X_aliasDeclaration_X.yml new file mode 100644 index 0000000..1ab94e1 --- /dev/null +++ b/src/main/resources/Alias/X_aliasDeclaration_X.yml @@ -0,0 +1,130 @@ +#################################################################### +## To create another alias, simply copy the file ## +## and name it what you want the aliascommand to be. ## +## The alias command is always the filename without .yml!!! ## +#################################################################### + +Alias: + # Here you can disable the alias + Enable: true + Permission: + # Here you can say if a permission is needed to use the alias# + # Permission: t2code.alias.use. + Necessary: true + Cost: + # Here you can say if you have to pay for the alias + Enable: false + # Here you set the price + Price: 0.0 + # Here you define if the bypass is activated or if you have to pay despite the bypass (t2code.alias.buy.bypass). + AllowByPass: true + Command: + # Here you can tell the alias to execute one or more commands + Enable: false + # Here you can specify whether the command should be executed from the console of the server + CommandAsConsole: false + # Here you can define if the command should be executed on the bungee. + # For this option, BungeeCord must be set to true in config.yml and the plugin must also work on the proxy as a bridge. + # (If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled). + BungeeCommand: false + # Here you can specify one or more commands to be executed. + # Placeholder: [player] = The player who executes the alias + Commands: [] + Message: + # Here you can specify whether the player should receive a message. + Enable: false + # Specify here the message that the player should get. + # Multiple lines can be used and placeholders are supported! + # Placeholder: [player] = The player who executes the alias + Messages: [] + # With the TextBuilder it is possible to create messages with hover and clickable messages with actions. + # !!! There is currently a poll on our Discord asking if this option should be removed !!! + # To the poll: https://ptb.discord.com/channels/780682397950672897/915625982910672896/984228029297471529 + TextBuilder: + # Here you can activate the TextBuilder. + Enable: false + # Set the hover here + Hover: '' + ClickEvent: + # Here you can give the message a function when clicked on + Enable: false + # Specify here what should happen + # OPEN_URL - Opens a URL under the path specified in ActionValue. + # OPEN_FILE - Opens a file under the path specified by ActionValue. + # RUN_COMMAND - Runs the command specified by ActionValue. + # SUGGEST_COMMAND - Inserts the string specified in ActionValue into the player text box. + # CHANGE_PAGE - Changes to the page number in a book specified by ActionValue. + # COPY_TO_CLIPBOARD - Copies the string specified by ActionValue to the player's clipboard. + Action: '' + # Here you set the value of the action. + # For example, the URL for the link to be opened or the command to be executed. + ActionValue: '' + + # Here you can specify that players with the permission () have a different function than other players. + # For example, you can say that players should come to a certain point and players with the admin function only to the server to the position where they were before. + # Example: + # Player: /warp CityBuild + # Player with Admin Perm: /server CityBuild + Admin: + # Here you can enable or disable the admin function + Enable: true + # Here you set the permission for the admin function + Permission: t2code.alias.admin + Command: + # Here you can tell the alias to execute one or more commands + Enable: false + # Here you can specify whether the command should be executed from the console of the server + CommandAsConsole: false + # Here you can define if the command should be executed on the bungee. + # For this option, BungeeCord must be set to true in config.yml and the plugin must also work on the proxy as a bridge. + # (If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled). + BungeeCommand: false + # Here you can specify one or more commands to be executed. + # Placeholder: [player] = The player who executes the alias + Commands: [] + Message: + # Here you can specify whether the player should receive a message. + Enable: false + # Specify here the message that the player should get. + # Multiple lines can be used and placeholders are supported! + # Placeholder: [player] = The player who executes the alias + Messages: [ ] + # With the TextBuilder it is possible to create messages with hover and clickable messages with actions. + # !!! There is currently a poll on our Discord asking if this option should be removed !!! + # To the poll: https://ptb.discord.com/channels/780682397950672897/915625982910672896/984228029297471529 + TextBuilder: + # Here you can activate the TextBuilder. + Enable: false + # Set the hover here + Hover: '' + ClickEvent: + # Here you can give the message a function when clicked on + Enable: false + # Specify here what should happen + # OPEN_URL - Opens a URL under the path specified in ActionValue. + # OPEN_FILE - Opens a file under the path specified by ActionValue. + # RUN_COMMAND - Runs the command specified by ActionValue. + # SUGGEST_COMMAND - Inserts the string specified in ActionValue into the player text box. + # CHANGE_PAGE - Changes to the page number in a book specified by ActionValue. + # COPY_TO_CLIPBOARD - Copies the string specified by ActionValue to the player's clipboard. + Action: '' + # Here you set the value of the action. + # For example, the URL for the link to be opened or the command to be executed. + ActionValue: '' + + Console: + # Here you can define if the alias is also usable in the console and what it should do from there. + Enable: false + Command: + # Here you can tell the alias to execute one or more commands + Enable: false + # Here you can specify whether the command should be executed by the Bungee console. + # For this option, BungeeCord must be set to true in config.yml and the plugin must also work on the proxy as a bridge. + BungeeCommand: false + # Here you can specify one or more commands to be executed. + Commands: [ ] + Message: + # Here you can specify whether the player should receive a message. + Enable: false + # Specify here the message that the player should get. + Messages: [ ]