mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2026-04-29 18:23:28 +02:00
Fix NPE for skin apply in ProtocolLib mode (Related #182)
This commit is contained in:
@@ -138,7 +138,7 @@ public class AuthStorage {
|
||||
|
||||
public void save(PlayerProfile playerProfile) {
|
||||
try (Connection con = dataSource.getConnection()) {
|
||||
UUID uuid = playerProfile.getUUID();
|
||||
UUID uuid = playerProfile.getUuid();
|
||||
|
||||
if (playerProfile.getUserId() == -1) {
|
||||
try (PreparedStatement saveStmt = con.prepareStatement(INSERT_PROFILE, RETURN_GENERATED_KEYS)) {
|
||||
|
||||
@@ -44,11 +44,11 @@ public class PlayerProfile {
|
||||
}
|
||||
|
||||
//todo: this should be optional
|
||||
public synchronized UUID getUUID() {
|
||||
public synchronized UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public synchronized void setUUID(UUID uuid) {
|
||||
public synchronized void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -51,8 +51,9 @@ public class MojangApiConnector {
|
||||
|
||||
private Instant lastRateLimit = Instant.now().minus(10, ChronoUnit.MINUTES);
|
||||
|
||||
protected final Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||
protected final Logger logger;
|
||||
protected final Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||
|
||||
public MojangApiConnector(Logger logger, Collection<String> localAddresses, int rateLimit
|
||||
, Iterable<HostAndPort> proxies) {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.github.games647.fastlogin.core.mojang;
|
||||
|
||||
public class SkinProperties {
|
||||
|
||||
public static final String TEXTURE_KEY = "textures";
|
||||
|
||||
private final String name = "textures";
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.github.games647.fastlogin.core.mojang;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
public class VerificationReply {
|
||||
@@ -17,6 +18,6 @@ public class VerificationReply {
|
||||
}
|
||||
|
||||
public SkinProperties[] getProperties() {
|
||||
return properties;
|
||||
return Arrays.copyOf(properties, properties.length);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -9,12 +9,12 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
|
||||
|
||||
protected final FastLoginCore<P, C, T> core;
|
||||
protected final P player;
|
||||
protected final L session;
|
||||
|
||||
protected L session;
|
||||
|
||||
public ForceLoginManagement(FastLoginCore<P, C, T> core, P player) {
|
||||
public ForceLoginManagement(FastLoginCore<P, C, T> core, P player, L session) {
|
||||
this.core = core;
|
||||
this.player = player;
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +49,7 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
|
||||
if (success) {
|
||||
//update only on success to prevent corrupt data
|
||||
if (playerProfile != null) {
|
||||
playerProfile.setUUID(session.getUuid());
|
||||
playerProfile.setUuid(session.getUuid());
|
||||
playerProfile.setPremium(true);
|
||||
storage.save(playerProfile);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
|
||||
}
|
||||
} else if (playerProfile != null) {
|
||||
//cracked player
|
||||
playerProfile.setUUID(null);
|
||||
playerProfile.setUuid(null);
|
||||
playerProfile.setPremium(false);
|
||||
storage.save(playerProfile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user