Update to Minecraft 1.19.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-03-15 03:30:00 +11:00
parent 90a887a912
commit 40076782ed
227 changed files with 2788 additions and 1621 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/PlayerConnection.java
+++ b/net/minecraft/server/network/PlayerConnection.java
@@ -182,6 +182,67 @@
@@ -184,6 +184,67 @@
import net.minecraft.world.phys.shapes.VoxelShapes;
import org.slf4j.Logger;
@@ -68,7 +68,7 @@
public class PlayerConnection implements ServerPlayerConnection, TickablePacketListener, PacketListenerPlayIn {
static final Logger LOGGER = LogUtils.getLogger();
@@ -198,7 +259,9 @@
@@ -200,7 +261,9 @@
private long keepAliveTime;
private boolean keepAlivePending;
private long keepAliveChallenge;
@@ -79,7 +79,7 @@
private int dropSpamTickCount;
private double firstGoodX;
private double firstGoodY;
@@ -244,8 +307,31 @@
@@ -246,8 +309,31 @@
this.keepAliveTime = SystemUtils.getMillis();
entityplayer.getTextFilter().join();
this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID());
@@ -112,7 +112,7 @@
@Override
public void tick() {
@@ -300,7 +386,7 @@
@@ -302,7 +388,7 @@
this.server.getProfiler().push("keepAlive");
long i = SystemUtils.getMillis();
@@ -121,7 +121,7 @@
if (this.keepAlivePending) {
this.disconnect(IChatBaseComponent.translatable("disconnect.timeout"));
} else {
@@ -312,15 +398,21 @@
@@ -314,15 +400,21 @@
}
this.server.getProfiler().pop();
@@ -143,7 +143,7 @@
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
}
@@ -344,16 +436,67 @@
@@ -346,16 +438,67 @@
return this.server.isSingleplayerOwner(this.player.getGameProfile());
}
@@ -212,7 +212,7 @@
}
private <T, R> CompletableFuture<R> filterTextPacket(T t0, BiFunction<ITextFilter, T, CompletableFuture<R>> bifunction) {
@@ -417,7 +560,34 @@
@@ -419,7 +562,34 @@
double d9 = entity.getDeltaMovement().lengthSqr();
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@@ -248,7 +248,7 @@
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
this.connection.send(new PacketPlayOutVehicleMove(entity));
return;
@@ -449,14 +619,72 @@
@@ -451,14 +621,72 @@
}
entity.absMoveTo(d3, d4, d5, f, f1);
@@ -321,7 +321,7 @@
this.player.getLevel().getChunkSource().move(this.player);
this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2);
this.clientVehicleIsFloating = d11 >= -0.03125D && !flag1 && !this.server.isFlightAllowed() && !entity.isNoGravity() && this.noBlocksAround(entity);
@@ -490,6 +718,7 @@
@@ -492,6 +720,7 @@
}
this.awaitingPositionFromClient = null;
@@ -329,7 +329,7 @@
}
}
@@ -497,7 +726,7 @@
@@ -499,7 +728,7 @@
@Override
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.getLevel());
@@ -338,7 +338,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook();
Objects.requireNonNull(recipebookserver);
@@ -527,6 +756,12 @@
@@ -529,6 +758,12 @@
@Override
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.getLevel());
@@ -351,7 +351,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -536,6 +771,7 @@
@@ -538,6 +773,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@@ -359,7 +359,7 @@
this.connection.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
});
}
@@ -785,6 +1021,13 @@
@@ -787,6 +1023,13 @@
if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container;
@@ -373,7 +373,7 @@
if (!containermerchant.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
@@ -799,6 +1042,13 @@
@@ -801,6 +1044,13 @@
@Override
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
@@ -387,7 +387,7 @@
int i = packetplayinbedit.getSlot();
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
@@ -807,7 +1057,7 @@
@@ -809,7 +1059,7 @@
Objects.requireNonNull(list);
optional.ifPresent(list::add);
@@ -396,7 +396,7 @@
Objects.requireNonNull(list);
stream.forEach(list::add);
@@ -825,7 +1075,7 @@
@@ -827,7 +1077,7 @@
ItemStack itemstack = this.player.getInventory().getItem(i);
if (itemstack.is(Items.WRITABLE_BOOK)) {
@@ -405,7 +405,7 @@
}
}
@@ -850,16 +1100,16 @@
@@ -852,16 +1102,16 @@
this.updateBookPages(list, (s) -> {
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
@@ -426,7 +426,7 @@
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
});
@@ -885,6 +1135,7 @@
@@ -887,6 +1137,7 @@
}
itemstack.addTagElement("pages", nbttaglist);
@@ -434,7 +434,7 @@
}
@Override
@@ -921,7 +1172,7 @@
@@ -923,7 +1174,7 @@
} else {
WorldServer worldserver = this.player.getLevel();
@@ -443,7 +443,7 @@
if (this.tickCount == 0) {
this.resetPosition();
}
@@ -931,7 +1182,7 @@
@@ -933,7 +1184,7 @@
this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
}
@@ -452,7 +452,7 @@
} else {
this.awaitingTeleportTime = this.tickCount;
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
@@ -943,7 +1194,15 @@
@@ -945,7 +1196,15 @@
if (this.player.isPassenger()) {
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
this.player.getLevel().getChunkSource().move(this.player);
@@ -468,7 +468,7 @@
double d3 = this.player.getX();
double d4 = this.player.getY();
double d5 = this.player.getZ();
@@ -963,15 +1222,33 @@
@@ -965,15 +1224,33 @@
++this.receivedMovePacketCount;
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
@@ -504,7 +504,7 @@
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d7, d8, d9});
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
return;
@@ -992,6 +1269,7 @@
@@ -994,6 +1271,7 @@
boolean flag1 = this.player.verticalCollisionBelow;
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
@@ -512,12 +512,12 @@
double d12 = d8;
d7 = d0 - this.player.getX();
@@ -1011,9 +1289,72 @@
@@ -1013,9 +1291,72 @@
this.player.absMoveTo(d0, d1, d2, f, f1);
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb))) {
- this.teleport(d3, d4, d5, f, f1);
+ this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet(), false); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
+ this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
} else {
+ // CraftBukkit start - fire PlayerMoveEvent
@@ -586,40 +586,25 @@
this.clientIsFloating = d12 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != EnumGamemode.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
this.player.getLevel().getChunkSource().move(this.player);
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
@@ -1052,19 +1393,80 @@
@@ -1054,11 +1395,68 @@
return true;
}
+ // CraftBukkit start - Delegate to teleport(Location)
public void dismount(double d0, double d1, double d2, float f, float f1) {
- this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), true);
+ this.dismount(d0, d1, d2, f, f1, PlayerTeleportEvent.TeleportCause.DISMOUNT);
+ }
+
+ public void dismount(double d0, double d1, double d2, float f, float f1, PlayerTeleportEvent.TeleportCause cause) {
+ this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), true, cause);
}
public void teleport(double d0, double d1, double d2, float f, float f1) {
- this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), false);
- this.teleport(d0, d1, d2, f, f1, Collections.emptySet());
+ this.teleport(d0, d1, d2, f, f1, PlayerTeleportEvent.TeleportCause.UNKNOWN);
+ }
+
+ public void teleport(double d0, double d1, double d2, float f, float f1, PlayerTeleportEvent.TeleportCause cause) {
+ this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), false, cause);
+ this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), cause);
}
public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set) {
- this.teleport(d0, d1, d2, f, f1, set, false);
public void teleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) {
+ this.teleport(d0, d1, d2, f, f1, set, PlayerTeleportEvent.TeleportCause.UNKNOWN);
+ }
+
+ public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, PlayerTeleportEvent.TeleportCause cause) {
+ this.teleport(d0, d1, d2, f, f1, set, false, cause);
}
- public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, boolean flag) {
+ public boolean teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, boolean flag, PlayerTeleportEvent.TeleportCause cause) { // CraftBukkit - Return event status
+ public boolean teleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set, PlayerTeleportEvent.TeleportCause cause) { // CraftBukkit - Return event status
+ Player player = this.getCraftPlayer();
+ Location from = player.getLocation();
+
@@ -632,7 +617,7 @@
+ Location to = new Location(this.getCraftPlayer().getWorld(), x, y, z, yaw, pitch);
+ // SPIGOT-5171: Triggered on join
+ if (from.equals(to)) {
+ this.internalTeleport(d0, d1, d2, f, f1, set, flag);
+ this.internalTeleport(d0, d1, d2, f, f1, set);
+ return false; // CraftBukkit - Return event status
+ }
+
@@ -649,15 +634,15 @@
+ f1 = to.getPitch();
+ }
+
+ this.internalTeleport(d0, d1, d2, f, f1, set, flag);
+ this.internalTeleport(d0, d1, d2, f, f1, set);
+ return event.isCancelled(); // CraftBukkit - Return event status
+ }
+
+ public void teleport(Location dest) {
+ internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.<PacketPlayOutPosition.EnumPlayerTeleportFlags>emptySet(), true);
+ internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
+ }
+
+ private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, boolean flag) {
+ private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) {
+ // CraftBukkit start
+ if (Float.isNaN(f)) {
+ f = 0;
@@ -668,10 +653,10 @@
+
+ this.justTeleported = true;
+ // CraftBukkit end
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.getX() : 0.0D;
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.getY() : 0.0D;
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.getZ() : 0.0D;
@@ -1076,6 +1478,14 @@
double d3 = set.contains(RelativeMovement.X) ? this.player.getX() : 0.0D;
double d4 = set.contains(RelativeMovement.Y) ? this.player.getY() : 0.0D;
double d5 = set.contains(RelativeMovement.Z) ? this.player.getZ() : 0.0D;
@@ -1070,6 +1468,14 @@
this.awaitingTeleport = 0;
}
@@ -685,8 +670,8 @@
+
this.awaitingTeleportTime = this.tickCount;
this.player.absMoveTo(d0, d1, d2, f, f1);
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag));
@@ -1084,6 +1494,7 @@
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
@@ -1078,6 +1484,7 @@
@Override
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.getLevel());
@@ -694,7 +679,7 @@
BlockPosition blockposition = packetplayinblockdig.getPos();
this.player.resetLastActionTime();
@@ -1094,14 +1505,46 @@
@@ -1088,14 +1495,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
@@ -743,7 +728,7 @@
this.player.drop(false);
}
@@ -1139,6 +1582,7 @@
@@ -1133,6 +1572,7 @@
@Override
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.getLevel());
@@ -751,7 +736,7 @@
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
WorldServer worldserver = this.player.getLevel();
EnumHand enumhand = packetplayinuseitem.getHand();
@@ -1162,6 +1606,7 @@
@@ -1156,6 +1596,7 @@
if (blockposition.getY() < i) {
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
@@ -759,7 +744,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
@@ -1190,6 +1635,7 @@
@@ -1184,6 +1625,7 @@
@Override
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.getLevel());
@@ -767,7 +752,7 @@
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
WorldServer worldserver = this.player.getLevel();
EnumHand enumhand = packetplayinblockplace.getHand();
@@ -1197,6 +1643,49 @@
@@ -1191,6 +1633,49 @@
this.player.resetLastActionTime();
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
@@ -817,7 +802,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.shouldSwing()) {
@@ -1217,7 +1706,7 @@
@@ -1211,7 +1696,7 @@
Entity entity = packetplayinspectate.getEntity(worldserver);
if (entity != null) {
@@ -826,7 +811,7 @@
return;
}
}
@@ -1232,6 +1721,7 @@
@@ -1226,6 +1711,7 @@
PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
}
@@ -834,7 +819,7 @@
}
@@ -1251,12 +1741,27 @@
@@ -1247,12 +1733,27 @@
@Override
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
@@ -863,7 +848,7 @@
this.player.getTextFilter().leave();
if (this.isSingleplayerOwner()) {
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
@@ -1279,6 +1784,15 @@
@@ -1275,6 +1776,15 @@
}
public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
@@ -879,7 +864,7 @@
try {
this.connection.send(packet, packetsendlistener);
} catch (Throwable throwable) {
@@ -1295,7 +1809,16 @@
@@ -1291,7 +1801,16 @@
@Override
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.getLevel());
@@ -896,7 +881,7 @@
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
this.player.stopUsingItem();
}
@@ -1304,18 +1827,25 @@
@@ -1300,18 +1819,25 @@
this.player.resetLastActionTime();
} else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@@ -923,7 +908,7 @@
PlayerChatMessage playerchatmessage;
try {
@@ -1333,9 +1863,9 @@
@@ -1329,9 +1855,9 @@
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent((IChatBaseComponent) completablefuture1.join()).filter(((FilteredText) completablefuture.join()).mask());
this.broadcastChatMessage(playerchatmessage1);
@@ -935,7 +920,7 @@
}
}
@@ -1359,12 +1889,25 @@
@@ -1355,12 +1881,25 @@
}
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
@@ -963,7 +948,7 @@
} catch (SignedMessageChain.a signedmessagechain_a) {
this.handleMessageDecodeFailure(signedmessagechain_a);
return;
@@ -1372,10 +1915,10 @@
@@ -1368,10 +1907,10 @@
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
@@ -976,16 +961,16 @@
}
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
@@ -1413,7 +1956,7 @@
PlayerConnection.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), s);
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.out_of_order_chat"));
return Optional.empty();
- } else if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
+ } else if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
return Optional.empty();
@@ -1412,7 +1951,7 @@
} else {
@@ -1462,6 +2005,122 @@
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
+ if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
return Optional.empty();
} else {
@@ -1460,6 +1999,122 @@
return false;
}
@@ -1108,7 +1093,7 @@
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
@@ -1469,13 +2128,33 @@
@@ -1467,13 +2122,33 @@
}
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
@@ -1145,7 +1130,7 @@
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
}
@@ -1497,13 +2176,59 @@
@@ -1495,13 +2170,59 @@
@Override
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.getLevel());
@@ -1203,9 +1188,9 @@
+ }
+ // CraftBukkit end
this.player.resetLastActionTime();
Entity entity;
IJumpable ijumpable;
@@ -1583,6 +2308,12 @@
@@ -1583,6 +2304,12 @@
}
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
@@ -1218,7 +1203,7 @@
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level.registryAccess())));
this.addPendingMessage(playerchatmessage);
}
@@ -1594,6 +2325,7 @@
@@ -1598,6 +2325,7 @@
@Override
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.getLevel());
@@ -1226,9 +1211,9 @@
final WorldServer worldserver = this.player.getLevel();
final Entity entity = packetplayinuseentity.getTarget(worldserver);
@@ -1606,13 +2338,51 @@
@@ -1612,13 +2340,51 @@
if (entity.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
- private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a) {
+ private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
@@ -1279,7 +1264,7 @@
if (enuminteractionresult.consumesAction()) {
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
if (enuminteractionresult.shouldSwing()) {
@@ -1625,23 +2395,29 @@
@@ -1631,23 +2397,29 @@
@Override
public void onInteraction(EnumHand enumhand) {
@@ -1312,7 +1297,7 @@
}
} else {
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
@@ -1687,15 +2463,21 @@
@@ -1693,15 +2465,21 @@
@Override
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel());
@@ -1336,7 +1321,7 @@
this.player.containerMenu.sendAllDataToRemote();
} else if (!this.player.containerMenu.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
@@ -1708,7 +2490,284 @@
@@ -1714,7 +2492,284 @@
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
this.player.containerMenu.suppressRemoteUpdates();
@@ -1622,7 +1607,7 @@
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
while (objectiterator.hasNext()) {
@@ -1748,6 +2807,7 @@
@@ -1754,6 +2809,7 @@
@Override
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.getLevel());
@@ -1630,7 +1615,7 @@
this.player.resetLastActionTime();
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
if (!this.player.containerMenu.stillValid(this.player)) {
@@ -1790,6 +2850,43 @@
@@ -1796,6 +2852,43 @@
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@@ -1673,8 +1658,8 @@
+ // CraftBukkit end
if (flag1 && flag2) {
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).set(itemstack);
@@ -1812,6 +2909,7 @@
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).setByPlayer(itemstack);
@@ -1818,6 +2911,7 @@
}
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
@@ -1682,7 +1667,7 @@
this.player.resetLastActionTime();
WorldServer worldserver = this.player.getLevel();
BlockPosition blockposition = packetplayinupdatesign.getPos();
@@ -1828,18 +2926,37 @@
@@ -1834,18 +2928,37 @@
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
@@ -1722,7 +1707,7 @@
tileentitysign.setChanged();
worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
@@ -1849,6 +2966,7 @@
@@ -1855,6 +2968,7 @@
@Override
public void handleKeepAlive(PacketPlayInKeepAlive packetplayinkeepalive) {
@@ -1730,7 +1715,7 @@
if (this.keepAlivePending && packetplayinkeepalive.getId() == this.keepAliveChallenge) {
int i = (int) (SystemUtils.getMillis() - this.keepAliveTime);
@@ -1863,7 +2981,17 @@
@@ -1869,7 +2983,17 @@
@Override
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.getLevel());
@@ -1749,7 +1734,7 @@
}
@Override
@@ -1872,8 +3000,50 @@
@@ -1878,8 +3002,50 @@
this.player.updateOptions(packetplayinsettings);
}