0.1.0 | Add Update Checker

This commit is contained in:
JaTiTV 2022-03-10 22:54:01 +01:00
parent 051c5de5da
commit b4d1fcf457
6 changed files with 62 additions and 11 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>AutoResponse</artifactId> <artifactId>AutoResponse</artifactId>
<version>0.0.1</version> <version>0.1.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>T2C-AutoResponse</name> <name>T2C-AutoResponse</name>

View File

@ -23,7 +23,6 @@ public class CreateExampleResponse {
File config = new File(Main.getPath(), "Responses/responseexample.yml"); File config = new File(Main.getPath(), "Responses/responseexample.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
Config.set("Response.Enable", true, yamlConfiguration); Config.set("Response.Enable", true, yamlConfiguration);
Config.set("Response.ResponseKeys", Collections.singletonList(".example"), yamlConfiguration); Config.set("Response.ResponseKeys", Collections.singletonList(".example"), yamlConfiguration);
Config.set("Response.Contains", false, yamlConfiguration); Config.set("Response.Contains", false, yamlConfiguration);
@ -41,7 +40,15 @@ public class CreateExampleResponse {
Config.set("Response.Message.TextBuilder.Hover", "&5Discord: &edc.t2code.net", yamlConfiguration); Config.set("Response.Message.TextBuilder.Hover", "&5Discord: &edc.t2code.net", yamlConfiguration);
Config.set("Response.Message.TextBuilder.ClickEvent.Enable", true, yamlConfiguration); Config.set("Response.Message.TextBuilder.ClickEvent.Enable", true, yamlConfiguration);
Config.set("Response.Message.TextBuilder.ClickEvent.Action", "OPEN_URL", yamlConfiguration); Config.set("Response.Message.TextBuilder.ClickEvent.Action", "OPEN_URL", yamlConfiguration);
Config.set("Response.Message.TextBuilder.ClickEvent.ActionValue", "dc.t2code.net", yamlConfiguration); Config.set("Response.Message.TextBuilder.ClickEvent.ActionValue", "http://dc.t2code.net", 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);
try { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);
} catch (IOException e) { } catch (IOException e) {

View File

@ -36,9 +36,16 @@ public class SelectResponses {
yamlConfiguration.getString("Response.Message.TextBuilder.Hover"), yamlConfiguration.getString("Response.Message.TextBuilder.Hover"),
yamlConfiguration.getBoolean("Response.Message.TextBuilder.ClickEvent.Enable"), yamlConfiguration.getBoolean("Response.Message.TextBuilder.ClickEvent.Enable"),
yamlConfiguration.getString("Response.Message.TextBuilder.ClickEvent.Action"), yamlConfiguration.getString("Response.Message.TextBuilder.ClickEvent.Action"),
yamlConfiguration.getString("Response.Message.TextBuilder.ClickEvent.ActionValue")); yamlConfiguration.getString("Response.Message.TextBuilder.ClickEvent.ActionValue"),
yamlConfiguration.getBoolean("Response.Protection.GameMode.Enable"),
yamlConfiguration.getString("Response.Protection.GameMode.Mode"),
yamlConfiguration.getStringList("Response.Protection.GameMode.List"),
yamlConfiguration.getBoolean("Response.Protection.World.Enable"),
yamlConfiguration.getString("Response.Protection.World.Mode"),
yamlConfiguration.getStringList("Response.Protection.World.List"));
Main.allResponses.add(response); Main.allResponses.add(response);
Main.allResponse.add(yamlConfiguration.getString("Response.ResponseKey")); Main.allResponse.addAll(yamlConfiguration.getStringList("Response.ResponseKeys"));
} }
} }
} }

View File

@ -37,7 +37,6 @@ public class ResponseListener implements Listener {
return; return;
} }
} }
} else { } else {
for (String responseKey : response.responseKeys){ for (String responseKey : response.responseKeys){
if (e.getMessage().equals(responseKey)) { if (e.getMessage().equals(responseKey)) {
@ -45,13 +44,31 @@ public class ResponseListener implements Listener {
return; return;
} }
} }
} }
} }
} }
} }
private static void execute(AsyncPlayerChatEvent e, Player player, ResponsesObject response, String responseKey) { private static void execute(AsyncPlayerChatEvent e, Player player, ResponsesObject response, String responseKey) {
if (response.protectionGameModeEnable) {
if (response.protectionGameModeMode.equalsIgnoreCase("blacklist") && response.protectionGameModeList.contains(player.getGameMode().toString())) {
return;
}
if (response.protectionGameModeMode.equalsIgnoreCase("whitelist") && !response.protectionGameModeList.contains(player.getGameMode().toString())) {
return;
}
}
if (response.protectionWorldEnable) {
if (response.protectionWorldMode.equalsIgnoreCase("blacklist") && response.protectionWorldList.contains(player.getWorld().getName())) {
return;
}
if (response.protectionWorldMode.equalsIgnoreCase("whitelist") && !response.protectionWorldList.contains(player.getWorld().getName())) {
return;
}
}
use(e, player, responseKey);
if (response.commandEnable) { if (response.commandEnable) {
for (String cmd : response.command) { for (String cmd : response.command) {
if (response.bungeeCommand) { if (response.bungeeCommand) {
@ -74,7 +91,6 @@ public class ResponseListener implements Listener {
Cmd.player(player, cmd.replace("[player]", player.getName())); Cmd.player(player, cmd.replace("[player]", player.getName()));
} }
} }
use(e, player, responseKey);
} }
} }
if (response.messageEnable) { if (response.messageEnable) {
@ -98,7 +114,6 @@ public class ResponseListener implements Listener {
} else { } else {
send.player(player, text); send.player(player, text);
} }
use(e, player, responseKey);
} }
} }
} }

View File

@ -21,6 +21,14 @@ public class ResponsesObject {
public String action; public String action;
public String actionValue; public String actionValue;
public Boolean protectionGameModeEnable;
public String protectionGameModeMode;
public List<String> protectionGameModeList;
public Boolean protectionWorldEnable;
public String protectionWorldMode;
public List<String> protectionWorldList;
public ResponsesObject(Boolean enable, public ResponsesObject(Boolean enable,
List<String> responseKeys, List<String> responseKeys,
Boolean contains, Boolean contains,
@ -36,7 +44,13 @@ public class ResponsesObject {
String hover, String hover,
Boolean clickEvent, Boolean clickEvent,
String action, String action,
String actionValue) { String actionValue,
Boolean protectionGameModeEnable,
String protectionGameModeMode,
List<String> protectionGameModeList,
Boolean protectionWorldEnable,
String protectionWorldMode,
List<String> protectionWorldList) {
this.enable = enable; this.enable = enable;
this.responseKeys = responseKeys; this.responseKeys = responseKeys;
this.contains=contains; this.contains=contains;
@ -53,5 +67,13 @@ public class ResponsesObject {
this.clickEvent = clickEvent; this.clickEvent = clickEvent;
this.action = action; this.action = action;
this.actionValue = actionValue; this.actionValue = actionValue;
this.protectionGameModeEnable = protectionGameModeEnable;
this.protectionGameModeMode = protectionGameModeMode;
this.protectionGameModeList = protectionGameModeList;
this.protectionWorldEnable = protectionWorldEnable;
this.protectionWorldMode = protectionWorldMode;
this.protectionWorldList = protectionWorldList;
} }
} }

View File

@ -3,7 +3,7 @@ package net.t2code.autoresponse;
public class Util { public class Util {
private static double requiredT2CodeLibVersion = 11.0; private static double requiredT2CodeLibVersion = 11.0;
private static String Prefix = "§8[§4T2Code§7-§bAutoResponse§8]"; private static String Prefix = "§8[§4T2Code§7-§bAutoResponse§8]";
private static Integer SpigotID = 00000; private static Integer SpigotID = 100603;
private static Integer BstatsID = 14091; private static Integer BstatsID = 14091;
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID; private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
private static String Discord = "http://dc.t2code.net"; private static String Discord = "http://dc.t2code.net";