Commit Graph

61 Commits

Author SHA1 Message Date
775002a357 [ci skip] Remove nullable from SyncedEntityData#packAll (#11949) 2025-01-11 20:03:13 +01:00
55f3f280cb Reimplement ItemStack Obfuscation (#11817)
Reimplementation of the itemstack obfuscation config that
leverages the component patch map codec to drop
unwanted components on items or replaces them with
sanitized versions.

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2025-01-09 18:58:18 +01:00
3b0b3a0aef and some more 2024-12-21 13:45:04 +01:00
15ad7cc156 improve comment and better local var name 2024-12-18 18:54:31 -08:00
5922e6334b fix allowPermanentBlockBreakExploits config 2024-12-18 23:35:47 +01:00
6126012369 readd beacon effect cause 2024-12-18 19:29:39 +01:00
7caf863b52 Small diff cleanups from patch updating
And remove a dumb log change in PacketEncoder
2024-12-17 16:50:59 +01:00
9c973e84bc Some fixes 2024-12-16 15:44:33 +01:00
1af7f42af5 fix mapping issue in PlayerChatMessage 2024-12-16 00:41:04 +01:00
e3b23b59f3 more runtime errors 2024-12-15 15:16:33 -08:00
4cc2be301d it compiles? 2024-12-15 14:36:05 -08:00
4c723932f6 Small fixups 2024-12-15 12:13:09 +01:00
aa4dd1b840 net/minecraft/network/protocol/handshake/ 2024-12-14 15:55:25 -05:00
93c74cf2f4 net/minecraft/network/ 2024-12-14 15:47:52 -05:00
b0f627d7bb Small cleanup 2024-12-14 21:47:32 +01:00
27a47b77c7 net/minecraft/network/protocol/login 2024-12-14 19:37:38 +01:00
902965e66a net.minecraft.network.protocol.common(.custom) 2024-12-14 19:06:58 +01:00
822b963d3f net/minecraft/network/protocol/game/ 2024-12-14 12:57:50 -05:00
02fb33c3ee net.minecraft.network.chat 2024-12-14 18:44:19 +01:00
83c42080d6 chat/contents 2024-12-13 21:49:47 +01:00
18a25937bc pathfinding, packet utils 2024-12-13 18:57:25 +01:00
e9b739bc48 some more directories 2024-12-13 09:40:09 -08:00
45ddf764d9 Move patches to unapplied 2024-12-12 12:30:31 +01:00
d300c94ec2 Properly resend entities
This resolves some issues which caused entities to not be resent correctly.
Entities that are interacted with need to be resent to the client, so we resend all the entity
data to the player whilst making sure not to clear dirty entries from the tracker. This makes
sure that values will be correctly updated to other players.

This also adds utilities to aid in further preventing entity desyncs.

This also also fixes the bug causing cancelling PlayerInteractEvent to cause items to continue
to be used despite being cancelled on the server.

For example, items being consumed but never finishing, shields being put up, etc.
The underlying issue of this is that the client modifies their synced data values,
and so we have to (forcibly) resend them in order for the client to reset their using item state.

See: https://github.com/PaperMC/Paper/pull/1896

== AT ==
public net.minecraft.server.level.ChunkMap$TrackedEntity serverEntity
2022-12-07 17:25:19 -05:00
7ec2cf09a3 Add proper async player disconnections
Blocking can cause performance problems
2024-10-16 06:41:32 -07:00
165e93c7c6 Fix sending disconnect packet in phases where it doesn't exist 2024-05-30 18:46:15 +01:00
c6f962ba54 Prevent sending oversized item data in equipment and metadata
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-12-01 12:36:25 +01:00
445e9a65fb Added API to get player ha proxy address 2024-04-08 23:24:38 +08:00
236dce4925 Handle Large Packets disconnecting client
If a players inventory is too big to send in a single packet,
split the inventory set into multiple packets instead.
2018-11-27 21:18:06 -05:00
3758965f88 Improve tag parser handling 2024-02-05 11:54:04 +01:00
46c2fbfb74 Reduce allocation of Vec3D by entity tracker 2020-04-27 00:04:16 -07:00
85e082a9b3 Optimize VarInts
https://github.com/PaperMC/Paper/pull/6957#issuecomment-985250854
2023-10-28 19:46:21 -04:00
53fab9663b Add Listing API for Player 2023-01-11 16:40:39 -05:00
16b8d46c1c Prevent causing expired keys from impacting new joins 2023-04-03 08:55:52 +01:00
26fe3d0cff Fix premature player kicks on shutdown
When the server is stopping, the default execution handler method will throw a
RejectedExecutionException in order to prevent further execution, this causes
us to lose the actual kick reason. To mitigate this, we'll use a seperate marked
class in order to gracefully ignore these.
2024-04-11 16:37:44 +01:00
37bf078394 Sanitize sent BlockEntity NBT 2021-12-03 16:55:50 -05:00
a17ed327b3 Multi Block Change API Implementation 2022-01-14 00:41:11 -05:00
0fd1e5c650 Multiple Entries with Scoreboards 2021-09-21 18:17:33 -05:00
0277ecd75d Add packet limiter config
Example config:
packet-limiter:
  kick-message: '&cSent too many packets'
  limits:
    all:
      interval: 7.0
      max-packet-rate: 500.0
    ServerboundPlaceRecipePacket:
      interval: 4.0
      max-packet-rate: 5.0
      action: DROP

all section refers to all incoming packets, the action for all is
hard coded to KICK.

For specific limits, the section name is the class's name,
and an action can be defined: DROP or KICK

If interval or rate are less-than 0, the limit is ignored
2020-10-30 22:37:16 -07:00
75225eb102 Add PlayerKickEvent causes 2021-05-15 20:30:45 -07:00
3ab2001afb Add Channel initialization listeners 2021-04-29 21:19:33 +02:00
d9c0a60246 MC-4: Fix item position desync
This fixes item position desync (MC-4) by running the item coordinates
through the encode/decode methods of the packet that causes the precision
loss, which forces the server to lose the same precision as the client
keeping them in sync.
2020-12-08 20:24:52 -06:00
4b0e4655fd Add API for quit reason 2020-11-14 16:19:52 +01:00
5d139ca424 Buffer joins to world
This patch buffers the number of logins which will attempt to join
the world per tick, this attempts to reduce the impact that join floods
has on the server
2020-08-19 05:05:54 +01:00
5f6808db9a Optimize NetworkManager Exception Handling 2020-07-05 22:38:18 -04:00
f5226d3739 Add PlayerConnectionCloseEvent
This event is invoked when a player has disconnected. It is guaranteed that,
if the server is in online-mode, that the provided uuid and username have been
validated.

The event is invoked for players who have not yet logged into the world, whereas
PlayerQuitEvent is only invoked on players who have logged into the world.

The event is invoked for players who have already logged into the world,
although whether or not the player exists in the world at the time of
firing is undefined. (That is, whether the plugin can retrieve a Player object
using the event parameters is undefined). However, it is guaranteed that this
event is invoked AFTER PlayerQuitEvent, if the player has already logged into
the world.

This event is guaranteed to never fire unless AsyncPlayerPreLoginEvent has
been called beforehand, and this event may not be called in parallel with
AsyncPlayerPreLoginEvent for the same connection.

Cancelling the AsyncPlayerPreLoginEvent guarantees the corresponding
PlayerConnectionCloseEvent is never called.

The event may be invoked asynchronously or synchronously. As it stands,
it is never invoked asynchronously. However, plugins should check
Event#isAsynchronous to be future-proof.

On purpose, the deprecated PlayerPreLoginEvent event is left out of the
API spec for this event. Plugins should not be using that event, and
how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent
is undefined.

== AT ==
public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
public net.minecraft.server.network.ServerLoginPacketListenerImpl state
2018-10-07 12:05:28 -07:00
a7bc7ca33a Disable Explicit Network Manager Flushing
This seems completely pointless, as packet dispatch uses .writeAndFlush.

Things seem to work fine without explicit flushing, but incase issues arise,
provide a System property to re-enable it using improved logic of doing the
flushing on the netty event loop, so it won't do the flush on the main thread.

Renable flushing by passing -Dpaper.explicit-flush=true
2018-03-11 14:13:33 -04:00
8838089321 Expose client protocol version and virtual host 2017-10-10 18:45:20 +02:00
a99426b5fe Configurable Player Collision 2016-04-13 02:10:49 -04:00
e2263633d4 Add PlayerUseUnknownEntityEvent
Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with
virtual entities/entities that are not actually known to the server.

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2016-04-02 05:09:16 -04:00