new config.yml and new register

This commit is contained in:
2024-07-01 21:21:27 +02:00
parent 5d72e0d48d
commit b7b3fbcb03
13 changed files with 205 additions and 338 deletions

View File

@@ -16,7 +16,7 @@ import net.t2code.alias.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
@@ -26,12 +26,16 @@ import java.util.List;
public class Load {
private static final Main plugin = Main.getPlugin();
public static void onLoad(String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
public Load (Main main,String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID){
onLoad(main, prefix, autor, version, spigot, discord, bstatsID);
}
private void onLoad(Main main,String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
Long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
loadReload();
loadReload(main);
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(),
(Boolean) Config.updateCheckOnJoin.value, (Boolean) Config.updateCheckSeePreReleaseUpdates.value, (Integer) Config.updateCheckTimeInterval.value);
(Boolean) Config.VALUES.updateCheckOnJoin.getValue(), (Boolean) Config.VALUES.updateCheckSeePreReleaseUpdates.getValue(), (Integer) Config.VALUES.updateCheckTimeInterval.getValue());
T2Ctemplate.onLoadFooter(prefix, long_);
T2Cregister.listener(new PluginEvents(), plugin);
@@ -41,11 +45,11 @@ public class Load {
private static ChatConfirm chatListener;
private static GuiListener guiListener;
public static void loadReload() {
public static void loadReload(Main main) {
HandlerList.unregisterAll(chatListener);
HandlerList.unregisterAll(guiListener);
boolean newInstall = !new File(Main.getPath(), "config.yml").exists();
FileSelect.config();
Config.set();
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
FileSelect.language();
if (newInstall) {
@@ -66,12 +70,13 @@ public class Load {
} catch (Exception e) {
e.printStackTrace();
}
/**
try {
plugin.saveResource("X_configDeclaration_X.yml", true);
} catch (Exception e) {
e.printStackTrace();
}
*/
try {
plugin.saveResource("SubAlias/X_subAliasDeclaration_X.yml", true);
@@ -80,17 +85,17 @@ public class Load {
}
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
SelectAlias.onSelect();
new SelectAlias(main);
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
SelectSubAlias.onSelect();
if ((Boolean) Config.subAliasTab.value) {
if ((Boolean) Config.VALUES.subAliasTab.getValue()) {
T2Cregister.listener(new TabEvent(), plugin);
}
chatListener = new ChatConfirm();
if (Config.buyConfirmDefault.value == Confirm.CHAT) T2Cregister.listener(chatListener, plugin);
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.CHAT) T2Cregister.listener(chatListener, plugin);
guiListener = new GuiListener();
if (Config.buyConfirmDefault.value == Confirm.GUI) T2Cregister.listener(guiListener, plugin);
if (T2CLibConfig.getBungee()) {
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.GUI) T2Cregister.listener(guiListener, plugin);
if ((boolean)T2CLibConfig.VALUES.proxy.getValue()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
}
AliasRegisterPermissions.onPermRegister();