Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
f37381ea8a
Removes synchronization from sending packets Makes normal packet sends no longer need to be wrapped and queued like it use to work. Adds more packet queue immunities on top of keep alive to let the following scenarios go out without delay: - Keep Alive - Chat - Kick - All of the packets during the Player Joined World event Hoping that latter one helps join timeout issues more too for slow connections. Removes processing packet queue off of main thread - for the few cases where it is allowed, order is not necessary nor should it even be happening concurrently in first place (handshaking/login/status) Ensures packets sent asynchronously are dispatched on main thread This helps ensure safety for ProtocolLib as packet listeners are commonly accessing world state. This will allow you to schedule a packet to be sent async, but itll be dispatched sync for packet listeners to process. This should solve some deadlock risks This may provide a decent performance improvement because thread synchronization incurs a cache reset so by avoiding ever entering a synchronized block, we get to avoid that, and packet sending is a really hot activity.
33 Zeilen
1.6 KiB
Diff
33 Zeilen
1.6 KiB
Diff
From a56e3e783fa197e1fc497e76640855b6f1d9b66f Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach@zachbr.io>
|
|
Date: Thu, 6 Feb 2020 19:20:27 -0600
|
|
Subject: [PATCH] Be more tolerant of invalid attributes
|
|
|
|
Prior to this commit, the player would be disconnected if they ever encountered an attribute with a name that did
|
|
not match Bukkit's expected vanilla scheme. It appears that datapacks can set whatever attribute name they want,
|
|
ignoring vanilla's typical scheme.
|
|
|
|
In a more perfect world the API would expose some way to interact with these attributes, however Bukkit is not
|
|
particularly flexible in this area. Perhaps this is an area for future expansion at a later time.
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
|
|
index 77e584b129a..007d28b16ce 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
|
|
@@ -47,6 +47,12 @@ public class CraftAttributeMap implements Attributable {
|
|
public static Attribute fromMinecraft(String nms) {
|
|
String[] split = nms.split("\\.", 2);
|
|
|
|
+ // Paper start - Datapacks can set their own attributes that may not match our expectations, ignore them
|
|
+ if (split.length != 2) {
|
|
+ return null;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
String generic = split[0];
|
|
String descriptor = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, split[1]); // movementSpeed -> MOVEMENT_SPEED
|
|
String fin = generic + "_" + descriptor;
|
|
--
|
|
2.26.2
|
|
|