final 1.2.3_beta-1

This commit is contained in:
JaTiTV 2023-07-08 22:47:52 +02:00
parent fd0db6939a
commit 6e96509069
7 changed files with 79 additions and 25 deletions

View File

@ -17,7 +17,7 @@ public enum Config {
buyMessage("buy.message", true, ConfigParam.BOOLEAN),
buyCurrency("buy.currency", "$", ConfigParam.STRING),
buyConfirmDefault("buy.confirm.default", Confirm.COMMAND, ConfigParam.CONFIRMENUM),
buyConfirmDefault("buy.confirm.use", Confirm.COMMAND, ConfigParam.CONFIRMENUM),
buyConfirmGuiFillItemEnabled("buy.confirm.gui.fillItem.enabled", true, ConfigParam.BOOLEAN),
buyConfirmGuiFillItem("buy.confirm.gui.fillItem.material", T2CitemVersion.getBlackStainedGlassPane().getType().toString(), ConfigParam.STRING),
buyConfirmGuiConfirm("buy.confirm.gui.confirm.material", T2CitemVersion.getGreenWool().getType().toString(), ConfigParam.STRING),

View File

@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
@ -16,24 +17,16 @@ import java.util.logging.Level;
public class Convert {
protected static void convert() {
convertTo4();
File config = new File(Main.getPath(),"");
if (config.exists()) convertTo4();
}
private static void convertTo4() {
// File dir = new File(Main.getPath(), "languages");
// File newDir = new File(Main.getPath() + "/languages/old/configVersion3");
//
// try {
// FileUtils.moveDirectory(dir, newDir);
// } catch (IOException e) {
// e.printStackTrace();
// }
long long1 = System.currentTimeMillis();
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.get(Config.configVersion.path) == null || ((Integer) Config.configVersion.value) < Util.getConfigVersion() && new File(Main.getPath(), "config.yml").exists()) {
System.out.println("convert");
yamlConfiguration.set("ConfigVersion", null);
try {
yamlConfiguration.save(config);
@ -52,6 +45,7 @@ public class Convert {
File f = new File(Main.getPath() + "/OldConfig/Version3/languages/");
File[] fileArray = f.listFiles();
for (File file : fileArray) {
long long2 = System.currentTimeMillis();
String sub = file.getName().substring(file.getName().length() - 4);
if (sub.equals(".yml")) {
YamlConfiguration yamlConfigurationOld;
@ -90,10 +84,11 @@ public class Convert {
T2Csend.warning(Main.getPlugin(), e.getMessage());
e.printStackTrace();
}
T2Csend.console(Util.getPrefix() + " §2The language file §6(" + newFile.getName() + ") &2was converted to the new config format §7- §e" + (System.currentTimeMillis() - long2) + "ms");
}
}
} else System.out.println("not convert");
}
T2Csend.console(Util.getPrefix() + " §2All files were successfully converted. §7- §e" + (System.currentTimeMillis() - long1) + "ms");
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
}
}

View File

@ -20,7 +20,7 @@ public class FileSelect {
public static void config() {
Convert.convert();
long long_ = System.currentTimeMillis();
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
for (Config value : Config.values()) {
@ -70,6 +70,9 @@ public class FileSelect {
} catch (IOException e) {
e.printStackTrace();
}
T2Csend.console(Util.getPrefix() + " §2The config.yml was loaded successfully §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
private static ArrayList<String> defaultLanguages = new ArrayList<>(Arrays.asList("german", "english"));

View File

@ -44,6 +44,9 @@ public class Load {
public static void loadReload() {
HandlerList.unregisterAll(chatListener);
HandlerList.unregisterAll(guiListener);
FileSelect.config();
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
FileSelect.language();
if (!new File(Main.getPath(), "config.yml").exists()) {
try {
CreateExampleAliasConfig.configCreate();
@ -56,19 +59,25 @@ public class Load {
e.printStackTrace();
}
}
try {
plugin.saveResource("Alias/X_aliasDeclaration_X.yml", true);
} 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);
} catch (Exception e) {
e.printStackTrace();
}
FileSelect.config();
FileSelect.language();
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
SelectAlias.onSelect();
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());

View File

@ -1,8 +1,7 @@
####################################################################
## The alias command is no longer the filename! ##
## Multiple alias commands can now be specified in one file, ##
## so there is no need to create multiple files! ##
## This option is under 'Alias.AliasList' ##
## This is an example file and serves only for the explanation ##
## of the individual options. ##
## Changes in this file are not considered and will be reset! ##
####################################################################
Alias:
@ -29,7 +28,7 @@ Alias:
# Here you define if the bypass is activated or if you have to pay despite the bypass (t2code.alias.buy.bypass).
AllowByPass: true
# Here you can set if you have to confirm if you want to pay before executing the command
# In the config.yml you can set at 'buy.confirm.command' if a command or a chatListener should be used for confirming the command.
# In the config.yml you can set under 'buy.confirm.use' if a command, a chatListener or a GUI should be used to confirm the command.
Confirm: true
Command:
# Here you can tell the alias to execute one or more commands

View File

@ -1,4 +1,8 @@
#
####################################################################
## This is an example file and serves only for the explanation ##
## of the individual options. ##
## Changes in this file are not considered and will be reset! ##
####################################################################
SubAlias:
# Here you can disable the alias
@ -28,7 +32,7 @@ SubAlias:
# Here you define if the bypass is activated or if you have to pay despite the bypass (t2code.alias.buy.bypass).
AllowByPass: true
# Here you can set if you have to confirm if you want to pay before executing the command
# In the config.yml you can set at 'buy.confirm.command' if a command or a chatListener should be used for confirming the command.
# In the config.yml you can set under 'buy.confirm.use' if a command, a chatListener or a GUI should be used to confirm the command.
Confirm: true
Command:
# Here you can tell the alias to execute one or more commands

View File

@ -0,0 +1,44 @@
####################################################################
## This is an example file and serves only for the explanation ##
## of the individual options. ##
## Changes in this file are not considered and will be reset! ##
####################################################################
# This option is only used for updates and file conversions.
configVersion: 4
plugin:
# In this option you can set the language of the plugin.
language: english
updateCheck:
# In this option you can set if players with the permission 't2code.alias.updatemsg' will get an update message on join when an update for the plugin is available.
onJoin: true
# In this option you can set whether you want to receive and display beta and snapshot versions in the update check.
seePreReleaseUpdates: true
# In this option you can set the time interval in minutes in which updates should be checked.
timeInterval: 60
buy:
# With this option you can set whether a confirmation should be sent after the payment for an alias for which you have to pay.
message: true
# With this option you set the currency.
currency: $
confirm:
# Here you can choose which confirmation method you want to use. (COMMAND, CHAT, GUI)
use: COMMAND
gui:
#
# !! You can change the GUI name and the button texts in the language file !!
#
fillItem:
# Here you can set if a fillitem should be used in the Confirm GUI.
enabled: true
# Here you can set which fillitem should be used in the Confirm GUI
material: BLACK_STAINED_GLASS_PANE
confirm:
# Here you can set the material for the confirmation button.
material: GREEN_WOOL
cancel:
# Here you can set the material for the cancel button.
material: RED_WOOL
subAlias:
# Here you can set if subcommands should be displayed as tabComplete
tabComplete: true