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
The error was tested in my code and it didn't work. Are you sure you are registering the View correctly?
(tested using other types of state as well)
O erro foi testado no meu código e não funcionou. Tem certeza de que está registrando o View corretamente?
![]()
(testado usando outros tipos de estado também)
do it to give an item directly from the console
O erro foi testado no meu código e não funcionou. Tem certeza de que está registrando o View corretamente?
![]()
(testado usando outros tipos de estado também)
do it to give an item directly from the console
Same.
If you need help, message me on discord: luapascoal.
