Skip to content

Conversation

@SaltyAlpaca
Copy link

435328973-60dc0543-573a-4c4d-8fcb-b2bf58637d60

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
Copy link
Owner

@Emibergo02 Emibergo02 left a 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();
Copy link
Owner

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

Copy link
Author

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));
Copy link
Owner

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

Copy link
Author

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
Copy link
Owner

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

Copy link
Author

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);


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary spaces

Copy link
Author

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;
Copy link
Owner

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

Copy link
Owner

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("")
Copy link
Owner

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

Copy link
Author

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 😭

@SaltyAlpaca
Copy link
Author

i could do it tomorrow maybe

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

Successfully merging this pull request may close these issues.

2 participants