mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
69 lines
3.3 KiB
Diff
69 lines
3.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/util/Session.java
|
|
+++ ../src-work/minecraft/net/minecraft/util/Session.java
|
|
@@ -5,6 +5,8 @@
|
|
import com.mojang.util.UUIDTypeAdapter;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
+
|
|
+import net.minecraftforge.fml.common.FMLLog;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
@@ -15,9 +17,24 @@
|
|
private final String playerID;
|
|
private final String token;
|
|
private final Session.Type sessionType;
|
|
+ /** Forge: Cache of the local session's GameProfile properties. */
|
|
+ private com.mojang.authlib.properties.PropertyMap properties;
|
|
|
|
public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn)
|
|
{
|
|
+ if (usernameIn == null || usernameIn.isEmpty())
|
|
+ {
|
|
+ usernameIn = "MissingName";
|
|
+ playerIDIn = tokenIn = "NotValid";
|
|
+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "=========================================================");
|
|
+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically");
|
|
+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your");
|
|
+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please");
|
|
+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher");
|
|
+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "when asking for help!");
|
|
+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "=========================================================");
|
|
+ }
|
|
+
|
|
this.username = usernameIn;
|
|
this.playerID = playerIDIn;
|
|
this.token = tokenIn;
|
|
@@ -49,14 +66,29 @@
|
|
try
|
|
{
|
|
UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID());
|
|
- return new GameProfile(uuid, this.getUsername());
|
|
+ GameProfile ret = new GameProfile(uuid, this.getUsername()); //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 var2)
|
|
{
|
|
- return new GameProfile((UUID)null, this.getUsername());
|
|
+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername());
|
|
}
|
|
}
|
|
|
|
+ /* ======================================== FORGE START ===================================== */
|
|
+ //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;
|
|
+ }
|
|
+ /* ========================================= FORGE END ====================================== */
|
|
+
|
|
@SideOnly(Side.CLIENT)
|
|
public static enum Type
|
|
{
|