|
51 | 51 | this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause |
52 | 52 | return; |
53 | 53 | } |
54 | | -@@ -1308,6 +_,10 @@ |
| 54 | +@@ -1301,6 +_,10 @@ |
55 | 55 | final int maxBookPageSize = pageMax.intValue(); |
56 | 56 | final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D); |
57 | 57 | long byteAllowed = maxBookPageSize; |
|
62 | 62 | for (final String page : pageList) { |
63 | 63 | final int byteLength = page.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; |
64 | 64 | byteTotal += byteLength; |
65 | | -@@ -1332,7 +_,8 @@ |
| 65 | +@@ -1325,7 +_,8 @@ |
66 | 66 | } |
67 | 67 |
|
68 | 68 | if (byteTotal > byteAllowed) { |
|
72 | 72 | this.disconnectAsync(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause // Paper - add proper async disconnect |
73 | 73 | return; |
74 | 74 | } |
75 | | -@@ -1351,31 +_,45 @@ |
| 75 | +@@ -1344,31 +_,45 @@ |
76 | 76 | Optional<String> optional = packet.title(); |
77 | 77 | optional.ifPresent(list::add); |
78 | 78 | list.addAll(packet.pages()); |
|
122 | 122 | itemStack.set( |
123 | 123 | DataComponents.WRITTEN_BOOK_CONTENT, new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getPlainTextName(), 0, list, true) |
124 | 124 | ); |
125 | | -@@ -1388,6 +_,16 @@ |
| 125 | +@@ -1381,6 +_,16 @@ |
126 | 126 | return this.player.isTextFilteringEnabled() ? Filterable.passThrough(filteredText.filteredOrEmpty()) : Filterable.from(filteredText); |
127 | 127 | } |
128 | 128 |
|
|
139 | 139 | @Override |
140 | 140 | public void handleEntityTagQuery(ServerboundEntityTagQueryPacket packet) { |
141 | 141 | PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); |
142 | | -@@ -1427,7 +_,15 @@ |
| 142 | +@@ -1420,7 +_,15 @@ |
143 | 143 | @Override |
144 | 144 | public void handleMovePlayer(ServerboundMovePlayerPacket packet) { |
145 | 145 | PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); |
|
156 | 156 | this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause |
157 | 157 | } else { |
158 | 158 | ServerLevel serverLevel = this.player.level(); |
159 | | -@@ -1610,7 +_,7 @@ |
| 159 | +@@ -1603,7 +_,7 @@ |
160 | 160 | movedWrongly = true; |
161 | 161 | if (event.getLogWarning()) |
162 | 162 | // Paper end |
|
165 | 165 | } // Paper |
166 | 166 | } |
167 | 167 |
|
168 | | -@@ -1675,6 +_,8 @@ |
| 168 | +@@ -1668,6 +_,8 @@ |
169 | 169 | this.lastYaw = to.getYaw(); |
170 | 170 | this.lastPitch = to.getPitch(); |
171 | 171 |
|
|
174 | 174 | Location oldTo = to.clone(); |
175 | 175 | PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); |
176 | 176 | this.cserver.getPluginManager().callEvent(event); |
177 | | -@@ -1730,6 +_,13 @@ |
| 177 | +@@ -1723,6 +_,13 @@ |
178 | 178 | this.player.tryResetCurrentImpulseContext(); |
179 | 179 | } |
180 | 180 |
|
|
188 | 188 | this.player.checkMovementStatistics(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z); |
189 | 189 | this.lastGoodX = this.player.getX(); |
190 | 190 | this.lastGoodY = this.player.getY(); |
191 | | -@@ -1747,6 +_,17 @@ |
| 191 | +@@ -1740,6 +_,17 @@ |
192 | 192 | } |
193 | 193 | } |
194 | 194 |
|
|
206 | 206 | private boolean shouldCheckPlayerMovement(boolean isElytraMovement) { |
207 | 207 | if (this.isSingleplayerOwner()) { |
208 | 208 | return false; |
209 | | -@@ -2161,6 +_,7 @@ |
| 209 | +@@ -2154,6 +_,7 @@ |
210 | 210 |
|
211 | 211 | boolean cancelled; |
212 | 212 | if (hitResult == null || hitResult.getType() != HitResult.Type.BLOCK) { |
213 | 213 | + if (this.player.gameMode.shiftClickMended(itemInHand)) return; // Purpur - Shift right click to use exp for mending |
214 | 214 | org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemInHand, hand); |
215 | 215 | cancelled = event.useItemInHand() == Event.Result.DENY; |
216 | 216 | } else { |
217 | | -@@ -2807,6 +_,7 @@ |
| 217 | +@@ -2800,6 +_,7 @@ |
218 | 218 |
|
219 | 219 | AABB boundingBox = target.getBoundingBox(); |
220 | 220 | if (packet.isWithinRange(this.player, boundingBox, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience value for interact range |
221 | 221 | + if (target instanceof net.minecraft.world.entity.Mob mob) mob.ticksSinceLastInteraction = 0; // Purpur - Entity lifespan |
222 | 222 | packet.dispatch( |
223 | 223 | new ServerboundInteractPacket.Handler() { |
224 | 224 | private void performInteraction(InteractionHand hand, ServerGamePacketListenerImpl.EntityInteraction entityInteraction, PlayerInteractEntityEvent event) { // CraftBukkit |
225 | | -@@ -3552,7 +_,7 @@ |
| 225 | +@@ -3545,7 +_,7 @@ |
226 | 226 | @Override |
227 | 227 | public void handleChangeGameMode(ServerboundChangeGameModePacket packet) { |
228 | 228 | PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); |
|
0 commit comments