PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.42k stars 2.21k forks source link

Spawn protection does not update the client inventory. #11012

Open HydrolienF opened 1 week ago

HydrolienF commented 1 week ago

Expected behavior

When a BlockPlaceEvent is canceled it should display the same amount of item in the player inventory as if no block where placed.

Observed/Actual behavior

Currently in paper-1.21-40 item isn't visible in the player inventory after the BlockPlaceEvent have been canceled. It's only a display bug, moving the item inside the inventory will show the right number of block back.

Steps/models to reproduce

  1. Create a simple plugin that cancel every BlockPlaceEvent.
  2. Try to place a block on an 1.21 server.

Plugin and Datapack List

I have tried with towny and flagsh, both have the same behavior.

Paper version

[21:32:38 INFO]: This server is running Paper version 1.21-40-master@b45d9b6 (2024-07-01T08:23:14Z) (Implementing API version 1.21-R0.1-SNAPSHOT) You are running the latest version

Other

No response

lynxplay commented 1 week ago

I cannot replicate this issue on 4d20922b79f5b3976e240932d087357a3808fde4. Cancelling the block place event works fine in. The item is reverted to its original count.

Closing this as I'd presume more people would have reported this. If you have more input or more specific replication steps, feel free to post them here, I'll gladly reopen the issue 👍

HydrolienF commented 1 week ago

I did more tries with I and, it still happend in paper 1.21.46. It only happend on the 4 chunks around 0,0. That's probaby why the bug havent been found before.

This is a video of me testing it https://youtu.be/iKC1voGuaDs

Steps to reproduce

  1. Download paper 1.21.46.
  2. Download towny (https://github.com/TownyAdvanced/Towny/releases) (appends with last version and last stable version)
  3. Start the paper server with default towny serttings (No build in wilderness)
  4. Give yourself 64 dirt block from the server console
  5. Try to place this near 0,0
lynxplay commented 1 week ago

Sounds like a spawn protections issue, will triage tomorrow if no one beats me to it.

Thanks for the replication steps!

HydrolienF commented 1 week ago

If you think it's a Towny issue, let me know, I will open an issue there.

HydrolienF commented 1 week ago

Thanks for the replication steps!

No problem

lynxplay commented 1 week ago

After installing latest towny, I still cannot replicate this. You are using the vanilla client yes?

HydrolienF commented 1 week ago

Yes, vanilla 1.21 client, Paper 1.21.46 & Towny 0.100.3.4. With default settings for Paper and Towny. Java 21 Temurin.

lynxplay commented 1 week ago

Okay yea, this is not related to the event at all. Spawn protection is simply failing 👍 I can replicate this by

Create new paper server Add operator so spawn protection activates Attempt to place block.

Notably, until this is fixed, I'd advise against using spawn protection in the first place, it's consistency is questionable. You can disable it by setting the spawn-protection radius to 0 in the server.properties. If you want to correctly protect regions, checkout plugins for it like WorldGuard.

HydrolienF commented 1 week ago

Thanks. I forget to say that I had op one of my 2 account before trying with the other one. I have disable spawn protection on my server.

Lulu13022002 commented 1 week ago

This is a vanilla issue (https://bugs.mojang.com/browse/MC-99075) that spigot try to fix at some point here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/nms-patches/net/minecraft/world/item/ItemStack.patch#189