mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-28 13:05:14 +01:00
Fix bug that allowed players to move blocked items into the backpack #65
This commit is contained in:
parent
cf32237ae9
commit
27c194c84b
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks</artifactId>
|
||||
<version>2.1.6</version>
|
||||
<version>2.1.7</version>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 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
|
||||
@ -96,10 +96,14 @@ public void onItemMove(InventoryClickEvent event)
|
||||
{
|
||||
if(event.getInventory().getHolder() instanceof Backpack)
|
||||
{
|
||||
if(event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD && event.getHotbarButton() != -1)
|
||||
if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getHotbarButton() != -1)
|
||||
{
|
||||
ItemStack item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton());
|
||||
if(item != null && isItemBlocked(item)) event.setCancelled(true);
|
||||
if(item != null && isItemBlocked(item))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageNotAllowedInBackpack.send(event.getView().getPlayer(), itemNameResolver.getName(item));
|
||||
}
|
||||
}
|
||||
else if(event.getCurrentItem() != null && isItemBlocked(event.getCurrentItem()))
|
||||
{
|
||||
|
@ -146,6 +146,15 @@ else if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY)
|
||||
messageDoNotRemoveItem.send(event.getWhoClicked());
|
||||
}
|
||||
}
|
||||
else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getHotbarButton() != -1)
|
||||
{
|
||||
ItemStack item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton());
|
||||
if(isItemShortcut(item))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageDoNotRemoveItem.send(event.getWhoClicked());
|
||||
}
|
||||
}
|
||||
else if(isItemShortcut(event.getCursor()) && !event.getWhoClicked().getInventory().equals(event.getClickedInventory()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user