mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 07:19:56 +03:00
85 lines
4.0 KiB
Diff
85 lines
4.0 KiB
Diff
--- ../src-base/minecraft/net/minecraft/util/Session.java
|
|
+++ ../src-work/minecraft/net/minecraft/util/Session.java
|
|
@@ -16,14 +16,30 @@
|
|
private final String username;
|
|
private final String playerID;
|
|
private final String token;
|
|
- private final Session.Type sessionType;
|
|
+ private final 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";
|
|
+ org.apache.logging.log4j.Logger logger = net.minecraftforge.fml.common.FMLLog.log;
|
|
+ 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.username = usernameIn;
|
|
this.playerID = playerIDIn;
|
|
this.token = tokenIn;
|
|
- this.sessionType = Session.Type.setSessionType(sessionTypeIn);
|
|
+ this.sessionType = Type.setSessionType(sessionTypeIn);
|
|
}
|
|
|
|
public String getSessionID()
|
|
@@ -51,21 +67,36 @@
|
|
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
|
|
{
|
|
LEGACY("legacy"),
|
|
MOJANG("mojang");
|
|
|
|
- private static final Map<String, Session.Type> SESSION_TYPES = Maps.<String, Session.Type>newHashMap();
|
|
+ private static final Map<String, Type> SESSION_TYPES = Maps.<String, Type>newHashMap();
|
|
private final String sessionType;
|
|
|
|
private Type(String sessionTypeIn)
|
|
@@ -81,7 +112,7 @@
|
|
|
|
static
|
|
{
|
|
- for (Session.Type session$type : values())
|
|
+ for (Type session$type : values())
|
|
{
|
|
SESSION_TYPES.put(session$type.sessionType, session$type);
|
|
}
|