Skip to content

Commit

Permalink
Add party detector
Browse files Browse the repository at this point in the history
Fix int parsing bug in Swiss German
  • Loading branch information
Lezurex committed Jan 30, 2021
1 parent d6ba85d commit 408204a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion config/splash.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Splash screen properties
#Sat Jan 30 19:04:06 CET 2021
#Sat Jan 30 19:19:39 CET 2021
logoTexture=textures/gui/title/mojang.png
background=0xFFFFFF
font=0x0
Expand Down
12 changes: 6 additions & 6 deletions options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ key_key.hotbar.6:7
key_key.hotbar.7:8
key_key.hotbar.8:9
key_key.hotbar.9:10
soundCategory_master:0.08278146
soundCategory_master:0.3245033
soundCategory_music:0.0
soundCategory_record:0.15492958
soundCategory_record:1.0
soundCategory_weather:0.0
soundCategory_block:0.16197184
soundCategory_block:1.0
soundCategory_hostile:0.0
soundCategory_neutral:0.15492958
soundCategory_player:0.0
soundCategory_ambient:0.14788732
soundCategory_neutral:1.0
soundCategory_player:1.0
soundCategory_ambient:1.0
modelPart_cape:true
modelPart_jacket:true
modelPart_left_sleeve:true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void register() {
@Override
public boolean onReceive(String formatted, String unFormatted) {

if(StatsAddon.getInstance().getCurrentGamemode() != null && unFormatted.contains("»") && !unFormatted.contains(LabyMod.getInstance().getPlayerName())) {
if (StatsAddon.getInstance().getCurrentGamemode() != null && unFormatted.contains("»") && !unFormatted.contains(LabyMod.getInstance().getPlayerName())) {
new Thread(() -> {
try {
Thread.sleep(StatsAddon.getInstance().cooldown);
Expand All @@ -36,7 +36,7 @@ public boolean onReceive(String formatted, String unFormatted) {

List<NetworkPlayerInfo> playerInfos = Lists.newCopyOnWriteArrayList();
Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap().forEach((loadedPlayer) -> {
if(!StatsAddon.getInstance().getPlayersJoined().contains(loadedPlayer)) {
if (!StatsAddon.getInstance().getPlayersJoined().contains(loadedPlayer)) {
playerInfos.add(loadedPlayer);
StatsAddon.getInstance().getPlayersJoined().add(loadedPlayer);
}
Expand All @@ -46,27 +46,34 @@ public boolean onReceive(String formatted, String unFormatted) {
new StatsDisplayUtil().displayStats(playerInfos);
}).start();
}
if(StatsAddon.getInstance().getCurrentGamemode() != null && StatsAddon.getInstance().enabled) {
if (StatsAddon.getInstance().getCurrentGamemode() != null && StatsAddon.getInstance().enabled) {
new Thread(() -> {
if(unFormatted.toLowerCase().contains("-=")) {
if (unFormatted.toLowerCase().contains("-=")) {
lastPlayerName = getNameFromStatsLine(unFormatted);
}
if(unFormatted.toLowerCase().contains("ranking:") && unFormatted.startsWith(" ")) {
if (unFormatted.toLowerCase().contains("ranking:") && unFormatted.startsWith(" ")) {
String[] content = formatted.split("\u00A7e");
if(content.length == 2) {
if (content.length == 2) {

if(!content[1].contains("-")) {
int rank = Integer.parseInt(content[1].replace("\u00A7e", "").replace(" ", "").replace(".", "").replace(",", "").replace("'", "").replace("\u00A7r", ""));
if(rank < StatsAddon.getInstance().warnLevel) {
if (!content[1].contains("-")) {
int rank = Integer.parseInt(content[1]
.replace("\u00A7e", "")
.replace(" ", "")
.replace(".", "")
.replace(",", "")
.replace("'", "")
.replace("\u00A7r", "")
.replace("`", ""));
if (rank < StatsAddon.getInstance().warnLevel) {
try {
Thread.sleep(20);
} catch (InterruptedException exception) {
exception.printStackTrace();
}
if(!lastPlayerName.equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getName())) {
if (!lastPlayerName.equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getName())) {
LabyMod.getInstance().displayMessageInChat(StatsAddon.getInstance().getGamemodePrefix() + "\u00A74Achtung! \u00A77Potentiell gef\u00E4hrlicher Gegner\u00A77!");
LabyMod.getInstance().displayMessageInChat(StatsAddon.getInstance().getGamemodePrefix() + "\u00A77Platz \u00A7e#" + rank + " \u00A77Name\u00A78: \u00A7c" + lastPlayerName);
if(StatsAddon.getInstance().alertEnabled) {
if (StatsAddon.getInstance().alertEnabled) {
new Thread(() -> {
for (int i = 0; i < 5; i++) {
Minecraft.getMinecraft().thePlayer.playSound("note.pling", 1, 1);
Expand All @@ -91,7 +98,7 @@ public boolean onReceive(String formatted, String unFormatted) {
}

private String getNameFromStatsLine(String string) {
if(string.contains("-=")) {
if (string.contains("-=")) {
String[] words = string.split(" ");
return words[3].replace("\u00A76", "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ public void displayStats(List<NetworkPlayerInfo> playerInfos) {
new Thread(() -> {
for(NetworkPlayerInfo playerInfo: playerInfos) {
if (StatsAddon.getInstance().getCurrentGamemode() != null) {
if (!playerInfo.getPlayerTeam().getColorSuffix().toLowerCase().replace("i", "y").replace("á", "a").contains("party")) {
if (playerInfo.getGameProfile() != Minecraft.getMinecraft().thePlayer.getGameProfile()) {
if (!playerInfo.getPlayerTeam().getColorSuffix().toLowerCase()
.replace("i", "y")
.replace("á", "a")
.contains("party")) {
if (!playerInfo.getGameProfile().getName().equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getName())) {
if (!StatsAddon.getInstance().checkedPlayers.contains(playerInfo)) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("/" + this.getCommand(playerInfo.getDisplayName().toString()));
Minecraft.getMinecraft().thePlayer.sendChatMessage("/" + this.getCommand(playerInfo.getGameProfile().getName()));
playerInfos.remove(playerInfo);
StatsAddon.getInstance().checkedPlayers.add(playerInfo);
try {
Expand Down

0 comments on commit 408204a

Please sign in to comment.