MarkusBordihn / BOs-Easy-NPC

Create easily NPC for your world or for your mod.
Other
20 stars 8 forks source link

[Bug] Trading open command doesn't work on dedicated server #351

Closed DedMaxim closed 1 month ago

DedMaxim commented 1 month ago

Minecraft and Mod version 🐞 Minecraft 1.20.1 Forge 47.3.11, also tried 47.3.5 - same result Easy NPC 5.6.0 / no other mods installed Windows 10 20H2 Intel Xeon E5-2680v2 Nvidia GTX 1070 Nvidia driver 560.81

Describe the bug 🐞 Execution of "/easy_npc trading open {UUID}" command on a dedicated server returns an error. Error message: Could not parse command: Cannot invoke "de.markusbordihn.easynpc.network.message.ServerNetworkMessageHandlerInterface.requestDataSync(java.util.UUID)" because the return value of "de.markusbordihn.easynpc.network.NetworkMessageHandlerManager.getServerHandler()" is null ...ding open 66cc4ed4-2657-42a3-97be-0a8adcb19d14<--[HERE]

To Reproduce βš™οΈ Steps to reproduce the behavior:

  1. Create a dedicated server and a client for it, join the server.
  2. Place an NPC and add any trading for it.
  3. Run the command /easy_npc trading open {UUID}

Expected behavior βœ”οΈ Trading screen opens

Screens... Video! πŸ“Έ Video demonstration https://drive.google.com/file/d/1FEXM2Ae_geveHb8v9slLD3netD3bWlj-/view?usp=sharing

Debugging πŸ› οΈ debug.log from the server debug.log latest.log from the server latest.log latest.log from the client latest.log

Additional context πŸ“ Was working fine in 4.5.1. And yes, I did fix all trades after upgrade. And I also tried fresh installes, as demonstrated in the video I provided

MarkusBordihn commented 1 month ago

Thank you for the detailed report. On a dedicated server, the command is executed server-side and may sometimes fail to correctly detect the nearest player.

I'll work on a fix for this, but in the meantime, you can bypass this issue by specifying the player directly at the end of the command, like so: /easy_npc trading open 63941185-4a98-4410-80c2-bf369388207b Dev or /easy_npc trading open 63941185-4a98-4410-80c2-bf369388207b @p