Skip to content

Commit

Permalink
"Girlboss" "Gaslight" were the people who made these mods teenagers? …
Browse files Browse the repository at this point in the history
…Why would you you want to exploit someone just because you do not agree with their opinion? Those names are so cringe they make me want to throw up! Can we just go back to the old system of chatting and forget chat reporting forever?
  • Loading branch information
0xAda committed Dec 24, 2022
1 parent 562e447 commit 4ca61de
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 85 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Girlboss

Girlboss is a mod that lets you detect when someone sends a private message to another player and attempts to detect who the receiving player is.
Girlboss is a mod that detects when people are sending private messages, and who has seen them. This is done by detecting acknowledgements of messages you haven't received via the last seen field.

The detection of someone sending a message is achieved by listening to "header packets" which are sent whenever a private message is sent.

The detection of who received it is achieved by comparing the "last message" field on the receiver's next chat message.

[Demo Video](https://www.youtube.com/watch?v=xnvMJV1unEY)
[Demo Video](https://www.youtube.com/watch?v=qnf4P1dGR9g)

8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.1
loader_version=0.14.9
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
loader_version=0.14.12
# Mod Properties
mod_version=1.0-SNAPSHOT
maven_group=gg.nodus
archives_base_name=girlboss
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.58.6+1.19.2
fabric_version=0.70.0+1.19.3
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 0 additions & 10 deletions src/main/java/gg/nodus/girlboss/Girlboss.java

This file was deleted.

53 changes: 44 additions & 9 deletions src/main/java/gg/nodus/girlboss/SignatureTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,56 @@

import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text;

import java.util.Arrays;
import java.util.Collection;
import java.util.UUID;
import java.nio.ByteBuffer;
import java.util.*;

public class SignatureTracker {

private static final Multimap<UUID, byte[]> signatures = MultimapBuilder.hashKeys().hashSetValues().build();
private static final Multimap<ByteBuffer, UUID> signatures = MultimapBuilder.hashKeys().hashSetValues().build();
private static final Set<ByteBuffer> seen = new HashSet<>();
private static final Set<String> alertsSent = new HashSet<>();
private static int alertsClearedTick = -1;
private static boolean hasSentFirstAlert = false;

public static void addSignature(UUID sender, byte[] signature) {
signatures.put(sender, signature);
public static void receivedMessage(final ByteBuffer signature) {
seen.add(signature);
}

public static Collection<byte[]> getSignatures(UUID sender) {
return signatures.get(sender);
}
public static void addSeenSignature(final UUID sender, final ByteBuffer signature) {
if (seen.contains(signature) || signatures.containsEntry(signature, sender)) {
return;
}

signatures.put(signature, sender);
if (MinecraftClient.getInstance().world == null) {
return;
}

final Collection<UUID> uuids = signatures.get(signature);
final List<String> names = new ArrayList<>();
for (final UUID uuid : uuids) {
final PlayerEntity playerEntity = MinecraftClient.getInstance().world.getPlayerByUuid(uuid);
if (playerEntity != null) {
names.add(playerEntity.getName().getString());
}
}

final int last = names.size() - 1;
final String joinedNames = String.join(" and ", String.join(", ", names.subList(0, last)), names.get(last));
final String verb = names.size() > 1 ? "have" : "has";

final String message = "§a[Girlboss] §7" + (names.size() == 1 ? names.get(0) : joinedNames) + " " + verb + " seen a message you haven't!";
if (MinecraftClient.getInstance().player.age != alertsClearedTick) {
alertsClearedTick = MinecraftClient.getInstance().player.age;
alertsSent.clear();
}
if (alertsSent.add(message) && hasSentFirstAlert) {
MinecraftClient.getInstance().player.sendMessage(Text.literal(message));
}
hasSentFirstAlert = true;
}
}

This file was deleted.

31 changes: 31 additions & 0 deletions src/main/java/gg/nodus/girlboss/mixin/MixinMessageHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package gg.nodus.girlboss.mixin;

import com.mojang.authlib.GameProfile;
import gg.nodus.girlboss.SignatureTracker;
import net.minecraft.client.network.message.MessageHandler;
import net.minecraft.network.message.MessageSignatureData;
import net.minecraft.network.message.MessageType;
import net.minecraft.network.message.SignedMessage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.nio.ByteBuffer;

@Mixin(MessageHandler.class)
public class MixinMessageHandler {

@Inject(method = "onChatMessage", at = @At("HEAD"))
public void onChatMessage(final SignedMessage message, final GameProfile sender, final MessageType.Parameters params, final CallbackInfo ci) {
if (message.signature() == null) {
return;
}
SignatureTracker.receivedMessage(message.signature().toByteBuffer());
for (final MessageSignatureData lastSeen : message.signedBody().lastSeenMessages().entries()) {
final ByteBuffer signatureByteBuffer = lastSeen.toByteBuffer();
SignatureTracker.addSeenSignature(sender.getId(), signatureByteBuffer);
}
}

}
8 changes: 2 additions & 6 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@
"license": "MIT",
"icon": "assets/girlboss/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"gg.nodus.girlboss.Girlboss"
]
},
"entrypoints": {},
"mixins": [
"girlboss.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.8",
"minecraft": "1.19.2"
"minecraft": "1.19.3"
}
}
4 changes: 1 addition & 3 deletions src/main/resources/girlboss.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
"minVersion": "0.8",
"package": "gg.nodus.girlboss.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
"MixinClientPlayNetworkHandler"
"MixinMessageHandler"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 4ca61de

Please sign in to comment.