mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-01 23:23:27 +01:00
61f261ee2a
Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b8020379c Extract Adventure Version into a variable, add reminder to update the linked JD on the homepage (#5422) 809466f2e Fix anchor respawn acting as a bed respawn when using the end portal (#5540) d219fd642 [Auto] Updated Upstream (Bukkit/CraftBukkit) db464b099 Implement methods to convert between Component and Brigadier's Message (#5542) 4047cffca Add PlayerBedFailEnterEvent (#4935) 70d697e6e Update Paperpclip 5ed771591 [CI-SKIP] Remove bad null annotation (#5538) 454a4c78e More World API (#3850) 869e02304 Add PlayerDeepSleepEvent (#5525) fb56fc35e fix non-dummy objectives not updating dc859a61f [CI-SKIP] [Auto] Rebuild Patches 7d1689f1a Add missing checkReachable check for shulker boxes (#5453) ba8eb3d4b Add missing Javadoc for COLORABLE MaterialTag (#5376) db801cbf3 Fix PlayerItemHeldEvent firing twice (#5534) 14de2b795 fix PigZombieAngerEvent cancellation (fixes #5319) (v2) (#5329) 86d684ad1 Add get-set drop chance to EntityEquipment (#5528) 33fb8cf63 Add consumeFuel to FurnaceBurnEvent (#5532) 9957f4630 Fix duplicating /give items on item drop cancel (#5536) d94882043 Fix legacyComposer not using AsyncChatEvent messages (#5509) 053bd82cc Don't print spawn load time when not loading spawn (#5467) a6d78caae Add isDeeplySleeping to HumanEntity (#5470) 711b7a80b Expose more Adventure serializers through PaperComponents (#5443) 3f63bde0c Set Area Effect Cloud Rotation (#5462) 3523f0fda Remove useless check on player interact cancellation (#5448) 6574d1aa8 fix #5526 - use correct type when sending message to clients dbfa833ec don't throw when loading TE with invalid keys a9525a6f7 Do not schedule poi task for each block write on chunk gen Airplane Changes: f5fb024 Temporarily revert patch 3c728a7 Oops, these 2 too 37a93e5 Your daily dose of 1-3% optimization patches bbd689a Remove useless check d8bdbc5 Reduce allocations for fire spreading 41051fd Redo reduction of entity chunk ticking check patch 31272d8 Flare Update 8f32713 Remove criterion patch 0fed2df Various patches that need to be reorganized later f78856b Updated Upstream (Tuinity) f7d6382 Flare Update 71d0799 Update gradle configuration 0f79774 Updated Upstream (Tuinity) Purpur Changes: 3dce975 Updated Upstream (Paper & Airplane) (#298) eb07368 Run GitHub Actions for pull requests e97d062 Updated Upstream (Paper, Tuinity, & Airplane) Empirecraft Changes: 2a021ede Updated Paper e963bb2c Add Paper MojangAPI to pom 6f5bf24e Updated Paper Origami Changes: 73ecdf1 Update Paper 73a3735 Item and exp merge improvements
82 lines
4.4 KiB
Diff
82 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
Date: Fri, 4 Sep 2020 10:07:42 +0300
|
|
Subject: [PATCH] Stop wasting resources on JsonList#get
|
|
|
|
Previously, when a banned player attempted to join the server was removing all the stale entries.
|
|
This caused a resource waste, which was unnoticeable to users that use ban plugins which doesn't
|
|
use the ban list. Akarin's changes for saving it async lowered the pressure, however it was
|
|
still pretty high.
|
|
|
|
Our changes are the following:
|
|
1. Stop removing all stale entries when JsonList#get is called.
|
|
2. Only if a player joins and his ban has expired, remove his ban which triggers a save which then
|
|
triggers removing of all stale entries.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/JsonList.java b/src/main/java/net/minecraft/server/players/JsonList.java
|
|
index c960852dc60d0598012c5eef0d139fe38bde63fb..96fbb1a3d216302aa937e07bf88fdb19c6ccc764 100644
|
|
--- a/src/main/java/net/minecraft/server/players/JsonList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/JsonList.java
|
|
@@ -71,9 +71,13 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
|
|
// Paper start
|
|
// this.g();
|
|
// return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error
|
|
+ // Yatopia start - only remove if it expires and has been requested
|
|
+ return this.getBackingMap().get(this.getMappingKey(k0));
|
|
+ /*
|
|
return (V) this.getBackingMap().computeIfPresent(this.getMappingKey(k0), (k, v) -> {
|
|
return v.hasExpired() ? null : v;
|
|
});
|
|
+ */ // Yatopia end
|
|
// Paper end
|
|
}
|
|
|
|
@@ -151,12 +155,22 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
|
|
this.removeStaleEntries(); // Paper - remove expired values before saving
|
|
JsonArray jsonarray = new JsonArray();
|
|
|
|
+ // Yatopia start - we're nuking streams wherever possible
|
|
+ /*
|
|
this.d.values().stream().map((jsonlistentry) -> {
|
|
JsonObject jsonobject = new JsonObject();
|
|
|
|
jsonlistentry.getClass();
|
|
return (JsonObject) SystemUtils.a(jsonobject, jsonlistentry::a); // CraftBukkit - decompile error
|
|
}).forEach(jsonarray::add);
|
|
+ */
|
|
+ for (V value : this.d.values()) {
|
|
+ JsonObject obj = new JsonObject();
|
|
+ // todo: obfhelper for this?
|
|
+ value.a(obj);
|
|
+ jsonarray.add(obj);
|
|
+ }
|
|
+ // Yatopia end
|
|
BufferedWriter bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
|
|
Throwable throwable = null;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 5742737bacbc738691a5caf9a169c12a8a25cc4a..dc7ab77f92e4c40a7828543b7f793d1f6e898b86 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -740,6 +740,7 @@ public abstract class PlayerList {
|
|
GameProfileBanEntry gameprofilebanentry;
|
|
if (getProfileBans().isBanned(gameprofile) && (gameprofilebanentry = getProfileBans().get(gameprofile)) != null) {
|
|
// Paper end
|
|
+ if (!gameprofilebanentry.hasExpired()) { // Yatopia
|
|
|
|
chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
|
|
if (gameprofilebanentry.getExpires() != null) {
|
|
@@ -747,7 +748,11 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
// return chatmessage;
|
|
- if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Spigot // Paper - Adventure
|
|
+ // Yatopia start
|
|
+ /* if (!gameprofilebanentry.hasExpired()) */ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Spigot // Paper - Adventure
|
|
+ } else {
|
|
+ getProfileBans().remove(gameprofile);
|
|
+ } // Yatopia end
|
|
} else if (!this.isWhitelisted(gameprofile, event)) { // Paper
|
|
//chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper
|
|
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
|