inventory-framework
inventory-framework copied to clipboard
Duplicated Item
Is there an existing issue for this?
- [X] I have searched the existing issues
🐛 Describe the bug
When using a command such as giving an item to a player on pagination, the item is duplicated when received, for example a rock. 2 stones are coming instead of 1
Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"give " + player.getName() + " minecraft:stone");
✔️ Expected behavior
No response
👣 Steps to Reproduce
private final State<Pagination> paginationState = lazyPaginationState(
(context) -> rewardList(),
(context, item, index, reward) -> {
final UserCache uCache = userCacheState.get(context);
final User user = uCache.getByUser(context.getPlayer().getName());
item.onRender(rewardItem -> rewardItem.setItem(new ItemBuilder(Material.SKULL_ITEM)
.build())
).onClick(click -> {
final Player player = context.getPlayer();
Bukkit.dispatchCommand(
Bukkit.getConsoleSender(),
"give " + player.getName() + " minecraft:stone"
);
});
}
);
@Override
public void onInit(@NotNull ViewConfigBuilder config) {
config.title("Time Online")
.size(5)
.scheduleUpdate(20L)
.layout(
" ",
" ",
" OOOOOOO ",
" OOOOOOO ",
" "
)
.cancelOnPickup()
.cancelOnDrag()
.cancelOnClick()
.cancelOnDrop()
.build();
}
public List<Reward> rewardList() {
final RewardsCache rCache = plugin.getRewardsCache();
return rCache.getCachedElements();
}
💻 Platform
- [X] Bukkit
- [ ] Sponge
- [ ] Other
⭐ Server Version
1.8
📚 Library Version
v3.0.8
✍️ Additional context
No response