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

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