- A description / explanation of the alias files has been added.
- Small code changes
This commit is contained in:
JaTiTV 2022-06-09 01:43:11 +02:00
parent 4334b26be5
commit e189722366
8 changed files with 142 additions and 18 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>Alias</artifactId>
<version>1.0.9</version>
<version>1.0.10</version>
<packaging>jar</packaging>
<name>T2C-Alias</name>

View File

@ -21,9 +21,7 @@ public final class Main extends JavaPlugin {
public static String version;
public static List<String> autor;
public static Main plugin;
public static HashMap<String, AliasObjekt> aliasHashMap = new HashMap<>();
public static ArrayList<String> allAliases = new ArrayList<>();

View File

@ -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) {

View File

@ -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);

View File

@ -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");
}
}

View File

@ -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", ""));

View File

@ -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();
}
}

View File

@ -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.<aliasname>
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: [ ]