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

click event #74

Open
jman13378 opened this issue Aug 23, 2022 · 2 comments
Open

click event #74

jman13378 opened this issue Aug 23, 2022 · 2 comments

Comments

@jman13378
Copy link

i have this but when i click one of the items it doesnt work

		for (int i = 0; i < stack.size(); i++) {
			CustomStack item = CustomStack.getInstance(stack.get(i));
			GuiItem guiItem = ItemBuilder.from(item.getItemStack().getType())
					.name(Component.text(item.getDisplayName())).asGuiItem(event -> {
						if (event.isRightClick())
							if (event.getCurrentItem().getItemMeta().hasDisplayName()) {
								event.getCurrentItem().getItemMeta().getDisplayName();
								String namespace = event.getCurrentItem().getItemMeta().getDisplayName();
								config.getStringList("items").add(namespace);
								config.createSection(namespace.replace(":",""));
								config.set(namespace.replace(":", "") + ".whitelist", true);
								config.set(namespace.replace(":", "") + ".can-float", true);
								config.set(namespace.replace(":", "") + ".water-collision", true);
								List<String> comments = new ArrayList<String>();
								comments.add("blocks:");
								comments.add("- Material");
								config.setComments(namespace.replace(":", ""), comments);
								BlockLimiter.getInstance().reloadConfig();
								gui.update();
							}
					});
			gui.addItem(guiItem);
		}
@jman13378
Copy link
Author

I added a getLogger and still and hasDisplayName returns true so why isnt this working

@jman13378
Copy link
Author

@LichtHund any ideas

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

1 participant