mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 10:44:39 +01:00
0076297721
By: Suddenly <suddenly@suddenly.coffee>
76 lines
3.5 KiB
Diff
76 lines
3.5 KiB
Diff
--- a/net/minecraft/server/players/GameProfileCache.java
|
|
+++ b/net/minecraft/server/players/GameProfileCache.java
|
|
@@ -85,7 +85,7 @@
|
|
}
|
|
|
|
public void onProfileLookupFailed(String s1, Exception exception) {
|
|
- atomicreference.set((Object) null);
|
|
+ atomicreference.set(null); // CraftBukkit - decompile error
|
|
}
|
|
};
|
|
|
|
@@ -117,7 +117,7 @@
|
|
GameProfileCache.GameProfileInfo usercache_usercacheentry = new GameProfileCache.GameProfileInfo(profile, date);
|
|
|
|
this.safeAdd(usercache_usercacheentry);
|
|
- this.save();
|
|
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.save(); // Spigot - skip saving if disabled
|
|
}
|
|
|
|
private long getNextOperation() {
|
|
@@ -142,14 +142,14 @@
|
|
usercache_usercacheentry.setLastAccess(this.getNextOperation());
|
|
optional = Optional.of(usercache_usercacheentry.getProfile());
|
|
} else {
|
|
- optional = GameProfileCache.lookupGameProfile(this.profileRepository, s1);
|
|
+ optional = GameProfileCache.lookupGameProfile(this.profileRepository, name); // CraftBukkit - use correct case for offline players
|
|
if (optional.isPresent()) {
|
|
this.add((GameProfile) optional.get());
|
|
flag = false;
|
|
}
|
|
}
|
|
|
|
- if (flag) {
|
|
+ if (flag && !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { // Spigot - skip saving if disabled
|
|
this.save();
|
|
}
|
|
|
|
@@ -208,7 +208,7 @@
|
|
|
|
label54:
|
|
{
|
|
- ArrayList arraylist;
|
|
+ List<GameProfileCache.GameProfileInfo> arraylist; // CraftBukkit - decompile error
|
|
|
|
try {
|
|
JsonArray jsonarray = (JsonArray) this.gson.fromJson(bufferedreader, JsonArray.class);
|
|
@@ -217,7 +217,7 @@
|
|
DateFormat dateformat = GameProfileCache.createDateFormat();
|
|
|
|
jsonarray.forEach((jsonelement) -> {
|
|
- Optional optional = GameProfileCache.readGameProfile(jsonelement, dateformat);
|
|
+ Optional<GameProfileCache.GameProfileInfo> optional = GameProfileCache.readGameProfile(jsonelement, dateformat); // CraftBukkit - decompile error
|
|
|
|
Objects.requireNonNull(list);
|
|
optional.ifPresent(list::add);
|
|
@@ -250,6 +250,11 @@
|
|
}
|
|
} catch (FileNotFoundException filenotfoundexception) {
|
|
;
|
|
+ // Spigot Start
|
|
+ } catch (com.google.gson.JsonSyntaxException | NullPointerException ex) {
|
|
+ GameProfileCache.LOGGER.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
|
|
+ this.file.delete();
|
|
+ // Spigot End
|
|
} catch (JsonParseException | IOException ioexception) {
|
|
GameProfileCache.LOGGER.warn("Failed to load profile cache {}", this.file, ioexception);
|
|
}
|
|
@@ -261,7 +266,7 @@
|
|
JsonArray jsonarray = new JsonArray();
|
|
DateFormat dateformat = GameProfileCache.createDateFormat();
|
|
|
|
- this.getTopMRUProfiles(1000).forEach((usercache_usercacheentry) -> {
|
|
+ this.getTopMRUProfiles(org.spigotmc.SpigotConfig.userCacheCap).forEach((usercache_usercacheentry) -> { // Spigot
|
|
jsonarray.add(GameProfileCache.writeGameProfile(usercache_usercacheentry, dateformat));
|
|
});
|
|
String s = this.gson.toJson(jsonarray);
|