mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Block Inventories now close when the Block is broken
This commit is contained in:
parent
3e7ac8c2fc
commit
2f1475a5ba
@ -630,6 +630,10 @@ public class SlimefunItems {
|
|||||||
|
|
||||||
public static ItemStack TRASH_CAN = null;
|
public static ItemStack TRASH_CAN = null;
|
||||||
|
|
||||||
|
public static ItemStack ELYTRA = new ItemStack(Material.ELYTRA);
|
||||||
|
public static ItemStack INFUSED_ELYTRA = new CustomItem(new CustomItem(ELYTRA, "§5Infused Elytra"), new String[] {"MENDING-1"});
|
||||||
|
public static ItemStack SOULBOUND_ELYTRA = new CustomItem(ELYTRA, "§cSoulbound Elytra");
|
||||||
|
|
||||||
// ChestTerminal Addon
|
// ChestTerminal Addon
|
||||||
|
|
||||||
public static ItemStack CHEST_TERMINAL = null;
|
public static ItemStack CHEST_TERMINAL = null;
|
||||||
|
@ -13,6 +13,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
@ -369,7 +370,14 @@ public class BlockStorage {
|
|||||||
|
|
||||||
if (destroy) {
|
if (destroy) {
|
||||||
if (storage.hasInventory(l)) storage.clearInventory(l);
|
if (storage.hasInventory(l)) storage.clearInventory(l);
|
||||||
if (storage.hasUniversalInventory(l)) storage.getUniversalInventory(l).save();
|
if (storage.hasUniversalInventory(l)) {
|
||||||
|
UniversalBlockMenu menu = storage.getUniversalInventory(l);
|
||||||
|
for (HumanEntity n: menu.toInventory().getViewers()) {
|
||||||
|
n.closeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
storage.getUniversalInventory(l).save();
|
||||||
|
}
|
||||||
if (ticking_chunks.containsKey(l.getChunk().toString())) {
|
if (ticking_chunks.containsKey(l.getChunk().toString())) {
|
||||||
Set<Block> blocks = ticking_chunks.get(l.getChunk().toString());
|
Set<Block> blocks = ticking_chunks.get(l.getChunk().toString());
|
||||||
blocks.remove(l.getBlock());
|
blocks.remove(l.getBlock());
|
||||||
@ -499,6 +507,11 @@ public class BlockStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearInventory(Location l) {
|
public void clearInventory(Location l) {
|
||||||
|
BlockMenu menu = getInventory(l);
|
||||||
|
for (HumanEntity n: menu.toInventory().getViewers()) {
|
||||||
|
n.closeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
inventories.get(l).delete(l);
|
inventories.get(l).delete(l);
|
||||||
inventories.remove(l);
|
inventories.remove(l);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user