diff --git a/core/src/main/java/top/einsluca/autogg/AutoGGConfiguration.java b/core/src/main/java/top/einsluca/autogg/AutoGGConfiguration.java index f2ac9a6..cf9d342 100644 --- a/core/src/main/java/top/einsluca/autogg/AutoGGConfiguration.java +++ b/core/src/main/java/top/einsluca/autogg/AutoGGConfiguration.java @@ -20,6 +20,12 @@ public class AutoGGConfiguration extends AddonConfig { @SwitchWidget.SwitchSetting private final ConfigProperty custom = new ConfigProperty<>(true); + @SwitchWidget.SwitchSetting + private final ConfigProperty defaults = new ConfigProperty<>(true); + + @SwitchWidget.SwitchSetting + private final ConfigProperty hypixel = new ConfigProperty<>(false); + @TextFieldWidget.TextFieldSetting public final ConfigProperty message = new ConfigProperty<>("gg"); @@ -41,4 +47,12 @@ public ConfigProperty enabled() { public ConfigProperty getCustom() { return custom; } + + public ConfigProperty getDefaults() { + return defaults; + } + + public ConfigProperty getHypixel() { + return hypixel; + } } diff --git a/core/src/main/java/top/einsluca/autogg/listener/ChatListener.java b/core/src/main/java/top/einsluca/autogg/listener/ChatListener.java index e7cace6..6b876f5 100644 --- a/core/src/main/java/top/einsluca/autogg/listener/ChatListener.java +++ b/core/src/main/java/top/einsluca/autogg/listener/ChatListener.java @@ -20,9 +20,19 @@ public void onChat(ChatReceiveEvent event) { } String message = event.chatMessage().getOriginalPlainText(); + if (!this.addon.configuration().getDefaults().get()) { + return; + } + this.addon.getServerRegistry().getServers().forEach(serverConfiguration -> { serverConfiguration.getServerAddress().forEach(serverAddress -> { - if (Laby.labyAPI().serverController().getCurrentServerData().address().getHost().equals(serverAddress)) { + + + if (Laby.labyAPI().serverController().getCurrentServerData().address().getHost().contains("hypixel.net") && !this.addon.configuration().getHypixel().getOrDefault(true)) { + return; + } + + if (Laby.labyAPI().serverController().getCurrentServerData().address().getHost().contains(serverAddress)) { for (String s : serverConfiguration.getFilter()) { if (message.contains(s)) { return; diff --git a/core/src/main/java/top/einsluca/autogg/server/CafeStubeConfiguration.java b/core/src/main/java/top/einsluca/autogg/server/CafeStubeConfiguration.java index 4f57dd0..2db55e6 100644 --- a/core/src/main/java/top/einsluca/autogg/server/CafeStubeConfiguration.java +++ b/core/src/main/java/top/einsluca/autogg/server/CafeStubeConfiguration.java @@ -5,7 +5,7 @@ public class CafeStubeConfiguration implements ServerConfiguration { @Override public List getServerAddress() { - return List.of("cafestu.be", "cafestibe.eu"); + return List.of("cafestu.be", "cafestube.eu"); } @Override diff --git a/core/src/main/java/top/einsluca/autogg/server/HypixelConfiguration.java b/core/src/main/java/top/einsluca/autogg/server/HypixelConfiguration.java new file mode 100644 index 0000000..cb90815 --- /dev/null +++ b/core/src/main/java/top/einsluca/autogg/server/HypixelConfiguration.java @@ -0,0 +1,20 @@ +package top.einsluca.autogg.server; + +import java.util.List; + +public class HypixelConfiguration implements ServerConfiguration { + @Override + public List getServerAddress() { + return List.of("hypixel.net"); + } + + @Override + public List getFormat() { + return List.of("Game over!", "won the game!", "They captured all wools!", "YOUR STATISTICS"); + } + + @Override + public List getFilter() { + return List.of(":"); + } +} diff --git a/core/src/main/java/top/einsluca/autogg/server/MyPvPConfiguration.java b/core/src/main/java/top/einsluca/autogg/server/MyPvPConfiguration.java index 8bf3d80..dd80e22 100644 --- a/core/src/main/java/top/einsluca/autogg/server/MyPvPConfiguration.java +++ b/core/src/main/java/top/einsluca/autogg/server/MyPvPConfiguration.java @@ -11,7 +11,7 @@ public List getServerAddress() { @Override public List getFormat() { - return List.of("Deine Spiel-Statistiken", "Your game statistics"); + return List.of("Deine Spiel-Statistiken", "Your game statistics", "Hat das Spiel gewonnen!"); } @Override diff --git a/core/src/main/java/top/einsluca/autogg/server/ServerRegistry.java b/core/src/main/java/top/einsluca/autogg/server/ServerRegistry.java index 02e3eee..9261b38 100644 --- a/core/src/main/java/top/einsluca/autogg/server/ServerRegistry.java +++ b/core/src/main/java/top/einsluca/autogg/server/ServerRegistry.java @@ -16,6 +16,7 @@ public ServerRegistry() { this.servers.add(new MCCIslandConfiguration()); this.servers.add(new MyPvPConfiguration()); this.servers.add(new StayMCConfiguration()); + this.servers.add(new HypixelConfiguration()); } public List getServers() { diff --git a/core/src/main/resources/assets/autogg/i18n/de_de.json b/core/src/main/resources/assets/autogg/i18n/de_de.json index a380c13..488fd2e 100644 --- a/core/src/main/resources/assets/autogg/i18n/de_de.json +++ b/core/src/main/resources/assets/autogg/i18n/de_de.json @@ -6,12 +6,21 @@ "name": "Aktiviert" }, "custom": { - "name": "Server-Protokoll" + "name": "Server-Protokoll", + "description": "Server-Protokoll bedeutet das Drittanbieter Server dich dazu bringen können, die GG Nachricht zu schreiben." }, "delay": { "name": "Verzögerung", "description": "Die Verzögerung zwischen dem Gewinn und dem Senden der Nachricht." }, + "defaults": { + "name": "Standard-Server", + "description": "Schalte ein oder aus, ob Standardserver genutzt werden sollen, eine Liste findest du weiter unten." + }, + "hypixel": { + "name": "Hypixel", + "description": "Schalte Hypixel Support ein oder aus." + }, "message": { "name": "Nachricht", "description": "Die Nachricht die gesendet wird, wenn du ein Spiel gewinnst." diff --git a/core/src/main/resources/assets/autogg/i18n/en_us.json b/core/src/main/resources/assets/autogg/i18n/en_us.json index bc10dfc..c53b690 100644 --- a/core/src/main/resources/assets/autogg/i18n/en_us.json +++ b/core/src/main/resources/assets/autogg/i18n/en_us.json @@ -6,12 +6,21 @@ "name": "Enabled" }, "custom": { - "name": "Server-Protocol" + "name": "Server-Protocol", + "description": "Server protocol means that third-party servers can make you write the GG message." }, "delay": { "name": "Delay", "description": "The delay between the game ending and the message being sent." }, + "defaults": { + "name": "Default servers", + "description": "Toggle on or off whether to use default servers, you can find a list below." + }, + "hypixel": { + "name": "Hypixel", + "description": "Switch Hypixel Support on or off." + }, "message": { "name": "Message", "description": "The message to send when the game ends."