mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Check for objective before slots, fixes #2247
This commit is contained in:
parent
e24b364297
commit
9d729dc6ae
@ -54,11 +54,6 @@ public class BukkitItemListener implements Listener {
|
|||||||
final Player player = (Player) event.getWhoClicked();
|
final Player player = (Player) event.getWhoClicked();
|
||||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||||
final ItemStack craftedItem = getCraftedItem(event);
|
final ItemStack craftedItem = getCraftedItem(event);
|
||||||
if (BukkitInventoryUtil.getEmptySlots(player)
|
|
||||||
< craftedItem.getAmount() / craftedItem.getMaxStackSize()) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
final ObjectiveType type = ObjectiveType.CRAFT_ITEM;
|
final ObjectiveType type = ObjectiveType.CRAFT_ITEM;
|
||||||
final Set<String> dispatchedQuestIDs = new HashSet<>();
|
final Set<String> dispatchedQuestIDs = new HashSet<>();
|
||||||
@ -69,6 +64,11 @@ public class BukkitItemListener implements Listener {
|
|||||||
|
|
||||||
if (quester.getCurrentQuests().containsKey(quest)
|
if (quester.getCurrentQuests().containsKey(quest)
|
||||||
&& quester.getCurrentStage(quest).containsObjective(type)) {
|
&& quester.getCurrentStage(quest).containsObjective(type)) {
|
||||||
|
if (BukkitInventoryUtil.getEmptySlots(player)
|
||||||
|
< craftedItem.getAmount() / craftedItem.getMaxStackSize()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
quester.craftItem(quest, craftedItem);
|
quester.craftItem(quest, craftedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user