Ignore inconsequential inventory clicks, fixes #1718

This commit is contained in:
PikaMug 2021-06-18 18:26:37 -04:00
parent ea8b8fe24b
commit 1644f18549
3 changed files with 10 additions and 3 deletions

View File

@ -191,7 +191,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final int moneyRew = (Integer) context.getSessionData(CK.REW_MONEY);
return ChatColor.GRAY + "(" + ChatColor.AQUA + moneyRew + " "
return ChatColor.GRAY + "(" + ChatColor.AQUA
+ plugin.getDependencies().getVaultEconomy().format(moneyRew) + ChatColor.GRAY + ")";
}
} else {
@ -496,7 +496,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
String text = getQueryText(context);
if (plugin.getDependencies().getVaultEconomy() != null) {
text = text.replace("<money>", ChatColor.AQUA
+ (plugin.getDependencies().getVaultEconomy().currencyNamePlural() + ChatColor.YELLOW));
+ plugin.getDependencies().getVaultEconomy().currencyNamePlural() + ChatColor.YELLOW);
}
return ChatColor.YELLOW + text;
}

View File

@ -21,6 +21,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.enchantment.EnchantItemEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.InventoryType.SlotType;
@ -42,6 +43,9 @@ public class ItemListener implements Listener {
@EventHandler
public void onCraftItem(final CraftItemEvent evt) {
if (evt.getAction().equals(InventoryAction.NOTHING)) {
return;
}
if (evt.getWhoClicked() instanceof Player) {
final Player player = (Player) evt.getWhoClicked();
if (plugin.canUseQuests(player.getUniqueId())) {

View File

@ -84,8 +84,11 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClickEvent(final InventoryClickEvent evt) {
final InventoryAction ac = evt.getAction();
if (ac.equals(InventoryAction.NOTHING)) {
return;
}
if (ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCurrentItem())) {
if (ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || ac.equals(InventoryAction.DROP_ALL_SLOT)
if (ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || ac.equals(InventoryAction.DROP_ALL_SLOT)
|| ac.equals(InventoryAction.DROP_ONE_SLOT)) {
evt.setCancelled(true);
return;