1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-17 18:47:40 +01:00

Don't tab-complete namespaced commands if send-namespaced is false

Tab-complete packet is supposed to tab-complete args for commands, but
it also can suggest commands like in version 1.12.2 or lower.

This patch prevents server from sending namespaced commands when player
requests tab-complete only commands.
This commit is contained in:
EpicPlayerA10 2023-06-18 12:38:24 +02:00
parent e46ee8e55e
commit 0f4ee39a8e

View file

@ -48,7 +48,7 @@
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
@@ -192,11 +196,72 @@
@@ -192,12 +196,73 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
@ -59,7 +59,7 @@
import net.minecraft.world.phys.shapes.VoxelShape;
+import org.bukkit.NamespacedKey;
import org.slf4j.Logger;
+
+// CraftBukkit start
+import io.papermc.paper.adventure.ChatProcessor; // Paper
+import io.papermc.paper.adventure.PaperAdventure; // Paper
@ -118,9 +118,10 @@
+import org.bukkit.inventory.InventoryView;
+import org.bukkit.inventory.SmithingInventory;
+// CraftBukkit end
+
public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl implements ServerGamePacketListener, ServerPlayerConnection, TickablePacketListener {
static final Logger LOGGER = LogUtils.getLogger();
@@ -212,7 +277,9 @@
private int tickCount;
private int ackBlockChangesUpTo = -1;
@ -338,7 +339,7 @@
boolean flag1 = entity.verticalCollisionBelow;
if (entity instanceof LivingEntity) {
@@ -449,20 +607,73 @@
@@ -449,19 +607,72 @@
d10 = d6 * d6 + d7 * d7 + d8 * d8;
boolean flag2 = false;
@ -357,8 +358,8 @@
+ this.player.absMoveTo(d0, d1, d2, this.player.getYRot(), this.player.getXRot()); // CraftBukkit
this.send(ClientboundMoveVehiclePacket.fromEntity(entity));
return;
}
+ }
+
+ // CraftBukkit start - fire PlayerMoveEvent
+ Player player = this.getCraftPlayer();
+ if (!this.hasMoved) {
@ -407,12 +408,11 @@
+ this.justTeleported = false;
+ return;
+ }
+ }
}
+ // CraftBukkit end
+
this.player.serverLevel().getChunkSource().move(this.player);
entity.recordMovementThroughBlocks(new Vec3(d0, d1, d2), entity.position());
Vec3 vec3d = new Vec3(entity.getX() - d0, entity.getY() - d1, entity.getZ() - d2);
@@ -489,16 +700,17 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) {
@ -441,7 +441,7 @@
this.player.getRecipeBook().setBookSetting(packet.getBookType(), packet.isOpen(), packet.isFiltering());
}
@@ -545,21 +758,85 @@
@@ -545,21 +758,90 @@
}
@ -521,6 +521,11 @@
- Suggestions suggestions1 = suggestions.getList().size() <= 1000 ? suggestions : new Suggestions(suggestions.getRange(), suggestions.getList().subList(0, 1000));
-
- this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions1));
+ // Paper start - Don't tab-complete namespaced commands if send-namespaced is false
+ if (!org.spigotmc.SpigotConfig.sendNamespaced && suggestions.getRange().getStart() <= 1) {
+ suggestions.getList().removeIf(suggestion -> suggestion.getText().contains(":"));
+ }
+ // Paper end - Don't tab-complete namespaced commands if send-namespaced is false
+ // Paper start - Brigadier API
+ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, packet.getCommand());
+ suggestEvent.setCancelled(suggestions.isEmpty());
@ -531,7 +536,7 @@
});
}
@@ -568,7 +845,7 @@
@@ -568,7 +850,7 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@ -540,7 +545,7 @@
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock commandblocklistenerabstract = null;
@@ -635,7 +912,7 @@
@@ -635,7 +917,7 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@ -549,7 +554,7 @@
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
@@ -668,7 +945,7 @@
@@ -668,7 +950,7 @@
ItemStack itemstack = iblockdata.getCloneItemStack(worldserver, blockposition, flag);
if (!itemstack.isEmpty()) {
@ -558,7 +563,7 @@
ServerGamePacketListenerImpl.addBlockDataToItem(iblockdata, worldserver, blockposition, itemstack);
}
@@ -866,6 +1143,13 @@
@@ -866,6 +1148,13 @@
AbstractContainerMenu container = this.player.containerMenu;
if (container instanceof MerchantMenu containermerchant) {
@ -572,7 +577,7 @@
if (!containermerchant.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
return;
@@ -879,6 +1163,51 @@
@@ -879,6 +1168,51 @@
@Override
public void handleEditBook(ServerboundEditBookPacket packet) {
@ -624,7 +629,7 @@
int i = packet.slot();
if (Inventory.isHotbarSlot(i) || i == 40) {
@@ -899,12 +1228,16 @@
@@ -899,12 +1233,16 @@
}
private void updateBookContents(List<FilteredText> pages, int slotId) {
@ -642,7 +647,7 @@
}
}
@@ -915,12 +1248,13 @@
@@ -915,12 +1253,13 @@
ItemStack itemstack1 = itemstack.transmuteCopy(Items.WRITTEN_BOOK);
itemstack1.remove(DataComponents.WRITABLE_BOOK_CONTENT);
@ -658,7 +663,7 @@
}
}
@@ -978,26 +1312,34 @@
@@ -978,26 +1317,34 @@
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
@ -700,7 +705,7 @@
double d3 = this.player.getX();
double d4 = this.player.getY();
double d5 = this.player.getZ();
@@ -1005,7 +1347,16 @@
@@ -1005,7 +1352,16 @@
double d7 = d1 - this.firstGoodY;
double d8 = d2 - this.firstGoodZ;
double d9 = this.player.getDeltaMovement().lengthSqr();
@ -718,7 +723,7 @@
if (this.player.isSleeping()) {
if (d10 > 1.0D) {
@@ -1019,36 +1370,106 @@
@@ -1019,36 +1375,106 @@
++this.receivedMovePacketCount;
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
@ -737,13 +742,13 @@
+ this.allowedPlayerTicks -= 1;
+ } else {
+ this.allowedPlayerTicks = 20;
+ }
}
+ double speed;
+ if (this.player.getAbilities().flying) {
+ speed = this.player.getAbilities().flyingSpeed * 20f;
+ } else {
+ speed = this.player.getAbilities().walkingSpeed * 10f;
}
+ }
+ // Paper start - Prevent moving into unloaded chunks
+ if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) {
+ // Paper start - Add fail move event
@ -834,7 +839,7 @@
double d11 = d7;
d6 = d0 - this.player.getX();
@@ -1059,17 +1480,100 @@
@@ -1059,17 +1485,100 @@
d8 = d2 - this.player.getZ();
d10 = d6 * d6 + d7 * d7 + d8 * d8;
@ -940,7 +945,7 @@
this.player.absMoveTo(d0, d1, d2, f, f1);
boolean flag4 = this.player.isAutoSpinAttack();
@@ -1119,6 +1623,7 @@
@@ -1119,6 +1628,7 @@
this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
}
@ -948,7 +953,7 @@
return true;
} else {
@@ -1147,23 +1652,98 @@
@@ -1147,23 +1657,98 @@
}
public void teleport(double x, double y, double z, float yaw, float pitch) {
@ -1050,7 +1055,7 @@
if (this.player.hasClientLoaded()) {
BlockPos blockposition = packet.getPos();
@@ -1175,14 +1755,46 @@
@@ -1175,14 +1760,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.getItemInHand(InteractionHand.OFF_HAND);
@ -1099,7 +1104,7 @@
this.player.drop(false);
}
@@ -1199,8 +1811,34 @@
@@ -1199,8 +1816,34 @@
case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK:
@ -1134,12 +1139,10 @@
return;
default:
throw new IllegalArgumentException("Invalid player action");
@@ -1216,11 +1854,33 @@
return (item instanceof BlockItem || item instanceof BucketItem) && !player.getCooldowns().isOnCooldown(stack);
@@ -1218,9 +1861,31 @@
}
+ }
+
}
+ // Spigot start - limit place/interactions
+ private int limitedPackets;
+ private long lastLimitedPacket = -1;
@ -1157,9 +1160,9 @@
+ }
+
+ return true;
}
+ }
+ // Spigot end
+
@Override
public void handleUseItemOn(ServerboundUseItemOnPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -1168,7 +1171,7 @@
if (this.player.hasClientLoaded()) {
this.player.connection.ackBlockChangesUpTo(packet.getSequence());
ServerLevel worldserver = this.player.serverLevel();
@@ -1230,6 +1890,11 @@
@@ -1230,6 +1895,11 @@
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
BlockHitResult movingobjectpositionblock = packet.getHitResult();
Vec3 vec3d = movingobjectpositionblock.getLocation();
@ -1180,7 +1183,7 @@
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
if (this.player.canInteractWithBlock(blockposition, 1.0D)) {
@@ -1243,7 +1908,8 @@
@@ -1243,7 +1913,8 @@
int i = this.player.level().getMaxY();
if (blockposition.getY() <= i) {
@ -1190,7 +1193,7 @@
InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
if (enuminteractionresult.consumesAction()) {
@@ -1257,11 +1923,11 @@
@@ -1257,11 +1928,11 @@
} else if (enuminteractionresult instanceof InteractionResult.Success) {
InteractionResult.Success enuminteractionresult_d = (InteractionResult.Success) enuminteractionresult;
@ -1204,7 +1207,7 @@
} else {
MutableComponent ichatmutablecomponent1 = Component.translatable("build.tooHigh", i).withStyle(ChatFormatting.RED);
@@ -1281,6 +1947,8 @@
@@ -1281,6 +1952,8 @@
@Override
public void handleUseItem(ServerboundUseItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -1213,7 +1216,7 @@
if (this.player.hasClientLoaded()) {
this.ackBlockChangesUpTo(packet.getSequence());
ServerLevel worldserver = this.player.serverLevel();
@@ -1296,6 +1964,47 @@
@@ -1296,6 +1969,47 @@
this.player.absRotateTo(f, f1);
}
@ -1261,7 +1264,7 @@
InteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult instanceof InteractionResult.Success) {
@@ -1321,7 +2030,7 @@
@@ -1321,7 +2035,7 @@
Entity entity = packet.getEntity(worldserver);
if (entity != null) {
@ -1270,7 +1273,7 @@
return;
}
}
@@ -1342,22 +2051,52 @@
@@ -1342,22 +2056,52 @@
@Override
public void onDisconnect(DisconnectionDetails info) {
@ -1327,7 +1330,7 @@
throw new IllegalArgumentException("Expected packet sequence nr >= 0");
} else {
this.ackBlockChangesUpTo = Math.max(sequence, this.ackBlockChangesUpTo);
@@ -1367,7 +2106,17 @@
@@ -1367,7 +2111,17 @@
@Override
public void handleSetCarriedItem(ServerboundSetCarriedItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -1345,7 +1348,7 @@
if (this.player.getInventory().selected != packet.getSlot() && this.player.getUsedItemHand() == InteractionHand.MAIN_HAND) {
this.player.stopUsingItem();
}
@@ -1376,11 +2125,18 @@
@@ -1376,11 +2130,18 @@
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -1364,7 +1367,7 @@
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packet.lastSeenMessages());
if (!optional.isEmpty()) {
@@ -1394,27 +2150,46 @@
@@ -1394,27 +2155,46 @@
return;
}
@ -1418,7 +1421,7 @@
ParseResults<CommandSourceStack> parseresults = this.parseCommand(command);
if (this.server.enforceSecureProfile() && SignableCommand.hasSignableArguments(parseresults)) {
@@ -1431,19 +2206,39 @@
@@ -1431,19 +2211,39 @@
if (!optional.isEmpty()) {
this.tryHandleChat(packet.command(), () -> {
@ -1462,7 +1465,7 @@
} catch (SignedMessageChain.DecodeException signedmessagechain_a) {
this.handleMessageDecodeFailure(signedmessagechain_a);
return;
@@ -1451,10 +2246,10 @@
@@ -1451,10 +2251,10 @@
CommandSigningContext.SignedArguments commandsigningcontext_a = new CommandSigningContext.SignedArguments(map);
@ -1475,7 +1478,7 @@
}
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
@@ -1530,14 +2325,20 @@
@@ -1530,14 +2330,20 @@
return com_mojang_brigadier_commanddispatcher.parse(command, this.player.createCommandSourceStack());
}
@ -1501,7 +1504,7 @@
}
}
@@ -1549,7 +2350,7 @@
@@ -1549,7 +2355,7 @@
if (optional.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -1510,10 +1513,12 @@
}
return optional;
@@ -1566,6 +2367,127 @@
return false;
}
@@ -1564,8 +2370,129 @@
}
return false;
+ }
+
+ // CraftBukkit start - add method
+ public void chat(String s, PlayerChatMessage original, boolean async) {
+ if (s.isEmpty() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) {
@ -1606,8 +1611,8 @@
+ this.server.console.sendMessage(s);
+ }
+ }
+ }
+
}
+ private void handleCommand(String s) {
+ org.spigotmc.AsyncCatcher.catchOp("Command Dispatched Async: " + s); // Paper - Add async catcher
+ if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
@ -1638,7 +1643,7 @@
private PlayerChatMessage getSignedMessage(ServerboundChatPacket packet, LastSeenMessages lastSeenMessages) throws SignedMessageChain.DecodeException {
SignedMessageBody signedmessagebody = new SignedMessageBody(packet.message(), packet.timeStamp(), packet.salt(), lastSeenMessages);
@@ -1573,15 +2495,44 @@
@@ -1573,15 +2500,44 @@
}
private void broadcastChatMessage(PlayerChatMessage message) {
@ -1689,7 +1694,7 @@
}
@@ -1592,7 +2543,7 @@
@@ -1592,7 +2548,7 @@
synchronized (this.lastSeenMessages) {
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -1698,7 +1703,7 @@
}
}
@@ -1601,7 +2552,40 @@
@@ -1601,7 +2557,40 @@
@Override
public void handleAnimate(ServerboundSwingPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -1739,7 +1744,7 @@
this.player.swing(packet.getHand());
}
@@ -1609,6 +2593,29 @@
@@ -1609,6 +2598,29 @@
public void handlePlayerCommand(ServerboundPlayerCommandPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasClientLoaded()) {
@ -1769,7 +1774,7 @@
this.player.resetLastActionTime();
Entity entity;
PlayerRideableJumping ijumpable;
@@ -1616,6 +2623,11 @@
@@ -1616,6 +2628,11 @@
switch (packet.getAction()) {
case PRESS_SHIFT_KEY:
this.player.setShiftKeyDown(true);
@ -1781,7 +1786,7 @@
break;
case RELEASE_SHIFT_KEY:
this.player.setShiftKeyDown(false);
@@ -1684,13 +2696,19 @@
@@ -1684,13 +2701,19 @@
}
if (i > 4096) {
@ -1802,7 +1807,7 @@
this.send(new ClientboundPlayerChatPacket(message.link().sender(), message.link().index(), message.signature(), message.signedBody().pack(this.messageSignatureCache), message.unsignedContent(), message.filterMask(), params));
this.addPendingMessage(message);
}
@@ -1703,6 +2721,18 @@
@@ -1703,6 +2726,18 @@
return this.connection.getRemoteAddress();
}
@ -1821,7 +1826,7 @@
public void switchToConfig() {
this.waitingForSwitchToConfig = true;
this.removePlayerFromWorld();
@@ -1718,9 +2748,17 @@
@@ -1718,9 +2753,17 @@
@Override
public void handleInteract(ServerboundInteractPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -1839,7 +1844,7 @@
this.player.resetLastActionTime();
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
@@ -1733,20 +2771,58 @@
@@ -1733,20 +2776,58 @@
if (this.player.canInteractWithEntity(axisalignedbb, 3.0D)) {
packet.dispatch(new ServerboundInteractPacket.Handler() {
@ -1902,7 +1907,7 @@
}
}
@@ -1755,19 +2831,20 @@
@@ -1755,19 +2836,20 @@
@Override
public void onInteraction(InteractionHand hand) {
@ -1926,7 +1931,7 @@
label23:
{
if (entity instanceof AbstractArrow) {
@@ -1785,17 +2862,41 @@
@@ -1785,17 +2867,41 @@
}
ServerGamePacketListenerImpl.this.player.attack(entity);
@ -1969,7 +1974,7 @@
}
}
@@ -1809,7 +2910,7 @@
@@ -1809,7 +2915,7 @@
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
@ -1978,7 +1983,7 @@
this.resetPosition();
CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD);
} else {
@@ -1817,11 +2918,11 @@
@@ -1817,11 +2923,11 @@
return;
}
@ -1993,7 +1998,7 @@
}
}
break;
@@ -1833,16 +2934,27 @@
@@ -1833,16 +2939,27 @@
@Override
public void handleContainerClose(ServerboundContainerClosePacket packet) {
@ -2023,7 +2028,7 @@
this.player.containerMenu.sendAllDataToRemote();
} else if (!this.player.containerMenu.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
@@ -1855,7 +2967,284 @@
@@ -1855,7 +2972,284 @@
boolean flag = packet.getStateId() != this.player.containerMenu.getStateId();
this.player.containerMenu.suppressRemoteUpdates();
@ -2309,7 +2314,7 @@
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packet.getChangedSlots()).iterator();
while (objectiterator.hasNext()) {
@@ -1879,6 +3268,14 @@
@@ -1879,6 +3273,14 @@
@Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
@ -2324,7 +2329,7 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.containerId()) {
@@ -1900,8 +3297,42 @@
@@ -1900,9 +3302,43 @@
ServerGamePacketListenerImpl.LOGGER.debug("Player {} tried to place impossible recipe {}", this.player, recipeholder.id().location());
return;
}
@ -2357,7 +2362,7 @@
+ return;
+ }
+ // Paper end - Add PlayerRecipeBookClickEvent - forward to legacy event
+
+ // Cast to keyed should be safe as the recipe will never be a MerchantRecipe.
+ recipeholder = this.server.getRecipeManager().byKey(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.RECIPE, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(recipeName))).orElse(null); // Paper - Add PlayerRecipeBookClickEvent - forward to legacy event
+ if (recipeholder == null) {
@ -2365,10 +2370,11 @@
+ }
+ RecipeBookMenu.PostPlaceAction containerrecipebook_a = containerrecipebook.handlePlacement(makeAll, this.player.isCreative(), recipeholder, this.player.serverLevel(), this.player.getInventory());
+ // CraftBukkit end
+
if (containerrecipebook_a == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) {
this.player.connection.send(new ClientboundPlaceGhostRecipePacket(this.player.containerMenu.containerId, craftingmanager_d.display().display()));
@@ -1917,6 +3348,7 @@
}
@@ -1917,6 +3353,7 @@
@Override
public void handleContainerButtonClick(ServerboundContainerButtonClickPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -2376,7 +2382,7 @@
this.player.resetLastActionTime();
if (this.player.containerMenu.containerId == packet.containerId() && !this.player.isSpectator()) {
if (!this.player.containerMenu.stillValid(this.player)) {
@@ -1945,7 +3377,44 @@
@@ -1945,7 +3382,44 @@
boolean flag1 = packet.slotNum() >= 1 && packet.slotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getCount() <= itemstack.getMaxStackSize();
@ -2421,7 +2427,7 @@
if (flag1 && flag2) {
this.player.inventoryMenu.getSlot(packet.slotNum()).setByPlayer(itemstack);
this.player.inventoryMenu.setRemoteSlot(packet.slotNum(), itemstack);
@@ -1964,7 +3433,19 @@
@@ -1964,7 +3438,19 @@
@Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) {
@ -2442,7 +2448,7 @@
this.filterTextPacket(list).thenAcceptAsync((list1) -> {
this.updateSignText(packet, list1);
@@ -1972,6 +3453,7 @@
@@ -1972,6 +3458,7 @@
}
private void updateSignText(ServerboundSignUpdatePacket packet, List<FilteredText> signText) {
@ -2450,7 +2456,7 @@
this.player.resetLastActionTime();
ServerLevel worldserver = this.player.serverLevel();
BlockPos blockposition = packet.getPos();
@@ -1993,15 +3475,33 @@
@@ -1993,15 +3480,33 @@
@Override
public void handlePlayerAbilities(ServerboundPlayerAbilitiesPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -2485,7 +2491,7 @@
if (this.player.isModelPartShown(PlayerModelPart.HAT) != flag) {
this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_HAT, this.player));
}
@@ -2012,7 +3512,7 @@
@@ -2012,7 +3517,7 @@
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {
@ -2494,7 +2500,7 @@
}
}
@@ -2033,7 +3533,7 @@
@@ -2033,7 +3538,7 @@
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@ -2503,7 +2509,7 @@
} else {
try {
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
@@ -2045,8 +3545,8 @@
@@ -2045,8 +3550,8 @@
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
@ -2514,7 +2520,7 @@
}
}
@@ -2058,7 +3558,7 @@
@@ -2058,7 +3563,7 @@
if (!this.waitingForSwitchToConfig) {
throw new IllegalStateException("Client acknowledged config, but none was requested");
} else {
@ -2523,7 +2529,7 @@
}
}
@@ -2076,15 +3576,18 @@
@@ -2076,15 +3581,18 @@
private void resetPlayerChatState(RemoteChatSession session) {
this.chatSession = session;
@ -2545,7 +2551,7 @@
@Override
public void handleClientTickEnd(ServerboundClientTickEndPacket packet) {
@@ -2115,4 +3618,17 @@
@@ -2115,4 +3623,17 @@
InteractionResult run(ServerPlayer player, Entity entity, InteractionHand hand);
}