use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_8_R3 method getLocation.
public Location getLocation(Inventory inventory) {
if (inventory == null) {
return null;
}
if (!(inventory instanceof CraftInventory)) {
return null;
}
try {
Field ic = CraftInventory.class.getDeclaredField("inventory");
ic.setAccessible(true);
Object crafting = ic.get(inventory);
if (crafting instanceof CustomInventoryCrafting) {
CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
return table.getLocation();
}
} catch (Exception exception) {
exception.printStackTrace();
}
return null;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_18_R2 method getLocation.
public Location getLocation(Inventory inventory) {
if (inventory == null) {
return null;
}
if (!(inventory instanceof CraftInventory)) {
return null;
}
try {
Field ic = CraftInventory.class.getDeclaredField("inventory");
ic.setAccessible(true);
Object crafting = ic.get(inventory);
if (crafting instanceof CustomInventoryCrafting) {
CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
return table.getLocation();
}
} catch (Exception exception) {
exception.printStackTrace();
}
return null;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_9_R2 method getLocation.
public Location getLocation(Inventory inventory) {
if (inventory == null) {
return null;
}
if (!(inventory instanceof CraftInventory)) {
return null;
}
try {
Field ic = CraftInventory.class.getDeclaredField("inventory");
ic.setAccessible(true);
Object crafting = ic.get(inventory);
if (crafting instanceof CustomInventoryCrafting) {
CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
return table.getLocation();
}
} catch (Exception exception) {
exception.printStackTrace();
}
return null;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project Denizen by DenizenScript.
the class ImprovedOfflinePlayerImpl method getEnderChest.
@Override
public Inventory getEnderChest() {
if (offlineEnderChests.containsKey(getUniqueId())) {
return offlineEnderChests.get(getUniqueId());
}
InventoryEnderChest endchest = new InventoryEnderChest(null);
endchest.a(((CompoundTagImpl) this.compound).toNMSTag().getList("EnderItems", 10));
org.bukkit.inventory.Inventory inv = new CraftInventory(endchest);
offlineEnderChests.put(getUniqueId(), inv);
return inv;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project Mohist by MohistMC.
the class CraftChest method getInventory.
@Override
public Inventory getInventory() {
CraftInventory inventory = (CraftInventory) this.getBlockInventory();
if (!isPlaced() || isWorldGeneration()) {
return inventory;
}
// The logic here is basically identical to the logic in ChestBlock.interact
CraftWorld world = (CraftWorld) this.getWorld();
ChestBlock blockChest = (ChestBlock) (this.getType() == Material.CHEST ? Blocks.CHEST : Blocks.TRAPPED_CHEST);
MenuProvider nms = blockChest.getMenuProvider(data, world.getHandle(), this.getPosition(), true);
if (nms instanceof ChestBlock.DoubleInventory) {
inventory = new CraftInventoryDoubleChest((ChestBlock.DoubleInventory) nms);
}
return inventory;
}
Aggregations