Fix swap with off-hand allows item filter bypass

This commit is contained in:
GeorgH93 2024-12-30 00:19:18 +01:00
parent a05bcc8f29
commit bab2a70b02
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 GeorgH93
* Copyright (C) 2024 GeorgH93
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,6 +25,7 @@
import at.pcgamingfreaks.Message.Placeholder.Placeholder;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -114,6 +115,13 @@ else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.get
event.setCancelled(true);
}
}
else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getClick().name().equals("SWAP_OFFHAND"))
{
if(checkIsBlockedAndShowMessage(player, player.getInventory().getItemInOffHand()))
{
event.setCancelled(true);
}
}
else if(!player.getInventory().equals(event.getClickedInventory()) && checkIsBlockedAndShowMessage(player, event.getCursor()))
{
event.setCancelled(true);

View File

@ -7,7 +7,7 @@
<packaging>pom</packaging>
<properties>
<revision>2.4.31.5</revision>
<revision>2.4.31.6</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>