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

Closing inventory with a shift-clicked clickable adds the item your inventory #30

Open
ukulelelesheep opened this issue Nov 19, 2019 · 1 comment

Comments

@ukulelelesheep
Copy link

Clickable close = new Clickable(icon) {
	@Override
	public void clicked(Player p) {
		p.closeInventory();
	}
};

Shift clicking adds icon to your inventory. If any other inventory is opened, then the item gets removed. If the item is dropped and picked back up, then the item is not removed, allowing a player to get an infinite amount of the item.

The issue is also present if clickableInventory.forceCloseInventory(p) is used instead of p.closeInventory()

The issue is resolved if closing the inventory is in a bukkit runnable that is run 1 tick later. Some sort of error thrown if an inventory is tried to be closed inside a clickable and a clickableIventory.closeLater(int tick) method or something like that would be a sufficient work around. Or maybe there is a fault elsewhere that is causing this.

@ProgrammerDan
Copy link

ProgrammerDan commented Nov 19, 2019 via email

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

No branches or pull requests

2 participants