Skip to content

Commit

Permalink
Warn about invalid gameprofiles for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Samsuik committed Jun 2, 2024
1 parent 7553a14 commit e22638a
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 1 deletion.
68 changes: 67 additions & 1 deletion patches/server/0004-mc-dev-imports.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 0fcae61702e187698c7ed971e6f46a5bccd6a2d1 Mon Sep 17 00:00:00 2001
From 2b95e40a883b305e569238322099dcdf1dc0de84 Mon Sep 17 00:00:00 2001
From: Samsuik <[email protected]>
Date: Tue, 9 May 2023 16:10:11 +0100
Subject: [PATCH] mc dev imports
Expand Down Expand Up @@ -5400,6 +5400,72 @@ index 000000000..22d7c2ab3
+
+ }
+}
diff --git a/src/main/java/net/minecraft/server/OpList.java b/src/main/java/net/minecraft/server/OpList.java
new file mode 100644
index 000000000..26b4e44b0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/OpList.java
@@ -0,0 +1,60 @@
+package net.minecraft.server;
+
+import com.google.gson.JsonObject;
+import com.mojang.authlib.GameProfile;
+import java.io.File;
+import java.util.Iterator;
+
+public class OpList extends JsonList<GameProfile, OpListEntry> {
+
+ public OpList(File file) {
+ super(file);
+ }
+
+ protected JsonListEntry<GameProfile> a(JsonObject jsonobject) {
+ return new OpListEntry(jsonobject);
+ }
+
+ public String[] getEntries() {
+ String[] astring = new String[this.e().size()];
+ int i = 0;
+
+ OpListEntry oplistentry;
+
+ for (Iterator iterator = this.e().values().iterator(); iterator.hasNext(); astring[i++] = ((GameProfile) oplistentry.getKey()).getName()) {
+ oplistentry = (OpListEntry) iterator.next();
+ }
+
+ return astring;
+ }
+
+ public boolean b(GameProfile gameprofile) {
+ OpListEntry oplistentry = (OpListEntry) this.get(gameprofile);
+
+ return oplistentry != null ? oplistentry.b() : false;
+ }
+
+ protected String c(GameProfile gameprofile) {
+ return gameprofile.getId().toString();
+ }
+
+ public GameProfile a(String s) {
+ Iterator iterator = this.e().values().iterator();
+
+ OpListEntry oplistentry;
+
+ do {
+ if (!iterator.hasNext()) {
+ return null;
+ }
+
+ oplistentry = (OpListEntry) iterator.next();
+ } while (!s.equalsIgnoreCase(((GameProfile) oplistentry.getKey()).getName()));
+
+ return (GameProfile) oplistentry.getKey();
+ }
+
+ protected String a(GameProfile object) { // Blossom - decompile fix
+ return this.c((GameProfile) object);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java
new file mode 100644
index 000000000..cfb92ead8
Expand Down
25 changes: 25 additions & 0 deletions patches/server/0124-warn-about-invalid-gameprofiles.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From ad02a7a0d44ae1edcee12660f646c73f2aa8587b Mon Sep 17 00:00:00 2001
From: Samsuik <[email protected]>
Date: Sun, 2 Jun 2024 13:53:04 +0100
Subject: [PATCH] warn about invalid gameprofiles


diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0ffb3277c..7cc24ed2c 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -411,6 +411,11 @@ public abstract class PlayerList {
public EntityPlayer attemptLogin(LoginListener loginlistener, GameProfile gameprofile, String hostname) {
// Moved from processLogin
UUID uuid = EntityHuman.a(gameprofile);
+ // Blossom start - warn about invalid gameprofiles
+ if (gameprofile.getId() == null) {
+ f.warn("User {} was not assigned a uuid before login", gameprofile.getName(), new Throwable());
+ }
+ // Blossom end
ArrayList arraylist = Lists.newArrayList();

EntityPlayer entityplayer;
--
2.40.0.windows.1

0 comments on commit e22638a

Please sign in to comment.