mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 06:28:52 +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.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class InventoryListener extends EventListener {
|
public class InventoryListener extends EventListener {
|
||||||
@@ -61,8 +62,10 @@ public class InventoryListener extends EventListener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||||
|
if(event.getInventory().getType() != InventoryType.BEACON) {
|
||||||
getUserManager().getUser(event.getPlayer().getName()).setSnapshot(event.getInventory().getContents());
|
getUserManager().getUser(event.getPlayer().getName()).setSnapshot(event.getInventory().getContents());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClose(InventoryCloseEvent event) {
|
public void onInventoryClose(InventoryCloseEvent event) {
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ public class User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void restore(Inventory inventory) {
|
public void restore(Inventory inventory) {
|
||||||
|
if(inventorySnapshot != null) {
|
||||||
inventory.clear();
|
inventory.clear();
|
||||||
for(ItemStack is : inventorySnapshot) {
|
for(ItemStack is : inventorySnapshot) {
|
||||||
if(is != null) {
|
if(is != null) {
|
||||||
@@ -142,4 +143,5 @@ public class User {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user