Bugfixes and performance optimizations

This commit is contained in:
2021-12-03 10:21:26 +01:00
parent 2fcd19ba50
commit 13baf14d7d
33 changed files with 148 additions and 255 deletions

View File

@@ -28,6 +28,10 @@ public class T2CodeTemplate {
send.console(prefix + " §4 §e| §2Spigot: §6" + spigot);
send.console(prefix + " §4 §e| §2Discord: §6" + discord);
send.console(prefix + " §4 §e-------------------");
if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) {
send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! Some features may not be working as expected. Please report all bugs here: http://dc.t2code.net");
send.console(prefix + " §4 §e-------------------");
}
//onLoadSeparateStroke(prefix);
return long_;
}
@@ -84,6 +88,4 @@ public class T2CodeTemplate {
}
}

View File

@@ -6,6 +6,7 @@ import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
import org.bukkit.Sound;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
@@ -45,6 +46,12 @@ public class Config {
}
}
public static void set(String path, ItemStack value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value);
}
}
public static void setSound(String soundName, String sound1_8, String sound1_9, String sound1_13, YamlConfiguration yamlConfiguration) {
Config.set("Sound." + soundName + ".Enable", true, yamlConfiguration);
String sound;
@@ -70,7 +77,7 @@ public class Config {
Config.set("Sound." + soundName + ".Sound", sound.toString(), yamlConfiguration);
}
public static boolean selectSoundEnable( String soundName, YamlConfiguration yamlConfiguration) {
public static boolean selectSoundEnable(String soundName, YamlConfiguration yamlConfiguration) {
return selectBoolean("Sound." + soundName + ".Enable", yamlConfiguration);
}
@@ -133,42 +140,28 @@ public class Config {
return Replace.replace(prefix, yamlConfiguration.getString(path));
}
public static void select(String prefix, String value, String path, YamlConfiguration yamlConfiguration) {
value = Replace.replace(prefix, yamlConfiguration.getString(path));
}
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getInt(path));
}
public static void select(String path, Integer value, YamlConfiguration yamlConfiguration) {
value = (yamlConfiguration.getInt(path));
}
public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getBoolean(path));
}
public static void select(String path, Boolean value, YamlConfiguration yamlConfiguration) {
value = (yamlConfiguration.getBoolean(path));
}
public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getDouble(path));
}
public static void select(String path, Double value, YamlConfiguration yamlConfiguration) {
value = (yamlConfiguration.getDouble(path));
}
public static List selectList(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getList(path));
}
public static void select(String path, List value, YamlConfiguration yamlConfiguration) {
value = (yamlConfiguration.getList(path));
public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getItemStack(path));
}
public static List selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
List<String> output = new ArrayList<>();
List<String> input = yamlConfiguration.getStringList(path);

View File

@@ -8,7 +8,6 @@ import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
import net.t2code.lib.Spigot.Lib.register.Register;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import net.t2code.lib.Spigot.Lib.vault.Vault;
import net.t2code.lib.Spigot.system.config.ConfigCreate;
@@ -17,7 +16,6 @@ import net.t2code.lib.Util;
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
@@ -64,8 +62,7 @@ public final class Main extends JavaPlugin {
NMSVersion.onCheck();
MCVersion.onCheck();
if (MCVersion.minecraft1_18){
send.warning(this, "The 1.18 is not yet supported with this version! Please check if there are updates of our plugins! " +
"For further questions please join our Discord: http://dc.t2code.net");
send.warning(this, "The 1.18 is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
}
ItemVersion.scan();
send.console(Main.prefix + " §3Server run on: §6" + MCVersion.isVersion + " / " + NMSVersion.isNMS);