Skip to content

Commit

Permalink
reformatted code, added new chat tags
Browse files Browse the repository at this point in the history
  • Loading branch information
firef1a committed Jun 2, 2024
1 parent 407c263 commit 1fea488
Show file tree
Hide file tree
Showing 8 changed files with 533 additions and 1,319 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Replaces the **TERRIBLE** and **UGLY** _new rank tags_ 👎👎LLLL with the **A
## This mod is exclusively for the minecraft server [DiamondFire](https://mcdiamondfire.com/)
Do not use this mod if you don't player DiamondFire, you'll be very disappointed!

### New Chat Tags (L)
![new](https://cdn.modrinth.com/data/cached_images/3974d68eb66ba03106bd9bec253081e3f0792589.png)
### Replaced with Old Chat Tags (very WWW)
![old](https://cdn.modrinth.com/data/cached_images/5d210ff4a57f48ad3bbf3df55ad97821438163fe.png)
### You can also use custom colors and symbols!
![Customized Rank Tags](https://cdn.modrinth.com/data/cached_images/5fb4989387991c053c7951d76ac5fabed84a30ac.png)

## Supported Rank Tags
Expand All @@ -23,6 +28,9 @@ The following Rank tags are supported:
- Dev
- Admin
- Owner (real)
- Emeritus
- Retired
- Builder

## Additional Features
This mod also allows you to disable VIP tags/badges completely (from [YouAintCool](https://github.com/Reasonlesss/YouAintCool) by [ReasonLess](https://github.com/Reasonlesss)) in the VIP section of the config.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.4+build.3
loader_version=0.15.11

# Mod Properties
mod_version=1.0.0-alpha
mod_version=1.1.0
maven_group=dev.fire
archives_base_name=dfrevert

Expand Down
300 changes: 108 additions & 192 deletions src/main/java/dev/fire/TextUtil.java

Large diffs are not rendered by default.

32 changes: 25 additions & 7 deletions src/main/java/dev/fire/config/ChatTag.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
package dev.fire.config;

import com.google.gson.JsonObject;
import net.minecraft.network.message.SentMessage;

public class ChatTag {
import java.io.Serializable;
import java.util.Map;

public class ChatTag implements Serializable {
public int BracketColor;
public int SymbolColor;
public int TextColor;
public String Symbol;
public String TextContent;
public ChatTag(int bracketcolor, int symbolcolor, int textcolor, String sym, String textcontent) {
BracketColor = bracketcolor;
SymbolColor = symbolcolor;
TextColor = textcolor;
Symbol = sym;
TextContent = textcontent;
public boolean addBoldSpace;
public ChatTag(int bracketcolor, int symbolcolor, int textcolor, String sym, String textcontent, boolean addBoldSpace) {
this.BracketColor = bracketcolor;
this.SymbolColor = symbolcolor;
this.TextColor = textcolor;
this.Symbol = sym;
this.TextContent = textcontent;
this.addBoldSpace = addBoldSpace;
}

public String toJson(){
JsonObject object = new JsonObject();
object.addProperty("BracketColor", BracketColor);
object.addProperty("SymbolColor", SymbolColor);
object.addProperty("TextColor", TextColor);
object.addProperty("Symbol", Symbol);
object.addProperty("TextContent", TextContent);
object.addProperty("addBoldSpace", addBoldSpace);
return object.toString();
}

}
1,409 changes: 310 additions & 1,099 deletions src/main/java/dev/fire/config/Config.java

Large diffs are not rendered by default.

93 changes: 74 additions & 19 deletions src/main/java/dev/fire/config/DefaultConfig.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package dev.fire.config;

import net.minecraft.text.Text;

import java.lang.reflect.Array;
import dev.fire.config.ChatTag;
import java.util.Arrays;
import java.util.List;
import java.util.*;

import static java.util.Map.entry;

public class DefaultConfig {
public static Config.CharSetOption SaveCharSet = Config.CharSetOption.UTF_8;
Expand All @@ -15,23 +15,78 @@ public class DefaultConfig {
public static boolean DisableMod = false;
public static boolean ShortenedChatTags = true;

public static ChatTag Vip = new ChatTag(0xFFAA00,0xFFD47F,0xFFD47F,"⭐","VIP");
public static Map<String, ChatTag> oldChatTags = Map.ofEntries(
entry("vip", new ChatTag(0xFFAA00, 0xFFD47F, 0xFFD47F, "⭐","VIP", false)),
entry("overlord", new ChatTag(0x00AAAA, 0xAAAAAA, 0xAA0000, "◆", "Overlord", false)),
entry("mythic", new ChatTag(0x555555, 0x555555, 0xAA00AA, "", "Mythic", false)),
entry("emperor", new ChatTag(0x00AA00, 0x00AA00, 0x55FFFF, "", "Emperor", false)),
entry("noble", new ChatTag(0xFFAA00, 0xFFAA00, 0x55FF55, "", "Noble", false)),

entry("owner", new ChatTag(0x000000, 0x000000, 0xFF0000, "", "Owner", false)),
entry("admin", new ChatTag(0x555555, 0x555555, 0xFF0000, "", "Admin", false)),
entry("dev", new ChatTag(0x555555, 0x555555, 0xFF7FAA, "", "Dev", false)),
entry("srmod", new ChatTag(0x808080, 0x808080, 0xAAFF55, "", "SrMod", false)),
entry("mod", new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55FF55, "", "Mod", false)),
entry("jrmod", new ChatTag(0xAAAAAA, 0xAAAAAA, 0x2AD42A, "", "JrMod", false)),
entry("srhelper", new ChatTag(0x808080, 0x808080, 0x2AFFAA, "", "SrHelper", false)),
entry("helper", new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55FFFF, "", "Helper", false)),
entry("jrhelper", new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55AAFF, "", "JrHelper", false)),
entry("emeritus", new ChatTag(0xFFAA00, 0xFFAA00, 0x2AD4D4, "", "Retired", false)),
entry("retired", new ChatTag(0x005555, 0x005555, 0x00AAAA, "", "Retired", false)),
entry("builder", new ChatTag(0x80552A, 0x80552A, 0xFFAA00, "", "Builder", false))
);

public static Map<String, ChatTag> newChatTags = Map.ofEntries(
entry("vip", new ChatTag(0xFFAA00, 0xFFD47F, 0xFFD47F, "⭐","VIP", false)),
entry("overlord", new ChatTag(0xAA002A, 0xFF7F7F, 0xFF5555, "◆", "Overlord", true)),
entry("mythic", new ChatTag(0x7F00AA, 0xFF7FD4, 0xD42AD4, "◇", "Mythic", true)),
entry("emperor", new ChatTag(0x2A70D4, 0xAAFFFF, 0x55AAFF, "◦", "Emperor", true)),
entry("noble", new ChatTag(0x00AA00, 0x00AA00, 0x7FFF7F, "", "Noble", true)),

entry("owner", new ChatTag(0x000000, 0x000000, 0xFF0000, "", "Owner", false)),
entry("admin", new ChatTag(0x555555, 0x555555, 0xFF0000, "", "Admin", false)),
entry("dev", new ChatTag(0x555555, 0x555555, 0xFF7FAA, "", "Dev", false)),
entry("srmod", new ChatTag(0x808080, 0x808080, 0xAAFF55, "", "SrMod", false)),
entry("mod", new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55FF55, "", "Mod", false)),
entry("jrmod", new ChatTag(0xAAAAAA, 0xAAAAAA, 0x2AD42A, "", "JrMod", false)),
entry("srhelper", new ChatTag(0x808080, 0x808080, 0x2AFFAA, "", "SrHelper", false)),
entry("helper", new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55FFFF, "", "Helper", false)),
entry("jrhelper", new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55AAFF, "", "JrHelper", false)),
entry("emeritus", new ChatTag(0xFFAA00, 0xFFAA00, 0x2AD4D4, "", "Retired", false)),
entry("retired", new ChatTag(0x005555, 0x005555, 0x00AAAA, "", "Retired", false)),
entry("builder", new ChatTag(0x80552A, 0x80552A, 0xFFAA00, "", "Builder", false))
);

public static ChatTag Overlord = new ChatTag(0x00AAAA, 0xAAAAAA, 0xAA0000, "◆", "Overlord");
public static ChatTag Mythic = new ChatTag(0x555555, 0x555555, 0xAA00AA, "", "Mythic");
public static ChatTag Emperor = new ChatTag(0x00AA00, 0x00AA00, 0x55FFFF, "", "Emperor");
public static ChatTag Noble = new ChatTag(0xFFAA00, 0xFFAA00, 0x55FF55, "", "Noble");
public static ArrayList<String> normalList = new ArrayList<String>(Arrays.asList(
"overlord",
"mythic",
"emperor",
"noble"
));

public static ChatTag Owner = new ChatTag(0x000000, 0x000000, 0xFF0000, "", "Owner");
public static ChatTag Admin = new ChatTag(0x555555, 0x555555, 0xFF0000, "", "Admin");
public static ChatTag Dev = new ChatTag(0x555555, 0x555555, 0xFF7FAA, "", "Dev");
public static ChatTag SrMod = new ChatTag(0x808080, 0x808080, 0xAAFF55, "", "SrMod");
public static ChatTag Mod = new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55FF55, "", "Mod");
public static ChatTag JrMod = new ChatTag(0xAAAAAA, 0xAAAAAA, 0x2AD42A, "", "JrMod");
public static ChatTag SrHelper = new ChatTag(0x808080, 0x808080, 0x2AFFAA, "", "SrHelper");
public static ChatTag Helper = new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55FFFF, "", "Helper");
public static ChatTag JrHelper = new ChatTag(0xAAAAAA, 0xAAAAAA, 0x55AAFF, "", "JrHelper");
public static ArrayList<String> staffList = new ArrayList<String>(Arrays.asList(
"emeritus",
"retired",
"builder",
"owner",
"admin",
"dev",
"srmod",
"mod",
"jrmod",
"srhelper",
"helper",
"jrhelper"
));

public static ChatTag Retired = new ChatTag(0xFFAA00, 0xFFAA00, 0x2AD4D4, "", "Retired");
public static Text getOldOverlord() {
ChatTag overlord = oldChatTags.get("overlord");
return Text.empty()
.append(Text.literal("[").withColor(overlord.BracketColor))
.append(Text.empty().append(Text.literal(overlord.Symbol).withColor(overlord.SymbolColor))
.append(Text.literal(overlord.TextContent).withColor(overlord.TextColor))
.append(Text.literal(overlord.Symbol).withColor(overlord.SymbolColor)))
.append(Text.literal("]").withColor(overlord.BracketColor));
}

}
7 changes: 7 additions & 0 deletions src/main/java/dev/fire/config/DfrevertException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dev.fire.config;

public class DfrevertException extends Exception {
public DfrevertException(String errorMessage) {
super(errorMessage);
}
}
1 change: 0 additions & 1 deletion src/main/java/dev/fire/mixin/ChatHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class ChatHudMixin {

@ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", at = @At("HEAD"), ordinal = 0, argsOnly = true)
public Text inject(Text message) {
//DFrevert.LOGGER.info(String.valueOf(message));
return TextUtil.replaceTags(message, false);
}
}

0 comments on commit 1fea488

Please sign in to comment.