mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 22:15:22 +00:00
Fix bug #161 - fix for InventoryType.BEACON returning null;
This commit is contained in:
1 parent
3c05abd742
commit
09194b2591
2 files changed
+5
No files matched your search
@@ -29,6 +29,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class InventoryListener extends EventListener {
|
||||
@@ -61,8 +62,10 @@ public class InventoryListener extends EventListener {
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||
if(event.getInventory().getType() != InventoryType.BEACON) {
|
||||
getUserManager().getUser(event.getPlayer().getName()).setSnapshot(event.getInventory().getContents());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
|
||||
@@ -135,6 +135,7 @@ public class User {
|
||||
}
|
||||
|
||||
public void restore(Inventory inventory) {
|
||||
if(inventorySnapshot != null) {
|
||||
inventory.clear();
|
||||
for(ItemStack is : inventorySnapshot) {
|
||||
if(is != null) {
|
||||
@@ -143,3 +144,4 @@ public class User {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user