Commit Graph

69 Commits

Author SHA1 Message Date
Owen
7f60924390 Configuration API (#12301)
This implements a solution that preemptively exits the tick loop if we have already marked the connection as disconnecting. This avoids changing the result of Connection#isConnected in order to avoid other possibly unintentional changes. Fundamentally it should be investigated if closing the connection async is really still needed.

This also additionally removes the login disconnecting logic for server stopping, as this was also a possible issue in the config stage but also shouldn't be an issue as connections are closed on server stop very early.

Additionally, do not check for isConnecting() on VERIFYING, as that seemed to be an old diff originally trying to resolve this code, however isConnected is not updated at this point so it pretty much was useless.
2025-06-30 11:49:15 +02:00
Owen
ea10fa4a79 Don't mutate the position of Items for MC-4 Fix (#12702) 2025-06-25 21:51:26 +02:00
Bjarne Koll
a24f9b204c 1.21.6 dev
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2025-06-17 15:45:25 +02:00
Nassim Jahnke
358e72ec0d Remove simplify remote item matching stuff for now
Twas broken for some time and I haven't had time to address it, this may be revisited later in a different way
2025-05-09 14:47:24 +02:00
Tamion
53d1d04ec5 Disable Item Obfuscation for entity related stacks (#12297) 2025-05-03 20:52:33 +02:00
Nassim Jahnke
f00727c57e 1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: MiniDigger | Martin <admin@minidigger.dev>
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
2025-04-12 17:27:00 +02:00
Nassim Jahnke
9b1798d643 Simplify custom payload handling (#12347) 2025-03-27 14:22:38 +01:00
Nassim Jahnke
f12d33f04e Track codec writing 2025-02-25 21:45:02 +01:00
David
775002a357 [ci skip] Remove nullable from SyncedEntityData#packAll (#11949) 2025-01-11 20:03:13 +01:00
Owen
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
Nassim Jahnke
3b0b3a0aef and some more 2024-12-21 13:45:04 +01:00
Jake Potrebic
15ad7cc156 improve comment and better local var name 2024-12-18 18:54:31 -08:00
Lulu13022002
5922e6334b fix allowPermanentBlockBreakExploits config 2024-12-18 23:35:47 +01:00
Lulu13022002
6126012369 readd beacon effect cause 2024-12-18 19:29:39 +01:00
Nassim Jahnke
7caf863b52 Small diff cleanups from patch updating
And remove a dumb log change in PacketEncoder
2024-12-17 16:50:59 +01:00
Nassim Jahnke
9c973e84bc Some fixes 2024-12-16 15:44:33 +01:00
Lulu13022002
1af7f42af5 fix mapping issue in PlayerChatMessage 2024-12-16 00:41:04 +01:00
Jake Potrebic
e3b23b59f3 more runtime errors 2024-12-15 15:16:33 -08:00
Jake Potrebic
4cc2be301d it compiles? 2024-12-15 14:36:05 -08:00
Nassim Jahnke
4c723932f6 Small fixups 2024-12-15 12:13:09 +01:00
Owen1212055
aa4dd1b840 net/minecraft/network/protocol/handshake/ 2024-12-14 15:55:25 -05:00
Owen1212055
93c74cf2f4 net/minecraft/network/ 2024-12-14 15:47:52 -05:00
Nassim Jahnke
b0f627d7bb Small cleanup 2024-12-14 21:47:32 +01:00
Noah van der Aa
27a47b77c7 net/minecraft/network/protocol/login 2024-12-14 19:37:38 +01:00
Noah van der Aa
902965e66a net.minecraft.network.protocol.common(.custom) 2024-12-14 19:06:58 +01:00
Owen1212055
822b963d3f net/minecraft/network/protocol/game/ 2024-12-14 12:57:50 -05:00
Noah van der Aa
02fb33c3ee net.minecraft.network.chat 2024-12-14 18:44:19 +01:00
Lulu13022002
83c42080d6 chat/contents 2024-12-13 21:49:47 +01:00
Noah van der Aa
18a25937bc pathfinding, packet utils 2024-12-13 18:57:25 +01:00
Jake Potrebic
e9b739bc48 some more directories 2024-12-13 09:40:09 -08:00
Nassim Jahnke
45ddf764d9 Move patches to unapplied 2024-12-12 12:30:31 +01:00
Owen1212055
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
Spottedleaf
7ec2cf09a3 Add proper async player disconnections
Blocking can cause performance problems
2024-10-16 06:41:32 -07:00
Shane Freeder
165e93c7c6 Fix sending disconnect packet in phases where it doesn't exist 2024-05-30 18:46:15 +01:00
Nassim Jahnke
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
nostalfinals
445e9a65fb Added API to get player ha proxy address 2024-04-08 23:24:38 +08:00
Aikar
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
Nassim Jahnke
3758965f88 Improve tag parser handling 2024-02-05 11:54:04 +01:00
Spottedleaf
46c2fbfb74 Reduce allocation of Vec3D by entity tracker 2020-04-27 00:04:16 -07:00
astei
85e082a9b3 Optimize VarInts
https://github.com/PaperMC/Paper/pull/6957#issuecomment-985250854
2023-10-28 19:46:21 -04:00
Corey Shupe
53fab9663b Add Listing API for Player 2023-01-11 16:40:39 -05:00
Shane Freeder
16b8d46c1c Prevent causing expired keys from impacting new joins 2023-04-03 08:55:52 +01:00
Shane Freeder
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
Owen1212055
37bf078394 Sanitize sent BlockEntity NBT 2021-12-03 16:55:50 -05:00
Brody Beckwith
a17ed327b3 Multi Block Change API Implementation 2022-01-14 00:41:11 -05:00
Cryptite
0fd1e5c650 Multiple Entries with Scoreboards 2021-09-21 18:17:33 -05:00
Spottedleaf
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
Jake Potrebic
75225eb102 Add PlayerKickEvent causes 2021-05-15 20:30:45 -07:00
Nassim Jahnke
3ab2001afb Add Channel initialization listeners 2021-04-29 21:19:33 +02:00
BillyGalbreath
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