mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Use static Gson
This commit is contained in:
parent
e4e79406ae
commit
add31d1f62
1 changed files with 4 additions and 4 deletions
|
|
@ -230,6 +230,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@Getter
|
@Getter
|
||||||
public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
|
|
||||||
|
private static final Gson GSON = new Gson();
|
||||||
|
|
||||||
private final GeyserImpl geyser;
|
private final GeyserImpl geyser;
|
||||||
private final UpstreamSession upstream;
|
private final UpstreamSession upstream;
|
||||||
private DownstreamSession downstream;
|
private DownstreamSession downstream;
|
||||||
|
|
@ -620,8 +622,6 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
@Setter @Getter
|
@Setter @Getter
|
||||||
private Map<String, byte[]> cookies = new Object2ObjectOpenHashMap<>();
|
private Map<String, byte[]> cookies = new Object2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
private final Gson gson = new Gson();
|
|
||||||
|
|
||||||
private final GeyserCameraData cameraData;
|
private final GeyserCameraData cameraData;
|
||||||
|
|
||||||
private final GeyserEntityData entityData;
|
private final GeyserEntityData entityData;
|
||||||
|
|
@ -771,7 +771,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
StepFullJavaSession step = PendingMicrosoftAuthentication.AUTH_FLOW.apply(true, 30);
|
StepFullJavaSession step = PendingMicrosoftAuthentication.AUTH_FLOW.apply(true, 30);
|
||||||
StepFullJavaSession.FullJavaSession response;
|
StepFullJavaSession.FullJavaSession response;
|
||||||
try {
|
try {
|
||||||
response = step.refresh(MinecraftAuthLogger.INSTANCE, PendingMicrosoftAuthentication.AUTH_CLIENT, step.fromJson(gson.fromJson(authChain, JsonObject.class)));
|
response = step.refresh(MinecraftAuthLogger.INSTANCE, PendingMicrosoftAuthentication.AUTH_CLIENT, step.fromJson(GSON.fromJson(authChain, JsonObject.class)));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
geyser.getLogger().error("Error while attempting to use auth chain for " + bedrockUsername() + "!", e);
|
geyser.getLogger().error("Error while attempting to use auth chain for " + bedrockUsername() + "!", e);
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
|
|
@ -784,7 +784,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
new GameProfile(mcProfile.getId(), mcProfile.getName()),
|
new GameProfile(mcProfile.getId(), mcProfile.getName()),
|
||||||
mcToken.getAccessToken()
|
mcToken.getAccessToken()
|
||||||
);
|
);
|
||||||
geyser.saveAuthChain(bedrockUsername(), gson.toJson(step.toJson(response)));
|
geyser.saveAuthChain(bedrockUsername(), GSON.toJson(step.toJson(response)));
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}).whenComplete((successful, ex) -> {
|
}).whenComplete((successful, ex) -> {
|
||||||
if (this.closed) {
|
if (this.closed) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue