PluginBugs / Issues-ChestPreview

Repository used to keep track of issues of my plugin ChestPreview
0 stars 0 forks source link

Viewing the virtual container of the lands plugin will cause the server to crash #15

Closed jhqwqmc closed 10 months ago

jhqwqmc commented 10 months ago

Terms

Discord tag (optional)

jhqwqmc#8740

What happened?

When I look at the container created by the lands plugin, it automatically triggers the right-click to open and crashes the server instantly. And it will cause inexplicable right-clicking caused by non-player operations.

Steps to reproduce the issue

https://github.com/PluginBugs/Issues-ChestPreview/assets/113768629/63174fe0-1c55-44a0-ac36-840bd9e30296

Server version

git-Purpur-2095 (MC: 1.20.2)*

ChestPreview Version

1.0.6

ProtocolLib Version

5.2.0-SNAPSHOT-679

LoneLibs Version

1.0.45

FULL server log

2024-01-10-9.log.gz crash-2024-01-10_18.48.38-server.txt

Error (optional)

No response

Problematic items yml configuration file (optional)

No response

Other files, you can drag and drop them here to upload. (optional)

No response

Screenshots/Videos (you can drag and drop files or paste links)

No response

github-actions[bot] commented 10 months ago

Hello, your report will be looked into as soon as possible. Please do not bump this thread and don't post it on multiple platforms.

Thanks a lot for your patience.

LoneDev6 commented 10 months ago

This will be fixed, thanks

jhqwqmc commented 10 months ago

It seems that the repair is not perfect.

jhqwqmc commented 10 months ago

Each preview triggers a virtual placement of blocks

jhqwqmc commented 10 months ago

https://github.com/PluginBugs/Issues-ChestPreview/assets/113768629/312de7a8-e60d-4fe4-a6ca-77973c5caa63

jhqwqmc commented 10 months ago

@LoneDev6

LoneDev6 commented 10 months ago

Is this causing any real gameplay issue? This is normal as I have to use a way to check if the player has actual permission to open the container. In this case I don't trigger the interaction anymore because it causes issues with plugins, now I trigger a fake block place event and check if it's cancelled by protection plugins.

Please let me know if it actually creates any issue. Note: this can be disabled in config.yml: check_container_access_permission: false

jhqwqmc commented 10 months ago

This could definitely cause some issues, because right now it's in notification mode. If I switch it to lock mode, the plugin will automatically lock some containers that I don't want to lock. Can you provide an API so I can notify other plugin developers to capture this event and cancel some unwanted actions?

jhqwqmc commented 10 months ago

I just changed check_container_access_permission to false but it still triggers like in the video.

jhqwqmc commented 10 months ago

Through testing, this method does not correctly check whether the player has permission to open the box, and can still be displayed to players who do not have permission to open it.

LoneDev6 commented 10 months ago

I made a mistake in the configuration, i will fix it later, i wrote optimization two times in my code. For now edit it like that:

optimization:
  container_detection_interval_ticks: 1
  optimization:
    check_container_access_permission: false
jhqwqmc commented 10 months ago

Can you judge directly through the API of this plugin? In this way, there is no need to open or place to determine whether there is permission. ChestProtectAPI

LoneDev6 commented 10 months ago

Hooking into protection plugins is tedious as it increases the build time of the plugin. For example to build my other plugin ItemsAdder it takes 25 seconds each time I have to make a minor change during my development phase. ItemsAdder hooks into more than 20 plugins.

I'd prefer to avoid hooking into protection plugins. The fake event is a trick used by many plugins to achieve that. Please let me know if the current trick is causing any gameplay issue, I might find another solution for that.

An idea would be to write a proper API to check for protection plugins, similar to this, but I don't really think it's a clean solution to hook every possible plugin.

jhqwqmc commented 10 months ago

However, fake events do have certain compatibility issues, but I don’t have any better ideas.