valueEntry : map.get(entryValues.getKey()).entrySet()) {
- valueBuilder.appendField(valueEntry.getKey(), valueEntry.getValue());
- allSkipped = false;
- }
- if (!allSkipped) {
- reallyAllSkipped = false;
- valuesBuilder.appendField(entryValues.getKey(), valueBuilder.build());
- }
- }
- if (reallyAllSkipped) {
- // Null = skip the chart
- return null;
- }
- return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
- }
- }
-
- /**
- * An extremely simple JSON builder.
- *
- * While this class is neither feature-rich nor the most performant one, it's sufficient enough
- * for its use-case.
- */
- public static class JsonObjectBuilder {
-
- private StringBuilder builder = new StringBuilder();
-
- private boolean hasAtLeastOneField = false;
-
- public JsonObjectBuilder() {
- builder.append("{");
- }
-
- /**
- * Appends a null field to the JSON.
- *
- * @param key The key of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendNull(String key) {
- appendFieldUnescaped(key, "null");
- return this;
- }
-
- /**
- * Appends a string field to the JSON.
- *
- * @param key The key of the field.
- * @param value The value of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, String value) {
- if (value == null) {
- throw new IllegalArgumentException("JSON value must not be null");
- }
- appendFieldUnescaped(key, "\"" + escape(value) + "\"");
- return this;
- }
-
- /**
- * Appends an integer field to the JSON.
- *
- * @param key The key of the field.
- * @param value The value of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, int value) {
- appendFieldUnescaped(key, String.valueOf(value));
- return this;
- }
-
- /**
- * Appends an object to the JSON.
- *
- * @param key The key of the field.
- * @param object The object.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, JsonObject object) {
- if (object == null) {
- throw new IllegalArgumentException("JSON object must not be null");
- }
- appendFieldUnescaped(key, object.toString());
- return this;
- }
-
- /**
- * Appends a string array to the JSON.
- *
- * @param key The key of the field.
- * @param values The string array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, String[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values)
- .map(value -> "\"" + escape(value) + "\"")
- .collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends an integer array to the JSON.
- *
- * @param key The key of the field.
- * @param values The integer array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, int[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values).mapToObj(String::valueOf).collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends an object array to the JSON.
- *
- * @param key The key of the field.
- * @param values The integer array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, JsonObject[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values).map(JsonObject::toString).collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends a field to the object.
- *
- * @param key The key of the field.
- * @param escapedValue The escaped value of the field.
- */
- private void appendFieldUnescaped(String key, String escapedValue) {
- if (builder == null) {
- throw new IllegalStateException("JSON has already been built");
- }
- if (key == null) {
- throw new IllegalArgumentException("JSON key must not be null");
- }
- if (hasAtLeastOneField) {
- builder.append(",");
- }
- builder.append("\"").append(escape(key)).append("\":").append(escapedValue);
- hasAtLeastOneField = true;
- }
-
- /**
- * Builds the JSON string and invalidates this builder.
- *
- * @return The built JSON string.
- */
- public JsonObject build() {
- if (builder == null) {
- throw new IllegalStateException("JSON has already been built");
- }
- JsonObject object = new JsonObject(builder.append("}").toString());
- builder = null;
- return object;
- }
-
- /**
- * Escapes the given string like stated in https://www.ietf.org/rfc/rfc4627.txt.
- *
- *
This method escapes only the necessary characters '"', '\'. and '\u0000' - '\u001F'.
- * Compact escapes are not used (e.g., '\n' is escaped as "\u000a" and not as "\n").
- *
- * @param value The value to escape.
- * @return The escaped value.
- */
- private static String escape(String value) {
- final StringBuilder builder = new StringBuilder();
- for (int i = 0; i < value.length(); i++) {
- char c = value.charAt(i);
- if (c == '"') {
- builder.append("\\\"");
- } else if (c == '\\') {
- builder.append("\\\\");
- } else if (c <= '\u000F') {
- builder.append("\\u000").append(Integer.toHexString(c));
- } else if (c <= '\u001F') {
- builder.append("\\u00").append(Integer.toHexString(c));
- } else {
- builder.append(c);
- }
- }
- return builder.toString();
- }
-
- /**
- * A super simple representation of a JSON object.
- *
- *
This class only exists to make methods of the {@link JsonObjectBuilder} type-safe and not
- * allow a raw string inputs for methods like {@link JsonObjectBuilder#appendField(String,
- * JsonObject)}.
- */
- public static class JsonObject {
-
- private final String value;
-
- private JsonObject(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return value;
- }
- }
- }
-}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/Main.java b/src/main/java/net/t2code/autoresponse/Spigot/Main.java
index 599d8a5..852c8b5 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/Main.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/Main.java
@@ -3,7 +3,7 @@ package net.t2code.autoresponse.Spigot;
import net.t2code.autoresponse.Spigot.objects.ResponsesObject;
import net.t2code.autoresponse.Spigot.system.Load;
import net.t2code.autoresponse.Util;
-import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@@ -42,7 +42,7 @@ public final class Main extends JavaPlugin {
// Plugin shutdown logic
allResponses.clear();
if (Bukkit.getPluginManager().getPlugin("T2CodeLib") == null) return;
- T2CodeTemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
+ T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
}
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/cmdManagement/CmdExecuter.java b/src/main/java/net/t2code/autoresponse/Spigot/cmdManagement/CmdExecuter.java
index f42bd20..5291fe8 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/cmdManagement/CmdExecuter.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/cmdManagement/CmdExecuter.java
@@ -2,7 +2,7 @@ package net.t2code.autoresponse.Spigot.cmdManagement;
import net.t2code.autoresponse.Spigot.config.languages.SelectMessages;
import net.t2code.autoresponse.Spigot.system.Permissions;
-import net.t2code.lib.Spigot.Lib.messages.send;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -26,7 +26,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
case "rl":
if (sender.hasPermission(Permissions.admin) || sender.isOp()) {
Commands.reload(sender);
- } else send.sender(sender, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/t2code-autoresponse reload")
+ } else T2Csend.sender(sender, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/t2code-autoresponse reload")
.replace("[perm]", Permissions.admin));
break;
case "info":
@@ -34,7 +34,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
case "version":
if (sender.hasPermission(Permissions.info)) {
Commands.info(sender);
- } else send.sender(sender, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/t2code-autoresponse info")
+ } else T2Csend.sender(sender, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/t2code-autoresponse info")
.replace("[perm]", Permissions.info));
break;
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/cmdManagement/Commands.java b/src/main/java/net/t2code/autoresponse/Spigot/cmdManagement/Commands.java
index 6001085..52f853e 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/cmdManagement/Commands.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/cmdManagement/Commands.java
@@ -4,26 +4,25 @@ import net.t2code.autoresponse.Util;
import net.t2code.autoresponse.Spigot.config.languages.SelectMessages;
import net.t2code.autoresponse.Spigot.system.Load;
import net.t2code.autoresponse.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commands {
public static void info(CommandSender sender) {
- T2CodeTemplate.sendInfo(sender, Util.getPrefix(),Util.getSpigot(),Util.getDiscord(), Main.getAutor(),Main.getVersion(), UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion);
+ T2Ctemplate.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
}
public static void reload(CommandSender sender) {
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadStart);
- send.console(Util.getPrefix() + "§8-------------------------------");
- send.console(Util.getPrefix() + " §6Plugin reload...");
- send.console(Util.getPrefix() + "§8-------------------------------");
+ T2Csend.console(Util.getPrefix() + "§8-------------------------------");
+ T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
+ T2Csend.console(Util.getPrefix() + "§8-------------------------------");
Load.loadReload();
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadEnd);
- send.console(Util.getPrefix() + "§8-------------------------------");
- send.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
- send.console(Util.getPrefix() + "§8-------------------------------");
+ T2Csend.console(Util.getPrefix() + "§8-------------------------------");
+ T2Csend.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
+ T2Csend.console(Util.getPrefix() + "§8-------------------------------");
}
}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/config/config/CreateConfig.java b/src/main/java/net/t2code/autoresponse/Spigot/config/config/CreateConfig.java
index 3f76417..c71dc17 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/config/config/CreateConfig.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/config/config/CreateConfig.java
@@ -2,8 +2,8 @@ package net.t2code.autoresponse.Spigot.config.config;
import net.t2code.autoresponse.Util;
import net.t2code.autoresponse.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
+import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
@@ -15,16 +15,20 @@ public class CreateConfig {
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
- Config.set("Plugin.language", "english", yamlConfiguration);
- Config.set("BungeeCord.Enable", false, yamlConfiguration);
+ T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
+ T2Cconfig.set("Plugin.updateCheck.onJoin", true, yamlConfiguration);
+ T2Cconfig.set("Plugin.updateCheck.seePreReleaseUpdates", true, yamlConfiguration);
+ T2Cconfig.set("Plugin.updateCheck.timeInterval", 60, yamlConfiguration);
- Config.set("Log.Console.Enable", true, yamlConfiguration);
+ T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration);
+
+ T2Cconfig.set("Log.Console.Enable", true, yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
- send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
+ T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/config/config/SelectConfig.java b/src/main/java/net/t2code/autoresponse/Spigot/config/config/SelectConfig.java
index 956bdd7..e55f616 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/config/config/SelectConfig.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/config/config/SelectConfig.java
@@ -7,6 +7,9 @@ import java.io.File;
public class SelectConfig {
public static String language;
+ public static Boolean updateCheckOnJoin;
+ public static Boolean updateCheckSeePreReleaseUpdates;
+ public static Integer updateCheckTimeInterval;
public static Boolean bungee;
public static Boolean logConsole;
@@ -15,6 +18,13 @@ public class SelectConfig {
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
language = yamlConfiguration.getString("Plugin.language");
+ updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
+ updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates");
+ updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
+
+
+
+
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
logConsole = yamlConfiguration.getBoolean("Log.Console.Enable");
}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/config/languages/CreateMessages.java b/src/main/java/net/t2code/autoresponse/Spigot/config/languages/CreateMessages.java
index de7d88c..66fecff 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/config/languages/CreateMessages.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/config/languages/CreateMessages.java
@@ -2,8 +2,8 @@ package net.t2code.autoresponse.Spigot.config.languages;
import net.t2code.autoresponse.Util;
import net.t2code.autoresponse.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
+import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
@@ -14,7 +14,7 @@ public class CreateMessages {
private static Plugin plugin = Main.getPlugin();
public static void langCreate() {
- send.debug(plugin,"§4Language files are created / updated...");
+ T2Csend.debug(plugin,"§4Language files are created / updated...");
Long long_ = Long.valueOf(System.currentTimeMillis());
/**
@@ -26,14 +26,14 @@ public class CreateMessages {
File messagesEN = new File(Main.getPath(), "languages/english_messages.yml");
YamlConfiguration yamlConfigurationEN = YamlConfiguration.loadConfiguration(messagesEN);
- Config.set("Plugin.Reload.Start", MSG.EN_ReloadStart, yamlConfigurationEN);
- Config.set("Plugin.Reload.End", MSG.EN_ReloadEnd, yamlConfigurationEN);
- Config.set("Plugin.ForCommand", MSG.EN_NoPermissionForCommand, yamlConfigurationEN);
+ T2Cconfig.set("Plugin.Reload.Start", MSG.EN_ReloadStart, yamlConfigurationEN);
+ T2Cconfig.set("Plugin.Reload.End", MSG.EN_ReloadEnd, yamlConfigurationEN);
+ T2Cconfig.set("Plugin.ForCommand", MSG.EN_NoPermissionForCommand, yamlConfigurationEN);
try {
yamlConfigurationEN.save(messagesEN);
} catch (IOException e) {
- send.warning(plugin,e.getMessage());
+ T2Csend.warning(plugin,e.getMessage());
e.printStackTrace();
}
@@ -47,17 +47,17 @@ public class CreateMessages {
File messagesDE = new File(Main.getPath(), "languages/german_messages.yml");
YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE);
- Config.set("Plugin.Reload.Start", MSG.DE_ReloadStart, yamlConfigurationDE);
- Config.set("Plugin.Reload.End", MSG.DE_ReloadEnd, yamlConfigurationDE);
- Config.set("Plugin.ForCommand", MSG.DE_NoPermissionForCommand, yamlConfigurationDE);
+ T2Cconfig.set("Plugin.Reload.Start", MSG.DE_ReloadStart, yamlConfigurationDE);
+ T2Cconfig.set("Plugin.Reload.End", MSG.DE_ReloadEnd, yamlConfigurationDE);
+ T2Cconfig.set("Plugin.ForCommand", MSG.DE_NoPermissionForCommand, yamlConfigurationDE);
try {
yamlConfigurationDE.save(messagesDE);
} catch (IOException e) {
- send.warning(plugin,e.getMessage());
+ T2Csend.warning(plugin,e.getMessage());
e.printStackTrace();
}
- send.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
+ T2Csend.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
}
}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/config/languages/SelectMessages.java b/src/main/java/net/t2code/autoresponse/Spigot/config/languages/SelectMessages.java
index bde8590..2dfefe4 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/config/languages/SelectMessages.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/config/languages/SelectMessages.java
@@ -3,8 +3,8 @@ package net.t2code.autoresponse.Spigot.config.languages;
import net.t2code.autoresponse.Util;
import net.t2code.autoresponse.Spigot.config.config.SelectConfig;
import net.t2code.autoresponse.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
+import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
@@ -24,28 +24,28 @@ public class SelectMessages {
public static void onSelect(String Prefix) {
- send.debug(Main.getPlugin(), "§4Select language...");
+ T2Csend.debug(Main.getPlugin(), "§4Select language...");
long long_ = System.currentTimeMillis();
File msg;
msg = new File(Main.getPath(), "languages/" + SelectConfig.language + "_messages.yml");
if (!msg.isFile()) {
- send.console(Prefix);
- send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- send.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found.");
- send.console(Prefix + " §6The default language §eEnglish §6is used!");
- send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- send.console(Prefix);
+ T2Csend.console(Prefix);
+ T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ T2Csend.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found.");
+ T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
+ T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ T2Csend.console(Prefix);
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
selectMSG = "english";
} else selectMSG = SelectConfig.language;
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(msg);
- ReloadStart = Config.select(prefix, "Plugin.Reload.Start", yamlConfiguration);
- ReloadEnd = Config.select(prefix, "Plugin.Reload.End", yamlConfiguration);
- NoPermissionForCommand = Config.select(prefix, "Plugin.ForCommand", yamlConfiguration);
+ ReloadStart = T2Cconfig.select(prefix, "Plugin.Reload.Start", yamlConfiguration);
+ ReloadEnd = T2Cconfig.select(prefix, "Plugin.Reload.End", yamlConfiguration);
+ NoPermissionForCommand = T2Cconfig.select(prefix, "Plugin.ForCommand", yamlConfiguration);
- send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
+ T2Csend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/config/response/CreateExampleResponse.java b/src/main/java/net/t2code/autoresponse/Spigot/config/response/CreateExampleResponse.java
index 566d77b..2b532cd 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/config/response/CreateExampleResponse.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/config/response/CreateExampleResponse.java
@@ -2,8 +2,8 @@ package net.t2code.autoresponse.Spigot.config.response;
import net.t2code.autoresponse.Util;
import net.t2code.autoresponse.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
+import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
@@ -16,42 +16,42 @@ public class CreateExampleResponse {
public static void configCreate() {
long long_ = System.currentTimeMillis();
if (new File(Main.getPath(), "config.yml").exists()) {
- if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
- } else send.console(Util.getPrefix() + " §4config.yml are created...");
+ if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) T2Csend.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
+ } else T2Csend.console(Util.getPrefix() + " §4config.yml are created...");
File config = new File(Main.getPath(), "Responses/responseexample.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
- Config.set("Response.Enable", true, yamlConfiguration);
- Config.set("Response.ResponseKeys", Collections.singletonList(".example"), yamlConfiguration);
- Config.set("Response.Contains", false, yamlConfiguration);
- Config.set("Response.BlockKeyMessage", true, yamlConfiguration);
- Config.set("Response.Permission.Necessary", true, yamlConfiguration);
- Config.set("Response.Permission.Permission", "t2c-autoresponse.response.example", yamlConfiguration);
+ T2Cconfig.set("Response.Enable", true, yamlConfiguration);
+ T2Cconfig.set("Response.ResponseKeys", Collections.singletonList(".example"), yamlConfiguration);
+ T2Cconfig.set("Response.Contains", false, yamlConfiguration);
+ T2Cconfig.set("Response.BlockKeyMessage", true, yamlConfiguration);
+ T2Cconfig.set("Response.Permission.Necessary", true, yamlConfiguration);
+ T2Cconfig.set("Response.Permission.Permission", "t2c-autoresponse.response.example", yamlConfiguration);
- Config.set("Response.Command.Enable", false, yamlConfiguration);
- Config.set("Response.Command.CommandAsConsole", false, yamlConfiguration);
- Config.set("Response.Command.BungeeCommand", false, yamlConfiguration);
- Config.set("Response.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
+ T2Cconfig.set("Response.Command.Enable", false, yamlConfiguration);
+ T2Cconfig.set("Response.Command.CommandAsConsole", false, yamlConfiguration);
+ T2Cconfig.set("Response.Command.BungeeCommand", false, yamlConfiguration);
+ T2Cconfig.set("Response.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
- Config.set("Response.Message.Enable", true, yamlConfiguration);
- Config.set("Response.Message.Global.Enable", false, yamlConfiguration);
- Config.set("Response.Message.Global.Bungee", false, yamlConfiguration);
- Config.set("Response.Message.Messages", Arrays.asList("[prefix] This is an Automated response from [T2Code-AutoResponse].", "[prefix] Contact us for questions / support on our Discord: dc.t2code.net'>Discord."), yamlConfiguration);
+ T2Cconfig.set("Response.Message.Enable", true, yamlConfiguration);
+ T2Cconfig.set("Response.Message.Global.Enable", false, yamlConfiguration);
+ T2Cconfig.set("Response.Message.Global.Bungee", false, yamlConfiguration);
+ T2Cconfig.set("Response.Message.Messages", Arrays.asList("[prefix] This is an Automated response from [T2Code-AutoResponse].", "[prefix] Contact us for questions / support on our Discord: dc.t2code.net'>Discord."), yamlConfiguration);
- Config.set("Response.Protection.GameMode.Enable", false, yamlConfiguration);
- Config.set("Response.Protection.GameMode.Mode", "blacklist", yamlConfiguration);
- Config.set("Response.Protection.GameMode.List", Arrays.asList("CREATIVE","SPECTATOR"), yamlConfiguration);
- Config.set("Response.Protection.World.Enable", false, yamlConfiguration);
- Config.set("Response.Protection.World.Mode", "blacklist", yamlConfiguration);
- Config.set("Response.Protection.World.List", Arrays.asList("World1","World2"), yamlConfiguration);
+ T2Cconfig.set("Response.Protection.GameMode.Enable", false, yamlConfiguration);
+ T2Cconfig.set("Response.Protection.GameMode.Mode", "blacklist", yamlConfiguration);
+ T2Cconfig.set("Response.Protection.GameMode.List", Arrays.asList("CREATIVE","SPECTATOR"), yamlConfiguration);
+ T2Cconfig.set("Response.Protection.World.Enable", false, yamlConfiguration);
+ T2Cconfig.set("Response.Protection.World.Mode", "blacklist", yamlConfiguration);
+ T2Cconfig.set("Response.Protection.World.List", Arrays.asList("World1","World2"), yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
- send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
+ T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/event/ResponseListener.java b/src/main/java/net/t2code/autoresponse/Spigot/event/ResponseListener.java
index c470ec3..147399b 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/event/ResponseListener.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/event/ResponseListener.java
@@ -1,18 +1,15 @@
package net.t2code.autoresponse.Spigot.event;
-import net.md_5.bungee.api.chat.ClickEvent;
-import net.t2code.autoresponse.Spigot.system.BungeeSend;
-import net.t2code.autoresponse.Util;
+import net.t2code.autoresponse.Spigot.Main;
import net.t2code.autoresponse.Spigot.config.config.SelectConfig;
import net.t2code.autoresponse.Spigot.objects.ResponsesObject;
import net.t2code.autoresponse.Spigot.system.BCommand_Sender_Reciver;
-
-import net.t2code.autoresponse.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.commands.Cmd;
-import net.t2code.lib.Spigot.Lib.messages.TextBuilder;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
-import net.t2code.lib.Spigot.Lib.replace.Replace;
+import net.t2code.autoresponse.Spigot.system.BungeeSend;
+import net.t2code.autoresponse.Util;
+import net.t2code.t2codelib.SPIGOT.api.commands.T2Ccmd;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
+import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -34,14 +31,14 @@ public class ResponseListener implements Listener {
if (!response.permNecessary || player.hasPermission(response.permission)) {
if (response.contains) {
for (String responseKey : response.responseKeys) {
- if (e.getMessage().contains(responseKey)) {
+ if (e.getMessage().toLowerCase().contains(responseKey.toLowerCase())) {
execute(e, player, response, responseKey);
return;
}
}
} else {
for (String responseKey : response.responseKeys) {
- if (e.getMessage().equals(responseKey)) {
+ if (e.getMessage().toLowerCase().equals(responseKey.toLowerCase())) {
execute(e, player, response, responseKey);
return;
}
@@ -79,20 +76,20 @@ public class ResponseListener implements Listener {
BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), BungeeSend.BUNGEECOMMAND);
} else BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), BungeeSend.COMMAND);
} else {
- send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- send.sender(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ T2Csend.sender(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
}
} else {
if (response.commandAsConsole) {
new BukkitRunnable() {
@Override
public void run() {
- Cmd.console(cmd.replace("[player]", player.getName()));
+ T2Ccmd.console(cmd.replace("[player]", player.getName()));
}
}.runTaskLater(Main.getPlugin(), 1L);
} else {
- Cmd.player(player, cmd.replace("[player]", player.getName()));
+ T2Ccmd.player(player, cmd.replace("[player]", player.getName()));
}
}
}
@@ -100,26 +97,26 @@ public class ResponseListener implements Listener {
if (response.messageEnable) {
for (String msg : response.messages) {
String text;
- if (PluginCheck.papi()) {
- text = Replace.replace(Util.getPrefix(), player, msg);
+ if (T2CpluginCheck.papi()) {
+ text = T2Creplace.replace(Util.getPrefix(), player, msg);
} else {
- text = Replace.replace(Util.getPrefix(), msg);
+ text = T2Creplace.replace(Util.getPrefix(), msg);
}
if (response.messageGlobal) {
if (response.messageGlobalBungee) {
BCommand_Sender_Reciver.sendToBungee(player, text, BungeeSend.ALLPLAYERMSG);
} else {
for (Player player1 : Bukkit.getOnlinePlayers()) {
- send.player(player1, text);
+ T2Csend.player(player1, text);
}
}
- } else send.player(player, text);
+ } else T2Csend.player(player, text);
}
}
}
private static void use(AsyncPlayerChatEvent e, Player player, String responseKey, ResponsesObject response) {
if (response.blockKeyMessage) e.setCancelled(true);
- if (SelectConfig.logConsole) send.console(Util.getPrefix() + " §6Player: §e" + player.getName() + " §6use AutoResponse: §e" + responseKey);
+ if (SelectConfig.logConsole) T2Csend.console(Util.getPrefix() + " §6Player: §e" + player.getName() + " §6use AutoResponse: §e" + responseKey);
}
}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/system/BCommand_Sender_Reciver.java b/src/main/java/net/t2code/autoresponse/Spigot/system/BCommand_Sender_Reciver.java
index 5a67075..a22b4b3 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/system/BCommand_Sender_Reciver.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/system/BCommand_Sender_Reciver.java
@@ -38,10 +38,10 @@ public class BCommand_Sender_Reciver {
if (sender instanceof Player) {
Player player = (Player) sender;
- player.sendPluginMessage(Main.getPlugin(), "t2car:bungee", stream.toByteArray());
+ player.sendPluginMessage(Main.getPlugin(), "t2c:aresp", stream.toByteArray());
} else {
for (Player player : Bukkit.getOnlinePlayers()) {
- player.sendPluginMessage(Main.getPlugin(), "t2car:bungee", stream.toByteArray());
+ player.sendPluginMessage(Main.getPlugin(), "t2c:aresp", stream.toByteArray());
return;
}
}
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/system/JoinEvent.java b/src/main/java/net/t2code/autoresponse/Spigot/system/JoinEvent.java
index eed4dac..d5a349e 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/system/JoinEvent.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/system/JoinEvent.java
@@ -4,7 +4,7 @@ package net.t2code.autoresponse.Spigot.system;
import net.t2code.autoresponse.Spigot.Main;
import net.t2code.autoresponse.Util;
-import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
+import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -18,6 +18,6 @@ public class JoinEvent implements Listener {
return;
}
Player player = event.getPlayer();
- UpdateAPI.join(Main.getPlugin(), Util.getPrefix(),Permissions.updatemsg,player,Util.getSpigot(), Util.getDiscord());
+ T2CupdateAPI.join(Main.getPlugin(), Util.getPrefix(),Permissions.updatemsg,player,Util.getSpigotID(), Util.getDiscord());
}
}
\ No newline at end of file
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/system/Load.java b/src/main/java/net/t2code/autoresponse/Spigot/system/Load.java
index 1f17e3c..0480258 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/system/Load.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/system/Load.java
@@ -10,25 +10,25 @@ import net.t2code.autoresponse.Spigot.config.languages.SelectMessages;
import net.t2code.autoresponse.Spigot.config.response.CreateExampleResponse;
import net.t2code.autoresponse.Spigot.config.response.SelectResponses;
import net.t2code.autoresponse.Spigot.event.ResponseListener;
-import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
-import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
+import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
+import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import org.bukkit.Bukkit;
-import org.bukkit.plugin.Plugin;
import java.util.List;
public class Load {
static Main plugin = Main.getPlugin();
public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
- Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
+ Long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
plugin.getCommand("t2code-autoresponse").setExecutor( new CmdExecuter());
loadReload();
- UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
+ T2CupdateAPI.onUpdateCheck(plugin, prefix,Util.getGit(), spigotID, discord,
+ SelectConfig.updateCheckOnJoin,SelectConfig.updateCheckSeePreReleaseUpdates,SelectConfig.updateCheckTimeInterval);
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
Bukkit.getServer().getPluginManager().registerEvents(new ResponseListener(), plugin);
- T2CodeTemplate.onLoadFooter(prefix, long_,version);
+ T2Ctemplate.onLoadFooter(prefix, long_,version);
Metrics.Bstats(plugin, bstatsID);
if (SelectConfig.bungee) {
plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
diff --git a/src/main/java/net/t2code/autoresponse/Spigot/system/Permissions.java b/src/main/java/net/t2code/autoresponse/Spigot/system/Permissions.java
index 99e6bd0..1091036 100644
--- a/src/main/java/net/t2code/autoresponse/Spigot/system/Permissions.java
+++ b/src/main/java/net/t2code/autoresponse/Spigot/system/Permissions.java
@@ -2,7 +2,7 @@ package net.t2code.autoresponse.Spigot.system;
import net.t2code.autoresponse.Spigot.Main;
import net.t2code.autoresponse.Spigot.objects.ResponsesObject;
-import net.t2code.lib.Spigot.Lib.register.Register;
+import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import org.bukkit.permissions.PermissionDefault;
public class Permissions {
@@ -15,12 +15,12 @@ public class Permissions {
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
protected static void register() {
- Register.permission(info, op, Main.getPlugin());
- Register.permission(updatemsg, op, Main.getPlugin());
- Register.permission(admin, op, info, true, Main.getPlugin());
- Register.permission(admin, op, updatemsg, true, Main.getPlugin());
+ T2Cregister.permission(info, op, Main.getPlugin());
+ T2Cregister.permission(updatemsg, op, Main.getPlugin());
+ T2Cregister.permission(admin, op, info, true, Main.getPlugin());
+ T2Cregister.permission(admin, op, updatemsg, true, Main.getPlugin());
for (ResponsesObject response : Main.allResponses) {
- Register.permission(response.permission, op, Main.getPlugin());
+ T2Cregister.permission(response.permission, op, Main.getPlugin());
}
}
}
diff --git a/src/main/java/net/t2code/autoresponse/Util.java b/src/main/java/net/t2code/autoresponse/Util.java
index 5880ec0..145f06e 100644
--- a/src/main/java/net/t2code/autoresponse/Util.java
+++ b/src/main/java/net/t2code/autoresponse/Util.java
@@ -1,9 +1,16 @@
package net.t2code.autoresponse;
public class Util {
- private static String requiredT2CodeLibVersion = "12.5";
+
+ public static String getInfoText() {
+ return "";
+ }
+ private static String requiredT2CodeLibVersion = "13.4";
private static String Prefix = "§8[§4T2Code§7-§bAutoResponse§8]";
private static Integer SpigotID = 100603;
+ public static String getGit() {
+ return "JaTiTV/T2C-AutoResponse";
+ }
private static Integer BstatsID = 14091;
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
private static String Discord = "http://dc.t2code.net";
diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml
deleted file mode 100644
index 9bff690..0000000
--- a/src/main/resources/bungee.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-name: T2C-AutoResponse
-version: ${project.version}
-main: net.t2code.autoresponse.Bungee.BMain
-description: T2Code Alias Plugin
-author: JaTiTV
-softdepends: [T2CodeLib]