Skip to content

Commit

Permalink
add hypixel and some new configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
EinsLucaaa committed Jul 12, 2023
1 parent 8f1452d commit 16f05e6
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 5 deletions.
14 changes: 14 additions & 0 deletions core/src/main/java/top/einsluca/autogg/AutoGGConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public class AutoGGConfiguration extends AddonConfig {
@SwitchWidget.SwitchSetting
private final ConfigProperty<Boolean> custom = new ConfigProperty<>(true);

@SwitchWidget.SwitchSetting
private final ConfigProperty<Boolean> defaults = new ConfigProperty<>(true);

@SwitchWidget.SwitchSetting
private final ConfigProperty<Boolean> hypixel = new ConfigProperty<>(false);

@TextFieldWidget.TextFieldSetting
public final ConfigProperty<String> message = new ConfigProperty<>("gg");

Expand All @@ -41,4 +47,12 @@ public ConfigProperty<Boolean> enabled() {
public ConfigProperty<Boolean> getCustom() {
return custom;
}

public ConfigProperty<Boolean> getDefaults() {
return defaults;
}

public ConfigProperty<Boolean> getHypixel() {
return hypixel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class CafeStubeConfiguration implements ServerConfiguration {
@Override
public List<String> getServerAddress() {
return List.of("cafestu.be", "cafestibe.eu");
return List.of("cafestu.be", "cafestube.eu");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package top.einsluca.autogg.server;

import java.util.List;

public class HypixelConfiguration implements ServerConfiguration {
@Override
public List<String> getServerAddress() {
return List.of("hypixel.net");
}

@Override
public List<String> getFormat() {
return List.of("Game over!", "won the game!", "They captured all wools!", "YOUR STATISTICS");
}

@Override
public List<String> getFilter() {
return List.of(":");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public List<String> getServerAddress() {

@Override
public List<String> getFormat() {
return List.of("Deine Spiel-Statistiken", "Your game statistics");
return List.of("Deine Spiel-Statistiken", "Your game statistics", "Hat das Spiel gewonnen!");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ServerConfiguration> getServers() {
Expand Down
11 changes: 10 additions & 1 deletion core/src/main/resources/assets/autogg/i18n/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
11 changes: 10 additions & 1 deletion core/src/main/resources/assets/autogg/i18n/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 16f05e6

Please sign in to comment.