Skip to content

Commit

Permalink
Add Parkour Warrior Survivor support
Browse files Browse the repository at this point in the history
  • Loading branch information
anastarawneh committed Jul 5, 2023
1 parent 8c08f14 commit 4dd1355
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class MCCINametagMod implements ModInitializer {
public static TextColor COLOR = TextColor.fromFormatting(Formatting.DARK_GRAY);
public static int GAME_STAGE = 0;
public static TextColor TEAM_COLOR = TextColor.fromFormatting(Formatting.GRAY);
public static TextColor FACTION_COLOR = TextColor.fromFormatting(Formatting.GRAY);

@Override
public void onInitialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import me.anastarawneh.mccinametagmod.MCCINametagMod;
import me.anastarawneh.mccinametagmod.util.UnicodeChars;
import me.anastarawneh.mccinametagmod.util.Util;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.PlayerListEntry;
Expand All @@ -28,6 +29,7 @@ public void onPlayerList(PlayerListS2CPacket packet, CallbackInfo ci) {
MCCINametagMod.TEAM = tabEntry.getDisplayName().getSiblings().get(1).getString();
MCCINametagMod.RANK = tabEntry.getDisplayName().getSiblings().get(0).getString();
MCCINametagMod.COLOR = tabEntry.getDisplayName().getSiblings().get(3).getStyle().getColor();
MCCINametagMod.FACTION_COLOR = Util.GetFactionColor();
break;
}
}
Expand All @@ -36,16 +38,19 @@ public void onPlayerList(PlayerListS2CPacket packet, CallbackInfo ci) {

@Inject(method = "onGameMessage(Lnet/minecraft/network/packet/s2c/play/GameMessageS2CPacket;)V", at = @At("TAIL"))
public void onGameMessage(GameMessageS2CPacket packet, CallbackInfo ci) {
if (packet.content().getString().contains("[" + UnicodeChars.BattleBox + "] Battle Box")||
packet.content().getString().contains("[" + UnicodeChars.SkyBattle + "] Sky Battle")) {
if (packet.content().getString().contains("[" + UnicodeChars.BattleBox + "] Battle Box") ||
packet.content().getString().contains("[" + UnicodeChars.SkyBattle + "] Sky Battle") ||
packet.content().getString().contains("[" + UnicodeChars.ParkourWarrior + "] Parkour Warrior")) {
MCCINametagMod.GAME_STAGE = 0;
}
if (packet.content().getString().contains("[" + UnicodeChars.Plus + "] You have chosen the") ||
packet.content().getString().contains("[" + UnicodeChars.SkyBattle + "] Game started!")) {
packet.content().getString().contains("[" + UnicodeChars.SkyBattle + "] Game started!") ||
packet.content().getString().contains("[" + UnicodeChars.ParkourWarrior + "] Game Over!")) {
MCCINametagMod.GAME_STAGE = 1;
}
if (packet.content().getString().contains("[" + UnicodeChars.BattleBox + "] Top players") ||
packet.content().getString().contains("[" + UnicodeChars.SkyBattle + "] Game Over!")) {
packet.content().getString().contains("[" + UnicodeChars.SkyBattle + "] Game Over!") ||
packet.content().getString().contains(MCCINametagMod.TEAM + ") You receive:")) {
MCCINametagMod.GAME_STAGE = 2;
}
}
Expand Down
Loading

0 comments on commit 4dd1355

Please sign in to comment.