52 lines
2.8 KiB
Diff
52 lines
2.8 KiB
Diff
--- a/net/minecraft/util/Session.java
|
|
+++ b/net/minecraft/util/Session.java
|
|
@@ -18,8 +18,22 @@
|
|
private final String field_148257_b;
|
|
private final String field_148258_c;
|
|
private final Session.Type field_152429_d;
|
|
+ /** Forge: Cache of the local session's GameProfile properties. */
|
|
+ private com.mojang.authlib.properties.PropertyMap properties;
|
|
|
|
public Session(String p_i1098_1_, String p_i1098_2_, String p_i1098_3_, String p_i1098_4_) {
|
|
+ if (p_i1098_1_ == null || p_i1098_1_.isEmpty()) {
|
|
+ p_i1098_1_ = "MissingName";
|
|
+ p_i1098_2_ = p_i1098_3_ = "NotValid";
|
|
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(getClass().getName());
|
|
+ logger.log(org.apache.logging.log4j.Level.WARN, "=========================================================");
|
|
+ logger.log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically");
|
|
+ logger.log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your");
|
|
+ logger.log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please");
|
|
+ logger.log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher");
|
|
+ logger.log(org.apache.logging.log4j.Level.WARN, "when asking for help!");
|
|
+ logger.log(org.apache.logging.log4j.Level.WARN, "=========================================================");
|
|
+ }
|
|
this.field_74286_b = p_i1098_1_;
|
|
this.field_148257_b = p_i1098_2_;
|
|
this.field_148258_c = p_i1098_3_;
|
|
@@ -45,12 +59,24 @@
|
|
public GameProfile func_148256_e() {
|
|
try {
|
|
UUID uuid = UUIDTypeAdapter.fromString(this.func_148255_b());
|
|
- return new GameProfile(uuid, this.func_111285_a());
|
|
+ GameProfile ret = new GameProfile(uuid, this.func_111285_a()); //Forge: Adds cached GameProfile properties to returned GameProfile.
|
|
+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service,
|
|
+ return ret; // which helps to fix MC-52974.
|
|
} catch (IllegalArgumentException illegalargumentexception) {
|
|
return new GameProfile((UUID)null, this.func_111285_a());
|
|
}
|
|
}
|
|
|
|
+ //For internal use only. Modders should never need to use this.
|
|
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) {
|
|
+ if (this.properties == null)
|
|
+ this.properties = properties;
|
|
+ }
|
|
+
|
|
+ public boolean hasCachedProperties() {
|
|
+ return properties != null;
|
|
+ }
|
|
+
|
|
@OnlyIn(Dist.CLIENT)
|
|
public static enum Type {
|
|
LEGACY("legacy"),
|