Prevent players from using the offhand swap key to move the backpack item (fixes #162)

This commit is contained in:
GeorgH93 2021-04-22 19:44:15 +02:00
parent c0002f75a5
commit 28796ef0f7
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 9 additions and 1 deletions

View File

@ -262,6 +262,14 @@ else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.get
messageDoNotRemoveItem.send(player); messageDoNotRemoveItem.send(player);
} }
} }
else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getClick().name().equals("SWAP_OFFHAND"))
{
if(isItemShortcut(player.getInventory().getItemInOffHand()))
{
event.setCancelled(true);
messageDoNotRemoveItem.send(player);
}
}
else if(isItemShortcut(event.getCursor())) else if(isItemShortcut(event.getCursor()))
{ {
if(!player.getInventory().equals(event.getClickedInventory())) if(!player.getInventory().equals(event.getClickedInventory()))

View File

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