Add Velocity

- bStats
  - config
  - updateChecker
This commit is contained in:
JaTiTV 2024-07-01 18:00:44 +02:00
parent 1397656bf2
commit eb237aaa89
18 changed files with 1526 additions and 50 deletions

View File

@ -26,6 +26,11 @@
<option name="name" value="sonatype-oss-snapshots1" />
<option name="url" value="https://s01.oss.sonatype.org/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="papermc-repo" />
<option name="name" value="papermc-repo" />
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="placeholderapi" />
<option name="name" value="placeholderapi" />

View File

@ -14,5 +14,5 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="16" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
</project>

16
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>16.7</version>
<version>16.7_dev-1</version>
<!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version-->
@ -81,6 +81,12 @@
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<!-- Velocity / Paper-->
<repository>
<id>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<!-- repo.t2code / T2Code -->
<repository>
<id>T2Code</id>
@ -146,6 +152,14 @@
<scope>provided</scope>
</dependency>
<!-- Velocity -->
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>3.3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- repo.t2code / T2Code -->
<dependency>
<groupId>net.t2code</groupId>

View File

@ -53,8 +53,7 @@ public class T2CBupdateAPI {
}
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
public void run() {
if ((boolean) T2CBlibConfig.VALUES.updateCheckFullDisable.getValue()) return;
(new T2CBupdateCheckerGit(plugin, spigotID)).getVersion((webData) -> {
(new T2CBupdateCheckerGit(plugin)).getVersion((webData) -> {
pluginVersion = plugin.getDescription().getVersion();
T2CupdateObject update = new T2CupdateObject(
plugin.getDescription().getName(),

View File

@ -18,15 +18,14 @@ import java.util.function.Consumer;
public class T2CBupdateCheckerGit {
private Plugin plugin;
private int resourceId;
public T2CBupdateCheckerGit(Plugin plugin, int resourceId) {
public T2CBupdateCheckerGit(Plugin plugin) {
this.plugin = plugin;
this.resourceId = resourceId;
}
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
if ((boolean)T2CBlibConfig.VALUES.updateCheckFullDisable.getValue() ) return;
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
if (!(boolean)T2CBlibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
RepoURL = RepoURL + "&pre-release=false";

View File

@ -3,7 +3,6 @@ package net.t2code.t2codelib.BUNGEE.system;
import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfigWriter;
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CBmetrics;
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CBbungeePlayers;
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
@ -12,8 +11,6 @@ import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse.T2CapiAut
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUI;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.opSecurity.T2CapiOpSecurity;
import java.io.IOException;
public class T2CBload {
public static void onLoad(Plugin plugin, String prefix, String autor, String version, String spigot, String discord, Integer spigotID, Integer bstatsID, String url) {
long long_ = System.currentTimeMillis();
@ -23,7 +20,7 @@ public class T2CBload {
T2CBsend.console(prefix + " §2Spigot: §6" + spigot);
T2CBsend.console(prefix + " §2Discord: §6" + discord);
T2CBmetrics.Bstats(plugin, bstatsID);
T2CBmetrics.bStats(plugin, bstatsID);
T2CBlibConfig.set();
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);

View File

@ -23,7 +23,7 @@ import java.util.zip.GZIPOutputStream;
public class T2CBmetrics {
public static void Bstats(Plugin plugin, int bstatsID) {
public static void bStats(Plugin plugin, int bstatsID) {
int pluginId = bstatsID; // <-- Replace with the id of your plugin!
T2CBmetrics metrics = new T2CBmetrics(plugin, pluginId);
}

View File

@ -0,0 +1,37 @@
package net.t2code.t2codelib.BUNGEE.system.config;
import net.md_5.bungee.config.ConfigurationProvider;
import net.t2code.t2codelib.BUNGEE.system.T2CodeBMain;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.t2codelib.T2CconfigItem;
import java.io.File;
import java.io.IOException;
public class ConvertT2CBlibConfig {
public static Configuration configuration;
public static void convert() throws IOException {
File config = new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml");
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
if (!config.exists()) return;
if (configuration.contains("plugin.updateCheck.onJoin")) return;
set("UpdateCheck.TimerInMin",T2CBlibConfig.VALUES.updateTimer);
set("UpdateCheck.SeePreReleaseUpdates",T2CBlibConfig.VALUES.seePreReleaseUpdates);
set("API.CommandGUI.Enable",T2CBlibConfig.VALUES.apiCommandGUIEnable);
set("API.AutoResponse.Enable",T2CBlibConfig.VALUES.apiAutoResponse);
set("API.OPSecurity.Enable",T2CBlibConfig.VALUES.apiOpSecurity);
config.delete();
}
private static void set(String path, T2CconfigItem item){
if (configuration.contains(path)){
item.setValue(configuration.get(path));
}
}
}

View File

@ -6,6 +6,7 @@ import net.t2code.t2codelib.T2CconfigItem;
import net.t2code.t2codelib.Util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -13,23 +14,14 @@ import java.util.List;
public class T2CBlibConfig {
public enum VALUES implements T2CconfigItem{
updateTimer("updateCheck.timerInMin", 60,"In this option you can set the time interval in minutes in which updates should be checked."),
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true,"In this option you can set whether you want to receive and display beta and snapshot versions in the update check."),
/**
* TODO Converter !!!!!
*/
updateTimer("UpdateCheck.TimerInMin", 60),
seePreReleaseUpdates("UpdateCheck.SeePreReleaseUpdates", true),
updateCheckFullDisable("Plugin.UpdateCheck.AllPlugins.FullDisable", false),
apiCommandGUIEnable("API.CommandGUI.Enable", false, "Aktiviere die API für CommandGUI"),
apiAutoResponse("API.AutoResponse.Enable", false),
apiOpSecurity("API.OPSecurity.Enable", false),
apiCommandGUIEnable("api.commandGUI.enable", false, "With this option you activate the api interface for the T2C-CommandGUI plugin."),
apiAutoResponse("api.autoResponse.enable", false,"With this option you activate the api interface for the T2C-AutoResponse plugin."),
apiOpSecurity("api.opSecurity.enable", false,"With this option you activate the api interface for the T2C-OPSecurity plugin."),
;
private final String path;
private Object value;
private final List<String> comments;
@ -62,6 +54,11 @@ public class T2CBlibConfig {
}
public static void set(){
try {
ConvertT2CBlibConfig.convert();
} catch (IOException e) {
throw new RuntimeException(e);
}
T2CBconfigWriter.createConfig(new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml"), VALUES.values(), Util.getConfigLogo());
}

View File

@ -5,7 +5,13 @@ public enum UpdateType {
DEVELOPMENT("<dark_red>DEV</dark_red>"),
BETA("<gold>BETA</gold>"),
SNAPSHOT("<yellow>SNAPSHOT</yellow>"),
STABLE("<dark_green>STABLE</dark_green>");
STABLE("<dark_green>STABLE</dark_green>"),
PRERELEASE_("Pre-Release"),
DEVELOPMENT_("DEV"),
BETA_("BETA"),
SNAPSHOT_("SNAPSHOT"),
STABLE_("STABLE");
public String text;

View File

@ -20,6 +20,8 @@ public class Util {
public static String getPrefix() {
return "<dark_gray>[<dark_red>T2Code</dark_red><dark_purple>Lib</dark_purple>]</dark_gray>";
}
@Getter
private static String vPrefix = "[T2CodeLib]";
public static Integer getSpigotID() {
return 96388;

View File

@ -0,0 +1,91 @@
package net.t2code.t2codelib.VELOCITY.api.messages;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.title.Title;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
public class T2CVsend {
public static void console(Logger logger, String msg) {
if (msg == null || msg.contains("[empty]")) return;
logger.info(msg);
}
public static void player(Player player, String msg) {
if (msg == null || msg.contains("[empty]")) return;
player.sendMessage(Component.text(msg));
}
public static void sender(CommandSource sender, String msg) {
if (msg == null || msg.contains("[empty]")) return;
sender.sendMessage(Component.text(msg));
}
public static void console(Logger logger, Object object) {
for (String msg : list(object)) {
if (msg == null || msg.contains("[empty]")) continue;
logger.info(msg);
}
}
public static void player(Player player, Object object) {
for (String msg : list(object)) {
if (msg == null || msg.contains("[empty]")) continue;
player.sendMessage(Component.text(msg));
}
}
public static void sender(CommandSource sender, Object object) {
for (String msg : list(object)) {
if (msg == null || msg.contains("[empty]")) return;
sender.sendMessage(Component.text(msg));
}
}
public static void title(Player player, @Nullable String title, @Nullable String subtitle, Integer fadeIn, Integer stay, Integer fadeOut) {
Component titleComponent = title != null ? Component.text(title) : Component.empty();
Component subtitleComponent = subtitle != null ? Component.text(subtitle) : Component.empty();
Title.Times times = Title.Times.times(Duration.ofSeconds(fadeIn == null ? 1 : fadeIn), Duration.ofSeconds(stay == null ? 3 : stay), Duration.ofSeconds(fadeOut == null ? 1 : fadeOut));
Title playerTitle = Title.title(titleComponent, subtitleComponent, times);
player.showTitle(playerTitle);
}
public static void debugmsg(Logger logger, String msg) {
logger.warn(msg);
}
public static void info(Logger logger, String msg) {
logger.info(msg);
}
public static void warning(Logger logger, String msg) {
logger.warn(msg);
}
public static void error(Logger logger, String msg) {
logger.error(msg);
}
private static ArrayList<String> list(Object object) {
ArrayList<String> list = new ArrayList<>();
if (object instanceof List) {
list = (ArrayList<String>) object;
}
if (object instanceof String) {
list.add((String) object);
}
return list;
}
}

View File

@ -0,0 +1,77 @@
package net.t2code.t2codelib.VELOCITY.api.update;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.proxy.ProxyServer;
import net.t2code.t2codelib.T2CupdateObject;
import net.t2code.t2codelib.T2CupdateWebData;
import net.t2code.t2codelib.UpdateType;
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
import net.t2code.t2codelib.VELOCITY.system.config.T2CVlibConfig;
import org.slf4j.Logger;
import java.time.Duration;
import java.util.HashMap;
public class T2CVupdateAPI {
public static HashMap<String, T2CupdateObject> bungeePluginVersins = new HashMap<>();
public static void sendUpdateMsg(Logger logger, String prefix, String discord, T2CupdateWebData webData, PluginContainer plugin) {
String publicVersion = webData.getVersion();
String pluginVersion = plugin.getDescription().getVersion().orElse("unknown");
String value;
if (webData.isPreRelease()) {
value = UpdateType.PRERELEASE_.text;
if (publicVersion.toLowerCase().contains("dev")) {
value = UpdateType.DEVELOPMENT_.text;
}
if (publicVersion.toLowerCase().contains("beta")) {
value = UpdateType.BETA_.text;
}
if (publicVersion.toLowerCase().contains("snapshot")) {
value = UpdateType.SNAPSHOT_.text;
}
} else value = UpdateType.STABLE_.text;
T2CVsend.console(logger, "╔══════════════" + prefix + "══════════════");
T2CVsend.console(logger, "║ A new [value] version was found!".replace("[value]", value));
T2CVsend.console(logger, "║ Your version: " + pluginVersion + " - Current version: " + webData.getVersion());
T2CVsend.console(logger, "║ You can download it here: " + webData.getUpdateUrl());
T2CVsend.console(logger, "║ You can find more information on Discord: " + discord);
T2CVsend.console(logger, "╚══════════════" + prefix + "══════════════");
}
private static Boolean noUpdate = true;
private static String pluginVersion;
public static void onUpdateCheckTimer(Logger logger, PluginContainer plugin, ProxyServer server, String prefix, String discord, Integer spigotID, String url) {
if ((int) T2CVlibConfig.VALUES.updateTimer.getValue() < 1) {
T2CVlibConfig.VALUES.updateTimer.setValue(1);
}
server.getScheduler().buildTask(plugin, () -> {
(new T2CVupdateCheckerGit(plugin,logger)).getVersion((webData) -> {
pluginVersion = plugin.getDescription().getVersion().toString();
T2CupdateObject update = new T2CupdateObject(
plugin.getDescription().getName().toString(),
plugin.getDescription().getVersion().toString(),
webData,
false,
!plugin.getDescription().getVersion().equals(webData.getVersion()),
true
);
bungeePluginVersins.put(plugin.getDescription().getName().toString(), update);
if (!pluginVersion.replace("_Velocity", "").equalsIgnoreCase(webData.getVersion())) {
sendUpdateMsg(logger,prefix, discord, webData, plugin);
noUpdate = true;
} else {
if (noUpdate) {
T2CVsend.console(logger, " No update found.");
noUpdate = false;
}
}
}, pluginVersion, spigotID, url);
}).repeat(Duration.ofMinutes((int) T2CVlibConfig.VALUES.updateTimer.getValue())).schedule();
}
}

View File

@ -0,0 +1,101 @@
package net.t2code.t2codelib.VELOCITY.api.update;
import com.velocitypowered.api.plugin.PluginContainer;
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
import net.t2code.t2codelib.T2CupdateObject;
import net.t2code.t2codelib.T2CupdateWebData;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.function.Consumer;
public class T2CVupdateCheckerGit {
private PluginContainer plugin;
private Logger logger;
public T2CVupdateCheckerGit(PluginContainer plugin, Logger logger) {
this.plugin = plugin;
this.logger=logger;
}
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
if (!(boolean)T2CBlibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
RepoURL = RepoURL + "&pre-release=false";
}
String finalRepoURL = RepoURL;
try {
URL url = new URL(finalRepoURL);
URLConnection yc = url.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
yc.getInputStream()));
String inputLine;
String data = "";
while ((inputLine = in.readLine()) != null)
data = inputLine;
in.close();
data = data.substring(1, data.length() - 1);
if (data.isEmpty()) {
consumer.accept(null);
return;
}
JSONObject obj = new JSONObject(data);
String updateTitle = obj.getString("name");
String version = obj.getString("tag_name");
String updateDescription = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''");
String updateUrl = obj.getString("html_url");
boolean preRelease = obj.getBoolean("prerelease");
String date = obj.getString("published_at");
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
Date parsedDate = inputFormat.parse(date);
String publishedAt = outputFormat.format(parsedDate);
JSONArray downloadArray = obj.getJSONArray("assets");
String gitURL = updateUrl;
String downloadURL;
if (downloadArray.isEmpty()) {
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
} else {
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
}
if (!preRelease) {
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
}
T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
consumer.accept(webData);
} catch (Exception var10) {
Boolean load = false;
if (T2CVupdateAPI.bungeePluginVersins.containsKey(plugin.getDescription().getName().toString())) {
load = T2CVupdateAPI.bungeePluginVersins.get(plugin.getDescription().getName().toString()).load;
}
T2CupdateObject update = new T2CupdateObject(
plugin.getDescription().getName().toString(),
pluginVersion,
null,
load,
false,
true
);
T2CVupdateAPI.bungeePluginVersins.put(plugin.getDescription().getName().toString(), update);
logger.error("Cannot look for updates: {}", var10.getMessage());
}
}
}

View File

@ -2,6 +2,7 @@ package net.t2code.t2codelib.VELOCITY.api.yml;// This class was created by JaTiT
import net.t2code.t2codelib.T2CconfigItem;
import org.slf4j.Logger;
import org.yaml.snakeyaml.Yaml;
import java.io.File;
@ -15,7 +16,8 @@ public class T2CVconfigWriter {
public static void createConfig(File configFile, T2CconfigItem[] manager, String... header) throws IOException {
public static void createConfig(Logger logger, File configFile, T2CconfigItem[] manager, String... header) throws IOException {
if (!configFile.exists()) {
configFile.getParentFile().mkdirs();
try {
@ -99,7 +101,7 @@ public class T2CVconfigWriter {
try {
StringBuilder configContent = new StringBuilder();
for(String h : headers){
configContent.append("# ").append(h).append("\n");
configContent.append(h).append("\n");
}
configContent.append("\n");
addSection(config, comments, configContent, "", 0);

View File

@ -2,5 +2,87 @@
package net.t2code.t2codelib.VELOCITY.system;
import com.google.inject.Inject;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.ProxyServer;
import lombok.Getter;
import net.t2code.t2codelib.Util;
import net.t2code.t2codelib.VELOCITY.api.update.T2CVupdateAPI;
import net.t2code.t2codelib.VELOCITY.system.bstats.Metrics;
import net.t2code.t2codelib.VELOCITY.system.config.T2CVlibConfig;
import org.slf4j.Logger;
import java.io.IOException;
import java.nio.file.Path;
public class T2CodeVMain {
private final ProxyServer server;
@Getter
private static Logger logger;
@Getter
private PluginContainer plugin;
@Getter
private final long starttime;
@Getter
private static Path dataDirectory;
private final Metrics.Factory metricsFactory;
@Inject
public T2CodeVMain(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory, Metrics.Factory metricsFactory) {
starttime = System.currentTimeMillis();
this.server = server;
T2CodeVMain.logger = logger;
T2CodeVMain.dataDirectory = dataDirectory;
this.metricsFactory = metricsFactory;
}
@Subscribe
public void onLoad(ProxyInitializeEvent e) {
new pl(this, server);
logger.info("╔════════════════════════════════════");
// logger.info("");
for (String s : Util.getLoadLogo()) {
logger.info("║ {}", s);
}
logger.info("");
// Thread.sleep(5000);
logger.info("║ Author: {}", String.valueOf(plugin.getDescription().getAuthors()).replace("[", "").replace("]", ""));
logger.info("║ Version: {}", plugin.getDescription().getVersion().orElse("unknown"));
logger.info("║ Spigot: {}", Util.getSpigot());
logger.info("║ Discord: {}", Util.getDiscord());
try {
T2CVlibConfig.set(dataDirectory,logger);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
// new T2CVcmd(server, logger);
// server.getEventManager().register(this, new T2CVpluginMessagingCmd(server, logger));
logger.info("");
logger.info("║ Plugin loaded successfully - {}ms", System.currentTimeMillis() - starttime);
logger.info("╚════════════════════════════════════");
Metrics.bStats(this, Util.getBstatsID(), metricsFactory);
T2CVupdateAPI.onUpdateCheckTimer(logger, plugin, server, Util.getVPrefix(), Util.getDiscord(), Util.getSpigotID(), Util.getGit());
}
public class pl {
public pl(Object pl, ProxyServer server) {
plugin = server.getPluginManager().fromInstance(pl)
.orElseThrow(() -> new IllegalArgumentException("The provided instance is not a plugin"));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,28 @@
package net.t2code.t2codelib.VELOCITY.system.config;
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfigWriter;
import net.t2code.t2codelib.BUNGEE.system.T2CodeBMain;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.T2CconfigItem;
import net.t2code.t2codelib.Util;
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
import net.t2code.t2codelib.VELOCITY.api.yml.T2CVconfigWriter;
import org.slf4j.Logger;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class T2CVlibConfig {
public enum VALUES implements T2CconfigItem{
/**
* TODO Converter !!!!!
*/
updateTimer("UpdateCheck.TimerInMin", 60),
seePreReleaseUpdates("UpdateCheck.SeePreReleaseUpdates", true),
updateCheckFullDisable("Plugin.UpdateCheck.AllPlugins.FullDisable", false),
apiCommandGUIEnable("API.CommandGUI.Enable", false, "Aktiviere die API für CommandGUI"),
apiAutoResponse("API.AutoResponse.Enable", false),
apiOpSecurity("API.OPSecurity.Enable", false),
public enum VALUES implements T2CconfigItem {
updateTimer("updateCheck.timerInMin", 60, "In this option you can set the time interval in minutes in which updates should be checked."),
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true, "In this option you can set whether you want to receive and display beta and snapshot versions in the update check."),
apiCommandGUIEnable("api.commandGUI.enable", false, "With this option you activate the api interface for the T2C-CommandGUI plugin."),
apiAutoResponse("api.autoResponse.enable", false, "With this option you activate the api interface for the T2C-AutoResponse plugin."),
apiOpSecurity("api.opSecurity.enable", false, "With this option you activate the api interface for the T2C-OPSecurity plugin."),
;
@ -61,8 +57,9 @@ public class T2CVlibConfig {
}
}
public static void set(){
T2CBconfigWriter.createConfig(new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml"), VALUES.values(), Util.getConfigLogo());
public static void set(Path dataDirectory, Logger logger) throws IOException {
long long_ = System.currentTimeMillis();
T2CVconfigWriter.createConfig(logger, new File(dataDirectory.getParent() + "/T2CodeLib", "config.yml"), VALUES.values(), Util.getConfigLogo());
T2CVsend.info(logger, "║ The config.yml were successfully created / updated." + " - " + (System.currentTimeMillis() - long_) + "ms");
}
}