mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-16 18:31:53 +01:00
More more more more work
This commit is contained in:
parent
f7123fdddb
commit
ca9ce05bb0
123 changed files with 74 additions and 82 deletions
patches/server
Add-API-for-resetting-a-single-score.patchAdd-BellRevealRaiderEvent.patchAdd-BlockBreakBlockEvent.patchAdd-ElderGuardianAppearanceEvent.patchAdd-EntityInsideBlockEvent.patchAdd-ItemFactory-getMonsterEgg-API.patchAdd-Mob-lookAt-API.patchAdd-PlayerKickEvent-causes.patchAdd-PlayerSetSpawnEvent.patchAdd-PufferFishStateChangeEvent.patchAdd-Raw-Byte-Entity-Serialization.patchAdd-System.out-err-catcher.patchAdd-Unix-domain-socket-support.patchAdd-a-bunch-of-missing-forceDrop-toggles.patchAdd-advancement-display-API.patchAdd-back-EntityPortalExitEvent.patchAdd-cause-to-Weather-ThunderChangeEvents.patchAdd-config-for-mobs-immune-to-default-effects.patchAdd-critical-damage-API.patchAdd-isCollidable-methods-to-various-places.patchAdd-methods-to-find-targets-for-lightning-strikes.patchAdd-missing-team-sidebar-display-slots.patchAdd-more-LimitedRegion-API.patchAdd-more-async-catchers.patchAdd-option-to-fix-items-merging-through-walls.patchAdd-packet-limiter-config.patchAdd-paper-mobcaps-and-paper-playermobcaps.patchAdded-EntityDamageItemEvent.patchAdds-PlayerArmSwingEvent.patchAllow-controlled-flushing-for-network-manager.patchAllow-removal-addition-of-entities-to-entity-ticklis.patchAllow-skipping-writing-of-comments-to-server.propert.patchAsync-catch-modifications-to-critical-entity-state.patchAttempt-to-recalculate-regionfile-header-if-it-is-co.patchAttributes-API-for-item-defaults.patchChange-EnderEye-target-without-changing-other-things.patchClear-bucket-NBT-after-dispense.patchConfig-option-for-Piglins-guarding-chests.patchConfigurable-item-frame-map-cursor-update-interval.patchConsolidate-flush-calls-for-entity-tracker-packets.patchCorrectly-handle-recursion-for-chunkholder-updates.patchCustom-table-implementation-for-blockstate-state-loo.patchDetail-more-information-in-watchdog-dumps.patchDistance-manager-tick-timings.patchDo-not-allow-the-server-to-unload-chunks-at-request-.patchDo-not-allow-ticket-level-changes-when-updating-chun.patchDo-not-allow-ticket-level-changes-while-unloading-pl.patchDo-not-copy-visible-chunks.patchDo-not-process-entity-loads-in-CraftChunk-getEntitie.patchDo-not-run-close-logic-for-inventories-on-chunk-unlo.patchDo-not-run-raytrace-logic-for-AIR.patchDon-t-apply-cramming-damage-to-players.patchDon-t-lookup-fluid-state-when-raytracing.patchDon-t-read-neighbour-chunk-data-off-disk-when-conver.patchEnsure-commands-are-not-ran-async.patchEnsure-disconnect-for-book-edit-is-called-on-main.patchExecute-chunk-tasks-mid-tick.patchFix-Bukkit-NamespacedKey-shenanigans.patchFix-GameProfileCache-concurrency.patchFix-PlayerBucketEmptyEvent-result-itemstack.patchFix-PlayerDropItemEvent-using-wrong-item.patchFix-PotionSplashEvent-for-water-splash-potions.patchFix-and-optimise-world-force-upgrading.patchFix-block-drops-position-losing-precision-millions-o.patchFix-chunks-refusing-to-unload-at-low-TPS.patchFix-commands-from-signs-not-firing-command-events.patchFix-dangerous-end-portal-logic.patchFix-exploit-that-allowed-colored-signs-to-be-created.patchFix-incorrect-message-for-outdated-client.patchFix-incosistency-issue-with-empty-map-items-in-CB.patchFix-invulnerable-end-crystals.patchFix-issues-with-mob-conversion.patchFix-return-value-of-Block-applyBoneMeal-always-being.patchFix-test-not-bootstrapping.patchFixes-kick-event-leave-message-not-being-sent.patchGet-entity-default-attributes.patchGoat-ram-API.patchImprove-boat-collision-performance.patchLeft-handed-API.patchLimit-item-frame-cursors-on-maps.patchLine-Of-Sight-Changes.patchLog-when-the-async-catcher-is-tripped.patchMake-CallbackExecutor-strict-again.patchMake-EntityUnleashEvent-cancellable.patchMake-hoppers-respect-inventory-max-stack-size.patchMake-item-validations-configurable.patchMake-sure-inlined-getChunkAt-has-inlined-logic-for-l.patchManually-inline-methods-in-BlockPosition.patchMissing-Entity-Behavior-API.patchMore-CommandBlock-API.patchMore-Lidded-Block-API.patchMove-range-check-for-block-placing-up.patchName-craft-scheduler-threads-according-to-the-plugin.patchOprimise-map-impl-for-tracked-players.patchOptimise-BlockSoil-nearby-water-lookup.patchOptimise-WorldServer-notify.patchOptimise-chunk-tick-iteration.patchOptimise-general-POI-access.patchOptimise-nearby-player-lookups.patchOptimise-non-flush-packet-sending.patch
|
@ -60,7 +60,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger()) {
|
||||
if (++this.aboveGroundTickCount > 80) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
|
||||
|
@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
|
||||
if (++this.aboveGroundVehicleTickCount > 80) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
|
||||
|
@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (this.keepAlivePending) {
|
||||
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
|
||||
|
@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
} else {
|
||||
if (elapsedTime >= 15000L) { // 15 seconds
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) {
|
||||
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
|
||||
|
@ -96,7 +96,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
this.chatPreviewThrottler.tick();
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
public void disconnect(String s) {
|
||||
// Paper start
|
||||
|
@ -122,8 +122,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Paper end
|
||||
// CraftBukkit start - fire PlayerKickEvent
|
||||
if (this.processedDisconnect) {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
|
||||
|
||||
- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - Adventure
|
||||
|
@ -131,7 +131,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
if (this.cserver.getServer().isRunning()) {
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
|
||||
|
@ -140,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
} else {
|
||||
Entity entity = this.player.getRootVehicle();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
|
||||
// CraftBukkit start
|
||||
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
|
||||
|
@ -156,7 +156,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
// Paper end
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
// Paper start - validate pick item position
|
||||
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
|
@ -165,7 +165,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||
if (byteLength > 256 * 4) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
|
||||
|
@ -174,7 +174,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
byteTotal += byteLength;
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
if (byteTotal > byteAllowed) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
|
||||
|
@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
this.lastBookTick = MinecraftServer.currentTick;
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
|
||||
|
@ -200,7 +200,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
} else {
|
||||
ServerLevel worldserver = this.player.getLevel();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.dropCount++;
|
||||
if (this.dropCount >= 20) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
|
||||
|
@ -209,7 +209,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
|
||||
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
||||
|
@ -218,7 +218,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
// Paper start
|
||||
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
|
@ -227,34 +227,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.getMessage())) {
|
||||
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) {
|
||||
- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
|
||||
+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause
|
||||
} else {
|
||||
if (this.tryHandleChat(packet.getMessage(), packet.getTimeStamp())) {
|
||||
// CraftBukkit start
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
Waitable waitable = new Waitable() {
|
||||
@Override
|
||||
protected Object evaluate() {
|
||||
- ServerGamePacketListenerImpl.this.disconnect(Component.translatable("disconnect.spam"));
|
||||
+ ServerGamePacketListenerImpl.this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
- this.disconnect(Component.translatable("disconnect.spam"));
|
||||
+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
|
||||
}
|
||||
if (this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages())) {
|
||||
// this.server.submit(() -> { // CraftBukkit - async chat
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
// this.chatSpamTickCount += 20;
|
||||
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
||||
// CraftBukkit end
|
||||
- this.disconnect(Component.translatable("disconnect.spam"));
|
||||
+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
// Spigot Start
|
||||
if ( entity == this.player && !this.player.isSpectator() )
|
||||
{
|
||||
|
@ -263,7 +254,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
// Spigot End
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
|
@ -272,7 +263,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
// Paper start
|
||||
if (!org.bukkit.Bukkit.isPrimaryThread()) {
|
||||
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
|
||||
|
@ -281,7 +272,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
} else if (!this.isSingleplayerOwner()) {
|
||||
// Paper start - This needs to be handled on the main thread for plugins
|
||||
server.submit(() -> {
|
||||
|
@ -290,7 +281,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
});
|
||||
// Paper end
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
|
||||
|
@ -299,7 +290,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
|
||||
try {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
|
||||
|
@ -308,7 +299,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
}
|
||||
|
||||
// Arm swing animation
|
|
@ -56,19 +56,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() &&
|
||||
(packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty())
|
||||
))) {
|
||||
- this.sendPacket(packet, callback);
|
||||
+ this.writePacket(packet, callback, null); // Paper
|
||||
- this.sendPacket(packet, packetsendlistener);
|
||||
+ this.sendPacket(packet, packetsendlistener, null); // Paper
|
||||
return;
|
||||
}
|
||||
// write the packets to the queue, then flush - antixray hooks there already
|
||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
|
||||
private void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback) {
|
||||
private void sendPacket(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
||||
+ // Paper start - add flush parameter
|
||||
+ this.writePacket(packet, callback, Boolean.TRUE);
|
||||
+ this.sendPacket(packet, packetsendlistener, Boolean.TRUE);
|
||||
+ }
|
||||
+ private void writePacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback, Boolean flushConditional) {
|
||||
+ private void sendPacket(Packet<?> packet, @Nullable PacketSendListener packetsendlistener, Boolean flushConditional) {
|
||||
+ this.packetWrites.getAndIncrement(); // must be befeore using canFlush
|
||||
+ boolean effectiveFlush = flushConditional == null ? this.canFlush : flushConditional.booleanValue();
|
||||
+ final boolean flush = effectiveFlush || packet instanceof net.minecraft.network.protocol.game.ClientboundKeepAlivePacket || packet instanceof ClientboundDisconnectPacket; // no delay for certain packets
|
||||
|
@ -80,22 +80,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
if (this.channel.eventLoop().inEventLoop()) {
|
||||
- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1);
|
||||
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1);
|
||||
+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
} else {
|
||||
this.channel.eventLoop().execute(() -> {
|
||||
- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1);
|
||||
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1);
|
||||
+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback, ConnectionProtocol packetState, ConnectionProtocol currentState) {
|
||||
private void doSendPacket(Packet<?> packet, @Nullable PacketSendListener packetsendlistener, ConnectionProtocol packetState, ConnectionProtocol currentState) {
|
||||
+ // Paper start - add flush parameter
|
||||
+ this.doSendPacket(packet, callback, packetState, currentState, true);
|
||||
+ this.doSendPacket(packet, packetsendlistener, packetState, currentState, true);
|
||||
+ }
|
||||
+ private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback, ConnectionProtocol packetState, ConnectionProtocol currentState, boolean flush) {
|
||||
+ private void doSendPacket(Packet<?> packet, @Nullable PacketSendListener packetsendlistener, ConnectionProtocol packetState, ConnectionProtocol currentState, boolean flush) {
|
||||
+ // Paper end - add flush parameter
|
||||
if (packetState != currentState) {
|
||||
this.setProtocol(packetState);
|
||||
|
@ -107,8 +107,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
|
||||
+ ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Paper - add flush parameter
|
||||
|
||||
if (callback != null) {
|
||||
channelfuture.addListener(callback);
|
||||
if (packetsendlistener != null) {
|
||||
channelfuture.addListener((future) -> {
|
||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
private boolean processQueue() {
|
|
@ -11,14 +11,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
PacketListener packetlistener = this.packetListener;
|
||||
|
||||
if (this.packetListener instanceof ServerGamePacketListenerImpl) {
|
||||
if (packetlistener instanceof TickablePacketListener) {
|
||||
+ // Paper start - detailed watchdog information
|
||||
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.push(this.packetListener);
|
||||
+ try {
|
||||
+ // Paper end - detailed watchdog information
|
||||
((ServerGamePacketListenerImpl) this.packetListener).tick();
|
||||
+ try { // Paper end - detailed watchdog information
|
||||
TickablePacketListener tickablepacketlistener = (TickablePacketListener) packetlistener;
|
||||
|
||||
tickablepacketlistener.tick();
|
||||
+ } finally { // Paper start - detailed watchdog information
|
||||
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.pop();
|
||||
+ } // Paper start - detailed watchdog information
|
|
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ Waitable wait = new Waitable() {
|
||||
+ @Override
|
||||
+ protected Object evaluate() {
|
||||
+ chat(fCommandLine, false);
|
||||
+ chat(fCommandLine, original, false);
|
||||
+ return null;
|
||||
+ }
|
||||
+ };
|
||||
|
|
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
// Paper end
|
||||
// CraftBukkit start
|
||||
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
|
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
if (this.player.isTextFilteringEnabled()) {
|
||||
- lines.add(net.kyori.adventure.text.Component.text(filteredtext.filteredOrEmpty())); // Paper - adventure
|
||||
+ lines.add(SharedConstants.filterText(net.kyori.adventure.text.Component.text(filteredtext.filteredOrEmpty()))); // Paper - adventure
|
||||
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(filteredtext.filteredOrEmpty()))); // Paper - adventure
|
||||
} else {
|
||||
- lines.add(net.kyori.adventure.text.Component.text(filteredtext.raw())); // Paper - adventure
|
||||
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(filteredtext.raw()))); // Paper - adventure
|
||||
|
|
|
@ -20,7 +20,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
// Do not kick the player
|
||||
return;
|
||||
}
|
||||
|
@ -28,16 +28,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Send the possibly modified leave message
|
||||
final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
|
||||
// CraftBukkit end
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
|
||||
this.connection.disconnect(ichatbasecomponent);
|
||||
});
|
||||
}));
|
||||
- this.onDisconnect(ichatbasecomponent); // CraftBukkit - fire quit instantly
|
||||
+ this.onDisconnect(ichatbasecomponent, event.leaveMessage()); // CraftBukkit - fire quit instantly // Paper - use kick event leave message
|
||||
this.connection.setReadOnly();
|
||||
MinecraftServer minecraftserver = this.server;
|
||||
Connection networkmanager = this.connection;
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
@Override
|
||||
public void onDisconnect(Component reason) {
|
||||
|
@ -49,14 +49,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// CraftBukkit start - Rarely it would send a disconnect line twice
|
||||
if (this.processedDisconnect) {
|
||||
return;
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
this.player.disconnect();
|
||||
// Paper start - Adventure
|
||||
- net.kyori.adventure.text.Component quitMessage = this.server.getPlayerList().remove(this.player);
|
||||
+ quitMessage = quitMessage == null ? this.server.getPlayerList().remove(this.player) : this.server.getPlayerList().remove(this.player, quitMessage); // Paper - pass in quitMessage to fix kick message not being used
|
||||
if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) {
|
||||
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), ChatType.SYSTEM);
|
||||
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
ItemStack itemstack = this.player.getItemInHand(enumhand);
|
||||
BlockHitResult movingobjectpositionblock = packet.getHitResult();
|
||||
Vec3 vec3d = movingobjectpositionblock.getLocation();
|
|
@ -34,20 +34,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F;
|
||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
if (this.channel.eventLoop().inEventLoop()) {
|
||||
this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
} else {
|
||||
+ // Paper start - optimise packets that are not flushed
|
||||
+ // note: since the type is not dynamic here, we need to actually copy the old executor code
|
||||
+ // into two branches. On conflict, just re-copy - no changes were made inside the executor code.
|
||||
+ if (!flush) {
|
||||
+ AbstractEventExecutor.LazyRunnable run = () -> {
|
||||
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
+ };
|
||||
+ this.channel.eventLoop().execute(run);
|
||||
+ } else { // Paper end - optimise packets that are not flushed
|
||||
this.channel.eventLoop().execute(() -> {
|
||||
- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change
|
||||
- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
||||
+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change
|
||||
});
|
||||
+ } // Paper
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue