-
Notifications
You must be signed in to change notification settings - Fork 34
Added Event to fill Inventorys <item> <inv> <ec> etc. #31
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
base: main
Are you sure you want to change the base?
Conversation
SaltyAlpaca
commented
Apr 19, 2025

Added Support for a custom Inventory filler, mostly for Enderchest, but also working for Inventory and Item
Reorderd the Inventory, to have a way better look and nicer view of the GUI with the armors being now at the top and the hotbar at the bottom fixing an ugly appearence and better code structure
This event replaces the CustomInventoryAPI with a simple Event
updated the ordering of the Armor and Items in the Inventory Share GUI
Fixed an Issue with the Item Display
Emibergo02
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good after the reviewed parts are fixed. I will make some optimizations and syntax corrections on for int loops and then it will be merged
| Bukkit.getPluginManager().callEvent(itemEvent); | ||
|
|
||
| // 3) Unwrap result | ||
| ItemStack[] itemArr = itemEvent.getContents(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would clone the item array here instead of the Event setContent method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdym, just clone it? Like this:
ItemStack[] originalArr = itemEvent.getContents();
ItemStack[] clonedArr = Arrays.stream(originalArr)
.map(item -> item == null ? null : item.clone())
.toArray(ItemStack[]::new);
ItemStack itemToDisplay = (clonedArr.length > 0 && clonedArr[0] != null)
? clonedArr[0]
: new ItemStack(Material.AIR);
| .getPlayerItem(targetName) | ||
| .thenAccept(item -> { | ||
| ItemStack[] guiItems = new ItemStack[27]; | ||
| Arrays.fill(guiItems, new ItemStack(Material.AIR)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not necessary. nulls are taken as material air anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't know, i just did it to be sure
| } | ||
| }.runTaskLater(plugin, 1))).open(player); | ||
| } | ||
| // Inhalte auf die GUI‑Größe trimmen/padden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ehm yes but in english
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot 🤭
|
|
||
| this.executorService = Executors.newFixedThreadPool(config.chatThreads); | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ye
|
|
||
| public InventoryPlaceholderEvent(Player player, Type type, ItemStack[] defaultContents) { | ||
| super(!player.getServer().isPrimaryThread()); | ||
| this.player = player; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmh please stick with the normal spaces conventions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For field assignations
|
|
||
| @AllArgsConstructor | ||
| public class ComponentProvider { | ||
| @Subst("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stop it. remove this Subst please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i couldn't remember where i put it 😭
|
i could do it tomorrow maybe |
idk what i should write here
Happy?