Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

Commit 332c27b

Browse files
author
UltraBlackLinux
committed
Added Modmenu entry:
- changeable length, index, words - toggleable message Damn this took long.
1 parent 55b8409 commit 332c27b

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ minecraft_version=1.16.5
66
yarn_mappings=1.16.5+build.4
77
loader_version=0.11.1
88
# Mod Properties
9-
mod_version=1.0
9+
mod_version=2.0
1010
maven_group=me.UltraBlackLinux
1111
archives_base_name=FixGG
1212
# Dependencies

src/main/java/me/ultrablacklinux/fixgg/config/FixGGConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ public static FixGGConfig get() {
2727
@Config(name = "general")
2828
public static class General implements ConfigData {
2929
@Comment("Words to check for typos. They mustn't contain themselves.")
30-
public String words = "gg gf gp";
30+
public String words = "gg;gf;gp";
3131
@Comment("Max amount of characters to be in front of the words.")
3232
public int index = 3;
33+
@Comment("Max amount of characters in the message part.")
34+
public int length = 6;
3335
@Comment("Toggle the notification")
3436
public boolean message = true;
3537
}

src/main/java/me/ultrablacklinux/fixgg/mixin/PlayerMixin.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,17 @@ public abstract class PlayerMixin {
2323

2424
@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
2525
private void onChatMessage(String fmsg, CallbackInfo info) {
26-
//important values
27-
//String[] words = new String[] {"gf", "gg", "gp"};
28-
String[] words = FixGGConfig.get().general.words.split(" ");
26+
String[] words = FixGGConfig.get().general.words.split(";");
2927
boolean showMessage = FixGGConfig.get().general.message;
3028
int maxIndex = FixGGConfig.get().general.index;
31-
//important values
32-
29+
int maxLength = FixGGConfig.get().general.length;
3330
String[] msg = fmsg.split(" ");
3431
Boolean changed = false;
3532

3633
for (String checkWord : words) { //check, if word exists
3734
for (int currentLocation = 0; currentLocation < msg.length; currentLocation++) {
3835
if (msg[currentLocation].toLowerCase().contains(checkWord) && !msg[currentLocation].toLowerCase().matches(checkWord)) {
39-
if (msg[currentLocation].length() <= maxIndex) {
36+
if (msg[currentLocation].indexOf(checkWord) <= maxIndex + 1 && msg[currentLocation].length() <= maxLength) {
4037
changed = true;
4138
if (msg[currentLocation].contains(checkWord.toUpperCase())) {
4239
msg[currentLocation] = checkWord.toUpperCase();

src/main/resources/assets/fixmygg/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"text.autoconfig.fixmygg.title": "FixMyGG Config",
33
"text.autoconfig.fixmygg.option.general.words": "Words",
44
"text.autoconfig.fixmygg.option.general.index": "Index",
5+
"text.autoconfig.fixmygg.option.general.length": "Length",
56
"text.autoconfig.fixmygg.option.general.message": "Notification"
67
}

0 commit comments

Comments
 (0)