geforkt von Mirrors/Paper
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.8 KiB
Diff
33 Zeilen
1.8 KiB
Diff
From c72ed431f4cc362c8e828c425d88ce21c0190040 Mon Sep 17 00:00:00 2001
|
|
From: nossr50 <nossr50@gmail.com>
|
|
Date: Thu, 26 Mar 2020 19:44:50 -0700
|
|
Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 2c81344a65b..3fc2360a103 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1690,7 +1690,17 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
|
|
if (damagesource.getEntity() instanceof EntityHuman) {
|
|
- ((EntityHuman) damagesource.getEntity()).ey(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
|
|
+ // Paper start - PlayerAttackEntityCooldownResetEvent
|
|
+ if (damagesource.getEntity() instanceof EntityPlayer) {
|
|
+ EntityPlayer player = (EntityPlayer) damagesource.getEntity();
|
|
+ if (new com.destroystokyo.paper.event.player.PlayerAttackEntityCooldownResetEvent(player.getBukkitEntity(), this.getBukkitEntity(), player.getCooledAttackStrength(0F)).callEvent()) {
|
|
+ player.resetCooldown();
|
|
+ }
|
|
+ } else {
|
|
+ ((EntityHuman) damagesource.getEntity()).resetCooldown();
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
}
|
|
if (event.isCancelled()) {
|
|
return false;
|
|
--
|
|
2.26.2
|
|
|