Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphical Bug #35

Closed
zadrarion opened this issue Apr 26, 2020 · 6 comments
Closed

Graphical Bug #35

zadrarion opened this issue Apr 26, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@zadrarion
Copy link

Hi guys,

I use protocolize for create fake inventory with bungee.
All works fine (thanks for this awesome lib) but when I open the inventory example, if I click on item in my inventory, he disappeared.

If i try to interract with this new empty slot, the item come back but i would prefer if i can avoid this "bug"

image

I only have my plugin with protocolize on the proxy.
If you need more details, let me know.

(PS: I'm french, and I think i'm really bad for write and speak in english, i'm sorry if this post is awfull)

@Exceptionflug
Copy link
Owner

Hey,

thank you for your interest. Did you already try to cancel the InventoryClickEvent?

@zadrarion
Copy link
Author

Hello,

Yes, i've cancel the InventoryClickEvent, so when i click on the Item in the fake GUI, nothing happen but when i click on item in my personal Inventory. my item dissapeared.

It's only graphical but it's annoying :/

Thanks for your help :D

@Exceptionflug
Copy link
Owner

Hey,

yeah I know what you mean. I will look forward to fix this in the next releasen. Since this is not a critical bug.

@zadrarion
Copy link
Author

zadrarion commented May 4, 2020

After some try, it would appear that the fake inventories trigger the opening and click event for each click. I don't know if this could help you. If i find any others informations, i will tell you.

@Exceptionflug
Copy link
Owner

This will not be implemented.

@galexrt
Copy link

galexrt commented Jan 29, 2022

I was able to "workaround" this bug by having Bungeecord send a "message" (I'm using Proton, though Plugin message should work as well) whenever the player presses a slot that is not "managed" by, e.g, the inventory opened. The "message" for simplicity just contains the UUID of the player.

Proxy side code (inventory creation code):

Inventory inventory = new Inventory(InventoryType.GENERIC_9X4);
# For `InventoryType.GENERIC_9X4` the `maxSlot` is 35
int maxSlot = 35;
# ...
inventory.onClick(click -> {
    if (click.slot() > maxSlot) {
      # Send message to server
      return;
    }
    # ...
};

The code on the server side will then when a messages is received from the proxy run:

Player player = getServer().getPlayer(message.getUuid());
player.updateInventory();

It isn't perfect but making it much better than when the items simply disappear.
It is probably a good idea to add a "debounce" / cooldown / queue logic on the server side to only update the inventory every few ticks / seconds and not on every click.

Would be cool if that graphical bug could be fixed somehow without creating a "system" like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants